コード例 #1
0
ファイル: Parser.cs プロジェクト: thomas13335/smg
        void TypeReference(out StateType stype)
        {
            stype = null; string name;
            Identifier(out name);
            stype = SM.GetStateType(name);
            if (la.kind == 29) {
            Get();
            if(null != stype)
            throw new CompilerException(ErrorCode.TypeRedefinition,
            "type '" + name + "' is already defined.");

            stype = SM.AddSimpleType(name);
            IdList list;
            IdentifierList(out list);
            stype.AddStateNames(list);
            Expect(30);
            stype.Freeze();
            }
            if(null == stype)
            throw new CompilerException(ErrorCode.UndefinedType,
            "type '" + name + "' is undefined.");
        }