I am trying to deal with errors, and I have a case that I do not understand.
The lexer is:
lexer grammar L;
MACHINE: 'machine';
DEFAULT: 'default';
MACDEF: 'macdef';
ID: ~('\\r' | '\\n' | ' ' | '\\t')+;
The parser is:
parser grammar G;
netrc: (machineEntry | macro)* defaultEntry? macro*;
machineEntry: MACHINE ID;
defaultEntry: DEFAULT;
macro: MACDEF ID;
When I feed the string "machine", I get what I expect:
line 1:7 missing ID at '<EOF>'
When I feed the string "macdef", I get no viable alternative, which seems wrong to me:
line 1:6 no viable alternative at input 'macdef'
I am very confused as to why I am getting two different error messages for what appears to be the same user error (missing ID after the keyword).
Any help appreciated, thanks in advance.
Martin