1using System.Collections;
41 foreach (
BadObject o1
in query.Execute(ctx))
46 r = r.Dereference(query.Position);
55 return r.Unwrap<TOut>();
60 return (TOut)ro.Instance;
64 Exception($
"Error in LINQ Where: {varName} => {query} : {r.ToSafeString()} is not a {typeof(TOut).Name}");
100 public static T
First<T>(
this IEnumerable<T> enumerable,
string predicate)
142 public static T
Last<T>(
this IEnumerable<T> enumerable,
string predicate)
160 public static IEnumerable<TOut>
Select<T, TOut>(
this IEnumerable<T> enumerable,
string predicate)
186 foreach (T o
in enumerable)
188 IEnumerable e = InnerSelect<T, IEnumerable>(varName, query, o);
190 foreach (
object o1
in e)
192 if (o1 is not TOut to)
195 Exception($
"Error in LINQ SelectMany: {varName} => {query} : {o1} is not a {typeof(TOut).Name}"
211 public static IEnumerable<T>
OrderBy<T>(
this IEnumerable<T> enumerable,
string predicate)
218 return enumerable.OrderBy(o => InnerSelect<T, IComparable>(varName, query, o));
235 return enumerable.OrderByDescending(o => InnerSelect<T, IComparable>(varName, query, o));
245 public static IEnumerable<T>
SkipWhile<T>(
this IEnumerable<T> enumerable,
string predicate)
262 public static IEnumerable<T>
TakeWhile<T>(
this IEnumerable<T> enumerable,
string predicate)
279 public static bool All<T>(
this IEnumerable<T> enumerable,
string predicate)
296 public static bool Any<T>(
this IEnumerable<T> enumerable,
string predicate)
313 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.