source: trip-planner-front/node_modules/@angular/compiler/src/expression_parser/ast.d.ts@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 20.6 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { SecurityContext } from '../core';
9import { ParseSourceSpan } from '../parse_util';
10export declare class ParserError {
11 input: string;
12 errLocation: string;
13 ctxLocation?: any;
14 message: string;
15 constructor(message: string, input: string, errLocation: string, ctxLocation?: any);
16}
17export declare class ParseSpan {
18 start: number;
19 end: number;
20 constructor(start: number, end: number);
21 toAbsolute(absoluteOffset: number): AbsoluteSourceSpan;
22}
23export declare abstract class AST {
24 span: ParseSpan;
25 /**
26 * Absolute location of the expression AST in a source code file.
27 */
28 sourceSpan: AbsoluteSourceSpan;
29 constructor(span: ParseSpan,
30 /**
31 * Absolute location of the expression AST in a source code file.
32 */
33 sourceSpan: AbsoluteSourceSpan);
34 abstract visit(visitor: AstVisitor, context?: any): any;
35 toString(): string;
36}
37export declare abstract class ASTWithName extends AST {
38 nameSpan: AbsoluteSourceSpan;
39 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, nameSpan: AbsoluteSourceSpan);
40}
41/**
42 * Represents a quoted expression of the form:
43 *
44 * quote = prefix `:` uninterpretedExpression
45 * prefix = identifier
46 * uninterpretedExpression = arbitrary string
47 *
48 * A quoted expression is meant to be pre-processed by an AST transformer that
49 * converts it into another AST that no longer contains quoted expressions.
50 * It is meant to allow third-party developers to extend Angular template
51 * expression language. The `uninterpretedExpression` part of the quote is
52 * therefore not interpreted by the Angular's own expression parser.
53 */
54export declare class Quote extends AST {
55 prefix: string;
56 uninterpretedExpression: string;
57 location: any;
58 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, prefix: string, uninterpretedExpression: string, location: any);
59 visit(visitor: AstVisitor, context?: any): any;
60 toString(): string;
61}
62export declare class EmptyExpr extends AST {
63 visit(visitor: AstVisitor, context?: any): void;
64}
65export declare class ImplicitReceiver extends AST {
66 visit(visitor: AstVisitor, context?: any): any;
67}
68/**
69 * Receiver when something is accessed through `this` (e.g. `this.foo`). Note that this class
70 * inherits from `ImplicitReceiver`, because accessing something through `this` is treated the
71 * same as accessing it implicitly inside of an Angular template (e.g. `[attr.title]="this.title"`
72 * is the same as `[attr.title]="title"`.). Inheriting allows for the `this` accesses to be treated
73 * the same as implicit ones, except for a couple of exceptions like `$event` and `$any`.
74 * TODO: we should find a way for this class not to extend from `ImplicitReceiver` in the future.
75 */
76export declare class ThisReceiver extends ImplicitReceiver {
77 visit(visitor: AstVisitor, context?: any): any;
78}
79/**
80 * Multiple expressions separated by a semicolon.
81 */
82export declare class Chain extends AST {
83 expressions: any[];
84 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, expressions: any[]);
85 visit(visitor: AstVisitor, context?: any): any;
86}
87export declare class Conditional extends AST {
88 condition: AST;
89 trueExp: AST;
90 falseExp: AST;
91 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, condition: AST, trueExp: AST, falseExp: AST);
92 visit(visitor: AstVisitor, context?: any): any;
93}
94export declare class PropertyRead extends ASTWithName {
95 receiver: AST;
96 name: string;
97 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, nameSpan: AbsoluteSourceSpan, receiver: AST, name: string);
98 visit(visitor: AstVisitor, context?: any): any;
99}
100export declare class PropertyWrite extends ASTWithName {
101 receiver: AST;
102 name: string;
103 value: AST;
104 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, nameSpan: AbsoluteSourceSpan, receiver: AST, name: string, value: AST);
105 visit(visitor: AstVisitor, context?: any): any;
106}
107export declare class SafePropertyRead extends ASTWithName {
108 receiver: AST;
109 name: string;
110 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, nameSpan: AbsoluteSourceSpan, receiver: AST, name: string);
111 visit(visitor: AstVisitor, context?: any): any;
112}
113export declare class KeyedRead extends AST {
114 receiver: AST;
115 key: AST;
116 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, receiver: AST, key: AST);
117 visit(visitor: AstVisitor, context?: any): any;
118}
119export declare class SafeKeyedRead extends AST {
120 receiver: AST;
121 key: AST;
122 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, receiver: AST, key: AST);
123 visit(visitor: AstVisitor, context?: any): any;
124}
125export declare class KeyedWrite extends AST {
126 receiver: AST;
127 key: AST;
128 value: AST;
129 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, receiver: AST, key: AST, value: AST);
130 visit(visitor: AstVisitor, context?: any): any;
131}
132export declare class BindingPipe extends ASTWithName {
133 exp: AST;
134 name: string;
135 args: any[];
136 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, exp: AST, name: string, args: any[], nameSpan: AbsoluteSourceSpan);
137 visit(visitor: AstVisitor, context?: any): any;
138}
139export declare class LiteralPrimitive extends AST {
140 value: any;
141 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, value: any);
142 visit(visitor: AstVisitor, context?: any): any;
143}
144export declare class LiteralArray extends AST {
145 expressions: any[];
146 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, expressions: any[]);
147 visit(visitor: AstVisitor, context?: any): any;
148}
149export declare type LiteralMapKey = {
150 key: string;
151 quoted: boolean;
152};
153export declare class LiteralMap extends AST {
154 keys: LiteralMapKey[];
155 values: any[];
156 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, keys: LiteralMapKey[], values: any[]);
157 visit(visitor: AstVisitor, context?: any): any;
158}
159export declare class Interpolation extends AST {
160 strings: any[];
161 expressions: any[];
162 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, strings: any[], expressions: any[]);
163 visit(visitor: AstVisitor, context?: any): any;
164}
165export declare class Binary extends AST {
166 operation: string;
167 left: AST;
168 right: AST;
169 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, operation: string, left: AST, right: AST);
170 visit(visitor: AstVisitor, context?: any): any;
171}
172/**
173 * For backwards compatibility reasons, `Unary` inherits from `Binary` and mimics the binary AST
174 * node that was originally used. This inheritance relation can be deleted in some future major,
175 * after consumers have been given a chance to fully support Unary.
176 */
177export declare class Unary extends Binary {
178 operator: string;
179 expr: AST;
180 left: never;
181 right: never;
182 operation: never;
183 /**
184 * Creates a unary minus expression "-x", represented as `Binary` using "0 - x".
185 */
186 static createMinus(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, expr: AST): Unary;
187 /**
188 * Creates a unary plus expression "+x", represented as `Binary` using "x - 0".
189 */
190 static createPlus(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, expr: AST): Unary;
191 /**
192 * During the deprecation period this constructor is private, to avoid consumers from creating
193 * a `Unary` with the fallback properties for `Binary`.
194 */
195 private constructor();
196 visit(visitor: AstVisitor, context?: any): any;
197}
198export declare class PrefixNot extends AST {
199 expression: AST;
200 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, expression: AST);
201 visit(visitor: AstVisitor, context?: any): any;
202}
203export declare class NonNullAssert extends AST {
204 expression: AST;
205 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, expression: AST);
206 visit(visitor: AstVisitor, context?: any): any;
207}
208export declare class MethodCall extends ASTWithName {
209 receiver: AST;
210 name: string;
211 args: any[];
212 argumentSpan: AbsoluteSourceSpan;
213 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, nameSpan: AbsoluteSourceSpan, receiver: AST, name: string, args: any[], argumentSpan: AbsoluteSourceSpan);
214 visit(visitor: AstVisitor, context?: any): any;
215}
216export declare class SafeMethodCall extends ASTWithName {
217 receiver: AST;
218 name: string;
219 args: any[];
220 argumentSpan: AbsoluteSourceSpan;
221 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, nameSpan: AbsoluteSourceSpan, receiver: AST, name: string, args: any[], argumentSpan: AbsoluteSourceSpan);
222 visit(visitor: AstVisitor, context?: any): any;
223}
224export declare class FunctionCall extends AST {
225 target: AST | null;
226 args: any[];
227 constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, target: AST | null, args: any[]);
228 visit(visitor: AstVisitor, context?: any): any;
229}
230/**
231 * Records the absolute position of a text span in a source file, where `start` and `end` are the
232 * starting and ending byte offsets, respectively, of the text span in a source file.
233 */
234export declare class AbsoluteSourceSpan {
235 readonly start: number;
236 readonly end: number;
237 constructor(start: number, end: number);
238}
239export declare class ASTWithSource extends AST {
240 ast: AST;
241 source: string | null;
242 location: string;
243 errors: ParserError[];
244 constructor(ast: AST, source: string | null, location: string, absoluteOffset: number, errors: ParserError[]);
245 visit(visitor: AstVisitor, context?: any): any;
246 toString(): string;
247}
248/**
249 * TemplateBinding refers to a particular key-value pair in a microsyntax
250 * expression. A few examples are:
251 *
252 * |---------------------|--------------|---------|--------------|
253 * | expression | key | value | binding type |
254 * |---------------------|--------------|---------|--------------|
255 * | 1. let item | item | null | variable |
256 * | 2. of items | ngForOf | items | expression |
257 * | 3. let x = y | x | y | variable |
258 * | 4. index as i | i | index | variable |
259 * | 5. trackBy: func | ngForTrackBy | func | expression |
260 * | 6. *ngIf="cond" | ngIf | cond | expression |
261 * |---------------------|--------------|---------|--------------|
262 *
263 * (6) is a notable exception because it is a binding from the template key in
264 * the LHS of a HTML attribute to the expression in the RHS. All other bindings
265 * in the example above are derived solely from the RHS.
266 */
267export declare type TemplateBinding = VariableBinding | ExpressionBinding;
268export declare class VariableBinding {
269 readonly sourceSpan: AbsoluteSourceSpan;
270 readonly key: TemplateBindingIdentifier;
271 readonly value: TemplateBindingIdentifier | null;
272 /**
273 * @param sourceSpan entire span of the binding.
274 * @param key name of the LHS along with its span.
275 * @param value optional value for the RHS along with its span.
276 */
277 constructor(sourceSpan: AbsoluteSourceSpan, key: TemplateBindingIdentifier, value: TemplateBindingIdentifier | null);
278}
279export declare class ExpressionBinding {
280 readonly sourceSpan: AbsoluteSourceSpan;
281 readonly key: TemplateBindingIdentifier;
282 readonly value: ASTWithSource | null;
283 /**
284 * @param sourceSpan entire span of the binding.
285 * @param key binding name, like ngForOf, ngForTrackBy, ngIf, along with its
286 * span. Note that the length of the span may not be the same as
287 * `key.source.length`. For example,
288 * 1. key.source = ngFor, key.span is for "ngFor"
289 * 2. key.source = ngForOf, key.span is for "of"
290 * 3. key.source = ngForTrackBy, key.span is for "trackBy"
291 * @param value optional expression for the RHS.
292 */
293 constructor(sourceSpan: AbsoluteSourceSpan, key: TemplateBindingIdentifier, value: ASTWithSource | null);
294}
295export interface TemplateBindingIdentifier {
296 source: string;
297 span: AbsoluteSourceSpan;
298}
299export interface AstVisitor {
300 /**
301 * The `visitUnary` method is declared as optional for backwards compatibility. In an upcoming
302 * major release, this method will be made required.
303 */
304 visitUnary?(ast: Unary, context: any): any;
305 visitBinary(ast: Binary, context: any): any;
306 visitChain(ast: Chain, context: any): any;
307 visitConditional(ast: Conditional, context: any): any;
308 visitFunctionCall(ast: FunctionCall, context: any): any;
309 /**
310 * The `visitThisReceiver` method is declared as optional for backwards compatibility.
311 * In an upcoming major release, this method will be made required.
312 */
313 visitThisReceiver?(ast: ThisReceiver, context: any): any;
314 visitImplicitReceiver(ast: ImplicitReceiver, context: any): any;
315 visitInterpolation(ast: Interpolation, context: any): any;
316 visitKeyedRead(ast: KeyedRead, context: any): any;
317 visitKeyedWrite(ast: KeyedWrite, context: any): any;
318 visitLiteralArray(ast: LiteralArray, context: any): any;
319 visitLiteralMap(ast: LiteralMap, context: any): any;
320 visitLiteralPrimitive(ast: LiteralPrimitive, context: any): any;
321 visitMethodCall(ast: MethodCall, context: any): any;
322 visitPipe(ast: BindingPipe, context: any): any;
323 visitPrefixNot(ast: PrefixNot, context: any): any;
324 visitNonNullAssert(ast: NonNullAssert, context: any): any;
325 visitPropertyRead(ast: PropertyRead, context: any): any;
326 visitPropertyWrite(ast: PropertyWrite, context: any): any;
327 visitQuote(ast: Quote, context: any): any;
328 visitSafeMethodCall(ast: SafeMethodCall, context: any): any;
329 visitSafePropertyRead(ast: SafePropertyRead, context: any): any;
330 visitSafeKeyedRead(ast: SafeKeyedRead, context: any): any;
331 visitASTWithSource?(ast: ASTWithSource, context: any): any;
332 /**
333 * This function is optionally defined to allow classes that implement this
334 * interface to selectively decide if the specified `ast` should be visited.
335 * @param ast node to visit
336 * @param context context that gets passed to the node and all its children
337 */
338 visit?(ast: AST, context?: any): any;
339}
340export declare class RecursiveAstVisitor implements AstVisitor {
341 visit(ast: AST, context?: any): any;
342 visitUnary(ast: Unary, context: any): any;
343 visitBinary(ast: Binary, context: any): any;
344 visitChain(ast: Chain, context: any): any;
345 visitConditional(ast: Conditional, context: any): any;
346 visitPipe(ast: BindingPipe, context: any): any;
347 visitFunctionCall(ast: FunctionCall, context: any): any;
348 visitImplicitReceiver(ast: ThisReceiver, context: any): any;
349 visitThisReceiver(ast: ThisReceiver, context: any): any;
350 visitInterpolation(ast: Interpolation, context: any): any;
351 visitKeyedRead(ast: KeyedRead, context: any): any;
352 visitKeyedWrite(ast: KeyedWrite, context: any): any;
353 visitLiteralArray(ast: LiteralArray, context: any): any;
354 visitLiteralMap(ast: LiteralMap, context: any): any;
355 visitLiteralPrimitive(ast: LiteralPrimitive, context: any): any;
356 visitMethodCall(ast: MethodCall, context: any): any;
357 visitPrefixNot(ast: PrefixNot, context: any): any;
358 visitNonNullAssert(ast: NonNullAssert, context: any): any;
359 visitPropertyRead(ast: PropertyRead, context: any): any;
360 visitPropertyWrite(ast: PropertyWrite, context: any): any;
361 visitSafePropertyRead(ast: SafePropertyRead, context: any): any;
362 visitSafeMethodCall(ast: SafeMethodCall, context: any): any;
363 visitSafeKeyedRead(ast: SafeKeyedRead, context: any): any;
364 visitQuote(ast: Quote, context: any): any;
365 visitAll(asts: AST[], context: any): any;
366}
367export declare class AstTransformer implements AstVisitor {
368 visitImplicitReceiver(ast: ImplicitReceiver, context: any): AST;
369 visitThisReceiver(ast: ThisReceiver, context: any): AST;
370 visitInterpolation(ast: Interpolation, context: any): AST;
371 visitLiteralPrimitive(ast: LiteralPrimitive, context: any): AST;
372 visitPropertyRead(ast: PropertyRead, context: any): AST;
373 visitPropertyWrite(ast: PropertyWrite, context: any): AST;
374 visitSafePropertyRead(ast: SafePropertyRead, context: any): AST;
375 visitMethodCall(ast: MethodCall, context: any): AST;
376 visitSafeMethodCall(ast: SafeMethodCall, context: any): AST;
377 visitFunctionCall(ast: FunctionCall, context: any): AST;
378 visitLiteralArray(ast: LiteralArray, context: any): AST;
379 visitLiteralMap(ast: LiteralMap, context: any): AST;
380 visitUnary(ast: Unary, context: any): AST;
381 visitBinary(ast: Binary, context: any): AST;
382 visitPrefixNot(ast: PrefixNot, context: any): AST;
383 visitNonNullAssert(ast: NonNullAssert, context: any): AST;
384 visitConditional(ast: Conditional, context: any): AST;
385 visitPipe(ast: BindingPipe, context: any): AST;
386 visitKeyedRead(ast: KeyedRead, context: any): AST;
387 visitKeyedWrite(ast: KeyedWrite, context: any): AST;
388 visitAll(asts: any[]): any[];
389 visitChain(ast: Chain, context: any): AST;
390 visitQuote(ast: Quote, context: any): AST;
391 visitSafeKeyedRead(ast: SafeKeyedRead, context: any): AST;
392}
393export declare class AstMemoryEfficientTransformer implements AstVisitor {
394 visitImplicitReceiver(ast: ImplicitReceiver, context: any): AST;
395 visitThisReceiver(ast: ThisReceiver, context: any): AST;
396 visitInterpolation(ast: Interpolation, context: any): Interpolation;
397 visitLiteralPrimitive(ast: LiteralPrimitive, context: any): AST;
398 visitPropertyRead(ast: PropertyRead, context: any): AST;
399 visitPropertyWrite(ast: PropertyWrite, context: any): AST;
400 visitSafePropertyRead(ast: SafePropertyRead, context: any): AST;
401 visitMethodCall(ast: MethodCall, context: any): AST;
402 visitSafeMethodCall(ast: SafeMethodCall, context: any): AST;
403 visitFunctionCall(ast: FunctionCall, context: any): AST;
404 visitLiteralArray(ast: LiteralArray, context: any): AST;
405 visitLiteralMap(ast: LiteralMap, context: any): AST;
406 visitUnary(ast: Unary, context: any): AST;
407 visitBinary(ast: Binary, context: any): AST;
408 visitPrefixNot(ast: PrefixNot, context: any): AST;
409 visitNonNullAssert(ast: NonNullAssert, context: any): AST;
410 visitConditional(ast: Conditional, context: any): AST;
411 visitPipe(ast: BindingPipe, context: any): AST;
412 visitKeyedRead(ast: KeyedRead, context: any): AST;
413 visitKeyedWrite(ast: KeyedWrite, context: any): AST;
414 visitAll(asts: any[]): any[];
415 visitChain(ast: Chain, context: any): AST;
416 visitQuote(ast: Quote, context: any): AST;
417 visitSafeKeyedRead(ast: SafeKeyedRead, context: any): AST;
418}
419export declare class ParsedProperty {
420 name: string;
421 expression: ASTWithSource;
422 type: ParsedPropertyType;
423 sourceSpan: ParseSourceSpan;
424 readonly keySpan: ParseSourceSpan | undefined;
425 valueSpan: ParseSourceSpan | undefined;
426 readonly isLiteral: boolean;
427 readonly isAnimation: boolean;
428 constructor(name: string, expression: ASTWithSource, type: ParsedPropertyType, sourceSpan: ParseSourceSpan, keySpan: ParseSourceSpan | undefined, valueSpan: ParseSourceSpan | undefined);
429}
430export declare enum ParsedPropertyType {
431 DEFAULT = 0,
432 LITERAL_ATTR = 1,
433 ANIMATION = 2
434}
435export declare const enum ParsedEventType {
436 Regular = 0,
437 Animation = 1
438}
439export declare class ParsedEvent {
440 name: string;
441 targetOrPhase: string;
442 type: ParsedEventType;
443 handler: ASTWithSource;
444 sourceSpan: ParseSourceSpan;
445 handlerSpan: ParseSourceSpan;
446 readonly keySpan: ParseSourceSpan | undefined;
447 constructor(name: string, targetOrPhase: string, type: ParsedEventType, handler: ASTWithSource, sourceSpan: ParseSourceSpan, handlerSpan: ParseSourceSpan, keySpan: ParseSourceSpan | undefined);
448}
449/**
450 * ParsedVariable represents a variable declaration in a microsyntax expression.
451 */
452export declare class ParsedVariable {
453 readonly name: string;
454 readonly value: string;
455 readonly sourceSpan: ParseSourceSpan;
456 readonly keySpan: ParseSourceSpan;
457 readonly valueSpan?: ParseSourceSpan | undefined;
458 constructor(name: string, value: string, sourceSpan: ParseSourceSpan, keySpan: ParseSourceSpan, valueSpan?: ParseSourceSpan | undefined);
459}
460export declare const enum BindingType {
461 Property = 0,
462 Attribute = 1,
463 Class = 2,
464 Style = 3,
465 Animation = 4
466}
467export declare class BoundElementProperty {
468 name: string;
469 type: BindingType;
470 securityContext: SecurityContext;
471 value: ASTWithSource;
472 unit: string | null;
473 sourceSpan: ParseSourceSpan;
474 readonly keySpan: ParseSourceSpan | undefined;
475 valueSpan: ParseSourceSpan | undefined;
476 constructor(name: string, type: BindingType, securityContext: SecurityContext, value: ASTWithSource, unit: string | null, sourceSpan: ParseSourceSpan, keySpan: ParseSourceSpan | undefined, valueSpan: ParseSourceSpan | undefined);
477}
Note: See TracBrowser for help on using the repository browser.