Exemple #1
0
        private void ParseNamespace(XmlElement ns)
        {
            ns_name = ns.GetAttribute("name");

            foreach (XmlNode def in ns.ChildNodes)
            {
                if (def.NodeType != XmlNodeType.Element)
                {
                    continue;
                }

                XmlElement elem = (XmlElement)def;

                switch (def.Name)
                {
                case "type":
                    string aname = elem.GetAttribute("aname");
                    string atype = elem.GetAttribute("atype");
                    if ((aname == "") || (atype == ""))
                    {
                        continue;
                    }
                    SymbolTable.AddAlias(aname, atype);
                    break;

                case "func":
                    SymbolTable.AddType(new FuncGen(ns_name, elem));
                    break;

                case "const":
                    SymbolTable.AddType(new ConstGen(ns_name, elem));
                    break;

                default:
                    Console.WriteLine("Unexpected node named " + def.Name);
                    break;
                }
            }
        }