private IFormulaComponent[] CreateComponents(ParseTreeElement rootElement) { IList list = new ArrayList(); rootElement.AddAsRPN(list); var arr = new IFormulaComponent[list.Count]; list.CopyTo(arr, 0); return(arr); }
internal Formula(FormulaEngine owner, string expression) { Engine = owner; // By default, we evaluate to a primitive ResultType = OperandType.Primitive; // Get our analyzer, have it parse the expression, and get all our information from it var analyzer = (CustomFormulaAnalyzer)Engine.Parser.Analyzer; ParseTreeElement rootElement = Parse(expression); ReferenceParseInfo[] infos = analyzer.ReferenceInfos; ProcessParseInfos(infos); Template = CreateTemplateString(expression, infos); analyzer.ResetReferences(); _components = CreateComponents(rootElement); ValidateComponents(); ComputeRawReferenceHashCodes(); ComputeDependencyReferences(); }
public ParseTreeElement(ParseTreeElement.EnumType type) { this.type = type; }