Code review comment: @SupunS I have corrected it please review again.

Code under review:
private ParserRuleContext getNextRule(ParserRuleContext currentCtx, int nextLookahead) {
        
        
        
        switch (currentCtx) {
            case COMP_UNIT:
            case FUNC_DEFINITION:
            case RETURN_TYPE_DESCRIPTOR:
            case EXTERNAL_FUNC_BODY:
            case FUNC_BODY_BLOCK:
            case STATEMENT:
            case VAR_DECL_STMT:
            case ASSIGNMENT_STMT:
            case REQUIRED_PARAM:
            case DEFAULTABLE_PARAM:
            case REST_PARAM:
            case MODULE_TYPE_DEFINITION:
            case RECORD_FIELD:
            case RECORD_TYPE_DESCRIPTOR:
            case OBJECT_TYPE_DESCRIPTOR:
            case ARG:
            case ARG_LIST:
            case OBJECT_FUNC_OR_FIELD:
            case IF_BLOCK:
            case BLOCK_STMT:
            case WHILE_BLOCK:
            case PANIC_STMT:
            case CALL_STMT:
            case IMPORT_DECL:
            case CONTINUE_STATEMENT:
            case BREAK_STATEMENT:
            case RETURN_STMT:
            case COMPUTED_FIELD_NAME:
            case LISTENERS_LIST:
            case SERVICE_DECL:
            case LISTENER_DECL:
            case CONSTANT_DECL:
            case NIL_TYPE_DESCRIPTOR:
            case COMPOUND_ASSIGNMENT_STMT:
            case OPTIONAL_TYPE_DESCRIPTOR:
                startContext(currentCtx);
                break;
            default:
                break;
        }

        ParserRuleContext parentCtx;
        STToken nextToken;
        switch (currentCtx) {
            case EOF:
                return ParserRuleContext.EOF;
            case COMP_UNIT:
                return ParserRuleContext.TOP_LEVEL_NODE;
            case PUBLIC_KEYWORD:
                parentCtx = getParentContext();
                if (parentCtx == ParserRuleContext.OBJECT_TYPE_DESCRIPTOR) {
                    return ParserRuleContext.OBJECT_FUNC_OR_FIELD;
                }

                return ParserRuleContext.TOP_LEVEL_NODE_WITHOUT_MODIFIER;
            case PRIVATE_KEYWORD:
                return ParserRuleContext.OBJECT_FUNC_OR_FIELD;
            case FUNC_DEFINITION:
                return ParserRuleContext.FUNCTION_KEYWORD;
            case RETURN_TYPE_DESCRIPTOR:
                return ParserRuleContext.RETURNS_KEYWORD;
            case EXTERNAL_FUNC_BODY:
                return ParserRuleContext.ASSIGN_OP;
            case FUNC_BODY_BLOCK:
                return ParserRuleContext.OPEN_BRACE;
            case STATEMENT:
                
                endContext(); 
                return ParserRuleContext.CLOSE_BRACE;
            case ASSIGN_OP:
                return getNextRuleForEqualOp();
            case COMPOUND_BINARY_OPERATOR:
                return ParserRuleContext.ASSIGN_OP;
            case CLOSE_BRACE:
                return getNextRuleForCloseBrace(nextLookahead);
            case CLOSE_PARENTHESIS:
                parentCtx = getParentContext();
                if (isParameter(parentCtx)) {
                    endContext(); 
                    endContext(); 
                }
                if (parentCtx == ParserRuleContext.NIL_TYPE_DESCRIPTOR) {
                    endContext();
                    
                    return getNextRuleForSimpleTypeDesc();
                }
                
                return ParserRuleContext.FUNC_BODY;
            case EXPRESSION:
                return ParserRuleContext.EXPRESSION_RHS;
            case EXTERNAL_KEYWORD:
                return ParserRuleContext.SEMICOLON;
            case FUNCTION_KEYWORD:
                return ParserRuleContext.FUNC_NAME;
            case FUNC_NAME:
                return ParserRuleContext.OPEN_PARENTHESIS;
            case OPEN_BRACE:
                
                
                
                
                

                
                if (isEndOfBlock(this.tokenReader.peek(nextLookahead))) {
                    return ParserRuleContext.CLOSE_BRACE;
                }

                return ParserRuleContext.STATEMENT;
            case OPEN_PARENTHESIS:
                parentCtx = getParentContext();
                if (parentCtx == ParserRuleContext.FUNC_DEFINITION) {
                    return ParserRuleContext.PARAM_LIST;
                }
                if (parentCtx == ParserRuleContext.NIL_TYPE_DESCRIPTOR) {
                    return ParserRuleContext.CLOSE_PARENTHESIS;
                }
                return ParserRuleContext.ARG;
            case RETURNS_KEYWORD:
                if (this.tokenReader.peek(nextLookahead).kind != SyntaxKind.RETURNS_KEYWORD) {
                    
                    
                    return ParserRuleContext.FUNC_BODY;
                }
                return ParserRuleContext.SIMPLE_TYPE_DESCRIPTOR;
            case SEMICOLON:
                return getNextRuleForSemicolon(nextLookahead);
            case SIMPLE_TYPE_DESCRIPTOR:
                return getNextRuleForSimpleTypeDesc();
            case VARIABLE_NAME:
            case PARAMETER_RHS:
                return getNextRuleForVarName(nextLookahead);
            case TOP_LEVEL_NODE_WITHOUT_MODIFIER:
                return ParserRuleContext.FUNC_DEFINITION;
            case FUNC_BODY:
                return ParserRuleContext.TOP_LEVEL_NODE_WITHOUT_MODIFIER;
            case REQUIRED_PARAM:
            case DEFAULTABLE_PARAM:
            case REST_PARAM:
                nextToken = this.tokenReader.peek(nextLookahead);
                if (isEndOfParametersList(nextToken)) {
                    endContext();
                    return ParserRuleContext.CLOSE_PARENTHESIS;
                }
                return ParserRuleContext.SIMPLE_TYPE_DESCRIPTOR;
            case ASSIGNMENT_STMT:
                return ParserRuleContext.VARIABLE_NAME;
            case COMPOUND_ASSIGNMENT_STMT:
                return ParserRuleContext.VARIABLE_NAME;
            case VAR_DECL_STMT:
                return ParserRuleContext.SIMPLE_TYPE_DESCRIPTOR;
            case EXPRESSION_RHS:
                return ParserRuleContext.BINARY_OPERATOR;
            case BINARY_OPERATOR:
                return ParserRuleContext.EXPRESSION;
            case COMMA:
                return getNextRuleForComma();
            case AFTER_PARAMETER_TYPE:
                return getNextRuleForParamType();
            case MODULE_TYPE_DEFINITION:
                return ParserRuleContext.TYPE_KEYWORD;
            case CLOSED_RECORD_BODY_END:
                nextToken = this.tokenReader.peek(nextLookahead);
                if (nextToken.kind == SyntaxKind.EOF_TOKEN) {
                    return ParserRuleContext.EOF;
                }
                return ParserRuleContext.TOP_LEVEL_NODE;
            case CLOSED_RECORD_BODY_START:
                startContext(ParserRuleContext.RECORD_FIELD);
                return ParserRuleContext.RECORD_FIELD;
            case ELLIPSIS:
                parentCtx = getParentContext();
                if (parentCtx == ParserRuleContext.MAPPING_CONSTRUCTOR || parentCtx == ParserRuleContext.ARG) {
                    return ParserRuleContext.EXPRESSION;
                }
                return ParserRuleContext.VARIABLE_NAME;
            case QUESTION_MARK:
                return ParserRuleContext.SEMICOLON;
            case RECORD_KEYWORD:
                return ParserRuleContext.RECORD_BODY_START;
            case TYPE_KEYWORD:
                return ParserRuleContext.TYPE_NAME;
            case RECORD_TYPE_DESCRIPTOR:
                return ParserRuleContext.RECORD_KEYWORD;
            case ASTERISK:
                return ParserRuleContext.TYPE_REFERENCE;
            case TYPE_REFERENCE:
                return ParserRuleContext.SEMICOLON;
            case TYPE_NAME:
                return ParserRuleContext.TYPE_DESCRIPTOR;
            case OBJECT_KEYWORD:
                return ParserRuleContext.OPEN_BRACE;
            case REMOTE_KEYWORD:
                return ParserRuleContext.FUNCTION_KEYWORD;
            case OBJECT_TYPE_DESCRIPTOR:
                return ParserRuleContext.OBJECT_TYPE_DESCRIPTOR_START;
            case OBJECT_TYPE_FIRST_QUALIFIER:
            case OBJECT_TYPE_SECOND_QUALIFIER:
                return ParserRuleContext.OBJECT_KEYWORD;
            case ABSTRACT_KEYWORD:
            case CLIENT_KEYWORD:
                return ParserRuleContext.OBJECT_KEYWORD;
            case OPEN_BRACKET:
                return ParserRuleContext.EXPRESSION;
            case CLOSE_BRACKET:
                parentCtx = getParentContext();
                if (parentCtx == ParserRuleContext.COMPUTED_FIELD_NAME) {
                    endContext(); 
                }
                return ParserRuleContext.EXPRESSION_RHS;
            case FIELD_OR_FUNC_NAME:
                return ParserRuleContext.EXPRESSION_RHS;
            case DOT:
                return getNextRuleForDot();
            case IF_KEYWORD:
                return ParserRuleContext.EXPRESSION;
            case ELSE_KEYWORD:
                return ParserRuleContext.ELSE_BODY;
            case BLOCK_STMT:
                return ParserRuleContext.OPEN_BRACE;
            case IF_BLOCK:
                return ParserRuleContext.IF_KEYWORD;
            case WHILE_BLOCK:
                return ParserRuleContext.WHILE_KEYWORD;
            case WHILE_KEYWORD:
                return ParserRuleContext.EXPRESSION;
            case CHECKING_KEYWORD:
                return ParserRuleContext.EXPRESSION;
            case CALL_STMT:
                return ParserRuleContext.CALL_STMT_START;
            case PANIC_STMT:
                return ParserRuleContext.PANIC_KEYWORD;
            case PANIC_KEYWORD:
                return ParserRuleContext.EXPRESSION;
            case FUNC_CALL:
                return ParserRuleContext.IMPORT_PREFIX;
            case IMPORT_KEYWORD:
                return ParserRuleContext.IMPORT_ORG_OR_MODULE_NAME;
            case IMPORT_PREFIX:
                return ParserRuleContext.SEMICOLON;
            case VERSION_NUMBER:
            case VERSION_KEYWORD:
                return ParserRuleContext.MAJOR_VERSION;
            case SLASH:
                return ParserRuleContext.IMPORT_MODULE_NAME;
            case IMPORT_ORG_OR_MODULE_NAME:
                return ParserRuleContext.IMPORT_DECL_RHS;
            case IMPORT_MODULE_NAME:
                return ParserRuleContext.AFTER_IMPORT_MODULE_NAME;
            case AS_KEYWORD:
                return ParserRuleContext.IMPORT_PREFIX;
            case MAJOR_VERSION:
            case MINOR_VERSION:
            case IMPORT_SUB_VERSION:
                return ParserRuleContext.MAJOR_MINOR_VERSION_END;
            case PATCH_VERSION:
                return ParserRuleContext.IMPORT_PREFIX_DECL;
            case IMPORT_DECL:
                return ParserRuleContext.IMPORT_KEYWORD;
            case CONTINUE_STATEMENT:
                return ParserRuleContext.CONTINUE_KEYWORD;
            case BREAK_STATEMENT:
                return ParserRuleContext.BREAK_KEYWORD;
            case CONTINUE_KEYWORD:
            case BREAK_KEYWORD:
                return ParserRuleContext.SEMICOLON;
            case RETURN_STMT:
                return ParserRuleContext.RETURN_KEYWORD;
            case RETURN_KEYWORD:
                return ParserRuleContext.RETURN_STMT_RHS;
            case ACCESS_EXPRESSION:
                
            case BASIC_LITERAL:
            case VARIABLE_REF:
                return ParserRuleContext.EXPRESSION_RHS;
            case MAPPING_FIELD_NAME:
                return ParserRuleContext.SPECIFIC_FIELD_RHS;
            case COLON:
                return ParserRuleContext.EXPRESSION;
            case STRING_LITERAL:
                
                return ParserRuleContext.COLON;
            case COMPUTED_FIELD_NAME:
                return ParserRuleContext.OPEN_BRACKET;
            case LISTENERS_LIST:
                return ParserRuleContext.EXPRESSION;
            case ON_KEYWORD:
                return ParserRuleContext.LISTENERS_LIST;
            case RESOURCE_KEYWORD:
                return ParserRuleContext.FUNC_DEFINITION;
            case SERVICE_DECL:
                return ParserRuleContext.SERVICE_KEYWORD;
            case SERVICE_KEYWORD:
                return ParserRuleContext.OPTIONAL_SERVICE_NAME;
            case SERVICE_NAME:
                return ParserRuleContext.ON_KEYWORD;
            case LISTENER_KEYWORD:
                return ParserRuleContext.TYPE_DESCRIPTOR;
            case LISTENER_DECL:
                return ParserRuleContext.LISTENER_KEYWORD;
            case FINAL_KEYWORD:
                return ParserRuleContext.TYPE_DESCRIPTOR;
            case CONSTANT_DECL:
                return ParserRuleContext.CONST_KEYWORD;
            case CONST_KEYWORD:
                return ParserRuleContext.CONST_DECL_TYPE;
            case CONST_DECL_TYPE:
                return ParserRuleContext.CONST_DECL_RHS;
            case NIL_TYPE_DESCRIPTOR:
                return ParserRuleContext.OPEN_PARENTHESIS;
            case TYPEOF_EXPRESSION:
                return ParserRuleContext.TYPEOF_KEYWORD;
            case TYPEOF_KEYWORD:
                return ParserRuleContext.EXPRESSION;
            case OPTIONAL_TYPE_DESCRIPTOR:
                return ParserRuleContext.TYPE_DESCRIPTOR;
            case UNARY_EXPRESSION:
                return ParserRuleContext.UNARY_OPERATOR;
            case UNARY_OPERATOR:
                return ParserRuleContext.EXPRESSION;

            case DECIMAL_INTEGER_LITERAL:
            case OBJECT_FUNC_OR_FIELD:
            case OBJECT_METHOD_START:
            case OBJECT_FUNC_OR_FIELD_WITHOUT_VISIBILITY:
            case OBJECT_FIELD_RHS:
            case PARAM_LIST:
            case ANNOTATION_ATTACHMENT:
            case ARG:
            case ARG_LIST:
            case ASSIGNMENT_OR_VAR_DECL_STMT:
            case ASSIGNMENT_OR_VAR_DECL_STMT_RHS:
            case BOOLEAN_LITERAL:
            case CALL_STMT_START:
            case ELSE_BLOCK:
            case ELSE_BODY:
            case FIELD_DESCRIPTOR_RHS:
            case FIELD_OR_REST_DESCIPTOR_RHS:
            case IMPORT_PREFIX_DECL:
            case NAMED_OR_POSITIONAL_ARG_RHS:
            case OBJECT_MEMBER:
            case OBJECT_TYPE_DESCRIPTOR_START:
            case RECORD_BODY_END:
            case RECORD_BODY_START:
            case RECORD_FIELD:
            case STATEMENT_START_IDENTIFIER:
            case TOP_LEVEL_NODE:
            case TYPE_DESCRIPTOR:
            case VAR_DECL_STMT_RHS:
            case AFTER_IMPORT_MODULE_NAME:
            case IMPORT_DECL_RHS:
            case IMPORT_VERSION_DECL:
            case MAJOR_MINOR_VERSION_END:
            case MAPPING_CONSTRUCTOR:
            case MAPPING_FIELD:
            case SPECIFIC_FIELD_RHS:
            case RETURN_STMT_RHS:
            case OPTIONAL_SERVICE_NAME:
            case RESOURCE_DEF:
            case CONST_DECL_RHS:
            default:
                throw new IllegalStateException("cannot find the next rule for: " + currentCtx);
        }
    }

