internal static SearchExpression ImplicitStringParser(SearchExpressionParserArgs args) { if (!args.HasOption(SearchExpressionParserFlags.ImplicitLiterals)) { return(null); } var text = args.text; if (text.length > 2) { if (ParserUtils.IsQuote(text[0])) { if (text[0] == text[text.length - 1]) { return(null); } } if (ParserUtils.IsOpener(text[0]) && ParserUtils.IsCloser(text[text.length - 1])) { return(null); } } return(new SearchExpression(SearchExpressionType.Text, text, text, ConstantEvaluator)); }
internal static SearchExpression ExplicitStringParser(SearchExpressionParserArgs args) { var outerText = args.text; var text = ParserUtils.SimplifyExpression(outerText); if (text.length < 2 || !ParserUtils.HasQuotes(text)) { return(null); } // Check for any string, since enclosed strings are not allowed, if we find a string token that means there are multiple strings in the text for (int i = 1; i < text.length - 2; ++i) { if (ParserUtils.IsQuote(text[i])) { return(null); } } return(new SearchExpression(SearchExpressionType.Text, outerText, text.Substring(1, text.length - 2), ConstantEvaluator)); }