antlr4 can't extract literal into token
问题 I have the following grammar and am trying to start out slowly, working up to move complex arguments. grammar Command; commands : command+ EOF; command : NAME args NL; args : arg | ; arg : DASH LOWER | LOWER; //arg : DASH 'a' | 'x'; NAME : [_a-zA-Z0-9]+; NL : '\n'; WS : [ \t\r]+ -> skip ; // spaces, tabs, newlines DASH : '-'; LOWER: [a-z];//'a' .. 'z'; I was hoping (for now) to parse files like this: cmd1 cmd3 -a If I run that input through grun I get an error: $ java org.antlr.v4.gui.TestRig