antlr4 - ANTLR lexer action pushing infos to parser? -


I'm new to ANTLR4 and knowing the best way to push information from a laser Wanna work parsing.

I have the following:

  LINE_DIRECTIVE: '#line' [\ t] + integral [\ t] + STRING_LITERAL {System.out. Println (gettext ()); Skip (); };  

Actually I would like to push getText () parser.

Putting a parse rule for line instructions is not such an option, such as a line command can be everywhere ...

Thank you for your help!

Whatever you can do on your LINE_DIRECTIVE second Is put in. Channel (and not leave token!). There are DEFAULT (or DEFAULT_CHANNEL ) and HIDDEN channels, and you can enter more than 1 . The parser reads the token only from the DEFAULT channel, but you can change it to runtime 2 .

1

2


Comments