1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | import { I18nMeta } from '../i18n/i18n_ast';
|
9 | import { ParseSourceSpan } from '../parse_util';
|
10 | import { InterpolatedAttributeToken, InterpolatedTextToken } from './tokens';
|
11 | interface BaseNode {
|
12 | sourceSpan: ParseSourceSpan;
|
13 | visit(visitor: Visitor, context: any): any;
|
14 | }
|
15 | export declare type Node = Attribute | Comment | Element | Expansion | ExpansionCase | Text;
|
16 | export declare abstract class NodeWithI18n implements BaseNode {
|
17 | sourceSpan: ParseSourceSpan;
|
18 | i18n?: I18nMeta | undefined;
|
19 | constructor(sourceSpan: ParseSourceSpan, i18n?: I18nMeta | undefined);
|
20 | abstract visit(visitor: Visitor, context: any): any;
|
21 | }
|
22 | export declare class Text extends NodeWithI18n {
|
23 | value: string;
|
24 | tokens: InterpolatedTextToken[];
|
25 | constructor(value: string, sourceSpan: ParseSourceSpan, tokens: InterpolatedTextToken[], i18n?: I18nMeta);
|
26 | visit(visitor: Visitor, context: any): any;
|
27 | }
|
28 | export declare class Expansion extends NodeWithI18n {
|
29 | switchValue: string;
|
30 | type: string;
|
31 | cases: ExpansionCase[];
|
32 | switchValueSourceSpan: ParseSourceSpan;
|
33 | constructor(switchValue: string, type: string, cases: ExpansionCase[], sourceSpan: ParseSourceSpan, switchValueSourceSpan: ParseSourceSpan, i18n?: I18nMeta);
|
34 | visit(visitor: Visitor, context: any): any;
|
35 | }
|
36 | export declare class ExpansionCase implements BaseNode {
|
37 | value: string;
|
38 | expression: Node[];
|
39 | sourceSpan: ParseSourceSpan;
|
40 | valueSourceSpan: ParseSourceSpan;
|
41 | expSourceSpan: ParseSourceSpan;
|
42 | constructor(value: string, expression: Node[], sourceSpan: ParseSourceSpan, valueSourceSpan: ParseSourceSpan, expSourceSpan: ParseSourceSpan);
|
43 | visit(visitor: Visitor, context: any): any;
|
44 | }
|
45 | export declare class Attribute extends NodeWithI18n {
|
46 | name: string;
|
47 | value: string;
|
48 | readonly keySpan: ParseSourceSpan | undefined;
|
49 | valueSpan: ParseSourceSpan | undefined;
|
50 | valueTokens: InterpolatedAttributeToken[] | undefined;
|
51 | constructor(name: string, value: string, sourceSpan: ParseSourceSpan, keySpan: ParseSourceSpan | undefined, valueSpan: ParseSourceSpan | undefined, valueTokens: InterpolatedAttributeToken[] | undefined, i18n: I18nMeta | undefined);
|
52 | visit(visitor: Visitor, context: any): any;
|
53 | }
|
54 | export declare class Element extends NodeWithI18n {
|
55 | name: string;
|
56 | attrs: Attribute[];
|
57 | children: Node[];
|
58 | startSourceSpan: ParseSourceSpan;
|
59 | endSourceSpan: ParseSourceSpan | null;
|
60 | constructor(name: string, attrs: Attribute[], children: Node[], sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan?: ParseSourceSpan | null, i18n?: I18nMeta);
|
61 | visit(visitor: Visitor, context: any): any;
|
62 | }
|
63 | export declare class Comment implements BaseNode {
|
64 | value: string | null;
|
65 | sourceSpan: ParseSourceSpan;
|
66 | constructor(value: string | null, sourceSpan: ParseSourceSpan);
|
67 | visit(visitor: Visitor, context: any): any;
|
68 | }
|
69 | export interface Visitor {
|
70 | visit?(node: Node, context: any): any;
|
71 | visitElement(element: Element, context: any): any;
|
72 | visitAttribute(attribute: Attribute, context: any): any;
|
73 | visitText(text: Text, context: any): any;
|
74 | visitComment(comment: Comment, context: any): any;
|
75 | visitExpansion(expansion: Expansion, context: any): any;
|
76 | visitExpansionCase(expansionCase: ExpansionCase, context: any): any;
|
77 | }
|
78 | export declare function visitAll(visitor: Visitor, nodes: Node[], context?: any): any[];
|
79 | export declare class RecursiveVisitor implements Visitor {
|
80 | constructor();
|
81 | visitElement(ast: Element, context: any): any;
|
82 | visitAttribute(ast: Attribute, context: any): any;
|
83 | visitText(ast: Text, context: any): any;
|
84 | visitComment(ast: Comment, context: any): any;
|
85 | visitExpansion(ast: Expansion, context: any): any;
|
86 | visitExpansionCase(ast: ExpansionCase, context: any): any;
|
87 | private visitChildren;
|
88 | }
|
89 | export {};
|