I am parsing the grammar with Antlr 4 (v4.9.2)
The following is the grammar:
grammar Test;
start
:
command+ EOF
;
command: commandType params ;
commandType: 'DISPLAY' ;
params: param (',' param)*
| ;//parameter list
param: ID;
ID : [a-z]+[a-z0-9]*
;
WS
:
[ \t\r\n]+ -> skip
;
The input text for the grammar is:
DISPLAY hello, really, sdfdsf
DISPLAY one more now
The following is the parse tree generated. (start (command (commandType DISPLAY) (params (param hello) , (param really) , (param sdfdsf))) (command (commandType DISPLAY) (params (param one))) more now )
The nodes "more now" is not labelled.
Why the parser did not throw error for "more now"?