Line commented on: case OPTIONAL_TYPE_DESCRIPTOR:

Revised code:
private ParserRuleContext getNextRule(ParserRuleContext currentCtx, int nextLookahead) {
        
        
        
        switch (currentCtx) {
            case COMP_UNIT:
            case FUNC_DEFINITION:
            case RETURN_TYPE_DESCRIPTOR:
            case EXTERNAL_FUNC_BODY:
            case FUNC_BODY_BLOCK:
            case STATEMENT:
            case VAR_DECL_STMT:
            case ASSIGNMENT_STMT:
            case REQUIRED_PARAM:
            case DEFAULTABLE_PARAM:
            case REST_PARAM:
            case MODULE_TYPE_DEFINITION:
            case RECORD_FIELD:
            case RECORD_TYPE_DESCRIPTOR:
            case OBJECT_TYPE_DESCRIPTOR:
            case ARG:
            case ARG_LIST:
            case OBJECT_FUNC_OR_FIELD:
            case IF_BLOCK:
            case BLOCK_STMT:
            case WHILE_BLOCK:
            case PANIC_STMT:
            case CALL_STMT:
            case IMPORT_DECL:
            case CONTINUE_STATEMENT:
            case BREAK_STATEMENT:
            case RETURN_STMT:
            case COMPUTED_FIELD_NAME:
            case LISTENERS_LIST:
            case SERVICE_DECL:
            case LISTENER_DECL:
            case CONSTANT_DECL:
            case NIL_TYPE_DESCRIPTOR:
            case COMPOUND_ASSIGNMENT_STMT:
            case OPTIONAL_TYPE_DESCRIPTOR:
                startContext(currentCtx);
                break;
            default:
                break;
        }

        ParserRuleContext parentCtx;
        STToken nextToken;
        switch (currentCtx) {
            case EOF:
                return ParserRuleContext.EOF;
            case COMP_UNIT:
                return ParserRuleContext.TOP_LEVEL_NODE;
            case PUBLIC_KEYWORD:
                parentCtx = getParentContext();
                if (parentCtx == ParserRuleContext.OBJECT_TYPE_DESCRIPTOR) {
                    return ParserRuleContext.OBJECT_FUNC_OR_FIELD;
                }

                return ParserRuleContext.TOP_LEVEL_NODE_WITHOUT_MODIFIER;
            case PRIVATE_KEYWORD:
                return ParserRuleContext.OBJECT_FUNC_OR_FIELD;
            case FUNC_DEFINITION:
                return ParserRuleContext.FUNCTION_KEYWORD;
            case RETURN_TYPE_DESCRIPTOR:
                return ParserRuleContext.RETURNS_KEYWORD;
            case EXTERNAL_FUNC_BODY:
                return ParserRuleContext.ASSIGN_OP;
            case FUNC_BODY_BLOCK:
                return ParserRuleContext.OPEN_BRACE;
            case STATEMENT:
                
                endContext(); 
                return ParserRuleContext.CLOSE_BRACE;
            case ASSIGN_OP:
                return getNextRuleForEqualOp();
            case COMPOUND_BINARY_OPERATOR:
                return ParserRuleContext.ASSIGN_OP;
            case CLOSE_BRACE:
                return getNextRuleForCloseBrace(nextLookahead);
            case CLOSE_PARENTHESIS:
                parentCtx = getParentContext();
                if (isParameter(parentCtx)) {
                    endContext(); 
                    endContext(); 
                }
                if (parentCtx == ParserRuleContext.NIL_TYPE_DESCRIPTOR) {
                    endContext();
                    
                    return getNextRuleForSimpleTypeDesc();
                }
                
                return ParserRuleContext.FUNC_BODY;
            case EXPRESSION:
                return ParserRuleContext.EXPRESSION_RHS;
            case EXTERNAL_KEYWORD:
                return ParserRuleContext.SEMICOLON;
            case FUNCTION_KEYWORD:
                return ParserRuleContext.FUNC_NAME;
            case FUNC_NAME:
                return ParserRuleContext.OPEN_PARENTHESIS;
            case OPEN_BRACE:
                
                
                
                
                

                
                if (isEndOfBlock(this.tokenReader.peek(nextLookahead))) {
                    return ParserRuleContext.CLOSE_BRACE;
                }

                return ParserRuleContext.STATEMENT;
            case OPEN_PARENTHESIS:
                parentCtx = getParentContext();
                if (parentCtx == ParserRuleContext.FUNC_DEFINITION) {
                    return ParserRuleContext.PARAM_LIST;
                }
                if (parentCtx == ParserRuleContext.NIL_TYPE_DESCRIPTOR) {
                    return ParserRuleContext.CLOSE_PARENTHESIS;
                }
                return ParserRuleContext.ARG;
            case RETURNS_KEYWORD:
                if (this.tokenReader.peek(nextLookahead).kind != SyntaxKind.RETURNS_KEYWORD) {
                    
                    
                    return ParserRuleContext.FUNC_BODY;
                }
                return ParserRuleContext.SIMPLE_TYPE_DESCRIPTOR;
            case SEMICOLON:
                return getNextRuleForSemicolon(nextLookahead);
            case SIMPLE_TYPE_DESCRIPTOR:
                return getNextRuleForSimpleTypeDesc();
            case VARIABLE_NAME:
            case PARAMETER_RHS:
                return getNextRuleForVarName(nextLookahead);
            case TOP_LEVEL_NODE_WITHOUT_MODIFIER:
                return ParserRuleContext.FUNC_DEFINITION;
            case FUNC_BODY:
                return ParserRuleContext.TOP_LEVEL_NODE_WITHOUT_MODIFIER;
            case REQUIRED_PARAM:
            case DEFAULTABLE_PARAM:
            case REST_PARAM:
                nextToken = this.tokenReader.peek(nextLookahead);
                if (isEndOfParametersList(nextToken)) {
                    endContext();
                    return ParserRuleContext.CLOSE_PARENTHESIS;
                }
                return ParserRuleContext.SIMPLE_TYPE_DESCRIPTOR;
            case ASSIGNMENT_STMT:
                return ParserRuleContext.VARIABLE_NAME;
            case COMPOUND_ASSIGNMENT_STMT:
                return ParserRuleContext.VARIABLE_NAME;
            case VAR_DECL_STMT:
                return ParserRuleContext.SIMPLE_TYPE_DESCRIPTOR;
            case EXPRESSION_RHS:
                return ParserRuleContext.BINARY_OPERATOR;
            case BINARY_OPERATOR:
                return ParserRuleContext.EXPRESSION;
            case COMMA:
                return getNextRuleForComma();
            case AFTER_PARAMETER_TYPE:
                return getNextRuleForParamType();
            case MODULE_TYPE_DEFINITION:
                return ParserRuleContext.TYPE_KEYWORD;
            case CLOSED_RECORD_BODY_END:
                nextToken = this.tokenReader.peek(nextLookahead);
                if (nextToken.kind == SyntaxKind.EOF_TOKEN) {
                    return ParserRuleContext.EOF;
                }
                return ParserRuleContext.TOP_LEVEL_NODE;
            case CLOSED_RECORD_BODY_START:
                startContext(ParserRuleContext.RECORD_FIELD);
                return ParserRuleContext.RECORD_FIELD;
            case ELLIPSIS:
                parentCtx = getParentContext();
                if (parentCtx == ParserRuleContext.MAPPING_CONSTRUCTOR || parentCtx == ParserRuleContext.ARG) {
                    return ParserRuleContext.EXPRESSION;
                }
                return ParserRuleContext.VARIABLE_NAME;
            case QUESTION_MARK:
                return getNextRuleForQuestionMark();
            case RECORD_KEYWORD:
                return ParserRuleContext.RECORD_BODY_START;
            case TYPE_KEYWORD:
                return ParserRuleContext.TYPE_NAME;
            case RECORD_TYPE_DESCRIPTOR:
                return ParserRuleContext.RECORD_KEYWORD;
            case ASTERISK:
                return ParserRuleContext.TYPE_REFERENCE;
            case TYPE_REFERENCE:
                return ParserRuleContext.SEMICOLON;
            case TYPE_NAME:
                return ParserRuleContext.TYPE_DESCRIPTOR;
            case OBJECT_KEYWORD:
                return ParserRuleContext.OPEN_BRACE;
            case REMOTE_KEYWORD:
                return ParserRuleContext.FUNCTION_KEYWORD;
            case OBJECT_TYPE_DESCRIPTOR:
                return ParserRuleContext.OBJECT_TYPE_DESCRIPTOR_START;
            case OBJECT_TYPE_FIRST_QUALIFIER:
            case OBJECT_TYPE_SECOND_QUALIFIER:
                return ParserRuleContext.OBJECT_KEYWORD;
            case ABSTRACT_KEYWORD:
            case CLIENT_KEYWORD:
                return ParserRuleContext.OBJECT_KEYWORD;
            case OPEN_BRACKET:
                return ParserRuleContext.EXPRESSION;
            case CLOSE_BRACKET:
                parentCtx = getParentContext();
                if (parentCtx == ParserRuleContext.COMPUTED_FIELD_NAME) {
                    endContext(); 
                }
                return ParserRuleContext.EXPRESSION_RHS;
            case FIELD_OR_FUNC_NAME:
                return ParserRuleContext.EXPRESSION_RHS;
            case DOT:
                return getNextRuleForDot();
            case IF_KEYWORD:
                return ParserRuleContext.EXPRESSION;
            case ELSE_KEYWORD:
                return ParserRuleContext.ELSE_BODY;
            case BLOCK_STMT:
                return ParserRuleContext.OPEN_BRACE;
            case IF_BLOCK:
                return ParserRuleContext.IF_KEYWORD;
            case WHILE_BLOCK:
                return ParserRuleContext.WHILE_KEYWORD;
            case WHILE_KEYWORD:
                return ParserRuleContext.EXPRESSION;
            case CHECKING_KEYWORD:
                return ParserRuleContext.EXPRESSION;
            case CALL_STMT:
                return ParserRuleContext.CALL_STMT_START;
            case PANIC_STMT:
                return ParserRuleContext.PANIC_KEYWORD;
            case PANIC_KEYWORD:
                return ParserRuleContext.EXPRESSION;
            case FUNC_CALL:
                return ParserRuleContext.IMPORT_PREFIX;
            case IMPORT_KEYWORD:
                return ParserRuleContext.IMPORT_ORG_OR_MODULE_NAME;
            case IMPORT_PREFIX:
                return ParserRuleContext.SEMICOLON;
            case VERSION_NUMBER:
            case VERSION_KEYWORD:
                return ParserRuleContext.MAJOR_VERSION;
            case SLASH:
                return ParserRuleContext.IMPORT_MODULE_NAME;
            case IMPORT_ORG_OR_MODULE_NAME:
                return ParserRuleContext.IMPORT_DECL_RHS;
            case IMPORT_MODULE_NAME:
                return ParserRuleContext.AFTER_IMPORT_MODULE_NAME;
            case AS_KEYWORD:
                return ParserRuleContext.IMPORT_PREFIX;
            case MAJOR_VERSION:
            case MINOR_VERSION:
            case IMPORT_SUB_VERSION:
                return ParserRuleContext.MAJOR_MINOR_VERSION_END;
            case PATCH_VERSION:
                return ParserRuleContext.IMPORT_PREFIX_DECL;
            case IMPORT_DECL:
                return ParserRuleContext.IMPORT_KEYWORD;
            case CONTINUE_STATEMENT:
                return ParserRuleContext.CONTINUE_KEYWORD;
            case BREAK_STATEMENT:
                return ParserRuleContext.BREAK_KEYWORD;
            case CONTINUE_KEYWORD:
            case BREAK_KEYWORD:
                return ParserRuleContext.SEMICOLON;
            case RETURN_STMT:
                return ParserRuleContext.RETURN_KEYWORD;
            case RETURN_KEYWORD:
                return ParserRuleContext.RETURN_STMT_RHS;
            case ACCESS_EXPRESSION:
                
            case BASIC_LITERAL:
            case VARIABLE_REF:
                return ParserRuleContext.EXPRESSION_RHS;
            case MAPPING_FIELD_NAME:
                return ParserRuleContext.SPECIFIC_FIELD_RHS;
            case COLON:
                return ParserRuleContext.EXPRESSION;
            case STRING_LITERAL:
                
                return ParserRuleContext.COLON;
            case COMPUTED_FIELD_NAME:
                return ParserRuleContext.OPEN_BRACKET;
            case LISTENERS_LIST:
                return ParserRuleContext.EXPRESSION;
            case ON_KEYWORD:
                return ParserRuleContext.LISTENERS_LIST;
            case RESOURCE_KEYWORD:
                return ParserRuleContext.FUNC_DEFINITION;
            case SERVICE_DECL:
                return ParserRuleContext.SERVICE_KEYWORD;
            case SERVICE_KEYWORD:
                return ParserRuleContext.OPTIONAL_SERVICE_NAME;
            case SERVICE_NAME:
                return ParserRuleContext.ON_KEYWORD;
            case LISTENER_KEYWORD:
                return ParserRuleContext.TYPE_DESCRIPTOR;
            case LISTENER_DECL:
                return ParserRuleContext.LISTENER_KEYWORD;
            case FINAL_KEYWORD:
                return ParserRuleContext.TYPE_DESCRIPTOR;
            case CONSTANT_DECL:
                return ParserRuleContext.CONST_KEYWORD;
            case CONST_KEYWORD:
                return ParserRuleContext.CONST_DECL_TYPE;
            case CONST_DECL_TYPE:
                return ParserRuleContext.CONST_DECL_RHS;
            case NIL_TYPE_DESCRIPTOR:
                return ParserRuleContext.OPEN_PARENTHESIS;
            case TYPEOF_EXPRESSION:
                return ParserRuleContext.TYPEOF_KEYWORD;
            case TYPEOF_KEYWORD:
                return ParserRuleContext.EXPRESSION;
            case OPTIONAL_TYPE_DESCRIPTOR:
                return ParserRuleContext.TYPE_DESCRIPTOR;
            case UNARY_EXPRESSION:
                return ParserRuleContext.UNARY_OPERATOR;
            case UNARY_OPERATOR:
                return ParserRuleContext.EXPRESSION;

            case DECIMAL_INTEGER_LITERAL:
            case OBJECT_FUNC_OR_FIELD:
            case OBJECT_METHOD_START:
            case OBJECT_FUNC_OR_FIELD_WITHOUT_VISIBILITY:
            case OBJECT_FIELD_RHS:
            case PARAM_LIST:
            case ANNOTATION_ATTACHMENT:
            case ARG:
            case ARG_LIST:
            case ASSIGNMENT_OR_VAR_DECL_STMT:
            case ASSIGNMENT_OR_VAR_DECL_STMT_RHS:
            case BOOLEAN_LITERAL:
            case CALL_STMT_START:
            case ELSE_BLOCK:
            case ELSE_BODY:
            case FIELD_DESCRIPTOR_RHS:
            case FIELD_OR_REST_DESCIPTOR_RHS:
            case IMPORT_PREFIX_DECL:
            case NAMED_OR_POSITIONAL_ARG_RHS:
            case OBJECT_MEMBER:
            case OBJECT_TYPE_DESCRIPTOR_START:
            case RECORD_BODY_END:
            case RECORD_BODY_START:
            case RECORD_FIELD:
            case STATEMENT_START_IDENTIFIER:
            case TOP_LEVEL_NODE:
            case TYPE_DESCRIPTOR:
            case VAR_DECL_STMT_RHS:
            case AFTER_IMPORT_MODULE_NAME:
            case IMPORT_DECL_RHS:
            case IMPORT_VERSION_DECL:
            case MAJOR_MINOR_VERSION_END:
            case MAPPING_CONSTRUCTOR:
            case MAPPING_FIELD:
            case SPECIFIC_FIELD_RHS:
            case RETURN_STMT_RHS:
            case OPTIONAL_SERVICE_NAME:
            case RESOURCE_DEF:
            case CONST_DECL_RHS:
            default:
                throw new IllegalStateException("cannot find the next rule for: " + currentCtx);
        }
    }