aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMu Qiao <qiaomuf@gentoo.org>2011-07-29 20:54:12 +0800
committerMu Qiao <qiaomuf@gentoo.org>2011-08-02 15:52:19 +0800
commit1e51015b4e2e76a912e077faf772e6470090b130 (patch)
treeaa73c41c86c408c2e7673087ed3afeda3036dccc
parentParser: allow 'function' to be string literal (diff)
downloadlibbash-1e51015b4e2e76a912e077faf772e6470090b130.tar.gz
libbash-1e51015b4e2e76a912e077faf772e6470090b130.tar.bz2
libbash-1e51015b4e2e76a912e077faf772e6470090b130.zip
Parser: improve the rule for regular expression
-rw-r--r--bashast/bashast.g14
-rw-r--r--scripts/var_expansion.bash7
2 files changed, 18 insertions, 3 deletions
diff --git a/bashast/bashast.g b/bashast/bashast.g
index ea8185f..5549439 100644
--- a/bashast/bashast.g
+++ b/bashast/bashast.g
@@ -620,19 +620,27 @@ keyword_condition_binary
-> ^(MATCH_PATTERN condition_part ^(STRING extended_pattern_match+))
| -> condition_part
);
-//TODO improve this rule
bash_pattern_part
scope {
int parens;
+#ifdef OUTPUT_C
+ bool quoted;
+#else
+ boolean quoted;
+#endif
}
@init {
$bash_pattern_part::parens = 0;
+ $bash_pattern_part::quoted = false;
}
:(
- (ESC BLANK) => ESC BLANK
+ DQUOTE! { $bash_pattern_part::quoted = !$bash_pattern_part::quoted; }
+ | {$bash_pattern_part::quoted}? => ~DQUOTE
+ | (ESC BLANK) => ESC BLANK
| LPAREN { if(LA(-2) != ESC) $bash_pattern_part::parens++; }
+ | LLPAREN { if(LA(-2) != ESC) $bash_pattern_part::parens += 2; }
| {$bash_pattern_part::parens != 0}? => RPAREN { if(LA(-2) != ESC) $bash_pattern_part::parens--; }
- | ~(BLANK|EOL|LOGICAND|LOGICOR|LPAREN|RPAREN)
+ | ~(BLANK|EOL|LOGICAND|LOGICOR|LPAREN|RPAREN|DQUOTE|LLPAREN)
)+;
keyword_binary_string_operator
: BLANK! binary_operator BLANK!
diff --git a/scripts/var_expansion.bash b/scripts/var_expansion.bash
index 2d9a28e..9f442b1 100644
--- a/scripts/var_expansion.bash
+++ b/scripts/var_expansion.bash
@@ -127,3 +127,10 @@ echo ${bar+abc}
foo=
unset bar
echo ${bar=abc}
+
+# This regular expression will cause boost::exception_detail::clone_impl<boost::xpressive::regex_error>
+#[[ "${version_components_groups}" =~ ("*".*" "|" *"|^2.*\ (2|\*)|^3.*\ (3|\*)) ]]
+[[ " ${FUNCNAME[@]:2} " =~ " "(_python_final_sanity_checks|python_execute_function|python_mod_optimize|python_mod_cleanup)" " ]]
+[[ "$(declare -p PYTHON_SANITY_CHECKS_EXECUTED)" != "declare -- PYTHON_SANITY_CHECKS_EXECUTED="* || " ${FUNCNAME[@]:1} " =~ " "(python_set_active_version|python_pkg_setup)" " && -z "${PYTHON_SKIP_SANITY_CHECKS}" ]]
+[[ " ${FUNCNAME[@]:1} " =~ " "(python_set_active_version|python_pkg_setup)" " ]]
+[[ "$(echo "2p" "${file}")" =~ ^"# Gentoo '".*"' wrapper script generated by python_generate_wrapper_scripts()"$ ]]