1 |
commit: cd818e41fb54894c6716edf2a14c5ee907a02528 |
2 |
Author: Petteri Räty <petsku <AT> petteriraty <DOT> eu> |
3 |
AuthorDate: Sat Apr 16 16:51:48 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Apr 17 10:57:04 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=cd818e41 |
7 |
|
8 |
Parser: escaped double quotes in dqstr |
9 |
|
10 |
The parser now handles escaped double quotes inside double quoted |
11 |
strings. |
12 |
|
13 |
--- |
14 |
bashast/bashast.g | 9 +++++---- |
15 |
bashast/gunit/fname.gunit | 3 +++ |
16 |
2 files changed, 8 insertions(+), 4 deletions(-) |
17 |
|
18 |
diff --git a/bashast/bashast.g b/bashast/bashast.g |
19 |
index 7b900cc..d82e7cf 100644 |
20 |
--- a/bashast/bashast.g |
21 |
+++ b/bashast/bashast.g |
22 |
@@ -409,10 +409,11 @@ nqstr_part |
23 |
//double quoted string rule, allows expansions |
24 |
dqstr : DQUOTE dqstr_part* DQUOTE -> ^(DOUBLE_QUOTED_STRING dqstr_part*); |
25 |
dqstr_part |
26 |
- : var_ref |
27 |
- | command_sub |
28 |
- | arithmetic_expansion |
29 |
- | ~(DOLLAR|TICK|DQUOTE); |
30 |
+ : var_ref |
31 |
+ | command_sub |
32 |
+ | arithmetic_expansion |
33 |
+ | ESC DQUOTE |
34 |
+ | ~(DOLLAR|TICK|DQUOTE); |
35 |
//single quoted string rule, no expansions |
36 |
sqstr_part |
37 |
: ~SQUOTE*; |
38 |
|
39 |
diff --git a/bashast/gunit/fname.gunit b/bashast/gunit/fname.gunit |
40 |
index a5b1f7f..f048755 100644 |
41 |
--- a/bashast/gunit/fname.gunit |
42 |
+++ b/bashast/gunit/fname.gunit |
43 |
@@ -67,3 +67,6 @@ fname: |
44 |
"ab[12[:alpha:]]" -> (STRING ab (MATCH_PATTERN 12 (CHARACTER_CLASS alpha))) |
45 |
"\"'foo'\"" -> (STRING (DOUBLE_QUOTED_STRING ' foo ')) |
46 |
"--preserve=timestamps,mode" -> (STRING - -p reserve = timestamps , mode) |
47 |
+ |
48 |
+dqstr: |
49 |
+"\"\\\"\"" -> (DOUBLE_QUOTED_STRING \ ") |