Attribute ignored in first rule of alternatives
Søren Enevoldsen <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
Dear Spirit Community,
I have the following rule:
auto const bound = rule<Bound>("bound")
= (x3::lit("[") >> x3::lit("<=") > uint_ > x3::lit("]"))
| (x3::lit("[") >> x3::lit("<") > uint_[bound_dec1] > x3::lit("]"))
;
Bound is a struct with a uint32_t member. I have a BOOST_ADAPT_STRUCT to
ensure Spirit X3 can write to it.
When I parse "[<5]" I get a Bound with the value 4 (bound_dec1]
decrements the parsed number by one and stores that. But if I input
"[<=5]", I would expect a bound with 5 after all the magic. But I always
get a 0. If I add a "no-op" function to the rule, such that the number
parsing becomes uint_[bound_dec0] , it parses correctly. But I don't
really think that should be necessary. How do I Spirit to not zero out
my attribute?
- Søren Enevoldsen
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general