aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMu Qiao <qiaomuf@gentoo.org>2011-07-27 14:27:47 +0800
committerMu Qiao <qiaomuf@gentoo.org>2011-08-02 15:52:18 +0800
commit5752979a8a8320c3bf3606055aa69e0fc202969e (patch)
tree1e25e9bb80d09483bb4bccbc17010b9723a357ac
parentUtility: add isolated functions for instruo (diff)
downloadlibbash-5752979a8a8320c3bf3606055aa69e0fc202969e.tar.gz
libbash-5752979a8a8320c3bf3606055aa69e0fc202969e.tar.bz2
libbash-5752979a8a8320c3bf3606055aa69e0fc202969e.zip
Parser: improve exported variable handling
The double quotes were not reserved when calling export. So when the walker called back to parser, the white spaces inside double quotes would be problematic. Now this is fixed.
-rw-r--r--bashast/bashast.g13
-rw-r--r--scripts/command_execution.bash1
2 files changed, 8 insertions, 6 deletions
diff --git a/bashast/bashast.g b/bashast/bashast.g
index 2a0b23a..55a499d 100644
--- a/bashast/bashast.g
+++ b/bashast/bashast.g
@@ -445,7 +445,7 @@ local_item
#endif
} ->;
export_item
- : ((~EOL) => (string_expr_part|BLANK|LPAREN|RPAREN))+;
+ : ((~EOL) => expansion_base)+;
builtin_variable_definitions
: (builtin_variable_definition_atom) (BLANK builtin_variable_definition_atom)*
@@ -681,22 +681,23 @@ quoted_string
| SINGLE_QUOTED_STRING_TOKEN -> ^(SINGLE_QUOTED_STRING SINGLE_QUOTED_STRING_TOKEN);
double_quoted_string
- : DQUOTE double_quoted_string_part* DQUOTE -> ^(DOUBLE_QUOTED_STRING double_quoted_string_part*);
-double_quoted_string_part
+ : DQUOTE ((~DQUOTE) => expansion_base)* DQUOTE -> ^(DOUBLE_QUOTED_STRING expansion_base*);
+
+// Perform all kinds of expansions
+expansion_base
: (DOLLAR (LBRACE|name|num|TIMES|AT|POUND|QMARK|MINUS|DOLLAR|BANG)) => variable_reference
| (command_substitution) => command_substitution
| (DOLLAR (LLPAREN|LSQUARE)) => arithmetic_expansion
| (ESC DQUOTE) => ESC DQUOTE -> DQUOTE
| (ESC TICK) => ESC TICK -> TICK
| (ESC DOLLAR) => ESC DOLLAR -> DOLLAR
- | ~(TICK|DQUOTE);
+ | .;
-// Perform all kinds of expansions
all_expansions
: expansion_atom+ -> ^(STRING expansion_atom+);
expansion_atom
: (DQUOTE) => double_quoted_string
- | double_quoted_string_part;
+ | expansion_base;
string_part
: ns_string_part
diff --git a/scripts/command_execution.bash b/scripts/command_execution.bash
index add4145..05e2177 100644
--- a/scripts/command_execution.bash
+++ b/scripts/command_execution.bash
@@ -73,3 +73,4 @@ ech\
o Hello\
world
echo \`\(\)\$\>\<\`
+export SRC_URI="${SRC_URI} http://www.oracle.com/technology/products/berkeley-db/db/update/${MY_PV}/patch.${MY_PV}.${i}"