Example #1
0
    // throws RecognitionException [1]
    // $ANTLR start literal
    // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVMGen.g:93:1: literal : ( LIT_ENTERO -> lit_entero(v=$LIT_ENTERO.text) | LIT_REAL -> lit_real(v=$LIT_REAL.text) | LIT_CADENA -> lit_cadena(v=$LIT_CADENA.text) | LIT_LOGICO -> lit_logico(v=$LIT_LOGICO.text));
    public literal_return literal()
    {
        literal_return retval = new literal_return();
        retval.start = input.LT(1);

        FkvmAST LIT_ENTERO18 = null;
        FkvmAST LIT_REAL19 = null;
        FkvmAST LIT_CADENA20 = null;
        FkvmAST LIT_LOGICO21 = null;

        try
        {
            // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVMGen.g:93:9: ( LIT_ENTERO -> lit_entero(v=$LIT_ENTERO.text) | LIT_REAL -> lit_real(v=$LIT_REAL.text) | LIT_CADENA -> lit_cadena(v=$LIT_CADENA.text) | LIT_LOGICO -> lit_logico(v=$LIT_LOGICO.text))
            int alt5 = 4;
            switch ( input.LA(1) )
            {
            case LIT_ENTERO:
                {
                alt5 = 1;
                }
                break;
            case LIT_REAL:
                {
                alt5 = 2;
                }
                break;
            case LIT_CADENA:
                {
                alt5 = 3;
                }
                break;
            case LIT_LOGICO:
                {
                alt5 = 4;
                }
                break;
                default:
                    NoViableAltException nvae_d5s0 =
                        new NoViableAltException("93:1: literal : ( LIT_ENTERO -> lit_entero(v=$LIT_ENTERO.text) | LIT_REAL -> lit_real(v=$LIT_REAL.text) | LIT_CADENA -> lit_cadena(v=$LIT_CADENA.text) | LIT_LOGICO -> lit_logico(v=$LIT_LOGICO.text));", 5, 0, input);

                    throw nvae_d5s0;
            }

            switch (alt5)
            {
                case 1 :
                    // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVMGen.g:93:11: LIT_ENTERO
                    {
                        LIT_ENTERO18 = (FkvmAST)input.LT(1);
                        Match(input,LIT_ENTERO,FOLLOW_LIT_ENTERO_in_literal595);

                        // TEMPLATE REWRITE
                        // 93:22: -> lit_entero(v=$LIT_ENTERO.text)
                        {
                            retval.st = templateLib.GetInstanceOf("lit_entero",
                          new STAttrMap().Add("v", LIT_ENTERO18.Text));
                        }

                    }
                    break;
                case 2 :
                    // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVMGen.g:94:11: LIT_REAL
                    {
                        LIT_REAL19 = (FkvmAST)input.LT(1);
                        Match(input,LIT_REAL,FOLLOW_LIT_REAL_in_literal616);

                        // TEMPLATE REWRITE
                        // 94:20: -> lit_real(v=$LIT_REAL.text)
                        {
                            retval.st = templateLib.GetInstanceOf("lit_real",
                          new STAttrMap().Add("v", LIT_REAL19.Text));
                        }

                    }
                    break;
                case 3 :
                    // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVMGen.g:95:11: LIT_CADENA
                    {
                        LIT_CADENA20 = (FkvmAST)input.LT(1);
                        Match(input,LIT_CADENA,FOLLOW_LIT_CADENA_in_literal637);

                        // TEMPLATE REWRITE
                        // 95:22: -> lit_cadena(v=$LIT_CADENA.text)
                        {
                            retval.st = templateLib.GetInstanceOf("lit_cadena",
                          new STAttrMap().Add("v", LIT_CADENA20.Text));
                        }

                    }
                    break;
                case 4 :
                    // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVMGen.g:96:11: LIT_LOGICO
                    {
                        LIT_LOGICO21 = (FkvmAST)input.LT(1);
                        Match(input,LIT_LOGICO,FOLLOW_LIT_LOGICO_in_literal658);

                        // TEMPLATE REWRITE
                        // 96:22: -> lit_logico(v=$LIT_LOGICO.text)
                        {
                            retval.st = templateLib.GetInstanceOf("lit_logico",
                          new STAttrMap().Add("v", LIT_LOGICO21.Text));
                        }

                    }
                    break;

            }
        }
        catch (RecognitionException re)
        {
            ReportError(re);
            Recover(input,re);
        }
        finally
        {
        }
        return retval;
    }
Example #2
0
    // throws RecognitionException [1]
    // $ANTLR start literal
    // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:111:1: literal : ( LIT_ENTERO | LIT_REAL | LIT_CADENA | LIT_LOGICO );
    public literal_return literal()
    {
        literal_return retval = new literal_return();
        retval.start = input.LT(1);

        FkvmAST root_0 = null;

        IToken set57 = null;

        FkvmAST set57_tree=null;

        try
        {
            // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:111:9: ( LIT_ENTERO | LIT_REAL | LIT_CADENA | LIT_LOGICO )
            // D:\\Proyectos\\ProyectosVS\\FKVM\\FKVM\\src\\antlr\\FKVM.g:
            {
                root_0 = (FkvmAST)adaptor.GetNilNode();

                set57 = (IToken)input.LT(1);
                if ( (input.LA(1) >= LIT_ENTERO && input.LA(1) <= LIT_LOGICO) )
                {
                    input.Consume();
                    adaptor.AddChild(root_0, adaptor.Create(set57));
                    errorRecovery = false;
                }
                else
                {
                    MismatchedSetException mse =
                        new MismatchedSetException(null,input);
                    RecoverFromMismatchedSet(input,mse,FOLLOW_set_in_literal0);    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;
    }