source: trip-planner-front/node_modules/@angular/compiler/src/i18n/i18n_ast.d.ts

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

initial commit

  • Property mode set to 100644
File size: 5.3 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 { ParseSourceSpan } from '../parse_util';
9/**
10 * Describes the text contents of a placeholder as it appears in an ICU expression, including its
11 * source span information.
12 */
13export interface MessagePlaceholder {
14 /** The text contents of the placeholder */
15 text: string;
16 /** The source span of the placeholder */
17 sourceSpan: ParseSourceSpan;
18}
19export declare class Message {
20 nodes: Node[];
21 placeholders: {
22 [phName: string]: MessagePlaceholder;
23 };
24 placeholderToMessage: {
25 [phName: string]: Message;
26 };
27 meaning: string;
28 description: string;
29 customId: string;
30 sources: MessageSpan[];
31 id: string;
32 /** The ids to use if there are no custom id and if `i18nLegacyMessageIdFormat` is not empty */
33 legacyIds: string[];
34 /**
35 * @param nodes message AST
36 * @param placeholders maps placeholder names to static content and their source spans
37 * @param placeholderToMessage maps placeholder names to messages (used for nested ICU messages)
38 * @param meaning
39 * @param description
40 * @param customId
41 */
42 constructor(nodes: Node[], placeholders: {
43 [phName: string]: MessagePlaceholder;
44 }, placeholderToMessage: {
45 [phName: string]: Message;
46 }, meaning: string, description: string, customId: string);
47}
48export interface MessageSpan {
49 filePath: string;
50 startLine: number;
51 startCol: number;
52 endLine: number;
53 endCol: number;
54}
55export interface Node {
56 sourceSpan: ParseSourceSpan;
57 visit(visitor: Visitor, context?: any): any;
58}
59export declare class Text implements Node {
60 value: string;
61 sourceSpan: ParseSourceSpan;
62 constructor(value: string, sourceSpan: ParseSourceSpan);
63 visit(visitor: Visitor, context?: any): any;
64}
65export declare class Container implements Node {
66 children: Node[];
67 sourceSpan: ParseSourceSpan;
68 constructor(children: Node[], sourceSpan: ParseSourceSpan);
69 visit(visitor: Visitor, context?: any): any;
70}
71export declare class Icu implements Node {
72 expression: string;
73 type: string;
74 cases: {
75 [k: string]: Node;
76 };
77 sourceSpan: ParseSourceSpan;
78 expressionPlaceholder: string;
79 constructor(expression: string, type: string, cases: {
80 [k: string]: Node;
81 }, sourceSpan: ParseSourceSpan);
82 visit(visitor: Visitor, context?: any): any;
83}
84export declare class TagPlaceholder implements Node {
85 tag: string;
86 attrs: {
87 [k: string]: string;
88 };
89 startName: string;
90 closeName: string;
91 children: Node[];
92 isVoid: boolean;
93 sourceSpan: ParseSourceSpan;
94 startSourceSpan: ParseSourceSpan | null;
95 endSourceSpan: ParseSourceSpan | null;
96 constructor(tag: string, attrs: {
97 [k: string]: string;
98 }, startName: string, closeName: string, children: Node[], isVoid: boolean, sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan | null, endSourceSpan: ParseSourceSpan | null);
99 visit(visitor: Visitor, context?: any): any;
100}
101export declare class Placeholder implements Node {
102 value: string;
103 name: string;
104 sourceSpan: ParseSourceSpan;
105 constructor(value: string, name: string, sourceSpan: ParseSourceSpan);
106 visit(visitor: Visitor, context?: any): any;
107}
108export declare class IcuPlaceholder implements Node {
109 value: Icu;
110 name: string;
111 sourceSpan: ParseSourceSpan;
112 /** Used to capture a message computed from a previous processing pass (see `setI18nRefs()`). */
113 previousMessage?: Message;
114 constructor(value: Icu, name: string, sourceSpan: ParseSourceSpan);
115 visit(visitor: Visitor, context?: any): any;
116}
117/**
118 * Each HTML node that is affect by an i18n tag will also have an `i18n` property that is of type
119 * `I18nMeta`.
120 * This information is either a `Message`, which indicates it is the root of an i18n message, or a
121 * `Node`, which indicates is it part of a containing `Message`.
122 */
123export declare type I18nMeta = Message | Node;
124export interface Visitor {
125 visitText(text: Text, context?: any): any;
126 visitContainer(container: Container, context?: any): any;
127 visitIcu(icu: Icu, context?: any): any;
128 visitTagPlaceholder(ph: TagPlaceholder, context?: any): any;
129 visitPlaceholder(ph: Placeholder, context?: any): any;
130 visitIcuPlaceholder(ph: IcuPlaceholder, context?: any): any;
131}
132export declare class CloneVisitor implements Visitor {
133 visitText(text: Text, context?: any): Text;
134 visitContainer(container: Container, context?: any): Container;
135 visitIcu(icu: Icu, context?: any): Icu;
136 visitTagPlaceholder(ph: TagPlaceholder, context?: any): TagPlaceholder;
137 visitPlaceholder(ph: Placeholder, context?: any): Placeholder;
138 visitIcuPlaceholder(ph: IcuPlaceholder, context?: any): IcuPlaceholder;
139}
140export declare class RecurseVisitor implements Visitor {
141 visitText(text: Text, context?: any): any;
142 visitContainer(container: Container, context?: any): any;
143 visitIcu(icu: Icu, context?: any): any;
144 visitTagPlaceholder(ph: TagPlaceholder, context?: any): any;
145 visitPlaceholder(ph: Placeholder, context?: any): any;
146 visitIcuPlaceholder(ph: IcuPlaceholder, context?: any): any;
147}
Note: See TracBrowser for help on using the repository browser.