public ASTNode require(IElementType... tokenTypes) {
        if (!is(tokenTypes))
            throw new IllegalArgumentException("Expected " + toString(tokenTypes) + " but got " + current());
        ASTNode current = current();
        i++;
        return current;
    }
Returns the current token if it is of the required type and throws otherwise.
integration/intellij/src/main/java/ai/vespa/intellij/schema/utils/Tokens.java