private boolean lookaheadSequence ( boolean terminated , Token . Kind ... kinds ) { int next = index ; for ( Token . Kind k : kinds ) { next = terminated ? skipWhiteSpace ( next ) : skipLineSpace ( next ) ; if ( next >= tokens . size ( ) || tokens . get ( next ++ ) . kind != k ) { return false ; } } return true ; }
Attempt to match a given sequence of tokens in the given order whilst ignoring any whitespace in between . Note that in any case the index will be unchanged!