[antlr-interest] Re: interactive envionments and non-delayed rule reduction
Richard Clark
rd_clark at sbcglobal.net
Tue Aug 3 20:41:25 PDT 2004
On Aug 3, 2004, at 19:46, Monty Zukowski wrote:
> Then my suggestion will work. Parse a single line, if it fails wait
> for the next line, put them together and try again.
Um, Monty, are you sure? I've been thinking about this and wondering
how I'd structure it if I did this.
Try this scenario:
(3 + 4
)
*5
The first (3+4 throws a RecognitionException (incomplete expression).
Adding the ) makes it OK. But then *5 throws a recognition expression,
and no number of added lines will fix it.
I wonder if this would work: leave the EOL tokens in and use them to
mark the end of an expression. If you get a recognition expression, and
the token is an EOL, append the next line and retry the whole thing. If
you get a recognition expression and the token is _not_ an EOL, report
and error and flush the input buffer.
What do you think?
...Richard
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list