1 |
|
2 |
|
3 |
|
4 |
|
5 | import { ATNSimulator } from "./atn/ATNSimulator";
|
6 | import { CharStream } from "./CharStream";
|
7 | import { Recognizer } from "./Recognizer";
|
8 | import { Token } from "./Token";
|
9 | import { TokenSource } from "./TokenSource";
|
10 | import { WritableToken } from "./WritableToken";
|
11 | export declare class CommonToken implements WritableToken {
|
12 | |
13 |
|
14 |
|
15 |
|
16 | protected static readonly EMPTY_SOURCE: {
|
17 | source?: TokenSource;
|
18 | stream?: CharStream;
|
19 | };
|
20 | |
21 |
|
22 |
|
23 | private _type;
|
24 | |
25 |
|
26 |
|
27 | private _line;
|
28 | |
29 |
|
30 |
|
31 |
|
32 | private _charPositionInLine;
|
33 | |
34 |
|
35 |
|
36 |
|
37 | private _channel;
|
38 | |
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 | protected source: {
|
48 | source?: TokenSource;
|
49 | stream?: CharStream;
|
50 | };
|
51 | |
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | private _text?;
|
58 | |
59 |
|
60 |
|
61 | protected index: number;
|
62 | |
63 |
|
64 |
|
65 | protected start: number;
|
66 | |
67 |
|
68 |
|
69 | private stop;
|
70 | constructor(type: number, text?: string, source?: {
|
71 | source?: TokenSource;
|
72 | stream?: CharStream;
|
73 | }, channel?: number, start?: number, stop?: number);
|
74 | /**
|
75 | * Constructs a new {@link CommonToken} as a copy of another {@link Token}.
|
76 | *
|
77 | * If `oldToken` is also a {@link CommonToken} instance, the newly
|
78 | * constructed token will share a reference to the {@link #text} field and
|
79 | * the {@link Tuple2} stored in {@link #source}. Otherwise, {@link #text} will
|
80 | * be assigned the result of calling {@link #getText}, and {@link #source}
|
81 | * will be constructed from the result of {@link Token#getTokenSource} and
|
82 | * {@link Token#getInputStream}.
|
83 | *
|
84 | * @param oldToken The token to copy.
|
85 | */
|
86 | static fromToken(oldToken: Token): CommonToken;
|
87 | get type(): number;
|
88 | set type(type: number);
|
89 | get line(): number;
|
90 | set line(line: number);
|
91 | get text(): string | undefined;
|
92 | |
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | set text(text: string | undefined);
|
102 | get charPositionInLine(): number;
|
103 | set charPositionInLine(charPositionInLine: number);
|
104 | get channel(): number;
|
105 | set channel(channel: number);
|
106 | get startIndex(): number;
|
107 | set startIndex(start: number);
|
108 | get stopIndex(): number;
|
109 | set stopIndex(stop: number);
|
110 | get tokenIndex(): number;
|
111 | set tokenIndex(index: number);
|
112 | get tokenSource(): TokenSource | undefined;
|
113 | get inputStream(): CharStream | undefined;
|
114 | toString(): string;
|
115 | toString<TSymbol, ATNInterpreter extends ATNSimulator>(recognizer: Recognizer<TSymbol, ATNInterpreter> | undefined): string;
|
116 | }
|