Code review comment: ```suggestion                 if (parentCtx != ParserRuleContext.QUERY_EXPRESSION) { ``` btw, why do we need to check the query ctx here? Any sample?

Code under review:
private ParserRuleContext getNextRuleForVarName() {
        ParserRuleContext parentCtx = getParentContext();
        switch (parentCtx) {
            case ASSIGNMENT_STMT:
                return ParserRuleContext.ASSIGNMENT_STMT_RHS;
            case CALL_STMT:
                return ParserRuleContext.ARG_LIST;
            case REQUIRED_PARAM:
            case PARAM_LIST:
                return ParserRuleContext.REQUIRED_PARAM_NAME_RHS;
            case DEFAULTABLE_PARAM:
                return ParserRuleContext.ASSIGN_OP;
            case REST_PARAM:
                return ParserRuleContext.PARAM_END;
            case FOREACH_STMT:
                return ParserRuleContext.IN_KEYWORD;
            case BINDING_PATTERN_STARTING_IDENTIFIER:
                return getNextRuleForBindingPattern(true);
            case TYPED_BINDING_PATTERN:
            case LIST_BINDING_PATTERN:
            case STMT_START_BRACKETED_LIST_MEMBER:
            case REST_BINDING_PATTERN:
            case FIELD_BINDING_PATTERN:
            case MAPPING_BINDING_PATTERN:
            case MAPPING_BP_OR_MAPPING_CONSTRUCTOR:
            case ERROR_BINDING_PATTERN:
                return getNextRuleForBindingPattern();
            case LISTENER_DECL:
            case CONSTANT_DECL:
                return ParserRuleContext.VAR_DECL_STMT_RHS;
            case RECORD_FIELD:
                return ParserRuleContext.FIELD_DESCRIPTOR_RHS;
            case ARG_LIST:
                return ParserRuleContext.NAMED_OR_POSITIONAL_ARG_RHS;
            case OBJECT_CONSTRUCTOR_MEMBER:
            case CLASS_MEMBER:
            case OBJECT_TYPE_MEMBER:
                return ParserRuleContext.OBJECT_FIELD_RHS;
            case ARRAY_TYPE_DESCRIPTOR:
                return ParserRuleContext.CLOSE_BRACKET;
            case KEY_SPECIFIER:
                return ParserRuleContext.TABLE_KEY_RHS;
            case LET_EXPR_LET_VAR_DECL:
            case LET_CLAUSE_LET_VAR_DECL:
                return ParserRuleContext.ASSIGN_OP;
            case ANNOTATION_DECL:
                return ParserRuleContext.ANNOT_OPTIONAL_ATTACH_POINTS;
            case QUERY_EXPRESSION:
            case JOIN_CLAUSE:
                return ParserRuleContext.IN_KEYWORD;
            case REST_MATCH_PATTERN:
                endContext(); 
                parentCtx = getParentContext();
                if (parentCtx == ParserRuleContext.MAPPING_MATCH_PATTERN) {
                    return ParserRuleContext.CLOSE_BRACE;
                }
                if (parentCtx == ParserRuleContext.ERROR_MATCH_PATTERN ||
                        parentCtx == ParserRuleContext.ERROR_ARG_LIST_MATCH_PATTERN_FIRST_ARG) {
                    return ParserRuleContext.CLOSE_PARENTHESIS;
                }
                return ParserRuleContext.CLOSE_BRACKET;
            case MAPPING_MATCH_PATTERN:
                return ParserRuleContext.COLON;
            case ON_FAIL_CLAUSE:
                return ParserRuleContext.BLOCK_STMT;
            case ERROR_ARG_LIST_MATCH_PATTERN_FIRST_ARG:
                endContext();
                return ParserRuleContext.ERROR_MESSAGE_MATCH_PATTERN_END;
            case ERROR_MATCH_PATTERN:
                return ParserRuleContext.ERROR_FIELD_MATCH_PATTERN_RHS;
            case RELATIVE_RESOURCE_PATH:
                return ParserRuleContext.CLOSE_BRACKET;
            case CHECKING_EXPRESSION:
                parentCtx = getParentContext();
                if (!(parentCtx == ParserRuleContext.QUERY_EXPRESSION)) {
                    return ParserRuleContext.RIGHT_DOUBLE_ARROW;
                }
            default:
                if (isStatement(parentCtx)) {
                    return ParserRuleContext.VAR_DECL_STMT_RHS;
                }
                throw new IllegalStateException("getNextRuleForVarName found: " + parentCtx);
        }
    }

