UNPKG

cm-tarnation

Version:

An alternative parser for CodeMirror 6

29 lines (28 loc) 966 B
/** * A `CompileStack` keeps track of opened nodes destined to be eventually * closed. Any number of nodes can be open, and this is how parsing * actually creates a tree with depth. */ export declare class CompileStack { ids: Uint16Array; positions: Uint32Array; children: Uint16Array; length: number; constructor(); /** Add a child to every element. */ increment(): void; /** * Add a new element. * * @param id - The node type of the token. * @param start - The start position of the token. * @param children - The number of children the token will start with. */ push(id: number, start: number, children: number): void; /** Remove and return the last element. */ pop(): number[]; /** Remove every element past the index given. */ close(idx: number): void; /** Returns the last element with the given ID. */ last(id: number): number | null; }