[antlr-interest] Not processing a newline always

Cliff Hudson cliff.s.hudson at gmail.com
Tue Apr 27 17:12:54 PDT 2010


Are you sending expressions to ANTLR a line at a time, or are you sending a
while 'file' which would be complete?  Do you have a lexer rule which
consumes whitespace?  Under what situations do you not want whitespace
ignored?

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Francesc d'Assis
Massanés
Sent: Monday, April 26, 2010 10:04 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Not processing a newline always

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

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list