1
- Message ::= Declaration * ( Pattern | Selector Variant + )
1
+ Message ::= ( s ? Declaration ) * s ? Body s ?
2
2
3
- /* Preamble */
4
- Declaration ::= ' let' WhiteSpace Variable ' =' ' {' Expression ' }'
5
- Selector ::= ' match' ( ' {' Expression ' }' )+
3
+ Declaration ::= ' let' s Variable s ? ' =' s ? ' {' s ? Expression s ? ' }'
4
+ Body ::= Pattern | Selector (s ? Variant )+
6
5
7
- /* Variants and Patterns */
8
- Variant ::= ' when ' ( WhiteSpace VariantKey ) + Pattern
9
- VariantKey ::= Literal | Nmtoken | ' * '
10
- Pattern ::= ' { ' ( Text | Placeholder ) * ' } ' / * ws : explicit * /
6
+ Pattern ::= ' { ' ( Text | Placeholder ) * ' } '
7
+ Selector ::= ' match ' (s ? ' { ' s ? Expression s ? ' } ' ) +
8
+ Variant ::= ' when ' ( s Key ) + s ? Pattern
9
+ Key ::= Nmtoken | Literal | ' * '
11
10
12
- /* Placeholders */
13
- Placeholder ::= ' {' (Expression | Markup | MarkupEnd )? ' }'
11
+ Placeholder ::= ' {' s ? (Expression | Markup | MarkupEnd )? s ? ' }'
14
12
15
- /* Expressions */
16
- Expression ::= Operand Annotation ? | Annotation
17
- Operand ::= Literal | Variable
18
- Annotation ::= Function Option *
19
- Option ::= Name ' =' (Literal | Nmtoken | Variable )
13
+ Expression ::= (Literal | Variable ) (s Annotation )? | Annotation
14
+ Annotation ::= Function (s Option )*
15
+ Option ::= Name s ? ' =' s ? (Literal | Nmtoken | Variable )
20
16
21
- /* Markup Tags */
22
- Markup ::= MarkupStart Option *
17
+ Markup ::= MarkupStart (s Option )*
23
18
24
19
<? TOKENS ? >
25
20
@@ -29,12 +24,12 @@ TextChar ::= AnyChar - ('{' | '}' | Esc)
29
24
AnyChar ::= [#x0- #x10FFFF ] - [#xD800- #xDFFF ]
30
25
31
26
/* Names */
32
- Variable ::= ' $' Name / * ws : explicit * /
33
- Function ::= ' :' Name / * ws : explicit * /
34
- MarkupStart ::= ' +' Name / * ws : explicit * /
35
- MarkupEnd ::= ' -' Name / * ws : explicit * /
36
- Name ::= NameStart NameChar * / * ws : explicit * /
37
- Nmtoken ::= NameChar + / * ws : explicit * /
27
+ Variable ::= ' $' Name
28
+ Function ::= ' :' Name
29
+ MarkupStart ::= ' +' Name
30
+ MarkupEnd ::= ' -' Name
31
+ Name ::= NameStart NameChar *
32
+ Nmtoken ::= NameChar +
38
33
NameStart ::= [a-zA-Z ] | " _"
39
34
| [#xC0- #xD6 ] | [#xD8- #xF6 ] | [#xF8- #x2FF ]
40
35
| [#x370- #x37D ] | [#x37F- #x1FFF ] | [#x200C- #x200D ]
@@ -44,13 +39,13 @@ NameChar ::= NameStart | [0-9] | "-" | "." | #xB7
44
39
| [#x0300- #x036F ] | [#x203F- #x2040 ]
45
40
46
41
/* Literals */
47
- Literal ::= ' (' (LiteralChar | LiteralEscape )* ' )' / * ws : explicit * /
42
+ Literal ::= ' (' (LiteralChar | LiteralEscape )* ' )'
48
43
LiteralChar ::= AnyChar - (' (' | ' )' | Esc )
49
44
50
45
/* Escape sequences */
51
46
Esc ::= ' \'
52
47
TextEscape ::= Esc Esc | Esc ' {' | Esc ' }'
53
48
LiteralEscape ::= Esc Esc | Esc ' (' | Esc ' )'
54
49
55
- /* WhiteSpace */
56
- WhiteSpace ::= #x9 | #xD | #xA | #x20 / * ws : definition * /
50
+ /* White space */
51
+ s ::= ( #x9 | #xD | #xA | #x20 ) +
0 commit comments