/** * AiScript interpreter */ import { AiScriptError } from '../error.js'; import { Scope } from './scope.js'; import type { Value, VFn } from './value.js'; import type * as Ast from '../node.js'; export declare class Interpreter { private opts; stepCount: number; private stop; scope: Scope; private abortHandlers; private vars; constructor(consts: Record, opts?: { in?(q: string): Promise; out?(value: Value): void; err?(e: AiScriptError): void; log?(type: string, params: Record): void; maxStep?: number; }); exec(script?: Ast.Node[]): Promise; /** * Executes AiScript Function. * When it fails, * (i)If error callback is registered via constructor, this.abort is called and the callback executed, then returns ERROR('func_failed'). * (ii)Otherwise, just throws a error. * * @remarks This is the same function as that passed to AiScript NATIVE functions as opts.topCall. */ execFn(fn: VFn, args: Value[]): Promise; /** * Executes AiScript Function. * Almost same as execFn but when error occurs this always throws and never calls callback. * * @remarks This is the same function as that passed to AiScript NATIVE functions as opts.call. */ execFnSimple(fn: VFn, args: Value[]): Promise; static collectMetadata(script?: Ast.Node[]): Map | undefined; private handleError; private log; private collectNs; private collectNsMember; private _fn; private _eval; private __eval; private _run; registerAbortHandler(handler: () => void): void; unregisterAbortHandler(handler: () => void): void; abort(): void; private assign; }