You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 Lexer.morph to change the lexer to produce other tokens.
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: