Type used to characterize an expression. An expression might have multiple types. For example a Set is also an iterable. A keyword is also considered a string value. SearchExpressionType can be used with SearchExpressionEvaluatorAttribute to describe the parameter list of an evaluator.
[SearchExpressionEvaluator(SearchExpressionType.Iterable | SearchExpressionType.Variadic)] [SearchExpressionEvaluatorSignatureOverload(SearchExpressionType.Number, SearchExpressionType.Iterable | SearchExpressionType.Variadic)] [Description("Extract and returns the X first results for each expression.")] public static IEnumerable<SearchItem> TakeXFirst(SearchExpressionContext c) { var argIndex = 0; var takeNumber = 1; if (c.args[0].types.HasFlag(SearchExpressionType.Number)) { ++argIndex; takeNumber = Math.Max((int)(c.args[0].GetNumberValue(takeNumber)), 0); } for ( ; argIndex < c.args.Length; ++argIndex) { var iterable = c.args[argIndex].Execute(c); var taken = 0; foreach (var item in iterable) { if (item == null) yield return null; else { yield return item; ++taken; if (taken == takeNumber) { c.Break(); break; } } } } }
Nil | Denote an invalid Expression. |
Optional | Used in SearchExpressionEvaluatorAttribute to specify a aprameter to be Optional. |
Variadic | Used in SearchExpressionEvaluatorAttribute to specify that a parameter can be used multiples times. For example count{Iterable1, Iterable2,... IterableN} can be executed with any number of iterables are parameters. |
Boolean | Denote a Literal expression of a boolean value. |
Number | Denote a Literal expression of a numerical value. |
Text | Denote an expression representing a textual (string) value. |
Selector | Denote an expression representing a selector. All selector starts with @. For example @size in expression: select{t:material, @size}. |
Keyword | Denote an expression yielding a SearchExpressionKeyword. |
Set | Denote an iterable expression of a group of generally literal values. For example [1, 2, 3] or [material, shader, texture2d]. |
Function | Denotes an expression of an evaluator function. For example: count{}. |
QueryString | Denote an expression representing a query string. For example: t:shader. |
Expandable | Denotes an expression using the ... operator to tell it can be expanded. |
Group | Denote an expression of a group of items. Groups are generated by the groupBy{} evaluator. |
Literal | Denote an expression built from a literal values: boolean, number, text or keyword. For example in the set expression [1,"hello",true] all set values are literals. |
Iterable | Denote an expression that can iterated to yield SearchItem. Set: [1, 2, 3], Query String: t:shader and evaluator: count{} are all example of iterables. |
AnyValue | Denote an expression with a value type: either Literal or Iterable. |
AnyExpression | Denote any expression of any type (Literal, Iterable or Selector). |