From da2335328b97c3a0ffde054513546cbd0e4698ab Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 7 Dec 2015 12:19:30 +0000 Subject: [PATCH] expression_grammar X3 - add support for single and double quoted arguments in regex functions --- include/mapnik/expression_grammar_x3_def.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/mapnik/expression_grammar_x3_def.hpp b/include/mapnik/expression_grammar_x3_def.hpp index aae395d6d..e84861ce0 100644 --- a/include/mapnik/expression_grammar_x3_def.hpp +++ b/include/mapnik/expression_grammar_x3_def.hpp @@ -323,7 +323,7 @@ namespace mapnik { namespace grammar { auto const relational_expression_def = additive_expression[do_assign] > *( ( (lit("<=") | lit("le")) > additive_expression [do_less_equal]) | - ( (lit("<") | lit("lt")) >> additive_expression[do_less]) // allow backtracking to be able handle '<' and '<>' correctly + ( (lit("<") | lit("lt")) >> additive_expression[do_less]) // allow backtracking to be able to handle '<' and '<>' correctly | ( (lit(">=") | lit("ge")) > additive_expression [do_greater_equal]) | @@ -337,8 +337,9 @@ namespace mapnik { namespace grammar { auto const feature_attr = lexeme['[' > +~char_(']') > ']']; auto const global_attr = x3::rule {} = lexeme[lit('@') > alpha > *alnum]; - auto const regex_match_expression_def = lit(".match") > '(' > quoted_string > ')'; - auto const regex_replace_expression_def = lit(".replace") > '(' > quoted_string > ',' > quoted_string > ')'; + auto const regex_arg = x3::rule {} = quoted_string | single_quoted_string; + auto const regex_match_expression_def = lit(".match") > '(' > regex_arg > ')'; + auto const regex_replace_expression_def = lit(".replace") > '(' > regex_arg > ',' > regex_arg > ')'; auto const multiplicative_expression_def = unary_expression [do_assign] > *( '*' > unary_expression [do_mult] |