-
Notifications
You must be signed in to change notification settings - Fork 7
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
If statement and "=>" #1
Comments
This project is awesome. 👏😎 Most lexers change their token state (Anltr calls it "mode"; start lexing using different rules, returning only after reaching the matching ending terminal) once they encounter such a terminal. In this way, some lexing rules which apply to the starting lexing state don't apply in the string lexing state. It would mean factoring out some token recognition to a separate lexer-only grammar, but it's unfortunately necessary since ANTLR doesn't allow lexical modes in mixed lexer-parsers. See Lexical Modes in https://github.com/antlr/antlr4/blob/master/doc/lexer-rules.md Examples: https://github.com/antlr/grammars-v4/blob/master/xml/XMLLexer.g4 https://stackoverflow.com/q/18243283/246672 Pseudocode:
|
Hi ! Actually it's more a dirty hack, as the preprocessor don't tokenize the input but rather naively analyze each line as raw text to match some input. I need to fix that using a more powerful parsing technic, obviously :) Thank you for that piece of information ! |
Hey. No prob. Check out the ANTLR XML, SmallTalk and esp. Python example parsers for the bits needed to do less hacks. Good luck, my friend. |
That's great material, thank you ! |
If/Else statements cannot have a
"=>"
into quotes anywhere if they are multilines because of the preprocessor that adds ';' after the predicate expression in order to disambiguate with the following blockTemporary workaround: Put the incriminated string into a variable outside of the if/else statement
Even if its a very specific issue, we need to ignore what's in the quotes when doing that kind of changes
The text was updated successfully, but these errors were encountered: