/// <summary> /// Build the abstract syntax tree for a given formula. The formula string will /// be first tokenized. /// </summary> /// <param name="formulaText">A string containing the mathematical formula that must be converted /// into an abstract syntax tree.</param> /// <returns>The abstract syntax tree of the formula.</returns> private Operation BuildAbstractSyntaxTree(string formulaText, ConstantRegistry compiledConstants) { TokenReader tokenReader = new TokenReader(cultureInfo); List <Token> tokens = tokenReader.Read(formulaText); AstBuilder astBuilder = new AstBuilder(FunctionRegistry, caseSensitive, compiledConstants); Operation operation = astBuilder.Build(tokens); if (optimizerEnabled) { return(optimizer.Optimize(operation, this.FunctionRegistry, this.ConstantRegistry)); } else { return(operation); } }
/// <summary> /// Build the abstract syntax tree for a given formula. The formula string will /// be first tokenized. /// </summary> /// <param name="formulaText">A string containing the mathematical formula that must be converted /// into an abstract syntax tree.</param> /// <returns>The abstract syntax tree of the formula.</returns> private Operation BuildAbstractSyntaxTree(string formulaText) { TokenReader tokenReader = new TokenReader(cultureInfo); List <Token> tokens = tokenReader.Read(formulaText); AstBuilder astBuilder = new AstBuilder(FunctionRegistry, adjustVariableCaseEnabled); Operation operation = astBuilder.Build(tokens); if (optimizerEnabled) { return(optimizer.Optimize(operation, this.FunctionRegistry)); } else { return(operation); } }
/// <summary> /// Build the abstract syntax tree for a given formula. The formula string will /// be first tokenized. /// </summary> /// <param name="formulaText">A string containing the mathematical formula that must be converted /// into an abstract syntax tree.</param> /// <returns>The abstract syntax tree of the formula.</returns> private Operation BuildAbstractSyntaxTree(string formulaText) { TokenReader tokenReader = new TokenReader(cultureInfo); List<Token> tokens = tokenReader.Read(formulaText); AstBuilder astBuilder = new AstBuilder(FunctionRegistry); Operation operation = astBuilder.Build(tokens); if (optimizerEnabled) return optimizer.Optimize(operation, this.FunctionRegistry); else return operation; }