Beispiel #1
0
 public static bool HasAny(this SearchExpressionType type, SearchExpressionType flags)
 {
     if (type == SearchExpressionType.Nil && flags == SearchExpressionType.Nil)
     {
         return(true);
     }
     return((type & flags) != 0);
 }
Beispiel #2
0
 internal SearchExpression(SearchExpressionType types,
                           StringView outerText, StringView innerText, StringView alias,
                           SearchExpressionEvaluator evaluator, SearchExpression[] parameters)
 {
     this.types      = types;
     this.outerText  = outerText;
     this.innerText  = innerText.valid ? innerText : outerText;
     this.alias      = alias;
     this.parameters = parameters ?? new SearchExpression[0];
     this.evaluator  = evaluator;
 }
Beispiel #3
0
        internal static SearchExpression NumberParser(StringView outerText)
        {
            var trimmedText = ParserUtils.SimplifyExpression(outerText);

            if (!Utils.TryParse(trimmedText.ToString(), out double _))
            {
                return(null);
            }

            SearchExpressionType types = SearchExpressionType.Number;

            if (trimmedText == "0" || trimmedText == "1")
            {
                types |= SearchExpressionType.Boolean;
            }
            return(new SearchExpression(types, outerText, trimmedText, ConstantEvaluator));
        }
Beispiel #4
0
 public static bool IsText(this SearchExpressionType type)
 {
     return(type.HasAny(SearchExpressionType.Literal | SearchExpressionType.Selector));
 }
Beispiel #5
0
 public static bool IsLiteral(this SearchExpressionType type)
 {
     return(type.HasAny(SearchExpressionType.Literal));
 }
Beispiel #6
0
 public static bool IsIterable(this SearchExpressionType type)
 {
     return(type.HasAny(SearchExpressionType.Iterable));
 }
 public SearchExpression(SearchExpressionType types, StringView outerText, StringView innerText, SearchExpressionEvaluator evaluator, SearchExpression[] parameters)
     : this(types, outerText, innerText, StringView.Null, evaluator, parameters)
 {
 }
 public Signature AddArgument(SearchExpressionType types, bool variadic, bool optional)
 {
     return(AddArgument(new Argument(types, variadic, optional)));
 }
Beispiel #9
0
 internal SearchExpression(SearchExpressionType types, StringView text, SearchExpressionEvaluator evaluator)
     : this(types, text, text, StringView.nil, evaluator, null)
 {
 }
Beispiel #10
0
 internal SearchExpression(SearchExpressionType types, StringView outerText, StringView innerText, StringView alias, SearchExpressionEvaluator evaluator)
     : this(types, outerText, innerText, alias, evaluator, null)
 {
 }
Beispiel #11
0
 internal SearchExpression(SearchExpressionType types, StringView outerText, StringView innerText)
     : this(types, outerText, innerText, StringView.nil, default, null)
 {
 }
Beispiel #12
0
 internal SearchExpression(SearchExpressionType types, StringView text)
     : this(types, text, StringView.nil, StringView.nil, default, null)
 {
 }
 public SearchExpression(SearchExpressionType types, StringView outerText, StringView innerText)
     : this(types, outerText, innerText, StringView.Null, default, null)
 {
 }
 public SearchExpression(SearchExpressionType types, StringView text)
     : this(types, text, StringView.Null, StringView.Null, default, null)
 {
 }
 public SearchExpression(SearchExpressionType types, StringView text, SearchExpressionEvaluator evaluator)
     : this(types, text, text, StringView.Null, evaluator, null)
 {
 }
Beispiel #16
0
 internal SearchExpression(SearchExpressionType types, StringView text, SearchExpressionEvaluator evaluator, SearchExpression[] parameters)
     : this(types, text, text, StringView.nil, evaluator, parameters)
 {
 }
 public Argument(SearchExpressionType types, bool variadic = false, bool optional = false)
 {
     this.types    = types;
     this.variadic = variadic;
     this.optional = optional || types.HasFlag(SearchExpressionType.Optional);
 }
Beispiel #18
0
 internal SearchExpression(SearchExpression ex, SearchExpressionType types, StringView outerText, StringView innerText)
     : this(types, outerText, innerText, ex.alias, ex.evaluator, ex.parameters)
 {
 }
 public Signature AddArgument(SearchExpressionType types)
 {
     return(AddArgument(types, types.HasFlag(SearchExpressionType.Variadic), types.HasFlag(SearchExpressionType.Optional)));
 }
 public SearchExpression(SearchExpressionType types, StringView outerText, StringView innerText, SearchExpressionEvaluator evaluator)
     : this(types, outerText, innerText, StringView.Null, evaluator, null)
 {
 }