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