Exemple #1
0
 public AstType visit(AstArrayType n) { return n; }
Exemple #2
0
        /* throws ParseException */
        /* final */
        public static AstType astType()
        {
            ast.AstType t; AstExp e;

            jj_consume_token(AstRegExpId.kw56);
            switch ((jj_ntk == AstRegExpId.UNDEFINED) ? jj_ntk_fn() : jj_ntk)
            {
                case AstRegExpId.kwBasicType:

                    jj_consume_token(AstRegExpId.kwBasicType);
                    switch ((jj_ntk == AstRegExpId.UNDEFINED)?jj_ntk_fn():jj_ntk)
                    {
                        case AstRegExpId.kwInt:
                            jj_consume_token(AstRegExpId.kwInt);
                            t = new AstBasicType(AstBasicType.Int);
                            break;

                        case AstRegExpId.kwBool:
                            jj_consume_token(AstRegExpId.kwBool);
                            t = new AstBasicType(AstBasicType.Bool);
                            break;

                        default:
                            jj_la1[6] = jj_gen;
                            jj_consume_token(AstRegExpId.UNDEFINED);
                            throw new AstParseException();
                    }
                    break;

                case AstRegExpId.kwObjType:

                    jj_consume_token(AstRegExpId.kwObjType);
                    e = astExp();
                    t = new AstObjType((AstId)e);
                    break;

                case AstRegExpId.kwArrayType:

                    jj_consume_token(AstRegExpId.kwArrayType);
                    t = astType();
                    t = new AstArrayType(t);
                    break;

                case AstRegExpId.kwNullType:

                    jj_consume_token(AstRegExpId.kwNullType);
                    t = null;
                    break;

                default:
                    jj_la1[7] = jj_gen;
                    jj_consume_token(AstRegExpId.UNDEFINED);
                    throw new AstParseException();
            }
            jj_consume_token(AstRegExpId.kw57);
            {if (true) return t;}
            throw new Error("Missing return statement in function");
        }
Exemple #3
0
        /* throws ParseException */
        // --------------------------------------------------------------------------
        // Type  ->  BasicType ["[" "]"] | <ID>
        // --------------------------------------------------------------------------
        /* final */
        public static DemiTasse.ast.AstType Type()
        {
            DemiTasse.ast.AstType t = null;
            AstId id = null;

            switch ((jj_ntk == MpRegExpId.UNDEFINED) ? jj_ntk_fn() : jj_ntk)
            {
                case MpRegExpId.BOOLEAN:

                    t = BasicType();
                    switch ((jj_ntk == MpRegExpId.UNDEFINED) ? jj_ntk_fn() : jj_ntk)
                    {
                        case MpRegExpId.LBRACKET:
                            jj_consume_token(MpRegExpId.LBRACKET);
                            jj_consume_token(MpRegExpId.RBRACKET);
                            t = new AstArrayType( t );
                            break;
                        default:
                            jj_la1[12] = jj_gen;
                            break;
                    }
                    return t;

                case MpRegExpId.INT:

                    t = BasicType();
                    switch ((jj_ntk == MpRegExpId.UNDEFINED) ? jj_ntk_fn() : jj_ntk)
                    {
                        case MpRegExpId.LBRACKET:
                            jj_consume_token(MpRegExpId.LBRACKET);
                            jj_consume_token(MpRegExpId.RBRACKET);
                            t = new AstArrayType( t );
                            break;
                        default:
                            jj_la1[12] = jj_gen;
                            break;
                    }
                    return t;

                case MpRegExpId.ID:
                    id = Id();
                    return new AstObjType( id );

                default:
                    jj_la1[13] = jj_gen;
                    jj_consume_token(MpRegExpId.UNDEFINED);
                    throw new MiniParseException();
            }
            throw new Error("Missing return statement in function");
        }