Esempio n. 1
0
		public virtual void visit(IProgramNode value)
		{
		}
Esempio n. 2
0
 public void visit(IProgramNode value, TreeNodeCollection t)
 {
     string s = value.GetType().Name + ".";
     ICompiledTypeNode[] ctn = new ICompiledTypeNode[0];
     prepare_base_node_collection(ctn, "compiled types", "->", 0);
     prepare_node(value.main_function, s + "main_function");
     prepare_base_node_collection(value.namespaces, s + value.namespaces[0].GetType().Name + "_list   :   namespaces", "namespaces", value.namespaces.Length);
 }
Esempio n. 3
0
        public void visit(IProgramNode value)
        {
            StringBuilder bodyBlock = new StringBuilder("");
            string currNamespace = "";

            // обнуляем отступ тела блокаame
            ISemanticNodeConverter.SourceTextBuilder.TextFormatter.Indents.BlockBodyDecrement();                                                 

            if (value.main_function != null)
                value.main_function.visit(this);
            mainFunction = ISemanticNodeConverter.SourceTextBuilder.TextFormatter.Indents.BlockBody + ISemanticNodeConverter.SourceTextBuilder.GetNodeFromStack();
                        
            // перед входом в блок ув. отступ
            //SemanticNodeConverter.SourceTextBuilder.TextFormatter.Indents.BlockBodyIncrement();
            mainNamespace = value.main_function.comprehensive_namespace;
            string outdir = System.IO.Path.GetDirectoryName(mainNamespace.Location.document.file_name);
            foreach (ICommonNamespaceNode nodeNamespace in value.namespaces)
            {
                nodeNamespace.visit(this);
                bodyBlock.Append(ISemanticNodeConverter.SourceTextBuilder.TextFormatter.Indents.BlockBody);
                currNamespace = ISemanticNodeConverter.SourceTextBuilder.GetNodeFromStack();
                bodyBlock.Append(currNamespace);                                                               
                if (value.namespaces[value.namespaces.Length-1] != nodeNamespace)
                    bodyBlock.Append(System.Environment.NewLine);
                string name = nodeNamespace.namespace_name.Replace('$', 'S');
                if (name == "")
                    name = System.IO.Path.GetFileNameWithoutExtension(mainNamespace.Location.document.file_name);
                SaveTextInFile(outdir + "\\" +name+".cs", currNamespace, false);
                nmspaceFiles.Add(outdir + "\\" + name + ".cs");
            }
            //bodyBlock.Append(mainFunctionNode);
            ISemanticNodeConverter.SourceTextBuilder.AddNodeInToStack(bodyBlock.ToString());
            ISemanticNodeConverter.SourceTextBuilder.AddNodeInToStack(ISemanticNodeConverter.ConvertPABCNETNodeProgram("program", value));
        }