On 09/11/2016 4:44 PM, [hidden email] wrote:
> Trying to parse "0/1/x" with
> qi::ascii::digit >> +(qi::char_('/') >> qi::ascii::digit)
> I had expected the synthesized attributes value to be "0/1".
> But he following code results in "0/1/", where the suffix is "/x". Is this the correct behavior?
It might not be intuitive, but I think it is the correct behavior. Qi
is greedy and will eat as much as it can. '/' is valid at that point,
while digit, after it, will fail and thus exit the + loop. The other
interpretation will be very inefficient requiring backtracking and
attribute saving and try-commit semantics.
If you want the behavior you expect, use syntactic predicates or
some other means to test first before committing the attribute.