@mojir/lits
Version:
Lits is a Lisp dialect implemented in TypeScript
26 lines (25 loc) • 1.18 kB
TypeScript
import type { Any } from '../interface';
import type { ContextParams } from '../Lits/Lits';
import type { NativeJsNamespace, SymbolNode, UserDefinedSymbolNode } from '../parser/types';
import type { SourceCodeInfo } from '../tokenizer/token';
import type { Context, LookUpResult } from './interface';
export type ContextStack = ContextStackImpl;
export declare class ContextStackImpl {
private contexts;
globalContext: Context;
private values?;
private nativeJsFunctions?;
constructor({ contexts, values: hostValues, nativeJsFunctions, }: {
contexts: Context[];
values?: Record<string, unknown>;
nativeJsFunctions?: NativeJsNamespace;
});
create(context: Context): ContextStack;
new(context: Context): ContextStack;
exportValues(values: Record<string, Any>, sourceCodeInfo: SourceCodeInfo | undefined): void;
addValues(values: Record<string, Any>, sourceCodeInfo: SourceCodeInfo | undefined): void;
getValue(name: string): unknown;
lookUp(node: UserDefinedSymbolNode): LookUpResult;
evaluateSymbol(node: SymbolNode): Any;
}
export declare function createContextStack(params?: ContextParams): ContextStack;