If I save the grammar
grammar L;
tree: 't' ;
a: tree | 'b' ;
in a file name L.g4
and invoke antlr4 L.g4
(Version 4.7.1) , it outputs an incomprehensible error message without any line or column numbers:
L.g4::: syntax error: mismatched character '|' expecting 'g'
The :::
part is where the line/column numbers of the errors usually go.
If I instead save
grammar L;
tre: 't' ;
a: tre | 'b' ;
as L.g4
and run antlr4
on it, it runs without errors.
What's wrong with the tree
identifier? It's not listed in the list of reserved keywords:
import, fragment, lexer, parser, grammar, returns, locals, throws, catch, finally, mode, options, tokens