Line commented on: if (!(parentCtx == ParserRuleContext.QUERY_EXPRESSION)) {

Revised code:
private ParserRuleContext getNextRuleForVarName() {
        ParserRuleContext parentCtx = getParentContext();
        switch (parentCtx) {
            case ASSIGNMENT_STMT:
                return ParserRuleContext.ASSIGNMENT_STMT_RHS;
            case CALL_STMT:
                return ParserRuleContext.ARG_LIST;
            case REQUIRED_PARAM:
            case PARAM_LIST:
                return ParserRuleContext.REQUIRED_PARAM_NAME_RHS;
            case DEFAULTABLE_PARAM:
                return ParserRuleContext.ASSIGN_OP;
            case REST_PARAM:
                return ParserRuleContext.PARAM_END;
            case FOREACH_STMT:
                return ParserRuleContext.IN_KEYWORD;
            case BINDING_PATTERN_STARTING_IDENTIFIER:
                return getNextRuleForBindingPattern(true);
            case TYPED_BINDING_PATTERN:
            case LIST_BINDING_PATTERN:
            case STMT_START_BRACKETED_LIST_MEMBER:
            case REST_BINDING_PATTERN:
            case FIELD_BINDING_PATTERN:
            case MAPPING_BINDING_PATTERN:
            case MAPPING_BP_OR_MAPPING_CONSTRUCTOR:
            case ERROR_BINDING_PATTERN:
                return getNextRuleForBindingPattern();
            case LISTENER_DECL:
            case CONSTANT_DECL:
                return ParserRuleContext.VAR_DECL_STMT_RHS;
            case RECORD_FIELD:
                return ParserRuleContext.FIELD_DESCRIPTOR_RHS;
            case ARG_LIST:
                return ParserRuleContext.NAMED_OR_POSITIONAL_ARG_RHS;
            case OBJECT_CONSTRUCTOR_MEMBER:
            case CLASS_MEMBER:
            case OBJECT_TYPE_MEMBER:
                return ParserRuleContext.OBJECT_FIELD_RHS;
            case ARRAY_TYPE_DESCRIPTOR:
                return ParserRuleContext.CLOSE_BRACKET;
            case KEY_SPECIFIER:
                return ParserRuleContext.TABLE_KEY_RHS;
            case LET_EXPR_LET_VAR_DECL:
            case LET_CLAUSE_LET_VAR_DECL:
                return ParserRuleContext.ASSIGN_OP;
            case ANNOTATION_DECL:
                return ParserRuleContext.ANNOT_OPTIONAL_ATTACH_POINTS;
            case QUERY_EXPRESSION:
            case JOIN_CLAUSE:
                return ParserRuleContext.IN_KEYWORD;
            case REST_MATCH_PATTERN:
                endContext(); 
                parentCtx = getParentContext();
                if (parentCtx == ParserRuleContext.MAPPING_MATCH_PATTERN) {
                    return ParserRuleContext.CLOSE_BRACE;
                }
                if (parentCtx == ParserRuleContext.ERROR_MATCH_PATTERN ||
                        parentCtx == ParserRuleContext.ERROR_ARG_LIST_MATCH_PATTERN_FIRST_ARG) {
                    return ParserRuleContext.CLOSE_PARENTHESIS;
                }
                return ParserRuleContext.CLOSE_BRACKET;
            case MAPPING_MATCH_PATTERN:
                return ParserRuleContext.COLON;
            case ON_FAIL_CLAUSE:
                return ParserRuleContext.BLOCK_STMT;
            case ERROR_ARG_LIST_MATCH_PATTERN_FIRST_ARG:
                endContext();
                return ParserRuleContext.ERROR_MESSAGE_MATCH_PATTERN_END;
            case ERROR_MATCH_PATTERN:
                return ParserRuleContext.ERROR_FIELD_MATCH_PATTERN_RHS;
            case RELATIVE_RESOURCE_PATH:
                return ParserRuleContext.CLOSE_BRACKET;
            case ON_FAIL_CHECK:
                return ParserRuleContext.RIGHT_DOUBLE_ARROW;
            default:
                if (isStatement(parentCtx)) {
                    return ParserRuleContext.VAR_DECL_STMT_RHS;
                }
                throw new IllegalStateException("getNextRuleForVarName found: " + parentCtx);
        }
    }