I'm trying to parse a sequence of the syntax: < direction > < type > < name >. For example:
in float foo
where the direction can be either in, out, or in_out. I've succeeded in parsing correct text by using a qi::symbols class to convert the direction keywords to an enum.
However, the problem shows when I don't have correct text. Take the example:
int foo
The symbol table parser will except the 'in' part of the 'int' type and so the results will be:
direction: in
type: t
name: foo
And the error is not detected. What's the best way to be able to parse the in, out and in_out reserved words and ensure that they are followed by a non-identifier character so that the 'int' part of the previous text fails?
Thanks
See Question&Answers more detail:os