Example #1
0
 static void TestParser()
 {
     for (int i = 48; i < 49; i++)
     {
         StreamReader test2 = File.OpenText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
                                                         @"C:\Users\ellia\source\repos\Compiler\Compiler\parser_tests\" + i + ".txt"));
         Lexer  lexer2 = new Lexer(test2);
         Parser parser = new Parser(lexer2);
         Node   node   = new NodeError();
         if (i < 34)
         {
             node = parser.ParseBlock();
         }
         if (i > 33)
         {
             node = parser.ParseNamespaceDeclaration();
         }
         if (node is NodeError)
         {
             Console.WriteLine("Test {0} is error", i);
         }
         //else Console.WriteLine("Test {0} works", i);
         else
         {
             Console.WriteLine("Test {0}: \n{1}", i, node);
         }
     }
 }