[antlr-interest] Not processing a newline always

Francesc d'Assis Massanés f.massanes at gmail.com
Mon Apr 26 10:03:30 PDT 2010


Hello,

I am trying to program a "complex" math program and to process the user
input I have been working in a grammar in antlr.

At this point it works almost as I want it to work but I am missing
something: I do not want to process newlines always.

Let me explain it better: when an expression is finished ( 4+5 ) you can
find a semi-colon or a newline, in any case you just finished this
expression.
But what happens if the expression is incomplete: ( 4+5+ ) then if you find
a semi-colon you have an error (you should not be able to parse this input)
but if you find a newline you should look the next line to follow
processing.

What I want is a rule like: Newline is HIDDEN if some other token is need to
finish the actual rule.

I do not know if it is even possible to do this with antlr or I shall go to
modify the output code.

Thanks,
Francesc Massanés


More information about the antlr-interest mailing list