[antlr-interest] Re: Error recovery

lgcraymer lgc at mail1.jpl.nasa.gov
Mon Apr 12 13:20:56 PDT 2004


--- In antlr-interest at yahoogroups.com, "jduquevieira" <jpdv at m...> wrote:
> --- In antlr-interest at yahoogroups.com, "lgcraymer" <lgc at m...> wrote:
> > What you really want to change is the input buffering.  Check out
> > CharBuffer.java in the antlr directory and write an equivalent
> > (assuming that you are using Java--C++ and C# differ) that blocks 
> on
> > interactive input at end of line rather than returning EOF.
> > 
> > --Loring
> 
> 
> Hi Loring. Thanks for taking the time to answer.
> 
> Anyway, I think that I didn't explain my self correctely.
> Imagine that the user writes:
>      "2+*4)"
> 
> As you can see, there are parenthesis missing (left) and a number 
> (between the "+" and the "*").

Ouch!  That's a tougher problem.  You need to insert imaginary tokens (or AST nodes) wherever you are missing a token.  There are 
multiple interpretations possible since both extraneous and missing elements are possible.  You are pretty much on your own, here.  I 
would suggest doing a web search on error recovery and user input--maybe you can find something that will help.

--Loring

> 
> Even though the user as failed to write a correct statement, my 
> editor has to be able to recover from it and show place holders 
> where the missing characters were expected:
>      "_2+_*4)"
> 
> All of this graphically, of course. But, that point is already 
> covered.
> All I have left to solve is the parser.
> 
> Any ideas?
> 
> Best regards.



 
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