1 |
commit: 81df82652238ccaff47b48f0c914a57fefb3b45c |
2 |
Author: Mu Qiao <qiaomuf <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jul 22 03:50:01 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Aug 2 07:46:29 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=81df8265 |
7 |
|
8 |
Parser: fix brace handling in regex |
9 |
|
10 |
--- |
11 |
bashast/bashast.g | 3 +-- |
12 |
bashast/gunit/cond_main.gunit | 1 + |
13 |
2 files changed, 2 insertions(+), 2 deletions(-) |
14 |
|
15 |
diff --git a/bashast/bashast.g b/bashast/bashast.g |
16 |
index 3b9b5bd..610b495 100644 |
17 |
--- a/bashast/bashast.g |
18 |
+++ b/bashast/bashast.g |
19 |
@@ -563,10 +563,9 @@ scope { |
20 |
} |
21 |
:( |
22 |
(ESC BLANK) => ESC BLANK |
23 |
- | (ESC RSQUARE) => ESC RSQUARE |
24 |
| LPAREN { if(LA(-2) != ESC) $bash_pattern_part::parens++; } |
25 |
| {$bash_pattern_part::parens != 0}? => RPAREN { if(LA(-2) != ESC) $bash_pattern_part::parens--; } |
26 |
- | ~(BLANK|RSQUARE|EOL|LOGICAND|LOGICOR|LPAREN|RPAREN) |
27 |
+ | ~(BLANK|EOL|LOGICAND|LOGICOR|LPAREN|RPAREN) |
28 |
)+; |
29 |
keyword_binary_string_operator |
30 |
: binary_operator |
31 |
|
32 |
diff --git a/bashast/gunit/cond_main.gunit b/bashast/gunit/cond_main.gunit |
33 |
index 4068c51..e4810a9 100644 |
34 |
--- a/bashast/gunit/cond_main.gunit |
35 |
+++ b/bashast/gunit/cond_main.gunit |
36 |
@@ -33,3 +33,4 @@ condition_expr: |
37 |
"[[ \"${DISTUTILS_SRC_TEST}\" =~ ^(setup\.py|nosetests|py\.test|trial(\ .*)?)$ ]]" -> (KEYWORD_TEST (MATCH_REGULAR_EXPRESSION (STRING (DOUBLE_QUOTED_STRING (VAR_REF DISTUTILS_SRC_TEST))) (STRING ^ ( setup \ . py | nosetests | py \ . test | trial ( \ . * ) ? ) $))) |
38 |
"[ -n "$FROM_LANG" -a -n "$TO_LANG" ]" -> (BUILTIN_TEST (BUILTIN_LOGIC a (n (STRING (DOUBLE_QUOTED_STRING (VAR_REF FROM_LANG)))) (n (STRING (DOUBLE_QUOTED_STRING (VAR_REF TO_LANG)))))) |
39 |
"[ -n "$FROM_LANG" -o -n "$TO_LANG" ]" -> (BUILTIN_TEST (BUILTIN_LOGIC o (n (STRING (DOUBLE_QUOTED_STRING (VAR_REF FROM_LANG)))) (n (STRING (DOUBLE_QUOTED_STRING (VAR_REF TO_LANG)))))) |
40 |
+"[[ "${element}" =~ (^[^[:space:]]+\ .) ]]" -> (KEYWORD_TEST (MATCH_REGULAR_EXPRESSION (STRING (DOUBLE_QUOTED_STRING (VAR_REF element))) (STRING ( ^ [ ^ [ : space : ] ] + \ . )))) |