Closed veelo closed 7 years ago
Yes, I find it worthwhile, if only because with it you're able to compile your EP grammar :-) (but not only for that, I'm all for offering choices to the grammar creator).
I'll merge this PR and wait for your documentation update, and then but the version with a small explanation text.
Thanks! I'll let you know.
The
longest_match!()
parser is like theor!()
parser, except that all rules are tried and the one producing the longest match is taken. I have extended the PEG grammar to let|
denote the longest match choice operator, besides the standard/
prioritised choice. Unfortunately, theExpression*
rules inpeggedgrammar.d
have become a tad convoluted; at first I used negative lookahead, but this I think is better. Alternatively, I could have usedExpression <- Expression | LongestExpression
.I hope you think this is worth it. With this change I am able to parse a complete EP source file that is currently in production, with non-standard language extensions. The
epgrammar.d
changes for this I will commit later. You may bump the version before or after that, but maybe let me document this extension first?