Table of Contents

Class CodeExecutor

Namespace
EzrSquared.Executor
Assembly
ezrSquared-lib.dll

Utility to execute ezrĀ² code under one static interpreter.

public static class CodeExecutor
Inheritance
object
CodeExecutor

Fields

Interpreter

The static interpreter.

public static readonly Interpreter Interpreter

Field Value

Interpreter

Properties

RuntimeContext

The runtime context, may be null.

public static Context? RuntimeContext { get; private set; }

Property Value

Context

RuntimeResult

The static RuntimeResult of Interpreter.

public static RuntimeResult RuntimeResult { get; }

Property Value

RuntimeResult

Methods

AddToContext(Reference, string)

Adds the given reference to the runtime context.

public static void AddToContext(Reference reference, string name)

Parameters

reference Reference

The reference to add.

name string

The 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 AccessMod

The accessibility modifiers for the reference. Defaults to Constant.

Type Parameters

TMemberInfo

See EzrWrapper<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 string

The name of the context.

Execute(string)

Executes the given script.

public static ExecutionResult Execute(string script)

Parameters

script string

The script to execute.

Returns

ExecutionResult

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 bool

Exclude 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.