title: Antlr: how to match everything between the other recognized tokens?
body: <p>How do I match all of the leftover text between the other tokens in my lexer?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>grammar UserQuery;
  
  expr:  expr AND expr
      | expr OR expr
      | NOT expr
      | TEXT+
      | '(' expr ')'
      ;
  
  OR  :    'OR';
  AND :    'AND';
  NOT :    'NOT';
  LPAREN : '(';
  RPAREN : ')';
  
  TEXT: .+?;
  </code></pre>
  
  <p>When I run the lexer on "xx AND yy", I get these tokens:</p>
  
  <pre><code>x type:TEXT
  x type:TEXT
    type:TEXT
  AND type:'AND'
    type:TEXT
  y type:TEXT
  y type:TEXT
  </code></pre>
  
  <p>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.</p>