1 | import SymbolTree = require("./SymbolTree");
|
2 |
|
3 | declare namespace TreeIterator {
|
4 | |
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | type IterateFunction = 1 | 2 | 3 | 4 | 5;
|
14 |
|
15 | interface TreeIteratorResult<T> {
|
16 | done: boolean;
|
17 | value: T;
|
18 | }
|
19 | }
|
20 |
|
21 | declare class TreeIterator<T extends object = any> implements IterableIterator<T> {
|
22 | constructor(tree: SymbolTree, root: T, firstResult: T, iterateFunction: TreeIterator.IterateFunction);
|
23 |
|
24 | next(): TreeIterator.TreeIteratorResult<T>;
|
25 |
|
26 | [Symbol.iterator](): this;
|
27 |
|
28 | /** Iterate previous sibling nodes. */
|
29 | static readonly PREV: 1;
|
30 |
|
31 | /** Iterate next sibling nodes. */
|
32 | static readonly NEXT: 2;
|
33 |
|
34 | /** Iterate ancestor nodes. */
|
35 | static readonly PARENT: 3;
|
36 |
|
37 | /** Iterate all tree-inclusive preceding nodes. */
|
38 | static readonly PRECEDING: 4;
|
39 |
|
40 | /** Iterate all tree-inclusive following nodes. */
|
41 | static readonly FOLLOWING: 5;
|
42 | }
|
43 |
|
44 | export = TreeIterator;
|