[antlr-interest] How do I throw exception on ERROR "no viable alternative at character "

Tilman Bender tbender at stud.hs-heilbronn.de
Fri May 15 01:50:31 PDT 2009


Hi,

Please have a look at the error reporting and recovery page on the wiki:

http://www.antlr.org/wiki/display/ANTLR3/Error+reporting+and+recovery

Maybe you could also override this:
http://www.antlr.org/api/Java/classorg_1_1antlr_1_1runtime_1_1_base_recognizer.html#6c32f5b03a9049357f3ddfbccee9a5e0

Allthough I am not sure this is a good idea.

HTH

Tilman Bender
Student des Software Engineering
Hochschule Heilbronn
tbender at stud.hs-heilbronn.de



Am 15.05.2009 um 06:51 schrieb Bharath R:

> Hi All ,
>
> Currentl when I parse my String , I am getting some errors printed  
> in the console.
>
> Like below : -
>
> line 1:6 no viable alternative at character '?'
> line 1:6 no viable alternative at character ' '
>
> and for the other characters also ( '@' ,',' )
>
> Instead of having the System.err , I need the parser to through the  
> exception.
>
> How Should I achieve this ??
>
>
>
> HUAWEI TECHNOLOGIES CO.,LTD. <att157f6.jpg>
>
>
> Address: Huawei Industrial Base
> Bantian Longgang
> Shenzhen 518129, P.R.China
> www.huawei.com
> -------------------------------------------------------------------------------------------------------------------------------------
> This e-mail and its attachments contain confidential information  
> from HUAWEI, which
> is intended only for the person or entity whose address is listed  
> above. Any use of the
> information contained herein in any way (including, but not limited  
> to, total or partial
> disclosure, reproduction, or dissemination) by persons other than  
> the intended
> recipient(s) is prohibited. If you receive this e-mail in error,  
> please notify the sender by
> phone or email immediately and delete it!
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090515/eb61f121/attachment.html 


More information about the antlr-interest mailing list