I have rather complicated expression parser with strict type checking. So my expression
rule declared to return effective type-index. Like that:
qi::rule < Iterator, type_index_t, skipper<Iterator>>
set_expression, expression, single_expression;
Now I have chaining multiple expression by rule:
expression = ((single_expression|set_expression) >> -(expression) )[
// following looks redundant
qi::_val = boost::phoenix::if_else(qi::_2, *qi::_2, qi::_1)
]
| qi::lit('(') >> expression >> ')'
;
Without explicit semantic action with if_else
I got wrong result of type of first entry instead of the last one.
So my question: is there better way to obtain correct expression type that equals to last item in sequence?
Aucun commentaire:
Enregistrer un commentaire