[antlr-interest] output unparsed code

Corina Herman cbodogai at gmail.com
Tue Jun 12 23:49:30 PDT 2012


Hello everybody!

I'm new to ANTRL and I'm trying to define a grammar for some specific
sentences and outputed as tree in C sharp. My problem is that when the
parser receives a phrase that doesn't fit to any rules I defined it simply
stops, I would like to go further meaning to output the line as it is
without transformation and going to the next sentence in the input.

I tried to add in my grammar at the end something like this, meaning no
matter what else it gets to put an unknown node in the tree but it's not
working.
unknown : .* EOL -> ^(UNKNOWN);

I also tried to figured out (with no succes) a way to complete this task in
generated lexer and parser.

Can you give me a hint or what should I do? Thank you in advance.

Corina Herman


More information about the antlr-interest mailing list