1 |
commit: 8f6a482aeb3abf9538ce9a0ae0e55fab9fbfb105 |
2 |
Author: Mu Qiao <qiaomuf <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Apr 10 08:07:35 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Apr 11 01:39:01 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=8f6a482a |
7 |
|
8 |
Make space after while/until keyword optional |
9 |
|
10 |
Space is optional between while/until keyword and the test-commands |
11 |
so we make it optional in the grammar. Bug #362795 |
12 |
|
13 |
--- |
14 |
bashast/bashast.g | 4 ++-- |
15 |
bashast/gunit/compound.gunit | 1 + |
16 |
2 files changed, 3 insertions(+), 2 deletions(-) |
17 |
|
18 |
diff --git a/bashast/bashast.g b/bashast/bashast.g |
19 |
index 2418a81..210912c 100644 |
20 |
--- a/bashast/bashast.g |
21 |
+++ b/bashast/bashast.g |
22 |
@@ -183,10 +183,10 @@ if_expr : IF wspace+ ag=clist BLANK* semiel THEN wspace+ iflist=clist BLANK? sem |
23 |
elif_expr |
24 |
: ELIF BLANK+ ag=clist BLANK* semiel THEN wspace+ iflist=clist BLANK* semiel -> ^(IF["if"] $ag $iflist); |
25 |
while_expr |
26 |
- : WHILE wspace istrue=clist semiel DO wspace dothis=clist semiel DONE -> ^(WHILE $istrue $dothis) |
27 |
+ : WHILE wspace? istrue=clist semiel DO wspace dothis=clist semiel DONE -> ^(WHILE $istrue $dothis) |
28 |
; |
29 |
until_expr |
30 |
- : UNTIL wspace istrue=clist semiel DO wspace dothis=clist semiel DONE -> ^(UNTIL $istrue $dothis) |
31 |
+ : UNTIL wspace? istrue=clist semiel DO wspace dothis=clist semiel DONE -> ^(UNTIL $istrue $dothis) |
32 |
; |
33 |
case_expr |
34 |
: CASE^ BLANK!+ word wspace! IN! wspace! (case_stmt wspace!)* last_case? ESAC!; |
35 |
|
36 |
diff --git a/bashast/gunit/compound.gunit b/bashast/gunit/compound.gunit |
37 |
index b8e8ef6..531e0ff 100644 |
38 |
--- a/bashast/gunit/compound.gunit |
39 |
+++ b/bashast/gunit/compound.gunit |
40 |
@@ -120,6 +120,7 @@ while_expr: |
41 |
echo \"file found\" |
42 |
done" -> (while (LIST (COMMAND (STRING echo) (STRING true))) (LIST (COMMAND (STRING echo) (STRING (DOUBLE_QUOTED_STRING file found))))) |
43 |
"while echo true; do echo \"file found\"; done" -> (while (LIST (COMMAND (STRING echo) (STRING true))) (LIST (COMMAND (STRING echo) (STRING (DOUBLE_QUOTED_STRING file found))))) |
44 |
+"while(( 1>0 )); do echo ok; done" -> (while (LIST (COMPOUND_ARITH (> 1 0))) (LIST (COMMAND (STRING echo) (STRING ok)))) |
45 |
"while echo true`; do echo file done" FAIL |
46 |
|
47 |
until_expr: |