diff options
author | André Aparício <aparicio99@gmail.com> | 2012-05-29 19:26:04 +0100 |
---|---|---|
committer | André Aparício <aparicio99@gmail.com> | 2012-07-08 10:22:30 +0100 |
commit | d23dab871c34b69444bab8ef0f30ca45314600f8 (patch) | |
tree | 71793d1312deb8a2450b58bacc22d98c682e1c5a | |
parent | Builtin: Implement unset array support (diff) | |
download | libbash-d23dab871c34b69444bab8ef0f30ca45314600f8.tar.gz libbash-d23dab871c34b69444bab8ef0f30ca45314600f8.tar.bz2 libbash-d23dab871c34b69444bab8ef0f30ca45314600f8.zip |
Walker: Improve command list to support "command && command && command"
-rw-r--r-- | bashast/libbashWalker.g | 7 | ||||
-rw-r--r-- | scripts/command_execution.bash | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g index 9157574..0c21ccd 100644 --- a/bashast/libbashWalker.g +++ b/bashast/libbashWalker.g @@ -736,18 +736,19 @@ argument[std::vector<std::string>& args, bool split] } }; -logic_command_list +logic_command @declarations { bool logic_and; } - :command - |^((LOGICAND { logic_and = true; } | LOGICOR { logic_and = false; }) command { + : ^((LOGICAND { logic_and = true; } | LOGICOR { logic_and = false; }) logic_command_list { if(logic_and ? !walker->get_status() : walker->get_status()) command(ctx); else seek_to_next_tree(ctx); }); +logic_command_list: command | logic_command; + command_list: ^(LIST logic_command_list+); compound_command diff --git a/scripts/command_execution.bash b/scripts/command_execution.bash index 58f1279..4c04908 100644 --- a/scripts/command_execution.bash +++ b/scripts/command_execution.bash @@ -17,6 +17,9 @@ false && echo "wrong" false || echo "right" true || echo "wrong" +echo right1 && echo right2 && false && echo wrong +false || echo right3 || echo wrong +true && false || echo right4 && echo right5 echo "end" : ${DEFAULTED:="yes"} FOO="abc" echo "command environment" |