1 | import { Dict, Option, PresentArray, WireFormat } from '@glimmer/interfaces';
|
2 | import { SourceLocation } from '../source/location';
|
3 | import { SourceSpan } from '../source/span';
|
4 | export interface Symbols {
|
5 | symbols: string[];
|
6 | has(name: string): boolean;
|
7 | get(name: string): number;
|
8 | getLocalsMap(): Dict<number>;
|
9 | getEvalInfo(): WireFormat.Core.EvalInfo;
|
10 | allocateFree(name: string): number;
|
11 | allocateNamed(name: string): number;
|
12 | allocateBlock(name: string): number;
|
13 | allocate(identifier: string): number;
|
14 | child(locals: string[]): BlockSymbols;
|
15 | }
|
16 | export interface BlockSymbols extends Symbols {
|
17 | slots: number[];
|
18 | }
|
19 | export interface ProgramSymbols extends Symbols {
|
20 | freeVariables: string[];
|
21 | }
|
22 | export interface BaseNode {
|
23 | type: NodeType;
|
24 | loc: SourceSpan;
|
25 | }
|
26 | export interface CommonProgram extends BaseNode {
|
27 | body: Statement[];
|
28 | blockParams: string[];
|
29 | chained?: boolean;
|
30 | }
|
31 | export interface Program extends CommonProgram {
|
32 | type: 'Program';
|
33 | symbols?: Symbols;
|
34 | }
|
35 | export interface Block extends CommonProgram {
|
36 | type: 'Block';
|
37 | }
|
38 | export declare type EntityEncodingState = 'transformed' | 'raw';
|
39 | export interface Template extends CommonProgram {
|
40 | type: 'Template';
|
41 | }
|
42 | export declare type PossiblyDeprecatedBlock = Block | Template;
|
43 | export interface CallParts {
|
44 | path: Expression;
|
45 | params: Expression[];
|
46 | hash: Hash;
|
47 | }
|
48 | export interface Call extends BaseNode {
|
49 | name?: Expression;
|
50 | path: Expression;
|
51 | params: Expression[];
|
52 | hash: Hash;
|
53 | }
|
54 | export declare type CallNode = MustacheStatement | BlockStatement | ElementModifierStatement | SubExpression;
|
55 | export interface MustacheStatement extends BaseNode {
|
56 | type: 'MustacheStatement';
|
57 | path: Expression;
|
58 | params: Expression[];
|
59 | hash: Hash;
|
60 |
|
61 | escaped: boolean;
|
62 | trusting: boolean;
|
63 | strip: StripFlags;
|
64 | }
|
65 | export interface BlockStatement extends BaseNode {
|
66 | type: 'BlockStatement';
|
67 | path: Expression;
|
68 | params: Expression[];
|
69 | hash: Hash;
|
70 | program: Block;
|
71 | inverse?: Option<Block>;
|
72 | openStrip: StripFlags;
|
73 | inverseStrip: StripFlags;
|
74 | closeStrip: StripFlags;
|
75 | chained?: boolean;
|
76 | }
|
77 | export interface ElementModifierStatement extends BaseNode {
|
78 | type: 'ElementModifierStatement';
|
79 | path: Expression;
|
80 | params: Expression[];
|
81 | hash: Hash;
|
82 | }
|
83 | export interface PartialStatement extends BaseNode {
|
84 | type: 'PartialStatement';
|
85 | name: PathExpression | SubExpression;
|
86 | params: Expression[];
|
87 | hash: Hash;
|
88 | indent: string;
|
89 | strip: StripFlags;
|
90 | }
|
91 | export interface CommentStatement extends BaseNode {
|
92 | type: 'CommentStatement';
|
93 | value: string;
|
94 | }
|
95 | export interface MustacheCommentStatement extends BaseNode {
|
96 | type: 'MustacheCommentStatement';
|
97 | value: string;
|
98 | }
|
99 | export interface NamedBlockName {
|
100 | type: 'NamedBlockName';
|
101 | name: string;
|
102 | loc: SourceLocation;
|
103 | }
|
104 | export interface ElementName {
|
105 | type: 'ElementName';
|
106 | name: string;
|
107 | loc: SourceLocation;
|
108 | }
|
109 | export interface ElementNode extends BaseNode {
|
110 | type: 'ElementNode';
|
111 | tag: string;
|
112 | selfClosing: boolean;
|
113 | attributes: AttrNode[];
|
114 | blockParams: string[];
|
115 | modifiers: ElementModifierStatement[];
|
116 | comments: MustacheCommentStatement[];
|
117 | children: Statement[];
|
118 | }
|
119 | export declare type StatementName = 'MustacheStatement' | 'CommentStatement' | 'BlockStatement' | 'PartialStatement' | 'MustacheCommentStatement' | 'TextNode' | 'ElementNode';
|
120 | export interface AttrNode extends BaseNode {
|
121 | type: 'AttrNode';
|
122 | name: string;
|
123 | value: TextNode | MustacheStatement | ConcatStatement;
|
124 | }
|
125 | export declare type AttrValue = TextNode | MustacheStatement | ConcatStatement;
|
126 | export interface TextNode extends BaseNode {
|
127 | type: 'TextNode';
|
128 | chars: string;
|
129 | }
|
130 | export interface ConcatStatement extends BaseNode {
|
131 | type: 'ConcatStatement';
|
132 | parts: PresentArray<TextNode | MustacheStatement>;
|
133 | }
|
134 | export declare type ExpressionName = 'SubExpression' | 'PathExpression' | LiteralName;
|
135 | export interface SubExpression extends Call {
|
136 | type: 'SubExpression';
|
137 | path: Expression;
|
138 | params: Expression[];
|
139 | hash: Hash;
|
140 | }
|
141 | export interface ThisHead {
|
142 | type: 'ThisHead';
|
143 | loc: SourceLocation;
|
144 | }
|
145 | export interface AtHead {
|
146 | type: 'AtHead';
|
147 | name: string;
|
148 | loc: SourceLocation;
|
149 | }
|
150 | export interface VarHead {
|
151 | type: 'VarHead';
|
152 | name: string;
|
153 | loc: SourceLocation;
|
154 | }
|
155 | export interface FreeVarHead {
|
156 | type: 'FreeVarHead';
|
157 | name: string;
|
158 | loc: SourceLocation;
|
159 | }
|
160 | export interface LocalVarHead {
|
161 | type: 'LocalVarHead';
|
162 | name: string;
|
163 | loc: SourceLocation;
|
164 | }
|
165 | export declare type PathHead = ThisHead | AtHead | VarHead;
|
166 | export interface MinimalPathExpression extends BaseNode {
|
167 | type: 'PathExpression';
|
168 | head: PathHead;
|
169 | tail: string[];
|
170 | }
|
171 | export interface PathExpression extends MinimalPathExpression {
|
172 | type: 'PathExpression';
|
173 | original: string;
|
174 | head: PathHead;
|
175 | tail: string[];
|
176 | |
177 |
|
178 |
|
179 | parts: string[];
|
180 | |
181 |
|
182 |
|
183 | this: boolean;
|
184 | |
185 |
|
186 |
|
187 | data: boolean;
|
188 | }
|
189 | export declare type LiteralName = 'StringLiteral' | 'BooleanLiteral' | 'NumberLiteral' | 'UndefinedLiteral' | 'NullLiteral';
|
190 | export interface StringLiteral extends BaseNode {
|
191 | type: 'StringLiteral';
|
192 | value: string;
|
193 | original: string;
|
194 | }
|
195 | export interface BooleanLiteral extends BaseNode {
|
196 | type: 'BooleanLiteral';
|
197 | value: boolean;
|
198 | original: boolean;
|
199 | }
|
200 | export interface NumberLiteral extends BaseNode {
|
201 | type: 'NumberLiteral';
|
202 | value: number;
|
203 | original: number;
|
204 | }
|
205 | export interface UndefinedLiteral extends BaseNode {
|
206 | type: 'UndefinedLiteral';
|
207 | value: undefined;
|
208 | original: undefined;
|
209 | }
|
210 | export interface NullLiteral extends BaseNode {
|
211 | type: 'NullLiteral';
|
212 | value: null;
|
213 | original: null;
|
214 | }
|
215 | export interface Hash extends BaseNode {
|
216 | type: 'Hash';
|
217 | pairs: HashPair[];
|
218 | }
|
219 | export interface HashPair extends BaseNode {
|
220 | type: 'HashPair';
|
221 | key: string;
|
222 | value: Expression;
|
223 | }
|
224 | export interface StripFlags {
|
225 | open: boolean;
|
226 | close: boolean;
|
227 | }
|
228 | export declare type SharedNodes = {
|
229 | CommentStatement: CommentStatement;
|
230 | MustacheCommentStatement: MustacheCommentStatement;
|
231 | TextNode: TextNode;
|
232 | StringLiteral: StringLiteral;
|
233 | BooleanLiteral: BooleanLiteral;
|
234 | NumberLiteral: NumberLiteral;
|
235 | NullLiteral: NullLiteral;
|
236 | UndefinedLiteral: UndefinedLiteral;
|
237 | MustacheStatement: MustacheStatement;
|
238 | ElementModifierStatement: ElementModifierStatement;
|
239 | PartialStatement: PartialStatement;
|
240 | AttrNode: AttrNode;
|
241 | ConcatStatement: ConcatStatement;
|
242 | };
|
243 | export declare type Nodes = SharedNodes & {
|
244 | Program: Program;
|
245 | Template: Template;
|
246 | Block: Block;
|
247 | BlockStatement: BlockStatement;
|
248 | ElementNode: ElementNode;
|
249 | SubExpression: SubExpression;
|
250 | PathExpression: PathExpression;
|
251 | Hash: Hash;
|
252 | HashPair: HashPair;
|
253 | };
|
254 | export declare type NodeType = keyof Nodes;
|
255 | export declare type Node = Nodes[NodeType];
|
256 | export declare type Statement = Nodes[StatementName];
|
257 | export declare type Statements = Pick<Nodes, StatementName>;
|
258 | export declare type Literal = Nodes[LiteralName];
|
259 | export declare type Expression = Nodes[ExpressionName];
|
260 | export declare type Expressions = Pick<Nodes, ExpressionName>;
|
261 | export declare type TopLevelStatement = Statement | Nodes['Block'];
|
262 |
|
\ | No newline at end of file |