Boost logo

Boost Users :

Subject: Re: [Boost-users] [Spirit/qi] parsing order, exact matches
From: Jeff Flinn (jeffrey.flinn_at_[hidden])
Date: 2013-10-02 16:08:27


On 10/2/2013 2:31 PM, beet wrote:
> Dear Boost-User list,
>
> I have modified the calc6-example from the Spirit docs, so that it uses
> double variables rather than integers. I have then added a number of
> mathematical functions.
>
> The rule for the unary functions (reduced to just sin and sinh here for
> readability) is:
>
> unary_function_rule_ =
> (string_("sin") > '(' > expression_rule_ > ')')
> | (string_("sinh") > '(' > expression_rule_ > ')')
> ;

For this specific case you can reverse the order:

> (string_("sinh") > '(' > expression_rule_ > ')')
> | (string_("sin") > '(' > expression_rule_ > ')')

for the more general case see:

http://www.boost.org/doc/libs/1_41_0/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/distinct.html

Jeff


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net