Exemple #1
0
    // throws RecognitionException [1]
    // $ANTLR start tipo
    // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVMGen.g:86:1: tipo : ( 'int' -> {%{\"int\"}} | 'float' -> {%{\"float\"}} | 'string' -> {%{\"string\"}} | 'bool' -> {%{\"bool\"}} | 'void' -> {%{\"void\"}});
    public tipo_return tipo()
    {
        tipo_return retval = new tipo_return();
        retval.start = input.LT(1);

        try
        {
            // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVMGen.g:86:6: ( 'int' -> {%{\"int\"}} | 'float' -> {%{\"float\"}} | 'string' -> {%{\"string\"}} | 'bool' -> {%{\"bool\"}} | 'void' -> {%{\"void\"}})
            int alt4 = 5;
            switch ( input.LA(1) )
            {
            case 37:
                {
                alt4 = 1;
                }
                break;
            case 38:
                {
                alt4 = 2;
                }
                break;
            case 39:
                {
                alt4 = 3;
                }
                break;
            case 40:
                {
                alt4 = 4;
                }
                break;
            case 41:
                {
                alt4 = 5;
                }
                break;
                default:
                    NoViableAltException nvae_d4s0 =
                        new NoViableAltException("86:1: tipo : ( 'int' -> {%{\"int\"}} | 'float' -> {%{\"float\"}} | 'string' -> {%{\"string\"}} | 'bool' -> {%{\"bool\"}} | 'void' -> {%{\"void\"}});", 4, 0, input);

                    throw nvae_d4s0;
            }

            switch (alt4)
            {
                case 1 :
                    // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVMGen.g:86:8: 'int'
                    {
                        Match(input,37,FOLLOW_37_in_tipo525);

                        // TEMPLATE REWRITE
                        // 86:14: -> {%{\"int\"}}
                        {
                            retval.st = new StringTemplate(templateLib,"int");
                        }

                    }
                    break;
                case 2 :
                    // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVMGen.g:87:8: 'float'
                    {
                        Match(input,38,FOLLOW_38_in_tipo538);

                        // TEMPLATE REWRITE
                        // 87:16: -> {%{\"float\"}}
                        {
                            retval.st = new StringTemplate(templateLib,"float");
                        }

                    }
                    break;
                case 3 :
                    // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVMGen.g:88:8: 'string'
                    {
                        Match(input,39,FOLLOW_39_in_tipo551);

                        // TEMPLATE REWRITE
                        // 88:17: -> {%{\"string\"}}
                        {
                            retval.st = new StringTemplate(templateLib,"string");
                        }

                    }
                    break;
                case 4 :
                    // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVMGen.g:89:8: 'bool'
                    {
                        Match(input,40,FOLLOW_40_in_tipo564);

                        // TEMPLATE REWRITE
                        // 89:15: -> {%{\"bool\"}}
                        {
                            retval.st = new StringTemplate(templateLib,"bool");
                        }

                    }
                    break;
                case 5 :
                    // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVMGen.g:90:8: 'void'
                    {
                        Match(input,41,FOLLOW_41_in_tipo577);

                        // TEMPLATE REWRITE
                        // 90:15: -> {%{\"void\"}}
                        {
                            retval.st = new StringTemplate(templateLib,"void");
                        }

                    }
                    break;

            }
        }
        catch (RecognitionException re)
        {
            ReportError(re);
            Recover(input,re);
        }
        finally
        {
        }
        return retval;
    }
Exemple #2
0
    // throws RecognitionException [1]
    // $ANTLR start tipo
    // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:109:1: tipo : ( 'int' | 'float' | 'string' | 'bool' | 'void' );
    public tipo_return tipo()
    {
        tipo_return retval = new tipo_return();
        retval.start = input.LT(1);

        FkvmAST root_0 = null;

        IToken set56 = null;

        FkvmAST set56_tree=null;

        try
        {
            // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:109:6: ( 'int' | 'float' | 'string' | 'bool' | 'void' )
            // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:
            {
                root_0 = (FkvmAST)adaptor.GetNilNode();

                set56 = (IToken)input.LT(1);
                if ( (input.LA(1) >= 37 && input.LA(1) <= 41) )
                {
                    input.Consume();
                    adaptor.AddChild(root_0, adaptor.Create(set56));
                    errorRecovery = false;
                }
                else
                {
                    MismatchedSetException mse =
                        new MismatchedSetException(null,input);
                    RecoverFromMismatchedSet(input,mse,FOLLOW_set_in_tipo0);    throw mse;
                }

            }

            retval.stop = input.LT(-1);

                retval.tree = (FkvmAST)adaptor.RulePostProcessing(root_0);
                adaptor.SetTokenBoundaries(retval.Tree, retval.start, retval.stop);

        }
        catch (RecognitionException re)
        {
            ReportError(re);
            Recover(input,re);
        }
        finally
        {
        }
        return retval;
    }