diff options
author | Mu Qiao <qiaomuf@gentoo.org> | 2011-07-05 11:46:01 +0800 |
---|---|---|
committer | Mu Qiao <qiaomuf@gentoo.org> | 2011-07-06 16:02:03 +0800 |
commit | 75705b99bb90701616cb0c100a8703e21710f897 (patch) | |
tree | 230343b6154ea442a74ae58810ba711e064a6e37 /bashast/gunit | |
parent | Merge branch 'multithreading' (diff) | |
download | libbash-75705b99bb90701616cb0c100a8703e21710f897.tar.gz libbash-75705b99bb90701616cb0c100a8703e21710f897.tar.bz2 libbash-75705b99bb90701616cb0c100a8703e21710f897.zip |
Parser: reduce backtracking for command_atom
Backtracking is reduced by left refactoring function definition and bash
command.
Diffstat (limited to 'bashast/gunit')
-rw-r--r-- | bashast/gunit/function.gunit | 11 | ||||
-rw-r--r-- | bashast/gunit/simp_command.gunit | 2 |
2 files changed, 2 insertions, 11 deletions
diff --git a/bashast/gunit/function.gunit b/bashast/gunit/function.gunit index a046bd1..06a34da 100644 --- a/bashast/gunit/function.gunit +++ b/bashast/gunit/function.gunit @@ -18,14 +18,13 @@ */ gunit java_libbash; -function: +command_atom: "function quit { exit }" -> (function (STRING quit) (CURRENT_SHELL (LIST (COMMAND (STRING exit))))) "function quit{ exit; }" FAIL "function quit { exit }" FAIL -"function 'foo' { exit; }" FAIL "function quit { exit; }" -> (function (STRING quit) (CURRENT_SHELL (LIST (COMMAND (STRING exit))))) "function foo() { :; }" -> (function (STRING foo) (CURRENT_SHELL (LIST (COMMAND (STRING :))))) "function foo(){ :; }" -> (function (STRING foo) (CURRENT_SHELL (LIST (COMMAND (STRING :))))) @@ -36,14 +35,6 @@ function: "function out() { function inner() { :; }; }" -> (function (STRING out) (CURRENT_SHELL (LIST (COMMAND (function (STRING inner) (CURRENT_SHELL (LIST (COMMAND (STRING :))))))))) -function_name: -"xemacs-packages_src_unpack" OK -"while" OK -"aa'bb" FAIL -"a\"" FAIL -"333" FAIL -"aa$aa" FAIL - command: "function quit { exit; } > /dev/null" -> (COMMAND (function (STRING quit) (CURRENT_SHELL (LIST (COMMAND (STRING exit))))) (REDIR > (STRING / dev / null))) "function quit { diff --git a/bashast/gunit/simp_command.gunit b/bashast/gunit/simp_command.gunit index db26ab4..2f58533 100644 --- a/bashast/gunit/simp_command.gunit +++ b/bashast/gunit/simp_command.gunit @@ -18,7 +18,7 @@ */ gunit java_libbash; -simple_command: +command_atom: "./command" -> (STRING . / command) "asdf=5 cat" -> (STRING cat) (= asdf (STRING 5)) "i=3 g=4 h=18 grep asdf" -> (STRING grep) (STRING asdf) (= i (STRING 3)) (= g (STRING 4)) (= h (STRING 18)) |