public static bool TryParse( string expression, bool caseSensitive, out ExpressionNode expressionNode) { return(ExpressionParser.TryParse(expression, false, out expressionNode)); }
public static bool TryParse(string expression, bool caseSensitiveLike, out ExpressionNode expressionNode) { expressionNode = null; string s = ("" + expression).Trim(); if (s.StartsWith("=")) { s = s.Substring(1); } int expressionHash = s.GetHashCode() ^ caseSensitiveLike.GetHashCode(); if (expressionHive.ContainsKey(expressionHash)) { expressionNode = expressionHive[expressionHash]; return(true); } if (String.IsNullOrEmpty(s)) { return(false); } using (ExpressionParser parser = new ExpressionParser(s, caseSensitiveLike)) { if (!parser.TryParse(false, out expressionNode)) { return(false); } } expressionHive[expressionHash] = expressionNode; return(true); }
public static bool TryParse( string expression, bool caseSensitiveLike, out ExpressionNode expressionNode) { expressionNode = (ExpressionNode)null; string text = (expression ?? "").Trim(); if (text.StartsWith("=")) { text = text.Substring(1); } int key = text.GetHashCode() ^ caseSensitiveLike.GetHashCode(); if (ExpressionParser.expressionHive.ContainsKey(key)) { expressionNode = ExpressionParser.expressionHive[key]; return(true); } if (string.IsNullOrEmpty(text)) { return(false); } using (ExpressionParser expressionParser = new ExpressionParser(text, caseSensitiveLike)) { if (!expressionParser.TryParse(false, out expressionNode)) { return(false); } } ExpressionParser.expressionHive[key] = expressionNode; return(true); }