1 |
commit: 0dfd3c9fc0901c078f064f7f738f6974dcabc4c1 |
2 |
Author: Mu Qiao <qiaomuf <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Apr 3 10:49:47 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Apr 3 10:49:47 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=0dfd3c9f |
7 |
|
8 |
Implement variable reference |
9 |
|
10 |
Double quoted string can use variable reference now. |
11 |
|
12 |
--- |
13 |
bashast/libbashWalker.g | 12 +++++++++--- |
14 |
scripts/var_def.ebuild | 2 ++ |
15 |
scripts/var_def.ebuild.result | 2 ++ |
16 |
3 files changed, 13 insertions(+), 3 deletions(-) |
17 |
|
18 |
diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g |
19 |
index c0c8395..fd736c8 100644 |
20 |
--- a/bashast/libbashWalker.g |
21 |
+++ b/bashast/libbashWalker.g |
22 |
@@ -62,9 +62,7 @@ var_def: |
23 |
|
24 |
string_expr returns[std::string libbash_value]: |
25 |
^(STRING libbash_string=string_expr) { $libbash_value = libbash_string; } |
26 |
- |^(DOUBLE_QUOTED_STRING (dq_str_part { libbash_string += $dq_str_part.libbash_value; })*) { |
27 |
- $libbash_value = libbash_string; |
28 |
- }; |
29 |
+ |^(DOUBLE_QUOTED_STRING (libbash_string=dqstr { $libbash_value += libbash_string; })*); |
30 |
|
31 |
//A rule for filenames/strings |
32 |
res_word_str returns[std::string libbash_value] |
33 |
@@ -105,6 +103,14 @@ dq_str_part returns[std::string libbash_value] |
34 |
}: |
35 |
BLANK|EOL|AMP|LOGICAND|LOGICOR|LESS_THAN|GREATER_THAN|PIPE|SQUOTE|SEMIC|COMMA|LPAREN|RPAREN|LLPAREN|RRPAREN|DOUBLE_SEMIC|LBRACE|RBRACE|TICK|LEQ|GEQ|str_part_with_pound; |
36 |
|
37 |
+//double quoted string rule, allows expansions |
38 |
+dqstr returns[std::string libbash_value]: |
39 |
+ dq_str_part { $libbash_value = $dq_str_part.libbash_value; } |
40 |
+ | libbash_string=var_ref { $libbash_value = libbash_string; }; |
41 |
+ |
42 |
+//variable reference |
43 |
+var_ref returns[std::string libbash_value]: |
44 |
+ ^(VAR_REF libbash_name=name) { $libbash_value=walker->resolve<std::string>(libbash_name); }; |
45 |
|
46 |
// shell arithmetic |
47 |
arithmetics returns[int value] |
48 |
|
49 |
diff --git a/scripts/var_def.ebuild b/scripts/var_def.ebuild |
50 |
index b5f9a14..73f94b1 100644 |
51 |
--- a/scripts/var_def.ebuild |
52 |
+++ b/scripts/var_def.ebuild |
53 |
@@ -8,3 +8,5 @@ SLOT="0" |
54 |
KEYWORDS="~amd64 ~x86" |
55 |
IUSE="" |
56 |
RDEPEND="dev-db/sqlite:3" |
57 |
+DEPEND="${RDEPEND} |
58 |
+ dev-util/pkgconfig" |
59 |
|
60 |
diff --git a/scripts/var_def.ebuild.result b/scripts/var_def.ebuild.result |
61 |
index 750f11b..671ae4c 100644 |
62 |
--- a/scripts/var_def.ebuild.result |
63 |
+++ b/scripts/var_def.ebuild.result |
64 |
@@ -1,3 +1,5 @@ |
65 |
+DEPEND=dev-db/sqlite:3 |
66 |
+ dev-util/pkgconfig |
67 |
DESCRIPTION=SunPinyin is a SLM (Statistical Language Model) based IME |
68 |
EAPI=1 |
69 |
HOMEPAGE=http://sunpinyin.googlecode.com |