How do I match all of the leftover text between the other tokens in my lexer?
Here's my code:
grammar UserQuery;
expr: expr AND expr
| expr OR expr
| NOT expr
| TEXT+
| '(' expr ')'
;
OR : 'OR';
AND : 'AND';
NOT : 'NOT';
LPAREN : '(';
RPAREN : ')';
TEXT: .+?;
When I run the lexer on "xx AND yy", I get these tokens:
x type:TEXT
x type:TEXT
type:TEXT
AND type:'AND'
type:TEXT
y type:TEXT
y type:TEXT
This sort-of works, except that I don't want each character to be a token. I'd like to consolidate all of the leftover text into a single TEXT token.