protected void consumeUntilGreedy ( Parser recognizer , IntervalSet set , CSSLexerState . RecoveryMode mode ) { CSSToken t ; do { Token next = recognizer . getInputStream ( ) . LT ( 1 ) ; if ( next instanceof CSSToken ) { t = ( CSSToken ) recognizer . getInputStream ( ) . LT ( 1 ) ; if ( t . getType ( ) == Token . EOF ) { logger . trace ( "token eof " ) ; break ; } } else break ; /* not a CSSToken, probably EOF */ logger . trace ( "Skipped greedy: {}" , t . getText ( ) ) ; // consume token even if it will match recognizer . consume ( ) ; } while ( ! ( t . getLexerState ( ) . isBalanced ( mode , null , t ) && set . contains ( t . getType ( ) ) ) ) ; }
Consumes token until lexer state is function - balanced and token from follow is matched . Matched token is also consumed