public ASTNode requireElement() {
        if (!isElement())
            throw new IllegalArgumentException("Expected an element but got " + current().getClass());
        ASTNode current = current();
        i++;
        return current;
    }
Returns the current token if it is any element and throws otherwise.
integration/intellij/src/main/java/ai/vespa/intellij/schema/utils/Tokens.java