1using System.Collections;
41 foreach (
BadObject o1
in query.Execute(ctx))
55 return r.Unwrap<TOut>();
60 return (TOut)ro.Instance;
64 $
"Error in LINQ Where: {varName} => {query} : {r.ToSafeString()} is not a {typeof(TOut).Name}"
99 public static T
First<T>(
this IEnumerable<T> enumerable,
string predicate)
137 public static T
Last<T>(
this IEnumerable<T> enumerable,
string predicate)
153 public static IEnumerable<TOut>
Select<T, TOut>(
this IEnumerable<T> enumerable,
string predicate)
175 foreach (T o
in enumerable)
177 IEnumerable e = InnerSelect<T, IEnumerable>(varName, query, o);
179 foreach (
object o1
in e)
181 if (o1 is not TOut to)
184 $
"Error in LINQ SelectMany: {varName} => {query} : {o1} is not a {typeof(TOut).Name}"
200 public static IEnumerable<T>
OrderBy<T>(
this IEnumerable<T> enumerable,
string predicate)
205 return enumerable.OrderBy(o => InnerSelect<T, IComparable>(varName, query, o));
220 return enumerable.OrderByDescending(o => InnerSelect<T, IComparable>(varName, query, o));
230 public static IEnumerable<T>
SkipWhile<T>(
this IEnumerable<T> enumerable,
string predicate)
245 public static IEnumerable<T>
TakeWhile<T>(
this IEnumerable<T> enumerable,
string predicate)
260 public static bool All<T>(
this IEnumerable<T> enumerable,
string predicate)
275 public static bool Any<T>(
this IEnumerable<T> enumerable,
string predicate)
290 public static IEnumerable<T>
Where<T>(
this IEnumerable<T> enumerable,
string predicate)
Base Implementation for all Expressions used inside the Script.
The Execution Context. Every execution of a script needs a context the script is running in....
BadScope Scope
The Root Scope of the Context.
BadExecutionContext Build()
Builds a new BadExecutionContext with the options provided in this Options Instance.
void DefineVariable(string name, BadObject value, BadScope? caller=null, BadPropertyInfo? info=null, BadObject[]? attributes=null)
Defines a new Variable in the current scope.
Implements a Reflected Object.
Type Type
The Type of the Reflected Object.
The Base Class for all BadScript Objects.
static bool CanWrap(object? o)
Returns true if the given object cam be wrapped.
static readonly BadObject Null
The Null Value for the BadScript Language.
Implements Common Functionality to parse Linq Queries in BadScript2.
static string string query ParsePredicate(string query)
static IEnumerable< BadExpression > Parse(string src)
Parses the given source into an IEnumerable of BadExpressions.
static bool InnerWhere(string varName, BadExpression query, object? o)
The Where Lamda Function for the Linq Extensions.
static readonly BadExecutionContextOptions PredicateContextOptions
The Predicate Context Options for the Linq Extensions.
Implements Generic LINQ Extensions.
static IEnumerable< TOut > SelectMany< T, TOut >(this IEnumerable< T > enumerable, string predicate)
Selects a property from the given enumerables elements and flattens the result.
static TOut InnerSelect< T, TOut >(string varName, BadExpression query, T o)
Select Lambda Function.
static bool Any< T >(this IEnumerable< T > enumerable, string predicate)
Returns true if any element in the enumerable matches the given predicate.
static IEnumerable< T > OrderByDescending< T >(this IEnumerable< T > enumerable, string predicate)
Orders the given enumerable by the given predicate in descending order.
static T Last< T >(this IEnumerable< T > enumerable, string predicate)
Returns the last element in the enumerable that matches the given predicate or throws an exception if...
static T First< T >(this IEnumerable< T > enumerable, string predicate)
Returns the first element in the enumerable that matches the given predicate or throws an exception i...
static IEnumerable< T > OrderBy< T >(this IEnumerable< T > enumerable, string predicate)
Orders the given enumerable by the given predicate.
static IEnumerable< TOut > Select< T, TOut >(this IEnumerable< T > enumerable, string predicate)
Selects a property from the given enumerables elements.
static IEnumerable< T > TakeWhile< T >(this IEnumerable< T > enumerable, string predicate)
Takes the elements while the given predicate is true.
static T FirstOrDefault< T >(this IEnumerable< T > enumerable, string predicate)
Returns the first element in the enumerable that matches the given predicate or the default value if ...
static IEnumerable< T > SkipWhile< T >(this IEnumerable< T > enumerable, string predicate)
Skips the elements while the given predicate is true.
static T LastOrDefault< T >(this IEnumerable< T > enumerable, string predicate)
Returns the last element in the enumerable that matches the given predicate or the default value if n...
static IEnumerable< T > Where< T >(this IEnumerable< T > enumerable, string predicate)
Filters the given enumerable by the given predicate.
static bool All< T >(this IEnumerable< T > enumerable, string predicate)
Returns true if all elements in the enumerable match the given predicate.
Contains the Expressions for the BadScript2 Language.
Contains the Classes for Reflection Objects.
Contains the Interop Abstractions and Implementations for the BadScript2 Language.
Contains the Runtime Objects.
Contains the Runtime Implementation.
Contains the Linq Implementation and Extensions.