@palasimi/ipa-cluster
Version:
Cluster words with similar IPA transcriptions together
28 lines • 856 B
TypeScript
/**
* Exception thrown by `Scope` when trying to resolve an undefined variable.
*/
export declare class NameError extends Error {
constructor(message: string);
}
/**
* Represents a scope of variable definitions.
*/
export declare class Scope<T> {
names: Map<string, T>;
outer: Scope<T> | null;
constructor(outer?: Scope<T> | null);
/**
* Defines a variable in the present scope.
* Redefining a variable name is an error.
* Masking variables defined in outer scopes is not an error.
* Returns `true` if there are no errors.
*/
define(name: string, value: T): boolean;
/**
* Tries to resolve a variable name.
* Throws a `NameError` if the variable is not defined.
* Returns the value assigned to the variable.
*/
resolve(name: string): T;
}
//# sourceMappingURL=scopes.d.ts.map