diff --git a/CSharpTranslator/antlr3/src/cs2j/CLR/cs2j.cs b/CSharpTranslator/antlr3/src/cs2j/CLR/cs2j.cs index 86717c6..7274fa8 100644 --- a/CSharpTranslator/antlr3/src/cs2j/CLR/cs2j.cs +++ b/CSharpTranslator/antlr3/src/cs2j/CLR/cs2j.cs @@ -9,6 +9,7 @@ using Antlr.Runtime; using System.Xml.Serialization; using RusticiSoftware.Translator.Utils; +using RusticiSoftware.Translator.AntlrUtils; using RusticiSoftware.Translator.CLR; namespace RusticiSoftware.Translator.CSharp @@ -340,54 +341,13 @@ namespace RusticiSoftware.Translator.CSharp // Dump the tree nodes if -dumpcsharp is passed on the command line. if (dumpCSharp) { - DumpNodes(nodes); + AntlrUtils.AntlrUtils.DumpNodes(nodes); } return nodes; } - /// DumpNodes - /// The CommonTreeNodeStream has a tree in "flat form". The UP and DOWN tokens represent the branches of the - /// tree. Dump these out in tree form to the console. - /// - private static void DumpNodes(CommonTreeNodeStream nodes) - { - Console.ForegroundColor = ConsoleColor.Magenta; - Console.WriteLine("Nodes"); - int spaces = 0; - string str_spaces = " "; - object o_prev = string.Empty; - //for (int n = 0; n < nodes.Count; ++n) - object o = nodes.NextElement(); - while (!nodes.IsEndOfFile(o)) - { - //object o = nodes.Get(n); - //object o = nodes[n]; - - if (o.ToString() == "DOWN") - { - spaces += 2; - if (o_prev.ToString() != "UP" && o_prev.ToString() != "DOWN") - Console.Write("\r\n{0} {1}", str_spaces.Substring(0, spaces), o_prev); - } - else if (o.ToString() == "UP") - { - spaces -= 2; - if (o_prev.ToString() != "UP" && o_prev.ToString() != "DOWN") - Console.Write(" {0}\r\n{1}", o_prev, str_spaces.Substring(0, spaces)); - } - else if (o_prev.ToString() != "UP" && o_prev.ToString() != "DOWN") - Console.Write(" {0}", o_prev.ToString()); - - o_prev = o; - o = nodes.NextElement(); - } - if (o_prev.ToString() != "UP" && o_prev.ToString() != "DOWN") - Console.WriteLine(" {0}", o_prev.ToString()); - Console.ResetColor(); - } - // Here's where we do the real work... public static void addNetTranslation(string fullName, Stream s) {