Exemplo n.º 1
0
        public void Compile(string path)
        {
            input = new CPreProcessor(path);
              foreach (string idir in IncludeDirs)
            input.AddIncludeDir(idir);

              foreach (string macro in Macros)
            input.Define(null, macro.Replace('=', ' '));

              if (this.DoCompile)
            Read();
              else if (this.DoPreProcess) {
            Token token;
            for (; ; ) {
              token = input.ReadToken();
              if (token == null)
            break;
              Console.Write(token.Litteral + " ");
            }

              } else
            throw new Exception();
        }
Exemplo n.º 2
0
Arquivo: Program.cs Projeto: AxFab/amy
        static void ExtractPreProcessorFromFile(string path)
        {
            int line = 0;
              //try
              //{
              CPreProcessor fr = new CPreProcessor(path);
              while (true) {
            Token tk = fr.ReadToken();
            if (tk == null)
              break;
            TokenType type = (TokenType)tk.Type;

            if (tk.Start.Row != line) {
              Console.WriteLine();
              line = tk.Start.Row;
            }

            Console.Write(tk.Litteral + " ");
            // Console.WriteLine("- {0} '{1}'", type, t.Litteral);
              }

              //}
              //catch (Exception e)
              //{
              //    Console.ForegroundColor = ConsoleColor.Red;
              //    Console.Error.WriteLine(e);
              //    Console.ForegroundColor = ConsoleColor.Gray;
              //}
        }