UNPKG

clarity-pattern-parser

Version:

Parsing Library for Typescript and Javascript.

63 lines (62 loc) 2.27 kB
export interface CycleFreeNode { id: string; type: string; name: string; startIndex: number; endIndex: number; value: string; children: CycleFreeNode[]; } export declare class Node { private _id; private _type; private _name; private _firstIndex; private _lastIndex; private _parent; private _children; private _value; get id(): string; get type(): string; get name(): string; get value(): string; get firstIndex(): number; get lastIndex(): number; get startIndex(): number; get endIndex(): number; get parent(): Node | null; get children(): readonly Node[]; get hasChildren(): boolean; get isLeaf(): boolean; constructor(type: string, name: string, firstIndex: number, lastIndex: number, children?: Node[], value?: string); removeChild(node: Node): void; findChildIndex(node: Node): number; spliceChildren(index: number, deleteCount: number, ...items: Node[]): Node[]; removeAllChildren(): void; replaceChild(newNode: Node, referenceNode: Node): void; replaceWith(newNode: Node): void; insertBefore(newNode: Node, referenceNode: Node | null): void; appendChild(newNode: Node): void; append(...nodes: Node[]): void; nextSibling(): Node | null; previousSibling(): Node | null; find(predicate: (node: Node) => boolean, breadthFirst?: boolean): Node | null; findAll(predicate: (node: Node) => boolean, breadthFirst?: boolean): Node[]; findRoot(): Node; findAncestor(predicate: (node: Node) => boolean): Node | null; walkUp(callback: (node: Node) => boolean | void): boolean; walkDown(callback: (node: Node) => boolean | void): boolean; walkBreadthFirst(callback: (node: Node) => boolean | void): boolean; transform(visitors: Record<string, (node: Node) => Node>): Node; flatten(): Node[]; compact(): void; remove(): void; clone(): Node; normalize(startIndex?: number): number; toString(): string; toCycleFreeObject(): CycleFreeNode; toJson(space?: number): string; isEqual(node: Node): boolean; static createValueNode(type: string, name: string, value?: string): Node; static createNode(type: string, name: string, children?: Node[]): Node; }