aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Aparício <aparicio99@gmail.com>2012-08-07 04:16:45 +0100
committerPetteri Räty <petsku@petteriraty.eu>2012-08-19 17:32:01 +0300
commit10e8001655ed4e82eccdeb650f073d462a66ff78 (patch)
tree2b2f68bcfa8d51a484800eb33e3af761eed8b94f
parentParser: Support appending strings with special characters (diff)
downloadlibbash-10e8001655ed4e82eccdeb650f073d462a66ff78.tar.gz
libbash-10e8001655ed4e82eccdeb650f073d462a66ff78.tar.bz2
libbash-10e8001655ed4e82eccdeb650f073d462a66ff78.zip
Parser: Support line break after pipe
-rw-r--r--bashast/bashast.g2
-rw-r--r--bashast/gunit/pipeline.gunit1
2 files changed, 2 insertions, 1 deletions
diff --git a/bashast/bashast.g b/bashast/bashast.g
index 9fd3fdb..8943209 100644
--- a/bashast/bashast.g
+++ b/bashast/bashast.g
@@ -272,7 +272,7 @@ command_separator
| AMP^
| EOL!;
pipeline
- : time? ((BANG) => (BANG BLANK!))? command^ (BLANK!? PIPE^ BLANK!? command)*;
+ : time? ((BANG) => (BANG BLANK!))? command^ (BLANK!? PIPE^ wspace!? command)*;
time
: TIME^ BLANK! ((time_posix) => time_posix)?;
diff --git a/bashast/gunit/pipeline.gunit b/bashast/gunit/pipeline.gunit
index b97ec3b..4a3a4f4 100644
--- a/bashast/gunit/pipeline.gunit
+++ b/bashast/gunit/pipeline.gunit
@@ -30,3 +30,4 @@ pipeline:
echo \"three\"
fi" -> (COMMAND (IF_STATEMENT (if (LIST (COMMAND (STRING cat) time)) (LIST (COMMAND (STRING echo) (STRING (DOUBLE_QUOTED_STRING three)))))))
"i=1 j=2" -> (COMMAND (VARIABLE_DEFINITIONS (= i (STRING 1)) (= j (STRING 2))))
+"cat foo |\ncat" -> (| (COMMAND (STRING cat) (STRING foo)) (COMMAND (STRING cat)))