Class CodeExecutor
- Namespace
- EzrSquared.Executor
- Assembly
- ezrSquared-lib.dll
Utility to execute ezrĀ² code under one static interpreter.
public static class CodeExecutor
- Inheritance
-
objectCodeExecutor
Fields
Interpreter
The static interpreter.
public static readonly Interpreter Interpreter
Field Value
Properties
RuntimeContext
The runtime context, may be null.
public static Context? RuntimeContext { get; private set; }
Property Value
RuntimeResult
The static RuntimeResult of Interpreter.
public static RuntimeResult RuntimeResult { get; }
Property Value
Methods
AddToContext(Reference, string)
Adds the given reference to the runtime context.
public static void AddToContext(Reference reference, string name)
Parameters
reference
ReferenceThe reference to add.
name
stringThe name of the new symbol.
Exceptions
- NullReferenceException
Thrown if the runtime context is null. Use CreateRuntimeContext(string) to initialize the runtime context.
AddToContext<TMemberInfo>(EzrWrapper<TMemberInfo>, AccessMod)
Adds the given wrapped C# object to the runtime context.
public static void AddToContext<TMemberInfo>(EzrWrapper<TMemberInfo> wrapper, AccessMod accessibilityModifiers = AccessMod.Constant) where TMemberInfo : MemberInfo
Parameters
wrapper
EzrWrapper<TMemberInfo>The wrapped object to add.
accessibilityModifiers
AccessModThe accessibility modifiers for the reference. Defaults to Constant.
Type Parameters
TMemberInfo
Exceptions
- NullReferenceException
Thrown if the runtime context is null. Use CreateRuntimeContext(string) to initialize the runtime context.
CreateRuntimeContext(string)
Creates the runtime context.
public static void CreateRuntimeContext(string name)
Parameters
name
stringThe name of the context.
Execute(string)
Executes the given script.
public static ExecutionResult Execute(string script)
Parameters
script
stringThe script to execute.
Returns
Exceptions
- NullReferenceException
Thrown if the runtime context is null. Use CreateRuntimeContext(string) to initialize the runtime context.
PopulateRuntimeContext(bool)
Populates the runtime context with all built-ins.
public static void PopulateRuntimeContext(bool excludeIO = false)
Parameters
excludeIO
boolExclude built-in I/O functions like Show(string, string, List<IEzrObject>, IEzrObject, RuntimeResult, Context)?
Exceptions
- NullReferenceException
Thrown if the runtime context is null. Use CreateRuntimeContext(string) to initialize the runtime context.