Ejemplo n.º 1
0
 public static bool HasAny(this SearchExpressionType type, SearchExpressionType flags)
 {
     if (type == SearchExpressionType.Nil && flags == SearchExpressionType.Nil)
     {
         return(true);
     }
     return((type & flags) != 0);
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 4
0
 public static bool IsText(this SearchExpressionType type)
 {
     return(type.HasAny(SearchExpressionType.Literal | SearchExpressionType.Selector));
 }
Ejemplo n.º 5
0
 public static bool IsLiteral(this SearchExpressionType type)
 {
     return(type.HasAny(SearchExpressionType.Literal));
 }
Ejemplo n.º 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)));
 }
Ejemplo n.º 9
0
 internal SearchExpression(SearchExpressionType types, StringView text, SearchExpressionEvaluator evaluator)
     : this(types, text, text, StringView.nil, evaluator, null)
 {
 }
Ejemplo n.º 10
0
 internal SearchExpression(SearchExpressionType types, StringView outerText, StringView innerText, StringView alias, SearchExpressionEvaluator evaluator)
     : this(types, outerText, innerText, alias, evaluator, null)
 {
 }
Ejemplo n.º 11
0
 internal SearchExpression(SearchExpressionType types, StringView outerText, StringView innerText)
     : this(types, outerText, innerText, StringView.nil, default, null)
 {
 }
Ejemplo n.º 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)
 {
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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)
 {
 }