Boost spirit semantic actions on qi::rule

Viewed 170

I've been reading up on semantic actions and I have a rule that looks like this:

  property_rule %=
    identifier_rule % ','
    >> lit(L":")
    >> type_specification_rule
    >> -(lit(L":=") >> +(alnum - ';'))
    >> lit(L";");

The property_rule is defined as

qi::rule<Iterator, property(), space_type> property_rule;

Now, I also want to support operator ≡ so what I want is to change the rule to something like

...
>> -(( lit(L":=") || lit(L"≡")[SEMANTIC_ACTION_HERE]) >> +(alnum - ';'))
...

In the semantic action, I want to change the property that is being parsed, specifically setting its field is_constant to true. The property is Fusion-adapted. How do I do it?

1 Answers
Related