I aimed for quick & dirty. IIRC Spirit Repository already contains a thing like this, but it's more fun to write it:
// a quick and dirty distinct keyword parser `kw`: Should be effective,
// at least to avoid parsing partial identifiers as keywords
static const qi::rule<Iterator, qi::unused_type(const char*)> kw = qi::lit(qi::_r1) >> !qi::alnum;
And use it wherever you needed it:
kw(+"module") > qualified > eol;
Test still compiles and passes.
PS. Note how the absence of a skipper on kw means 'implied lexeme' semantics.
Look at the last commit only for the
kw
parserI aimed for quick & dirty. IIRC Spirit Repository already contains a thing like this, but it's more fun to write it:
And use it wherever you needed it:
Test still compiles and passes.
PS. Note how the absence of a skipper on
kw
means 'implied lexeme' semantics.