From 561fadd4ff51337e4f3643e9a822d15edfab6f40 Mon Sep 17 00:00:00 2001 From: artemp Date: Tue, 9 Feb 2016 16:24:37 +0100 Subject: [PATCH] expression grammar - sync with master (https://github.com/mapnik/mapnik/pull/3287) --- include/mapnik/expression_grammar_x3_def.hpp | 24 ++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/include/mapnik/expression_grammar_x3_def.hpp b/include/mapnik/expression_grammar_x3_def.hpp index 285786379..f1d3c98f5 100644 --- a/include/mapnik/expression_grammar_x3_def.hpp +++ b/include/mapnik/expression_grammar_x3_def.hpp @@ -285,6 +285,7 @@ namespace mapnik { namespace grammar { expression_grammar_type const expression("expression"); // rules x3::rule const logical_expression("logical expression"); + x3::rule const not_expression("not expression"); x3::rule const conditional_expression("conditional expression"); x3::rule const equality_expression("equality expression"); x3::rule const relational_expression("relational expression"); @@ -304,12 +305,20 @@ namespace mapnik { namespace grammar { auto const ustring = x3::rule {} = no_skip[alpha > *alnum]; // start - auto const expression_def = logical_expression; + auto const expression_def = logical_expression [do_assign] + | + ustring[do_unicode] + ; - auto const logical_expression_def = conditional_expression[do_assign] > - *(((lit("and") | lit("&&")) > conditional_expression[do_and]) + auto const logical_expression_def = not_expression[do_assign] > + *(((lit("and") | lit("&&")) > not_expression[do_and]) | - ((lit("or") | lit("||")) > conditional_expression[do_or])); + ((lit("or") | lit("||")) > not_expression[do_or])); + + auto const not_expression_def = conditional_expression[do_assign] + | + (lit("not") | lit('!')) > conditional_expression[do_not] + ; auto const conditional_expression_def = equality_expression[do_assign] | @@ -385,20 +394,17 @@ namespace mapnik { namespace grammar { | global_attr[do_global_attribute] | - (lit("not") | lit("!") ) > expression[do_not] - | unary_func_expression[do_assign] | binary_func_expression[do_assign] | - ('(' > expression[do_assign] > ')') - | - ustring[do_unicode] // parse as un-quoted unicode string if we get here! + ('(' > logical_expression[do_assign] > ')') ; BOOST_SPIRIT_DEFINE ( expression, logical_expression, + not_expression, conditional_expression, equality_expression, relational_expression,