static object GenerateParseGraph(string text) { var errorReporter = new Mock <IErrorReporter>(MockBehavior.Strict); var parser = new ConfigParser(errorReporter.Object); var config = parser.Parse(new ConfigScanner(text)); SyntaxTreeDecorator.Decorate(config, errorReporter.Object); var parse = ParseGraph.ConstructGraph(config); return(parse.Graph); }
public bool Load(TextReader reader, IErrorReporter reporter, ICodeGeneratorEnv environment) { var wrapper = new ReporterWrapper(reporter); _loadStart = null; _parseDone = null; _calculationDone = null; _tableDone = null; _loadStart = DateTime.Now; var parser = new ConfigParser(wrapper); var config = parser.Parse(new ConfigScanner(reader.ReadToEnd())); _parseDone = DateTime.Now; if (wrapper.HasError) { _config = null; return(false); } SyntaxTreeDecorator.Decorate(config, wrapper); _calculationDone = DateTime.Now; if (wrapper.HasError) { _config = null; return(false); } _data = TableGenerator.GenerateTables(config); _tableDone = DateTime.Now; if (!config.Manager.SuppressTableEmbedding) { config.TableResourceName = environment.GetResourceName(ParserTableFile.Suffix); } _config = config; return(true); }
public bool Load(TextReader reader, IErrorReporter reporter, ICodeGeneratorEnv environment) { var wrapper = new ReporterWrapper(reporter); _loadStart = null; _parseDone = null; _calculationDone = null; _writeStart = null; _writeDone = null; _loadStart = DateTime.Now; var parser = new ConfigParser(wrapper); var config = parser.Parse(new ConfigScanner(reader.ReadToEnd())); _parseDone = DateTime.Now; if (wrapper.HasError) { return(false); } config.TableResourceNameFormat = environment.GetResourceName(".{0}.table"); SyntaxTreeDecorator.Decorate(config, wrapper); _calculationDone = DateTime.Now; if (wrapper.HasError) { _config = null; return(false); } else { _config = config; return(true); } }