At 21:42 21/01/2009, Bot Tiger wrote:
>I wanted to know how I can change the error handler so it can
>quit on the first error.
>
>I tried doing @rulecatch {}, but antlr 3.1.1 says:
>
>"error(100): C:\Users\admin\Desktop\SimpleCalc.g:12:1: syntax
>error: antlr: C:\Users\admin\Desktop\SimpleCalc.g:12:1:
>unexpected token: tokens {"
I'm not sure about @rulecatch itself (and whether or not it'll do
what you want), but the error you're getting there is because
you've put it in the wrong place :)
The first thing in the grammar file is the intro line ("grammar
foo;"). Following that must be the options block and the tokens
block, in that order. (You don't have to specify either one, but
if you do, then that's where they have to be.) Only after that
can you define action blocks (such as @rulecatch), and finally the
actual rules appear at the end.
So move the @rulecatch block underneath your tokens block and then
the error should go away. Whether it actually works after that,
though, I don't know :)
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
-~----------~----~----~----~------~----~------~--~---