mercredi 24 mai 2017

boost spirit parser look ahead parsing

I want to parse a string which is of the form: string_number. I am not sure how to write a grammar for boost qi parser.

Right now my grammar looks like: +qi::char_("a-zA-Z0-9_-") >> lit('_') >> qi::int_

But doesn't look like it works. Example strings are: ab_bcd_123 --> tokens(ab_bcd, 123) ab_123 ---> tokens(ab, 123)

Aucun commentaire:

Enregistrer un commentaire