Ejemplo n.º 1
0
 public override void CaseATempNamespaceDecl(ATempNamespaceDecl node)
 {
     InATempNamespaceDecl(node);
     if (node.GetEndToken() != null)
     {
         node.GetEndToken().Apply(this);
     }
     {
         Object[] temp = new Object[node.GetDecl().Count];
         node.GetDecl().CopyTo(temp, 0);
         for (int i = temp.Length - 1; i >= 0; i--)
         {
             ((PDecl)temp[i]).Apply(this);
         }
     }
     {
         Object[] temp = new Object[node.GetName().Count];
         node.GetName().CopyTo(temp, 0);
         for (int i = temp.Length - 1; i >= 0; i--)
         {
             ((TIdentifier)temp[i]).Apply(this);
         }
     }
     if (node.GetToken() != null)
     {
         node.GetToken().Apply(this);
     }
     OutATempNamespaceDecl(node);
 }
Ejemplo n.º 2
0
        public override void CaseATempNamespaceDecl(ATempNamespaceDecl node)
        {
            ANamespaceDecl visitMe = null;
            Node parent = node.Parent();
            IList declList;
            if (parent is ANamespaceDecl)
                declList = ((ANamespaceDecl) parent).GetDecl();
            else
                declList = ((AASourceFile)parent).GetDecl();
            parent.RemoveChild(node);

            List<TIdentifier> identifiers = new List<TIdentifier>();
            foreach (TIdentifier identifier in node.GetName())
            {
                identifiers.Add(identifier);
            }

            foreach (TIdentifier identifier in identifiers)
            {
                TRBrace endToken = null;
                if (node.GetEndToken() != null)
                    endToken = new TRBrace("}", node.GetEndToken().Line, node.GetEndToken().Pos);
                ANamespaceDecl ns = new ANamespaceDecl(new TNamespace("namespace", node.GetToken().Line, node.GetToken().Pos), identifier, new ArrayList(), endToken);
                if (visitMe == null)
                    visitMe = ns;
                declList.Add(ns);
                declList = ns.GetDecl();
            }
            while (node.GetDecl().Count > 0)
            {
                declList.Add(node.GetDecl()[0]);
            }
            visitMe.Apply(this);
        }