For given input:
hello hello
And grammar:
grammar test;
foo: bar ;
bar : 'hello' bar | EOF;
WS : [ \t\r\n]+ -> skip ;
I get a valid parse tree for rule bar.
But when I remove foo rule:
grammar test;
bar : 'hello' bar | EOF;
WS : [ \t\r\n]+ -> skip ;
I get an error "line 1:11 no viable alternative at input '< EOF>". What is going on here? I am using intellij plugin for ANTLR4 for rule testing.