Closed dselman closed 6 years ago
The the token regular expression has to actually match its keywords. /[a-zA-Z]+/
doesn't match NOTICE TO
(since it doesn't allow whitespace).
Why not simply treat all words as IDEN and recognize the sequence NOTICE
TO
of two IDENs in your parser?
If you really want to do it in your lexer, you can add notice
as a separate token type with {match: /NOTICE\s+TO(?![a-zA-Z])/, lineBreaks: true}
The the token regular expression has to actually match its keywords
Ooh, we should add a warning for this :-)
From some preliminary testing, it looks like keywords must be simple string literals. Is this by design? Is there another (better) way to achieve this?
Sample Nearley grammar using a Moo lexer:
Sample input:
Output: