1 |
commit: 149d235bfa4aff7fdbdca9b8a5f1b3fc5b493f34 |
2 |
Author: Petteri Räty <petsku <AT> petteriraty <DOT> eu> |
3 |
AuthorDate: Fri Apr 8 19:07:54 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Apr 9 06:13:53 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=149d235b |
7 |
|
8 |
Remove backtracking for arg rule |
9 |
|
10 |
Add syntactic predicates to remove the need to backtrack when evaluation |
11 |
the arg rule. |
12 |
|
13 |
--- |
14 |
bashast/bashast.g | 9 +++++---- |
15 |
1 files changed, 5 insertions(+), 4 deletions(-) |
16 |
|
17 |
diff --git a/bashast/bashast.g b/bashast/bashast.g |
18 |
index 5214b65..ec04917 100644 |
19 |
--- a/bashast/bashast.g |
20 |
+++ b/bashast/bashast.g |
21 |
@@ -109,11 +109,12 @@ simple_command |
22 |
bash_command |
23 |
: fname_no_res_word (BLANK+ arg)* -> ^(COMMAND fname_no_res_word arg*); |
24 |
//An argument to a command |
25 |
+//fname can also match var_ref and command_sub but that gives a noisier AST |
26 |
arg |
27 |
- : var_ref |
28 |
- | fname |
29 |
- | command_sub |
30 |
- | var_ref; |
31 |
+options{backtrack=false;} |
32 |
+ : (var_ref) => var_ref |
33 |
+ | (command_sub) => command_sub |
34 |
+ | fname; |
35 |
redirect: BLANK!* here_string_op^ BLANK!* fname |
36 |
| BLANK!* here_doc_op^ BLANK!* fname EOL! heredoc |
37 |
| BLANK* redir_op BLANK* redir_dest -> ^(REDIR redir_op redir_dest) |