public ProcessStateVisualization(ProcessSystem ast, BaseFormatter formatter)
 {
     _ast = ast;
     _formatter = formatter;
     foreach (ProcessDefinition pd in _ast.ChildNodes) {
         _procConstants.Add(pd.Name, pd.Process);
     }
 }
コード例 #2
0
 private static void CheckPrintout(CompileOptions options, ProcessSystem system)
 {
     //Check whether we want to print out a formatted version of the source
     if (options["p"] != "") {
         string format = options["p"];
         BaseFormatter formatter = null;
         if (format.ToLower() == "html") {
             formatter = new BaseFormatter();
         } else if (format.ToLower() == "latex" || format.ToLower() == "tex") {
             format = "tex";
             formatter = new LaTeXFormatter();
         } else if (format.ToLower() == "txt" || format.ToLower() == "ccs") {
             format = "formatted_ccs"; //So we don't overwrite the original file...
             formatter = new BaseFormatter();
         } else {
             DieIf(true, "Format for /print options must be one of ccs,html,latex");
         }
         formatter.Start(system);
         string result = formatter.GetFormatted();
         string filename = Path.ChangeExtension(options.OutputFile, format);
         File.WriteAllText(filename, result);
         Console.WriteLine("Formatted source written to {0}", filename);
     }
 }