|
export class Program { };
|
|
export class Environment { };
|
|
export class Value { };
|
|
|
|
export type Posn = {
|
|
posnLine: number,
|
|
posnColm: number
|
|
};
|
|
|
|
export type Range = [Posn, Posn];
|
|
|
|
export type CubicalT = {
|
|
exports: {
|
|
parseFromStringJs(s: string): Promise<Program>;
|
|
newEnvironment(): Promise<Environment>;
|
|
typeCheckProgram(p: Environment, e: Program): Promise<Environment>;
|
|
|
|
zonkAndShowTypeJs(val: Value): Promise<string>;
|
|
|
|
getTypeByNameJs(name: string, e: Environment): Promise<Value>;
|
|
getValueByNameJs(name: string, e: Environment): Promise<Value>;
|
|
classifyValueByNameJs(name: string, e: Environment): Promise<string>;
|
|
|
|
findDefinitionJs(name: string, e: Environment): Promise<Range | null>;
|
|
}
|
|
};
|
|
|
|
export const waitForLoad : Promise<CubicalT> = new Promise(resolve =>
|
|
document.addEventListener('cubicalLoaded', () => {
|
|
resolve((window as unknown as { cubical: CubicalT}).cubical)
|
|
}));
|