-
Notifications
You must be signed in to change notification settings - Fork 205
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
Context sensitive tokens #1027
Comments
I'm not sure I completely understand what you're suggesting, but this looks very similar to multi-mode lexers to me. |
Sounds like multi mode Lexing too. |
Thanks @HoldYourWaffle and @bd82, that's right. Sorry for being a noob ;) |
Fellow noobs should help each other out right 😉 @bd82 Maybe it's a good idea to make multi-mode lexing more prevalent in the documentation? There isn't really a tutorial page for it (although the linked example is plenty to understand how it works) and I didn't find the page until you linked to it from another issue. Perhaps we could add a section to the lexer tutorial page that mentions it? |
It seems like this feature is more popular than I thought... Having a full guide e.g: Would be best but that it a fair bit of work to create... Perhaps (as suggested) a small note could be added in the lexer tutorial to aid discover-ability. |
I'd love to add one, but the 'Edit on github' link results in a 404 😅 |
The move to mono repo structure broke the links. I will sort it out later. |
The edit links are now fixed. But you may want to edit them on a local dev env due to enforcement of prettier formatting. |
I created a pull request with an added note.
I saw something about a 'transitioning to a mono repo' before, and I've always wondered: what kinds of chevrotain were in a different repository? The |
|
That makes sense, thanks! |
Following the discussions on #993 and #1023, I'm wondering if it'd make sense to have an option for stateful tokens.
For this to work, the lexer would be initiated with a
state
variable, an empty object at first.If present, the
effect
function of a token is invoked whenever encountered during lexing:The
gate
property of a token is called with thestate
variable before a match.@bd82 does this make any sense?
The text was updated successfully, but these errors were encountered: