I’m getting:
line n:m required (…)+ loop did not match anything at character u’#’
But the parser finishes with 0 = parser.getNumberOfSyntaxErrors(), and produces an AST that is correct. Further checks confirm that the error message is being printed by the lexer which throws an antlr3.exceptions.EarlyExitException that somehow never reaches the parser.
The lexical rule that should match at that point is:
LOCALVAR
:
'#' NAME_CHAR+
;
And the point of failure in the input reads #I).
Why doe the lexing and the parsing succeed? Why the message on valid input?
My solution to a similar problem:
When parsing the following phrase:
The lexer protests with:
Changing the rules to:
Fixed the problem.
The issue is, in part, that ANTLR lexers are nor RE but LL.