Here is a breakdown of the default token formatting.
[@{TokenIndex},{StartIndex}:{StopIndex}={Text},<{TokenType}>,{Line}:{Column}]
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 value 20
is assigned to the token named Foo
, then the first token in your listing was produced by either a lexer rule named Foo
or a lexer rule containing the action -> type(foo)
or you have a user-defined action which explicitly assigns the type Foo
to a token produced by some other rule (this will be code you wrote, not code generated by ANTLR).