Closed somidad closed 4 years ago
Currently all targets will just insert raw text of lexer actions directly into generated lexer code, so it is not in scope of the rust target right now. ANTLR can add syntax extension to lexer actions similar to parser actions, but that should be decided in main ANTLR repo for all targets.
Personally, I am not sure if it is a good idea because it will work only in very trivial cases, anything more complex and you will need to write target specific code anyway.
I see. Thanks
For example, I have the following rule
It would generate the following lexer in Rust
Which results in a compilation error since Rust lexer does not have
getCharPositionInLine()
. Instaed, it hasget_char_position_in_line()
.I think it would be better if Rust runtime automatically substitutes Java-specific TokenSource methods including
getCharPositioninInLine()
torecog.get_char_position_in_line()