[antlr-interest] Match A with exception of B .....how do I do that?

Johannes Luber jaluber at gmx.de
Mon Feb 23 09:54:13 PST 2009


Vlastimil Adamovsky schrieb:
> Thank you Johannes,
>  
> I am still wrestling with ANLR and learning the secret ways ....:)))
> You write:
>  
> "but for better error messages it is recommend just to match the superset
> and to check in the parser for incorrect characters."

I haven't gotten around using ANTLR error handling yet, so I can't be
more specific than that you use actions like "{Check($A.text);}",
possibly with "?" appended. ANTLR supports custom error messages in some
way, too. If it isn't described on the wiki, I can only say to look at
"The Definitive ANTLR Reference". Or maybe someone else can give more
details.

Johannes
>  
> How do I do that? BTW, yor suggestion with "C : (~B)=> A;" did not work
> for me,
> but it is possible it is all my fault. I like your second suggestion
> better, but don't know how
> do it.......I find the ANTLR an amazing software, but still it takes
> time to "get it"...
>  
> Vlastimil
> 
> 



More information about the antlr-interest mailing list