1 |
commit: 1434467973035473d51ad3f8c0955e363fc0df17 |
2 |
Author: Mu Qiao <qiaomuf <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat May 28 08:19:29 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat May 28 12:10:25 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=14344679 |
7 |
|
8 |
Walker: support command substitution in double quoted string |
9 |
|
10 |
--- |
11 |
bashast/libbashWalker.g | 3 +++ |
12 |
scripts/command_execution.bash | 2 ++ |
13 |
scripts/command_execution.bash.result | 2 ++ |
14 |
3 files changed, 7 insertions(+), 0 deletions(-) |
15 |
|
16 |
diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g |
17 |
index 67886a0..d5522fc 100644 |
18 |
--- a/bashast/libbashWalker.g |
19 |
+++ b/bashast/libbashWalker.g |
20 |
@@ -320,6 +320,9 @@ double_quoted_string returns[std::string libbash_value] |
21 |
|(ARITHMETIC_EXPRESSION) => ^(ARITHMETIC_EXPRESSION value=arithmetics) { |
22 |
$libbash_value = boost::lexical_cast<std::string>(value); |
23 |
} |
24 |
+ |libbash_string=command_substitution { |
25 |
+ $libbash_value = libbash_string; |
26 |
+ } |
27 |
|libbash_string=any_string { $libbash_value = libbash_string; }; |
28 |
|
29 |
any_string returns[std::string libbash_value] |
30 |
|
31 |
diff --git a/scripts/command_execution.bash b/scripts/command_execution.bash |
32 |
index b9b1c82..95401b4 100644 |
33 |
--- a/scripts/command_execution.bash |
34 |
+++ b/scripts/command_execution.bash |
35 |
@@ -44,3 +44,5 @@ declare -F unset_outer |
36 |
unset -f unset_outer |
37 |
declare -F unset_outer |
38 |
echo '$FOO006 "abc" $(( 1 + 2 )) $(echo hi) ...' |
39 |
+echo "abc $(echo def) ghi" |
40 |
+FOO008="abc $(echo def) ghi" |
41 |
|
42 |
diff --git a/scripts/command_execution.bash.result b/scripts/command_execution.bash.result |
43 |
index d7642f5..d47650d 100644 |
44 |
--- a/scripts/command_execution.bash.result |
45 |
+++ b/scripts/command_execution.bash.result |
46 |
@@ -14,9 +14,11 @@ FOO006=0 in global |
47 |
FOO006= in global |
48 |
unset_outer |
49 |
$FOO006 "abc" $(( 1 + 2 )) $(echo hi) ... |
50 |
+abc def ghi |
51 |
DEFAULTED=yes |
52 |
FOO001=hello |
53 |
FOO002=Hello World |
54 |
FOO003=1 |
55 |
FOO004=abc |
56 |
FOO005=1 2 3 |
57 |
+FOO008=abc def ghi |