1 |
commit: 36007f2a8a9e2f6ccbc97cae317d30585662b5fb |
2 |
Author: Mu Qiao <qiaomuf <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jun 20 08:33:11 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jul 3 20:14:14 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=36007f2a |
7 |
|
8 |
Parser: support ANSI-C Quoting |
9 |
|
10 |
--- |
11 |
bashast/bashast.g | 4 +++- |
12 |
bashast/gunit/fname.gunit | 1 + |
13 |
2 files changed, 4 insertions(+), 1 deletions(-) |
14 |
|
15 |
diff --git a/bashast/bashast.g b/bashast/bashast.g |
16 |
index 8903c02..01eaa68 100644 |
17 |
--- a/bashast/bashast.g |
18 |
+++ b/bashast/bashast.g |
19 |
@@ -35,6 +35,7 @@ options |
20 |
#endif |
21 |
} |
22 |
tokens{ |
23 |
+ ANSI_C_QUOTING; |
24 |
ARG; |
25 |
ARRAY; |
26 |
ARRAY_SIZE; |
27 |
@@ -524,7 +525,8 @@ nqstr_part |
28 |
| SINGLE_QUOTED_STRING_TOKEN -> ^(SINGLE_QUOTED_STRING SINGLE_QUOTED_STRING_TOKEN) |
29 |
| str_part |
30 |
| pattern_match_trigger |
31 |
- | BANG; |
32 |
+ | BANG |
33 |
+ | DOLLAR SINGLE_QUOTED_STRING_TOKEN -> ^(ANSI_C_QUOTING SINGLE_QUOTED_STRING_TOKEN); |
34 |
//double quoted string rule, allows expansions |
35 |
dqstr : DQUOTE dqstr_part* DQUOTE -> ^(DOUBLE_QUOTED_STRING dqstr_part*); |
36 |
dqstr_part |
37 |
|
38 |
diff --git a/bashast/gunit/fname.gunit b/bashast/gunit/fname.gunit |
39 |
index fce198f..5bacdb3 100644 |
40 |
--- a/bashast/gunit/fname.gunit |
41 |
+++ b/bashast/gunit/fname.gunit |
42 |
@@ -68,6 +68,7 @@ fname: |
43 |
"ab[12[:alpha:]]" -> (STRING ab (MATCH_ANY 12 (CHARACTER_CLASS alpha))) |
44 |
"\"'foo'\"" -> (STRING (DOUBLE_QUOTED_STRING ' foo ')) |
45 |
"--preserve=timestamps,mode" -> (STRING - - preserve = timestamps , mode) |
46 |
+"$'asdf'" -> (STRING (ANSI_C_QUOTING 'asdf')) |
47 |
|
48 |
dqstr: |
49 |
"\"\\\\\"\$\`\"" -> (DOUBLE_QUOTED_STRING \ " $ `) |