import type { BaseObject } from "../objects/baseObject.js"; import { BooleanObject } from "../objects/booleanObject.js"; import { FullObject } from "../objects/fullObject.js"; import { NullObject } from "../objects/nullObject.js"; import { NumberObject } from "../objects/numberObject.js"; import { StringObject } from "../objects/stringObject.js"; import type { WrapperObjectFieldRetriever } from "../objects/wrapperObject.js"; import { WrapperObject } from "../objects/wrapperObject.js"; /** * Default InterpreterContext requiering only the maxExecutionSteps */ export declare class InterpreterContext { readonly maxExecutionSteps: number; /** * Singleton considered "null" */ readonly null: NullObject; /** * Prototype for all created table objects */ readonly objectPrototype: FullObject; /** * Prototype for number objects */ readonly numberPrototype: FullObject; /** * Prototype for string objects */ readonly stringPrototype: FullObject; /** * Prototype for all boolean objects */ readonly booleanPrototype: FullObject; /** * Prototype for all created DSL functions, including native functions */ readonly functionPrototype: FullObject; /** * Prototype for all created wrapper objects */ readonly wrapperPrototype: FullObject; /** * The current amount of execution steps. * Should never get larger than maxExecutionSteps. * Each action which can lead to infinite loops should (e.g. jumps) should increase this counter */ currentExecutionSteps: number; /** * Current execution scope. * Code modifying this is responsible for recreating the correct scope afterwards. * No automatic management is performed. */ currentScope: FullObject; /** * Map to store module specific values by module */ private readonly moduleValues; /** * Initial global execution scope */ private readonly globalScope; /** * Creates a new DefaultInterpreterContext * * @param maxExecutionSteps The maximum amount of execution steps */ constructor(maxExecutionSteps: number, modules: string[]); /** * Sets a module specific value, ensures that the module actually exists * * @param module the name of the module * @param key the name of the field to access * @param value the new value stored under key */ setModuleValue(module: string, key: string, value: any): void; /** * Gets a module specific value, ensures that the module actually exists * * @param module the name of the module * @param key the name of the field to access * @returns the stored value */ getModuleValue(module: string, key: string): any; /** * Gets the module specific map of values, throws an Error if no map was found * * @param module the name of the module * @returns the found value */ private getModuleMap; /** * Creates a new StringObject with the provided value * * @param value the value of the string * @returns the created object */ newString(value: string): StringObject; /** * Creates a new NumberObject with the provided value * * @param value the value of the number * @returns the created object */ newNumber(value: number): NumberObject; /** * Creates a new BooleanObject with the provided value * * @param value the value of the boolean * @returns the created object */ newBoolean(value: boolean): BooleanObject; /** * Creates a new FullObject with the correct proto from the context * * @returns the created empty FullObject */ newObject(): FullObject; /** * Creates a new WrapperObject with the provided wrapped object and entries * * @param wrapped the wrapped object * @param entries entries function which compute the value of the fields * @returns the created WrapperObject */ newWrapperObject(wrapped: T, entries: Map>): WrapperObject; /** * Creates a new WrapperObject for a list with the provided wrapped object and entries * * @param wrapped the wrapped objects * @param converter the converter to convert the wrapped object to a WrapperObject * @returns the created WrapperObject */ newListWrapperObject(wrapped: T[], converter: WrapperObjectFieldRetriever): WrapperObject; /** * Creates the getter function for a list wrapper object * * @param converter the converter to convert the wrapped object to a WrapperObject * @param wrapped the wrapped objects * @returns the created getter function */ private createListWrapperGetterFunction; /** * Gets a field on the global scope * * @param key identifier of the field * @returns the value of the field */ getGlobalField(key: string | number): BaseObject; /** * Gets a field on the current scope * * @param key identifier of the field * @returns the value of the field */ getField(key: string | number): BaseObject; /** * Increases the step counter, and throws an error if the counter is bigger than the max allowed value */ nextStep(): void; } //# sourceMappingURL=interpreterContext.d.ts.map