The grammar compiler should be issuing a warning about the use of a greedy .+
in the lexer.
The VALUE
rule literally says "consume as many characters as you can, with no consideration of what the characters are". If your input is not exactly hello
or :
, then your lexer will consume a single VALUE
token containing the entire input.
Perhaps the following lexer is closer to what you're after:
lexer grammar textLexer;
HELLO : 'hello';
COLON : ':' -> pushMode(ValueMode);
mode ValueMode;
VALUE : ~[\r\n]+ -> popMode;