Skip to content

How to reconcile overlapping tokens. #440

Answered by alecthomas
TheGrandmother asked this question in Q&A
Discussion options

You must be logged in to vote

It's relatively straightforward and you can see an example in the SQL lexer here. Basically, just ensure your keywords come before your identifier in the lexer patterns. They are attempted in order, so if an identifier isn't a keyword it will match as an identifier.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@TheGrandmother
Comment options

Answer selected by TheGrandmother
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #439 on May 31, 2025 11:40.