1
- message = pattern / complex-message
1
+ message = simple-message / complex-message
2
2
3
- complex-message = " {{" [s ] * (declaration [s ]) body [s ] " }}"
3
+ simple-message = [simple-start pattern ]
4
+ simple-start = simple-start-char / text-escape / expression
5
+ pattern = * (text-char / text-escape / expression )
4
6
5
- declaration = input-declaration / local-declaration
7
+ complex-message = * (declaration [s ]) complex-body
8
+ declaration = input-declaration / local-declaration / reserved-statement
6
9
input-declaration = input [s ] variable-expression
7
10
local-declaration = local s variable [s ] " =" [s ] expression
8
11
9
- body = quoted-pattern
10
- / (selectors 1 * ([s ] variant ))
11
-
12
+ complex-body = quoted-pattern
13
+ / ((selectors / reserved-statement ) 1 * ([s ] variant ))
12
14
quoted-pattern = " {{" pattern " }}"
13
- pattern = * ( text / expression )
15
+
14
16
selectors = match 1 * ([s ] expression )
15
- variant = when 1 * (s key ) [s ] quoted-pattern
17
+ variant = key * (s key ) [s ] quoted-pattern
16
18
key = literal / " *"
17
19
18
20
expression = literal-expression / variable-expression / function-expression
19
21
literal-expression = " {" [s ] literal [s annotation ] [s ] " }"
20
22
variable-expression = " {" [s ] variable [s annotation ] [s ] " }"
21
23
function-expression = " {" [s ] annotation [s ] " }"
22
- annotation = (function * (s option )) / reserved / private-use
24
+ annotation = (function * (s option ))
25
+ / reserved-annotation
26
+ / private-use-annotation
23
27
24
28
literal = quoted / unquoted
25
29
variable = " $" name
26
30
function = (" :" / " +" / " -" ) identifier
27
31
option = identifier [s ] " =" [s ] (literal / variable )
28
32
29
- ; reserved keywords are always lowercase
30
- input = %s " input"
31
- local = %s " local"
32
- match = %s " match"
33
- when = %s " when"
33
+ input = %s " .input"
34
+ local = %s " .local"
35
+ match = %s " .match"
34
36
35
- text = 1 * (text-char / text-escape )
36
- text-char = %x 0 -5B ; omit \
37
- / %x 5D -7A ; omit {
38
- / %x 7C ; omit }
39
- / %x 7E -D7FF ; omit surrogates
40
- / %x E000 -10FFFF
37
+ simple-start-char = %x 0 -2D ; omit .
38
+ / %x 2F -5B ; omit \
39
+ / %x 5D -7A ; omit {
40
+ / %x 7C ; omit }
41
+ / %x 7E -D7FF ; omit surrogates
42
+ / %x E000 -10FFFF
43
+ text-char = simple-start-char / " ."
41
44
42
45
quoted = " |" * (quoted-char / quoted-escape ) " |"
43
46
quoted-char = %x 0 -5B ; omit \
@@ -49,16 +52,19 @@ unquoted = unquoted-start *(name-char / ":")
49
52
unquoted-start = name-start / DIGIT / " ."
50
53
/ %x B7 / %x 300 -36F / %x 203F -2040
51
54
52
- ; reserve sigils for private-use by implementations
53
- private-use = private-start reserved-body
54
- private-start = " ^" / " &"
55
+ ; Reserve additional .keywords for use by future versions of this specification.
56
+ reserved-statement = reserved-keyword [s reserved-body ] 1 * ([s ] expression )
57
+ ; Note that the following expression is a simplification,
58
+ ; as this rule MUST NOT be considered to match existing keywords
59
+ ; (`.input`, `.local`, and `.match`).
60
+ reserved-keyword = " ." name
55
61
56
- ; reserve additional sigils for use by
57
- ; future versions of this specification
58
- reserved = reserved-start reserved-body
59
- reserved-start = " !" / " @" / " #" / " %" / " *" / " <" / " >" / " /" / " ?" / " ~"
60
- reserved-body = * ( [s ] 1 * (reserved-char / reserved-escape / quoted ))
62
+ ; Reserve additional sigils for use by future versions of this specification.
63
+ reserved-annotation = reserved-annotation-start reserved-body
64
+ reserved-annotation-start = " !" / " @" / " #" / " %" / " *"
65
+ / " <" / " >" / " /" / " ?" / " ~"
61
66
67
+ reserved-body = * ([s ] 1 * (reserved-char / reserved-escape / quoted ))
62
68
reserved-char = %x 00 -08 ; omit HTAB and LF
63
69
/ %x 0B -0C ; omit CR
64
70
/ %x 0E -19 ; omit SP
@@ -67,6 +73,10 @@ reserved-char = %x00-08 ; omit HTAB and LF
67
73
/ %x 7E -D7FF ; omit surrogates
68
74
/ %x E000 -10FFFF
69
75
76
+ ; Reserve sigils for private-use by implementations.
77
+ private-use-annotation = private-start reserved-body
78
+ private-start = " ^" / " &"
79
+
70
80
; identifier matches https://www.w3.org/TR/REC-xml-names/#NT-QName
71
81
; name matches https://www.w3.org/TR/REC-xml-names/#NT-NCName
72
82
identifier = [namespace " :" ] name
0 commit comments