@mojir/lits
Version:
Lits is a Lisp dialect implemented in TypeScript
28 lines (27 loc) • 1.31 kB
TypeScript
import type { Any } from '../interface';
import type { ContextParams, LazyValue } from '../Lits/Lits';
import type { NativeJsFunction, 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 lazyValues?;
private nativeJsFunctions?;
constructor({ contexts, values: hostValues, lazyValues: lazyHostValues, nativeJsFunctions, }: {
contexts: Context[];
values?: Record<string, unknown>;
lazyValues?: Record<string, LazyValue>;
nativeJsFunctions?: Record<string, NativeJsFunction>;
});
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;