1 |
|
2 |
|
3 |
|
4 |
|
5 | import { Parser } from "./Parser";
|
6 | import { Recognizer } from "./Recognizer";
|
7 | import { RuleNode } from "./tree/RuleNode";
|
8 | import { ParseTree } from "./tree/ParseTree";
|
9 | import { Interval } from "./misc/Interval";
|
10 | import { ParseTreeVisitor } from "./tree/ParseTreeVisitor";
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | export declare class RuleContext extends RuleNode {
|
62 | _parent: RuleContext | undefined;
|
63 | invokingState: number;
|
64 | constructor();
|
65 | constructor(parent: RuleContext | undefined, invokingState: number);
|
66 | static getChildContext(parent: RuleContext, invokingState: number): RuleContext;
|
67 | depth(): number;
|
68 | /** A context is empty if there is no invoking state; meaning nobody called
|
69 | * current context.
|
70 | */
|
71 | get isEmpty(): boolean;
|
72 | get sourceInterval(): Interval;
|
73 | get ruleContext(): RuleContext;
|
74 | get parent(): RuleContext | undefined;
|
75 | /** @since 4.7. {@see ParseTree#setParent} comment */
|
76 | setParent(parent: RuleContext): void;
|
77 | get payload(): RuleContext;
|
78 | /** Return the combined text of all child nodes. This method only considers
|
79 | * tokens which have been added to the parse tree.
|
80 | *
|
81 | * Since tokens on hidden channels (e.g. whitespace or comments) are not
|
82 | * added to the parse trees, they will not appear in the output of this
|
83 | * method.
|
84 | */
|
85 | get text(): string;
|
86 | get ruleIndex(): number;
|
87 | /** For rule associated with this parse tree internal node, return
|
88 | * the outer alternative number used to match the input. Default
|
89 | * implementation does not compute nor store this alt num. Create
|
90 | * a subclass of ParserRuleContext with backing field and set
|
91 | * option contextSuperClass.
|
92 | * to set it.
|
93 | *
|
94 | * @since 4.5.3
|
95 | */
|
96 | get altNumber(): number;
|
97 | /** Set the outer alternative number for this context node. Default
|
98 | * implementation does nothing to avoid backing field overhead for
|
99 | * trees that don't need it. Create
|
100 | * a subclass of ParserRuleContext with backing field and set
|
101 | * option contextSuperClass.
|
102 | *
|
103 | * @since 4.5.3
|
104 | */
|
105 | set altNumber(altNumber: number);
|
106 | getChild(i: number): ParseTree;
|
107 | get childCount(): number;
|
108 | accept<T>(visitor: ParseTreeVisitor<T>): T;
|
109 | /** Print out a whole tree, not just a node, in LISP format
|
110 | * (root child1 .. childN). Print just a node if this is a leaf.
|
111 | * We have to know the recognizer so we can get rule names.
|
112 | */
|
113 | toStringTree(recog: Parser): string;
|
114 | /** Print out a whole tree, not just a node, in LISP format
|
115 | * (root child1 .. childN). Print just a node if this is a leaf.
|
116 | */
|
117 | toStringTree(ruleNames: string[] | undefined): string;
|
118 | toStringTree(): string;
|
119 | toString(): string;
|
120 | toString(recog: Recognizer<any, any> | undefined): string;
|
121 | toString(ruleNames: string[] | undefined): string;
|
122 | toString(recog: Recognizer<any, any> | undefined, stop: RuleContext | undefined): string;
|
123 | toString(ruleNames: string[] | undefined, stop: RuleContext | undefined): string;
|
124 | }
|