I'm trying to write a grammar for an XML-like language, where we use << instead of < characters. This is a partial snap of the lexer, where TEXT represents the text between (outside) tags:
OPEN : '<<' ;
CLOSE : '>>' ;
TEXT : ~[^<]+ ;
The definition for TEXT above is clearly wrong, because it will stop at the first occurrence of < even when one is not followed by another <. I am looking for a way to define "capture everything until you encounter a <<" but don't include the << as part of the match.
So something like this won't work either:
TEXT : .*? '<<' ;
Is there a way to accomplish that in ANTLR4?
-- TR