1 |
commit: b6dbd318c00436d0c4ba5544bcd7fea4e5ce6879 |
2 |
Author: Petteri Räty <petsku <AT> petteriraty <DOT> eu> |
3 |
AuthorDate: Fri Apr 8 13:31:40 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Apr 8 13:31:40 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=b6dbd318 |
7 |
|
8 |
Simplify variable definition blank handling |
9 |
|
10 |
Moved the blank matching from var_def level to simple_command so it only |
11 |
needs to be specified once. |
12 |
|
13 |
--- |
14 |
bashast/bashast.g | 9 ++++----- |
15 |
1 files changed, 4 insertions(+), 5 deletions(-) |
16 |
|
17 |
diff --git a/bashast/bashast.g b/bashast/bashast.g |
18 |
index 551ae4e..7f4bed5 100644 |
19 |
--- a/bashast/bashast.g |
20 |
+++ b/bashast/bashast.g |
21 |
@@ -105,8 +105,7 @@ command |
22 |
| simple_command; |
23 |
//Simple bash commands |
24 |
simple_command |
25 |
- : var_def+ bash_command^ redirect* |
26 |
- | bash_command^ redirect*; |
27 |
+ : (var_def BLANK!+)* bash_command^ redirect*; |
28 |
bash_command |
29 |
: fname_no_res_word (BLANK+ arg)* -> ^(COMMAND fname_no_res_word arg*); |
30 |
//An argument to a command |
31 |
@@ -217,9 +216,9 @@ cond_comparison |
32 |
: cond_expr -> ^(COMPOUND_COND cond_expr); |
33 |
//Variables |
34 |
//Defining a variable |
35 |
-var_def : BLANK* name LSQUARE BLANK? var_index BLANK* RSQUARE EQUALS value BLANK* -> ^(EQUALS ^(name var_index) value) |
36 |
- | BLANK!* name EQUALS^ value BLANK!* |
37 |
- | BLANK!* LET! name EQUALS^ arithmetic BLANK!*; |
38 |
+var_def : name LSQUARE BLANK? var_index BLANK* RSQUARE EQUALS value -> ^(EQUALS ^(name var_index) value) |
39 |
+ | name EQUALS^ value |
40 |
+ | LET! name EQUALS^ arithmetic; |
41 |
//Possible values of a variable |
42 |
value : num |
43 |
| var_ref |