So i am using Antlrworks 2, working on a rather large grammar. Problem is that in this grammar there are multiple ambiguities that i am trying to work through.
I was wondering if there is a way to interpret which rules were invoked when there was a failure.
For instance, when i run my rule i get following output
[@0,0:1='99',<20>,1:0]
[@1,2:1='<EOF>',<-1>,1:2]
line 1:0 mismatched input '99' expecting Digit2
(dummy 99)
I am wondering what [@0,0:1='99',<20>,1:0]
means. Do the @0
or <20>
have any relationship to the rule number in my grammar or something ?
Here is a breakdown of the default token formatting.
The
{TokenType}
field generally corresponds to a particular lexer rule (the constant will be declared in your generated lexer). However, the-> type(X)
command can be used in any lexer rule to reassign tokens produced by that rule to another type. If the value20
is assigned to the token namedFoo
, then the first token in your listing was produced by either a lexer rule namedFoo
or a lexer rule containing the action-> type(foo)
or you have a user-defined action which explicitly assigns the typeFoo
to a token produced by some other rule (this will be code you wrote, not code generated by ANTLR).