This example uses boost spirit to parse a simple colon-delimited grammar.
The grammar we want to recognize is:
identifier := [a-z]+ separator := ':' path := (identifier separator path) | identifier
From the boost spirit perspective this example shows a few things that I found difficult to figure out when building my first parser.
- How to flag an incomplete token at the end of input as an error. (use of boost::spirit::eoi)
- How to bind an action on an instance of an object that is taken as input to the parser.
- Use of std::wstring.