1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import * as ASTv1 from './api';
|
9 | export interface CommonNode {
|
10 | loc: SourceLocation;
|
11 | }
|
12 | export interface NodeMap {
|
13 | Program: {
|
14 | input: Program;
|
15 | output: ASTv1.Template | ASTv1.Block;
|
16 | };
|
17 | MustacheStatement: {
|
18 | input: MustacheStatement;
|
19 | output: ASTv1.MustacheStatement | void;
|
20 | };
|
21 | Decorator: {
|
22 | input: Decorator;
|
23 | output: never;
|
24 | };
|
25 | BlockStatement: {
|
26 | input: BlockStatement;
|
27 | output: ASTv1.BlockStatement | void;
|
28 | };
|
29 | DecoratorBlock: {
|
30 | input: DecoratorBlock;
|
31 | output: never;
|
32 | };
|
33 | PartialStatement: {
|
34 | input: PartialStatement;
|
35 | output: never;
|
36 | };
|
37 | PartialBlockStatement: {
|
38 | input: PartialBlockStatement;
|
39 | output: never;
|
40 | };
|
41 | ContentStatement: {
|
42 | input: ContentStatement;
|
43 | output: void;
|
44 | };
|
45 | CommentStatement: {
|
46 | input: CommentStatement;
|
47 | output: ASTv1.MustacheCommentStatement | null;
|
48 | };
|
49 | SubExpression: {
|
50 | input: SubExpression;
|
51 | output: ASTv1.SubExpression;
|
52 | };
|
53 | PathExpression: {
|
54 | input: PathExpression;
|
55 | output: ASTv1.PathExpression;
|
56 | };
|
57 | StringLiteral: {
|
58 | input: StringLiteral;
|
59 | output: ASTv1.StringLiteral;
|
60 | };
|
61 | BooleanLiteral: {
|
62 | input: BooleanLiteral;
|
63 | output: ASTv1.BooleanLiteral;
|
64 | };
|
65 | NumberLiteral: {
|
66 | input: NumberLiteral;
|
67 | output: ASTv1.NumberLiteral;
|
68 | };
|
69 | UndefinedLiteral: {
|
70 | input: UndefinedLiteral;
|
71 | output: ASTv1.UndefinedLiteral;
|
72 | };
|
73 | NullLiteral: {
|
74 | input: NullLiteral;
|
75 | output: ASTv1.NullLiteral;
|
76 | };
|
77 | }
|
78 | export declare type NodeType = keyof NodeMap;
|
79 | export declare type Node<T extends NodeType = NodeType> = NodeMap[T]['input'];
|
80 | export declare type Output<T extends NodeType> = NodeMap[T]['output'];
|
81 | export interface SourceLocation {
|
82 | source: string;
|
83 | start: Position;
|
84 | end: Position;
|
85 | }
|
86 | export interface Position {
|
87 | line: number;
|
88 | column: number;
|
89 | }
|
90 | export interface Program extends CommonNode {
|
91 | type: 'Program';
|
92 | body: Statement[];
|
93 | blockParams: string[];
|
94 | chained?: boolean;
|
95 | }
|
96 | export declare type Statement = MustacheStatement | BlockStatement | DecoratorBlock | PartialStatement | PartialBlockStatement | ContentStatement | CommentStatement;
|
97 | export interface CommonMustache extends CommonNode {
|
98 | path: Expression;
|
99 | params: Expression[];
|
100 | hash: Hash;
|
101 | escaped: boolean;
|
102 | strip: StripFlags;
|
103 | }
|
104 | export interface MustacheStatement extends CommonMustache {
|
105 | type: 'MustacheStatement';
|
106 | }
|
107 | export interface Decorator extends CommonMustache {
|
108 | type: 'DecoratorStatement';
|
109 | }
|
110 | export interface CommonBlock extends CommonNode {
|
111 | chained: boolean;
|
112 | path: PathExpression | SubExpression;
|
113 | params: Expression[];
|
114 | hash: Hash;
|
115 | program: Program;
|
116 | inverse: Program;
|
117 | openStrip: StripFlags;
|
118 | inverseStrip: StripFlags;
|
119 | closeStrip: StripFlags;
|
120 | }
|
121 | export interface BlockStatement extends CommonBlock {
|
122 | type: 'BlockStatement';
|
123 | }
|
124 | export interface DecoratorBlock extends CommonBlock {
|
125 | type: 'DecoratorBlock';
|
126 | }
|
127 | export interface PartialStatement extends CommonNode {
|
128 | type: 'PartialStatement';
|
129 | name: PathExpression | SubExpression;
|
130 | params: Expression[];
|
131 | hash: Hash;
|
132 | indent: string;
|
133 | strip: StripFlags;
|
134 | }
|
135 | export interface PartialBlockStatement extends CommonNode {
|
136 | type: 'PartialBlockStatement';
|
137 | name: PathExpression | SubExpression;
|
138 | params: Expression[];
|
139 | hash: Hash;
|
140 | program: Program;
|
141 | openStrip: StripFlags;
|
142 | closeStrip: StripFlags;
|
143 | }
|
144 | export interface ContentStatement extends CommonNode {
|
145 | type: 'ContentStatement';
|
146 | value: string;
|
147 | original: StripFlags;
|
148 | }
|
149 | export interface CommentStatement extends CommonNode {
|
150 | type: 'CommentStatement';
|
151 | value: string;
|
152 | strip: StripFlags;
|
153 | }
|
154 | export declare type Expression = SubExpression | PathExpression | Literal;
|
155 | export interface SubExpression extends CommonNode {
|
156 | type: 'SubExpression';
|
157 | path: PathExpression | SubExpression;
|
158 | params: Expression[];
|
159 | hash: Hash;
|
160 | }
|
161 | export interface PathExpression extends CommonNode {
|
162 | type: 'PathExpression';
|
163 | data: boolean;
|
164 | depth: number;
|
165 | parts: string[];
|
166 | original: string;
|
167 | }
|
168 | export declare type Literal = StringLiteral | BooleanLiteral | NumberLiteral | UndefinedLiteral | NullLiteral;
|
169 | export interface StringLiteral extends CommonNode {
|
170 | type: 'StringLiteral';
|
171 | value: string;
|
172 | original: string;
|
173 | }
|
174 | export interface BooleanLiteral extends CommonNode {
|
175 | type: 'BooleanLiteral';
|
176 | value: boolean;
|
177 | original: boolean;
|
178 | }
|
179 | export interface NumberLiteral extends CommonNode {
|
180 | type: 'NumberLiteral';
|
181 | value: number;
|
182 | original: number;
|
183 | }
|
184 | export interface UndefinedLiteral extends CommonNode {
|
185 | type: 'UndefinedLiteral';
|
186 | }
|
187 | export interface NullLiteral extends CommonNode {
|
188 | type: 'NullLiteral';
|
189 | }
|
190 | export interface Hash extends CommonNode {
|
191 | pairs: HashPair[];
|
192 | }
|
193 | export interface HashPair extends CommonNode {
|
194 | key: string;
|
195 | value: Expression;
|
196 | }
|
197 | export interface StripFlags {
|
198 | open: boolean;
|
199 | close: boolean;
|
200 | }
|
201 |
|
\ | No newline at end of file |