-
-
Notifications
You must be signed in to change notification settings - Fork 112
-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
Concept of a lexer mode #419
Labels
question
Further information is requested
Comments
Well, yes and not. You cannot change the Lexer at runtime, as it is constructed during compilation (which makes it fast). However, you can still use callbacks, extras, and other techniques to interpret the tokens differently, depending on the context. At runtime, in a callback, you can also use |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible for the lexer to run in different modes, where in one mode something might be recognized, and it in another it would not?
For example, when lexing
red AND blue
A lexer running in "query" mode might recognize AND as a operator, and it "text" mode it would treat it as a regular token.
Other lexers that I've used, including JFlex and Antlr, have this feature and it's extremely useful.
The text was updated successfully, but these errors were encountered: