At 04:26 24/02/2009, Vlastimil Adamovsky wrote:
>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."
>
>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"...

There are a couple of "secret ways" that might help you here :)

The first is that in ANTLR, any rule that starts with a leading 
uppercase character is a lexer rule, and anything with a leading 
lowercase character is a parser rule.  You should try to keep the 
lexer as simple as possible, and in particular avoid creating 
multiple top-level lexer rules that can match the same input 
(which in general means that a non-fragment lexer rule should not 
refer to any other non-fragment lexer rules).  (Almost all of the 
rules you posted earlier look like they should be parser rules.)

The second is that ~ only operates on sets, not sequences.  In the 
lexer, that means that ~ will only work on individual characters; 
in the parser, that means that ~ will only work on individual 
tokens.


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to