1 | export type Selector = string
|
2 | export interface LocationDetails {
|
3 | offset: number
|
4 | line: number
|
5 | column: number
|
6 | }
|
7 | export interface Location {
|
8 | start: LocationDetails,
|
9 | end: LocationDetails
|
10 | }
|
11 | export interface SimpleFormat {
|
12 | type: 'numberFormat' | 'dateFormat' | 'timeFormat'
|
13 | style: string
|
14 | location: Location
|
15 | }
|
16 | export interface PluralFormat extends PluralStyle {
|
17 | ordinal: false
|
18 | }
|
19 | export interface SelectFormat {
|
20 | type: 'selectFormat'
|
21 | options: OptionalFormatPattern[],
|
22 | location: Location
|
23 | }
|
24 | export interface SelectOrdinalFormat extends PluralStyle {
|
25 | ordinal: true,
|
26 | }
|
27 | export type ElementFormat = SimpleFormat | PluralFormat | SelectOrdinalFormat | SelectFormat
|
28 | export interface OptionalFormatPattern {
|
29 | type: 'optionalFormatPattern',
|
30 | selector: Selector
|
31 | value: MessageFormatPattern
|
32 | location: Location
|
33 | }
|
34 | export interface PluralStyle {
|
35 | type: 'pluralFormat',
|
36 | offset: number
|
37 | options: OptionalFormatPattern[],
|
38 | location: Location
|
39 | }
|
40 | export interface MessageTextElement {
|
41 | type: 'messageTextElement'
|
42 | value: string
|
43 | location: Location
|
44 | }
|
45 | export interface ArgumentElement {
|
46 | type: 'argumentElement'
|
47 | id: string
|
48 | format: ElementFormat
|
49 | location: Location
|
50 | }
|
51 | export type Element = MessageTextElement | ArgumentElement
|
52 |
|
53 | export interface MessageFormatPattern {
|
54 | type: 'messageFormatPattern',
|
55 | elements: Array<Element>,
|
56 | location: Location
|
57 | }
|
58 | interface Parser {
|
59 | parse (msg: string): MessageFormatPattern
|
60 | }
|
61 | declare const parser: Parser
|
62 | export default parser |
\ | No newline at end of file |