1 |
commit: c3154deab71045fbcd6643c03d8de5b95f8e5379 |
2 |
Author: Mu Qiao <qiaomuf <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon May 30 09:54:47 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jun 1 06:12:20 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=c3154dea |
7 |
|
8 |
Parser: fix line break for compound expression |
9 |
|
10 |
Semicolon and EOL are allowed to appear simultaneously as line break. |
11 |
|
12 |
--- |
13 |
bashast/bashast.g | 2 +- |
14 |
bashast/gunit/compound.gunit | 3 ++- |
15 |
2 files changed, 3 insertions(+), 2 deletions(-) |
16 |
|
17 |
diff --git a/bashast/bashast.g b/bashast/bashast.g |
18 |
index 104dd36..de8158a 100644 |
19 |
--- a/bashast/bashast.g |
20 |
+++ b/bashast/bashast.g |
21 |
@@ -387,7 +387,7 @@ cond_part: brace_expansion |
22 |
| fname; |
23 |
//Rules for whitespace/line endings |
24 |
wspace : BLANK+|EOL+; |
25 |
-semiel : BLANK* (SEMIC|EOL) BLANK*; |
26 |
+semiel : BLANK* (SEMIC EOL?|EOL) BLANK*; |
27 |
|
28 |
//definition of word. this is just going to grow... |
29 |
word : (brace_expansion) => brace_expansion |
30 |
|
31 |
diff --git a/bashast/gunit/compound.gunit b/bashast/gunit/compound.gunit |
32 |
index a7ce999..6651be2 100644 |
33 |
--- a/bashast/gunit/compound.gunit |
34 |
+++ b/bashast/gunit/compound.gunit |
35 |
@@ -109,7 +109,8 @@ fi" -> (IF_STATEMENT (if (LIST (COMMAND (STRING echo) (STRING yay2))) (LIST (COM |
36 |
"if echo yay2; then echo yay ;fi" -> (IF_STATEMENT (if (LIST (COMMAND (STRING echo) (STRING yay2))) (LIST (COMMAND (STRING echo) (STRING yay))))) |
37 |
"if echo yay2 then echo yay; fi" FAIL |
38 |
|
39 |
-"if echo yay2; then |
40 |
+"if echo yay2; |
41 |
+then |
42 |
echo yay |
43 |
elif echo yay3; then |
44 |
echo boo |