aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMu Qiao <qiaomuf@gentoo.org>2012-03-02 10:19:33 +0800
committerMu Qiao <qiaomuf@gentoo.org>2012-03-02 10:19:33 +0800
commit156c4064b36c833ee8080d0b3aa7da1316914c1c (patch)
tree40caa338e13d003a95a40fe935d7327c20303a64
parentParser: Allow EOLs in builtin array definition (diff)
downloadlibbash-156c4064b36c833ee8080d0b3aa7da1316914c1c.tar.gz
libbash-156c4064b36c833ee8080d0b3aa7da1316914c1c.tar.bz2
libbash-156c4064b36c833ee8080d0b3aa7da1316914c1c.zip
Walker: allow bash expansions in regular expressions
-rw-r--r--bashast/libbashWalker.g4
-rw-r--r--scripts/var_expansion.bash5
2 files changed, 8 insertions, 1 deletions
diff --git a/bashast/libbashWalker.g b/bashast/libbashWalker.g
index 67a39fc..d45d9c3 100644
--- a/bashast/libbashWalker.g
+++ b/bashast/libbashWalker.g
@@ -797,7 +797,9 @@ keyword_condition returns[bool status]
} r=keyword_condition) { $status= l && r; }
|^(NEGATION l=keyword_condition) { $status = !l; }
|^(MATCH_REGULAR_EXPRESSION left_str=string_expr right_str=string_expr) {
- boost::xpressive::sregex re = boost::xpressive::sregex::compile(right_str.libbash_value);
+ bash_ast ast(std::stringstream(right_str.libbash_value), &bash_ast::parser_all_expansions);
+ std::string pattern = ast.interpret_with(*walker, &bash_ast::walker_string_expr);
+ boost::xpressive::sregex re = boost::xpressive::sregex::compile(pattern);
$status = boost::xpressive::regex_match(left_str.libbash_value, re);
}
|s=common_condition { $status = s; };
diff --git a/scripts/var_expansion.bash b/scripts/var_expansion.bash
index e78ac8f..4bdcb3e 100644
--- a/scripts/var_expansion.bash
+++ b/scripts/var_expansion.bash
@@ -141,3 +141,8 @@ echo "${search_paths/#/${root}}"
[[ "$(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()"$ ]]
+
+PYTHON_DEPEND="2:2.6"
+version_components_group_regex="(2|3|\*)(:([[:digit:]]+\.[[:digit:]]+)?(:([[:digit:]]+\.[[:digit:]]+)?)?)?"
+version_components_groups="${PYTHON_DEPEND}"
+[[ "${version_components_groups}" =~ ^((\!)?[[:alnum:]_-]+\?\ )?${version_components_group_regex}(\ ${version_components_group_regex})?$ ]] && echo true