1
|
/**
|
2
|
* @license
|
3
|
* Copyright Google Inc. 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
|
*/
|
8
|
import { ParseSourceSpan } from '../parse_util';
|
9
|
export declare class Message {
|
10
|
nodes: Node[];
|
11
|
placeholders: {
|
12
|
[phName: string]: string;
|
13
|
};
|
14
|
placeholderToMessage: {
|
15
|
[phName: string]: Message;
|
16
|
};
|
17
|
meaning: string;
|
18
|
description: string;
|
19
|
id: string;
|
20
|
sources: MessageSpan[];
|
21
|
/**
|
22
|
* @param nodes message AST
|
23
|
* @param placeholders maps placeholder names to static content
|
24
|
* @param placeholderToMessage maps placeholder names to messages (used for nested ICU messages)
|
25
|
* @param meaning
|
26
|
* @param description
|
27
|
* @param id
|
28
|
*/
|
29
|
constructor(nodes: Node[], placeholders: {
|
30
|
[phName: string]: string;
|
31
|
}, placeholderToMessage: {
|
32
|
[phName: string]: Message;
|
33
|
}, meaning: string, description: string, id: string);
|
34
|
}
|
35
|
export interface MessageSpan {
|
36
|
filePath: string;
|
37
|
startLine: number;
|
38
|
startCol: number;
|
39
|
endLine: number;
|
40
|
endCol: number;
|
41
|
}
|
42
|
export interface Node {
|
43
|
sourceSpan: ParseSourceSpan;
|
44
|
visit(visitor: Visitor, context?: any): any;
|
45
|
}
|
46
|
export declare class Text implements Node {
|
47
|
value: string;
|
48
|
sourceSpan: ParseSourceSpan;
|
49
|
constructor(value: string, sourceSpan: ParseSourceSpan);
|
50
|
visit(visitor: Visitor, context?: any): any;
|
51
|
}
|
52
|
export declare class Container implements Node {
|
53
|
children: Node[];
|
54
|
sourceSpan: ParseSourceSpan;
|
55
|
constructor(children: Node[], sourceSpan: ParseSourceSpan);
|
56
|
visit(visitor: Visitor, context?: any): any;
|
57
|
}
|
58
|
export declare class Icu implements Node {
|
59
|
expression: string;
|
60
|
type: string;
|
61
|
cases: {
|
62
|
[k: string]: Node;
|
63
|
};
|
64
|
sourceSpan: ParseSourceSpan;
|
65
|
expressionPlaceholder: string;
|
66
|
constructor(expression: string, type: string, cases: {
|
67
|
[k: string]: Node;
|
68
|
}, sourceSpan: ParseSourceSpan);
|
69
|
visit(visitor: Visitor, context?: any): any;
|
70
|
}
|
71
|
export declare class TagPlaceholder implements Node {
|
72
|
tag: string;
|
73
|
attrs: {
|
74
|
[k: string]: string;
|
75
|
};
|
76
|
startName: string;
|
77
|
closeName: string;
|
78
|
children: Node[];
|
79
|
isVoid: boolean;
|
80
|
sourceSpan: ParseSourceSpan;
|
81
|
constructor(tag: string, attrs: {
|
82
|
[k: string]: string;
|
83
|
}, startName: string, closeName: string, children: Node[], isVoid: boolean, sourceSpan: ParseSourceSpan);
|
84
|
visit(visitor: Visitor, context?: any): any;
|
85
|
}
|
86
|
export declare class Placeholder implements Node {
|
87
|
value: string;
|
88
|
name: string;
|
89
|
sourceSpan: ParseSourceSpan;
|
90
|
constructor(value: string, name: string, sourceSpan: ParseSourceSpan);
|
91
|
visit(visitor: Visitor, context?: any): any;
|
92
|
}
|
93
|
export declare class IcuPlaceholder implements Node {
|
94
|
value: Icu;
|
95
|
name: string;
|
96
|
sourceSpan: ParseSourceSpan;
|
97
|
constructor(value: Icu, name: string, sourceSpan: ParseSourceSpan);
|
98
|
visit(visitor: Visitor, context?: any): any;
|
99
|
}
|
100
|
export interface Visitor {
|
101
|
visitText(text: Text, context?: any): any;
|
102
|
visitContainer(container: Container, context?: any): any;
|
103
|
visitIcu(icu: Icu, context?: any): any;
|
104
|
visitTagPlaceholder(ph: TagPlaceholder, context?: any): any;
|
105
|
visitPlaceholder(ph: Placeholder, context?: any): any;
|
106
|
visitIcuPlaceholder(ph: IcuPlaceholder, context?: any): any;
|
107
|
}
|
108
|
export declare class CloneVisitor implements Visitor {
|
109
|
visitText(text: Text, context?: any): Text;
|
110
|
visitContainer(container: Container, context?: any): Container;
|
111
|
visitIcu(icu: Icu, context?: any): Icu;
|
112
|
visitTagPlaceholder(ph: TagPlaceholder, context?: any): TagPlaceholder;
|
113
|
visitPlaceholder(ph: Placeholder, context?: any): Placeholder;
|
114
|
visitIcuPlaceholder(ph: IcuPlaceholder, context?: any): IcuPlaceholder;
|
115
|
}
|
116
|
export declare class RecurseVisitor implements Visitor {
|
117
|
visitText(text: Text, context?: any): any;
|
118
|
visitContainer(container: Container, context?: any): any;
|
119
|
visitIcu(icu: Icu, context?: any): any;
|
120
|
visitTagPlaceholder(ph: TagPlaceholder, context?: any): any;
|
121
|
visitPlaceholder(ph: Placeholder, context?: any): any;
|
122
|
visitIcuPlaceholder(ph: IcuPlaceholder, context?: any): any;
|
123
|
}
|