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

Terence Parr parrt at cs.usfca.edu
Wed Sep 17 12:16:15 PDT 2008


Or,Overrides the reporting method to do nothing :)
Ter
On Sep 17, 2008, at 11:39 AM, Jim Idle wrote:

> On Wed, 2008-09-17 at 14:14 -0400, Tim Halloran wrote:
>>
>> My lexer is sending warnings to stderr of the form and I'd like to  
>> suppress these.
>>
>> line 1:7 no viable alternative at character 'H'
>> line 1:8 no viable alternative at character 'I'
>> line 1:9 no viable alternative at character 'D'
>> line 1:10 no viable alternative at character 'E'
>
> Rather than do that, create a last rule in the lexer;
>
> ANY : . { System.out.println("Don't support this char" + $text);  
> skip(); }
>
> Or perhaps you want a filtering lexer?
>
> Jim
>>
>
> 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