@specs-feup/lara
Version:
A js port of the popular framework for building source-to-source compilers
39 lines • 1.13 kB
TypeScript
type LaraTupleKey = string | number | symbol;
export interface LaraTupleChain extends Record<LaraTupleKey, LaraTupleChain | number> {
"!tuple_id": number;
}
/**
* Creates ids for arbitrary tuples.
*/
export default class TupleId {
private currentId;
private tupleChain;
/**
* @returns An unique id associated with the given tuple
*/
getId(...tuple: LaraTupleKey[]): number;
/**
* @returns An array where each element is an array which contains a tuple and the corresponding id
*/
getTuples(): Record<number, LaraTupleKey[]>;
private getTuplesRecursive;
private isTuple;
/**
* Creates a new tuples object.
*/
private newTuple;
private getTupleId;
private setTupleId;
/**
* @param tuples - Should always be a valid tuples object, created with _newTuples()
* @param element - The key for the next tuples object
* @returns the next tuples object, creating a new tuples if necessary.
*/
private nextTuple;
/**
* @returns the next id
*/
private nextId;
}
export {};
//# sourceMappingURL=TupleId.d.ts.map