aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMu Qiao <qiaomuf@gentoo.org>2011-07-22 11:50:01 +0800
committerMu Qiao <qiaomuf@gentoo.org>2011-08-02 15:46:29 +0800
commit81df82652238ccaff47b48f0c914a57fefb3b45c (patch)
treeca2dcbb13e63ec6f03520f8b4f669d3520713682
parentParser&Walker: reimplement export built-in (diff)
downloadlibbash-81df82652238ccaff47b48f0c914a57fefb3b45c.tar.gz
libbash-81df82652238ccaff47b48f0c914a57fefb3b45c.tar.bz2
libbash-81df82652238ccaff47b48f0c914a57fefb3b45c.zip
Parser: fix brace handling in regex
-rw-r--r--bashast/bashast.g3
-rw-r--r--bashast/gunit/cond_main.gunit1
2 files changed, 2 insertions, 2 deletions
diff --git a/bashast/bashast.g b/bashast/bashast.g
index 3b9b5bd..610b495 100644
--- a/bashast/bashast.g
+++ b/bashast/bashast.g
@@ -563,10 +563,9 @@ scope {
}
:(
(ESC BLANK) => ESC BLANK
- | (ESC RSQUARE) => ESC RSQUARE
| LPAREN { if(LA(-2) != ESC) $bash_pattern_part::parens++; }
| {$bash_pattern_part::parens != 0}? => RPAREN { if(LA(-2) != ESC) $bash_pattern_part::parens--; }
- | ~(BLANK|RSQUARE|EOL|LOGICAND|LOGICOR|LPAREN|RPAREN)
+ | ~(BLANK|EOL|LOGICAND|LOGICOR|LPAREN|RPAREN)
)+;
keyword_binary_string_operator
: binary_operator
diff --git a/bashast/gunit/cond_main.gunit b/bashast/gunit/cond_main.gunit
index 4068c51..e4810a9 100644
--- a/bashast/gunit/cond_main.gunit
+++ b/bashast/gunit/cond_main.gunit
@@ -33,3 +33,4 @@ condition_expr:
"[[ \"${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 ( \ . * ) ? ) $)))
"[ -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))))))
"[ -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))))))
+"[[ "${element}" =~ (^[^[:space:]]+\ .) ]]" -> (KEYWORD_TEST (MATCH_REGULAR_EXPRESSION (STRING (DOUBLE_QUOTED_STRING (VAR_REF element))) (STRING ( ^ [ ^ [ : space : ] ] + \ . ))))