aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMu Qiao <qiaomuf@gentoo.org>2011-07-21 18:13:22 +0800
committerMu Qiao <qiaomuf@gentoo.org>2011-08-02 15:46:29 +0800
commit45c86202bd9b8f6df72b58cd977c6ba87c80eeb7 (patch)
treee52e2533e386eee685d6060272e107efbf61a9c4
parentParser: support '@' in non-quoted string (diff)
downloadlibbash-45c86202bd9b8f6df72b58cd977c6ba87c80eeb7.tar.gz
libbash-45c86202bd9b8f6df72b58cd977c6ba87c80eeb7.tar.bz2
libbash-45c86202bd9b8f6df72b58cd977c6ba87c80eeb7.zip
Parser: allow blanks before semicolon for for_expr
-rw-r--r--bashast/bashast.g2
-rw-r--r--bashast/gunit/compound.gunit1
2 files changed, 2 insertions, 1 deletions
diff --git a/bashast/bashast.g b/bashast/bashast.g
index b380379..6204ed0 100644
--- a/bashast/bashast.g
+++ b/bashast/bashast.g
@@ -446,7 +446,7 @@ for_expr
(
name wspace
(
- IN for_each_value* (SEMIC|EOL) wspace?
+ IN for_each_value* BLANK? (SEMIC|EOL) wspace?
|SEMIC wspace?
|
) DO wspace command_list semiel DONE -> ^(FOR name for_each_value* command_list)
diff --git a/bashast/gunit/compound.gunit b/bashast/gunit/compound.gunit
index 18314bf..7270246 100644
--- a/bashast/gunit/compound.gunit
+++ b/bashast/gunit/compound.gunit
@@ -94,6 +94,7 @@ done" -> (for each (STRING (COMMAND_SUB `ls |grep log`)) (LIST (COMMAND (STRING
"for each in `ls |grep log`;do echo \"file found\"; done" -> (for each (STRING (COMMAND_SUB `ls |grep log`)) (LIST (COMMAND (STRING echo) (STRING (DOUBLE_QUOTED_STRING file found)))))
"for i in 'foo' 'bar'; do echo $i; done" -> (for i (STRING (SINGLE_QUOTED_STRING 'foo')) (STRING (SINGLE_QUOTED_STRING 'bar')) (LIST (COMMAND (STRING echo) (STRING (VAR_REF i)))))
"for i in foo$var bar; do echo $i; done" -> (for i (STRING foo (VAR_REF var)) (STRING bar) (LIST (COMMAND (STRING echo) (STRING (VAR_REF i)))))
+"for i in foo$var bar ; do echo $i; done" -> (for i (STRING foo (VAR_REF var)) (STRING bar) (LIST (COMMAND (STRING echo) (STRING (VAR_REF i)))))
"for each in `ls |grep log`; do echo file done" FAIL
"for ((5+3;5+3;5+3)); do echo yay; done" -> (CFOR (FOR_INIT (+ 5 3)) (FOR_COND (+ 5 3)) (LIST (COMMAND (STRING echo) (STRING yay))) (FOR_MOD (+ 5 3)))