[antlr-interest] How does one suppress 'no viable alternative at character' warning messages

Terence Parr parrt at cs.usfca.edu
Wed Sep 17 12:27:21 PDT 2008


Try overriding  nextToken()...hmm...that might be hard.

Just throw an Error, which will not require a change to the signature  
and will blast all way out.
Ter
On Sep 17, 2008, at 12:23 PM, Tim Halloran wrote:

> On Wed, Sep 17, 2008 at 3:16 PM, Terence Parr <parrt at cs.usfca.edu>  
> wrote:
> Or,Overrides the reporting method to do nothing :)
> Ter
>
> I tried this with
>
> @lexer::members {
> @Override
> public void reportError(RecognitionException e) {
>     throw e;
> }
> }
>
> but this is unhappy because I can't change the method signature to  
> add "throws RecognitionException."
>
> Doing nothing, as Terrence suggested above, works but still accepts  
> sentences that are not in my language,  for example if I accept  
> (hide) and I give the string (***hide) where * is not accepted by my  
> lexer the parser views them as the same sentence.  This appears to  
> be because the recover by single symbol deletion is going on and I  
> have not figured out how to turn it off.  Am I correct?
>
> Regards,
> Tim
>
> 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