/// <summary> /// 构造方法 /// </summary> /// <param name="dictionaryInfo"></param> /// <param name="callerContext"></param> internal ExpressionDictionaryCalculatorContext(ExpressionDictionary dictionaryInfo, object callerContext) { dictionaryInfo.NullCheck("dictionaryInfo"); this.DictionaryInfo = dictionaryInfo; this.CallerContext = callerContext; }
/// <summary> /// Default constructor, creates an ExpressionParser object /// </summary> public ExpressionParser() { // Cache for values and expressions Values = new ValuesDictionary(); Expressions = new ExpressionDictionary(); // Add all valid operators. DefaultOperators operators = new(); ops = new Dictionary <string, Operator>(); foreach (Operator op in operators.Operators) { string symbol = op.Symbol; if (symbol.Length > maxoplength) { maxoplength = symbol.Length; } ops.Add(symbol, op); } // Constants spconst = new Dictionary <string, double>(); spconst.Add("euler", Math.E); spconst.Add("pi", Math.PI); spconst.Add("nan", double.NaN); spconst.Add("infinity", double.PositiveInfinity); spconst.Add("true", 1D); spconst.Add("false", 0D); treeParser = new TreeParser(ops, spconst) { ImplicitMultiplication = true, RequireParentheses = true }; Culture = CultureInfo.InvariantCulture; }
/// <summary> /// Default constructor, creates an ExpressionParser object /// </summary> public ExpressionParser() { // Cache for values and expressions htbl = new ValuesDictionary(); cachedExpressions = new ExpressionDictionary(); // Add all valid operators. DefaultOperators operators = new DefaultOperators(); ops = new Dictionary<string, Operator>(); foreach (Operator op in operators.Operators) { string symbol = op.Symbol; if(symbol.Length > maxoplength) { maxoplength = symbol.Length; } ops.Add(symbol, op); } // Constants spconst = new Dictionary<string, double>(); spconst.Add( "euler", Math.E ); spconst.Add( "pi" , Math.PI ); spconst.Add( "nan" , double.NaN ); spconst.Add( "infinity" , double.PositiveInfinity ); spconst.Add( "true" , 1D ); spconst.Add( "false", 0D ); treeParser = new TreeParser(ops, spconst); treeParser.ImplicitMultiplication = true; treeParser.RequireParentheses = true; Culture = CultureInfo.InvariantCulture; }
public void Setup() { _dictionary = new ExpressionDictionary(); }
public DictionaryToObjectMappingBuilder() { _mappingDictionary = new ExpressionDictionary <object, object, TResult>(); }
/// <summary> /// Construct a new Lexical Scanner with some input. /// </summary> /// <param name="input">Input string</param> public LexicalScanner(string input) { _input = input; _dictionary = new ExpressionDictionary(); }
public NumberToFlagMappingBuilder() { _mappingDictionary = new ExpressionDictionary <int, bool, TResult>(); }
public Tokenizer(ExpressionDictionary dictionary, string input) { _dictionary = dictionary; _input = input; }