private int peekToken ( ) throws IOException { // By far the most common case: last token hasn't been consumed, // so return already-peeked token. if ( currentFlaggedToken != Token . EOF ) { return currentToken ; } int lineno = ts . getLineno ( ) ; int tt = ts . getToken ( ) ; boolean sawEOL = false ; // process comments and whitespace while ( tt == Token . EOL || tt == Token . COMMENT ) { if ( tt == Token . EOL ) { lineno ++ ; sawEOL = true ; tt = ts . getToken ( ) ; } else { if ( compilerEnv . isRecordingComments ( ) ) { String comment = ts . getAndResetCurrentComment ( ) ; recordComment ( lineno , comment ) ; // Comments may contain multiple lines, get the number // of EoLs and increase the lineno lineno += getNumberOfEols ( comment ) ; break ; } tt = ts . getToken ( ) ; } } currentToken = tt ; currentFlaggedToken = tt | ( sawEOL ? TI_AFTER_EOL : 0 ) ; return currentToken ; // return unflagged token }
The flags if any are saved in currentFlaggedToken .