static void compare_logs(string path) { Console.WriteLine("comparing the visitation logs for the parser and dynamic visitor for file {0}", path); Log log1 = new Log(); using (Reader file = new Reader(path)) { Util.TxtLocation loc = new Util.TxtLocation(path); VectorLogger logger = new VectorLogger(log1, loc, new SafeVectorVisitor(null)); Parser p = new Parser(file, logger, loc); p.SafeRead(); } Log log2 = new Log(); using (Reader file = new Reader(path)) { VectBox top = new VectBox(); VectBuilder builder = new VectBuilder(top); Parser p = new Parser(file, builder); Util.TxtLocation loc = new Util.TxtLocation(path); p.SafeRead(); VectorLogger logger = new VectorLogger(log2, loc, new SafeVectorVisitor(null)); if (top.value != null) DynamicVisitor.accept(top.value, logger); } LogComparer.compare_logs(log1, log2); Console.WriteLine(); }
static object[] build(string path) { using (Reader file = new Reader(path)) { VectBox top = new VectBox(); VectBuilder visitor = new VectBuilder(top); Parser parser = new Parser(file, visitor); Console.WriteLine("parsing: {0}", path); Console.WriteLine(parser.SafeRead() ? "OK" : "FAILED"); //Console.WriteLine("{0} error{1}", parser.errors, parser.errors!=1?"s":""); //Console.WriteLine(parser.errors == 0 ? "OK" : "FAILED!"); return top.value; } }