public FormulaParser(ExcelDataProvider excelDataProvider, ParsingContext parsingContext) { parsingContext.Parser = this; parsingContext.ExcelDataProvider = excelDataProvider; parsingContext.NameValueProvider = new NameValueProvider(excelDataProvider); parsingContext.RangeAddressFactory = new RangeAddressFactory(excelDataProvider); _parsingContext = parsingContext; _excelDataProvider = excelDataProvider; Configure(configuration => { configuration .SetLexer(new Lexer(_parsingContext.Configuration.FunctionRepository, _parsingContext.NameValueProvider)) .SetGraphBuilder(new ExpressionGraphBuilder(excelDataProvider, _parsingContext)) .SetExpresionCompiler(new ExpressionCompiler()) .SetIdProvider(new IntegerIdProvider()) .FunctionRepository.LoadModule(new BuiltInFunctions()); }); try { var sw = new Stopwatch(); sw.Start(); var chain = new CalculationChain.CalculationChainBuilder(_parsingContext).Build(); foreach (var cell in chain.Cells) { var result = ParseAt(cell.Address); try { _excelDataProvider.SetCellValue(cell.Address, result); } catch { } } sw.Stop(); } catch { } }
public void Setup() { _parsingContext = ParsingContext.Create(); _excelDataProvider = MockRepository.GenerateStub<ExcelDataProvider>(); _parsingContext.ExcelDataProvider = _excelDataProvider; _builder = new CalculationChainBuilder(_parsingContext); }
public static ParsingContext Create() { var context = new ParsingContext(); context.Configuration = ParsingConfiguration.Create(); context.Scopes = new ParsingScopes(context); context.Dependencies = new FormulaDependencies(); return context; }
public void Setup() { _idProvider = new IntegerIdProvider(); _provider = MockRepository.GenerateStub<ExcelDataProvider>(); SetupExcelProvider(); _idProvider = new IntegerIdProvider(); _chainContext = CalcChainContext.Create(_idProvider); _builder = new CalcChainContextBuilder(); _parsingContext = ParsingContext.Create(); _parsingContext.RangeAddressFactory = new RangeAddressFactory(_provider); _parsingContext.Configuration.SetIdProvider(_idProvider); _parsingContext.Configuration.SetLexer(new Lexer(_parsingContext.Configuration.FunctionRepository, _parsingContext.NameValueProvider)); _parsingContext.ExcelDataProvider = _provider; }
public void Setup() { _context = ParsingContext.Create(); }
public void Setup() { _parsingContext = ParsingContext.Create(); _scope = _parsingContext.Scopes.NewScope(RangeAddress.Empty); }
public void Setup() { _parsingContext = ParsingContext.Create(); var provider = MockRepository.GenerateStub<ExcelDataProvider>(); _factory = new ExpressionFactory(provider, _parsingContext); }