示例#1
0
 // Load and start the catalog
 void Start()
 {
     Logger.WriteLine(2, ">Gateway: Start");
     _catalog             = Catalog.Create();
     _catalog.LoadFlag    = true;
     _catalog.ExecuteFlag = true;
     _catalog.SetConfig(_settings);
     _catalog.Start(_database);
     _parser = PegCompiler.Create(_catalog);
 }
示例#2
0
        // Compile using selected parser
        // Code is (now) always executed as compiled unless or until there is an error
        static bool Compile(string path)
        {
            _output.WriteLine("*** Compiling: {0}", path);
            IParser parser = PegCompiler.Create(_catalog);

            //IParser parser = (!_psw) ?
            //  PegCompiler.Create(_catalog) :
            //  OldCompiler.Create(_catalog);
            using (StreamReader input = File.OpenText(path)) {
                var ret = parser.RunScript(input, Console.Out, _evaluator, path);
                _output.WriteLine("*** Compiled {0} {1} ", path, ret ? "OK"
          : parser.Aborted ? "- terminated with fatal error"
          : "with error count = " + parser.ErrorCount.ToString());
                return(parser.ErrorCount == 0);
            }
        }