aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetteri Räty <petsku@petteriraty.eu>2012-08-19 17:49:11 +0300
committerPetteri Räty <petsku@petteriraty.eu>2012-08-19 17:49:11 +0300
commita6de545c440ed82f16ccf12cf229efc99ecd7ec7 (patch)
tree76d19ae4b68035b7427d33e2e22a0623d06f584a
parentParser: Support line break after pipe (diff)
parentParser: Accept semicolons inside builtin variable definitions (diff)
downloadlibbash-a6de545c440ed82f16ccf12cf229efc99ecd7ec7.tar.gz
libbash-a6de545c440ed82f16ccf12cf229efc99ecd7ec7.tar.bz2
libbash-a6de545c440ed82f16ccf12cf229efc99ecd7ec7.zip
Merge remote-tracking branch 'aparicio/multiline_string_declaration'
-rw-r--r--bashast/bashast.g10
-rw-r--r--scripts/command_execution.bash15
2 files changed, 24 insertions, 1 deletions
diff --git a/bashast/bashast.g b/bashast/bashast.g
index 8943209..799b1cf 100644
--- a/bashast/bashast.g
+++ b/bashast/bashast.g
@@ -466,15 +466,23 @@ array_atom
builtin_variable_definition_item
scope {
int parens;
+#ifdef OUTPUT_C
+ bool dquotes;
+#else
+ boolean dquotes;
+#endif
}
@init {
$builtin_variable_definition_item::parens = 0;
+ $builtin_variable_definition_item::dquotes = false;
}
: (
(LPAREN) => LPAREN { ++$builtin_variable_definition_item::parens; }
|(RPAREN) => RPAREN { --$builtin_variable_definition_item::parens; }
+ |(DQUOTE) => DQUOTE { $builtin_variable_definition_item::dquotes = ! $builtin_variable_definition_item::dquotes; }
|(~(EOL|SEMIC)) => expansion_base
- | {LA(1) == EOL && $builtin_variable_definition_item::parens > 0}? => EOL
+ | {LA(1) == SEMIC && $builtin_variable_definition_item::dquotes}? => SEMIC
+ | {LA(1) == EOL && $builtin_variable_definition_item::parens > 0 || $builtin_variable_definition_item::dquotes}? => EOL
)+;
#ifdef OUTPUT_C
diff --git a/scripts/command_execution.bash b/scripts/command_execution.bash
index c526d75..df6275b 100644
--- a/scripts/command_execution.bash
+++ b/scripts/command_execution.bash
@@ -82,6 +82,20 @@ echo ${array[@]}
ech\
o Hello\
world
+function multiline()
+{
+ declare var1="foo
+bar"
+ export var2="one
+ two
+three"
+ local var3="foo
+bar"
+ echo $var1
+ echo $var2
+ echo $var3
+}
+multiline
echo \`\(\)\$\>\<\`
export SRC_URI="${SRC_URI} http://www.oracle.com/technology/products/berkeley-db/db/update/${MY_PV}/patch.${MY_PV}.${i}"
> /dev/null
@@ -95,6 +109,7 @@ echo "${!variable// /$'\n'}"
eval abc+=\( \"\$@\" \)
declare MOZILLA_FIVE_HOME="/usr/share/${PN}"
declare foo=23 empty bar=42
+declare var=";; ; foobar"; echo yay
echo $MOZILLA_FIVE_HOME $foo $lol $bar
echo \(\)\[\]\$\"\>\'