-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maximum munch? #159
Comments
Have you tried swapping the order of the rules? Earlier rules take precedence. |
I can't really do that, because I also have:
which is a superset of TERM phrases. In this setup, if the input is This would work, if the longest match was picked. Instead, the earliest match is. I was wondering how to get around this issue. |
I'm afraid I don't exactly understand what you're trying to do. Moo doesn't choose the regexp with the longest match -- indeed, because it combines all the regexps into a single JS regexp for speed, it can't do this. Instead, the first regexp will match: earlier rules take precedence. It's hard to provide a solid recommendation without knowing more about the language you're trying to parse. But usually people seem to solve problems that sound like this by:
|
Hi,
this is more of a question than an issue about Moo, so here goes:
I have the following lexer:
On input
moo
, this will return:On input
moo*
I would want it to return a singlePREFIXTERM
, but I'm getting this instead:How can I get it to go for a single PREFIXTERM?
The text was updated successfully, but these errors were encountered: