Example #1
0
        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);
        }
Example #2
0
        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);
            }
        }