[antlr-interest] How to disable error messages

JLIST jlist9 at gmail.com
Sat Jun 14 11:46:53 PDT 2008


Hello Benjamin,

Thanks for the quick reply. Indeed, it only happens when
there are UTF-8 characters in the string. I now check if
there is any characters that's greater than 0x7f. If yes,
I'll skip parsing.

Jack

> Are you possibly feeding non-ascii data as a byte string into the
> parser? If you are parsing non-ascii data, you have to decode it into
> a unicode string before handing it off to ANTLR.

> And now to surpressing the messages (if you really want that): the
> easiest way is probably to override the emitErrorMessage methods of
> your lexer and parser classes.

> -Ben

> On Sat, Jun 14, 2008 at 7:53 PM, JLIST <jlist9 at gmail.com> wrote:
>> Hi,
>>
>> I'm using Python code generated by Antlr. I'm getting a lot
>> of errors like this:
>>
>> line 1:0 no viable alternative at character '\xe6'
>>
>> The grammar works OK so I'd like to disable these errors from
>> the console after starting the program. I wonder if there is a
>> simple way to turn that off from code?
>>
>> Thanks,
>> Jack
>>
>>



-- 
Best regards,
 JLIST                            mailto:jlist9 at gmail.com



More information about the antlr-interest mailing list