示例#1
0
        private Namespace ReadNamespace()
        {
            string word = ReadWord();

            if (word == "null")
            {
                return(null);
            }
            ASType kind = (ASType)Enum.Parse(typeof(ASType), word);

            Expect("(");

            string name = ReadString();
            uint   id;

            if ((Char)sr.Peek() == ',')
            {
                sr.Read();//skipchar
                string s = ReadString();
                try {
                    //id = NamespaceLabels.First(x => x.Key == s).Value;//s in namespacelabels
                    id = Parent.mostParent().NamespaceLabels[s];
                }
                catch
                {
                    id = (uint)Parent.mostParent().NamespaceLabels.Count + 1;
                    Parent.mostParent().NamespaceLabels.Add(s, id);
                }
            }
            else
            {
                id = 0;
            }
            Expect(")");

            return(new Namespace(kind, name, id));
        }
示例#2
0
        public MultinameBase ReadMultiname()
        {
            string word = ReadWord();

            if (word == "null")
            {
                return(null);
            }

            MultinameBase ret;
            ASType        kind = (ASType)Enum.Parse(typeof(ASType), word);

            Expect("(");
            switch (kind)
            {
            case ASType.QName:
            case ASType.QNameA:
                ret             = new QName();
                ((QName)ret).Ns = ReadNamespace();
                Expect(",");
                ((QName)ret).Name = ReadString();
                break;

            case ASType.RTQName:
            case ASType.RTQNameA:
                ret = new RTQName();
                ((RTQName)ret).Name = ReadString();
                break;

            case ASType.RTQNameL:
            case ASType.RTQNameLA:
                ret = new MultinameBase();
                break;

            case ASType.Multiname:
            case ASType.MultinameA:
                ret = new Multiname();
                ((Multiname)ret).Name = ReadString();
                Expect(",");
                ((Multiname)ret).NsSet = ReadNamespaceSet();
                break;

            case ASType.MultinameL:
            case ASType.MultinameLA:
                ret = new Multiname();
                ((MultinameL)ret).NsSet = ReadNamespaceSet();
                break;

            case ASType.TypeName:
                ret = new TypeName();
                ((TypeName)ret).Name   = ReadMultiname();
                ((TypeName)ret).Params = ReadList('<', '>', ReadMultiname, false);
                break;

            default:
                throw new ASParsingException("Cannot handle multiname kind: " + kind.ToString());
            }
            ret.Kind = kind;
            Expect(")");
            return(ret);
        }
示例#3
0
 public ASArgument(string name, ASType type) {
     this.Name = name;
     this.Type = type;
 }