diff options
author | Mu Qiao <qiaomuf@gentoo.org> | 2011-07-28 19:50:44 +0800 |
---|---|---|
committer | Mu Qiao <qiaomuf@gentoo.org> | 2011-08-02 15:52:19 +0800 |
commit | 9bfb2dbd4180e1171db2026fb58646045c1e7144 (patch) | |
tree | 11ec06d9a84e27cac0699b49e252583915680109 /bashast | |
parent | Parser: split token compositions (diff) | |
download | libbash-9bfb2dbd4180e1171db2026fb58646045c1e7144.tar.gz libbash-9bfb2dbd4180e1171db2026fb58646045c1e7144.tar.bz2 libbash-9bfb2dbd4180e1171db2026fb58646045c1e7144.zip |
Walker: support expansions without colon
Diffstat (limited to 'bashast')
-rw-r--r-- | bashast/libbashWalker.g | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g index fc05b91..bfcb73b 100644 --- a/bashast/libbashWalker.g +++ b/bashast/libbashWalker.g @@ -475,13 +475,36 @@ var_expansion returns[std::string libbash_value] bool greedy; } :^(USE_DEFAULT_WHEN_UNSET_OR_NULL var_name libbash_word=raw_string) { - libbash_value = walker->do_default_expansion($var_name.libbash_value, libbash_word, $var_name.index); + libbash_value = walker->do_default_expansion(walker->is_unset_or_null($var_name.libbash_value, $var_name.index), + $var_name.libbash_value, + libbash_word, + $var_name.index); + } + |^(USE_DEFAULT_WHEN_UNSET var_name libbash_word=raw_string) { + libbash_value = walker->do_default_expansion(walker->is_unset($var_name.libbash_value), + $var_name.libbash_value, + libbash_word, + $var_name.index); } |^(ASSIGN_DEFAULT_WHEN_UNSET_OR_NULL var_name libbash_word=raw_string) { - libbash_value = walker->do_assign_expansion($var_name.libbash_value, libbash_word, $var_name.index); + libbash_value = walker->do_assign_expansion(walker->is_unset_or_null($var_name.libbash_value, $var_name.index), + $var_name.libbash_value, + libbash_word, + $var_name.index); + } + |^(ASSIGN_DEFAULT_WHEN_UNSET var_name libbash_word=raw_string) { + libbash_value = walker->do_assign_expansion(walker->is_unset($var_name.libbash_value), + $var_name.libbash_value, + libbash_word, + $var_name.index); } |^(USE_ALTERNATE_WHEN_UNSET_OR_NULL var_name libbash_word=raw_string) { - libbash_value = walker->do_alternate_expansion($var_name.libbash_value, libbash_word, $var_name.index); + libbash_value = walker->do_alternate_expansion(walker->is_unset_or_null($var_name.libbash_value, $var_name.index), + libbash_word); + } + |^(USE_ALTERNATE_WHEN_UNSET var_name libbash_word=raw_string) { + libbash_value = walker->do_alternate_expansion(walker->is_unset($var_name.libbash_value), + libbash_word); } |(^(OFFSET array_name arithmetics arithmetics)) => ^(OFFSET libbash_name=array_name offset=arithmetics length=arithmetics) { libbash_value = walker->do_subarray_expansion(libbash_name, offset, length); |