static void test_scan(string path) { using (Reader file = new Reader(path)) { Scanner scanner = new Scanner(file); Attributes attrib; Console.WriteLine("scanning: {0}", path); do { attrib = scanner.scan(); //if (attrib.token != Token.ERROR) { // if (Token.NUM == attrib.token) { // Console.WriteLine("{0} {1} {3} {4}", attrib.loc.PathPoint(), Enum.GetName(attrib.token.GetType(), attrib.token), (attrib.literal==null)?(""):("= "+attrib.literal), (attrib.error == null)?(""):("warning: "+attrib.error)); // } //} else { Console.WriteLine("{0} error: {1} = {2}", attrib.loc.PathPoint(), attrib.error, attrib.literal); //} } while (attrib.token != Token.EOF); } }
public Parser(Reader reader, VectVisitor visitor, TxtLocation loc) { m_scanner = new Scanner(reader); m_visitor = visitor; m_loc = loc; }
static void compare_files(string path1, string path2) { Console.WriteLine("comparing the token stream of {0} and {1}", path1, path2); using (Reader file1 = new Reader(path1)) { using (Reader file2 = new Reader(path2)) { Scanner s1 = new Scanner(file1); Scanner s2 = new Scanner(file2); Comparer comp = new Comparer(s1, s2); comp.run(); } } Console.WriteLine(); }
public Comparer(Scanner s1, Scanner s2) { m_s1 = s1; m_s2 = s2; }