1- message = simple-message / complex-message
1+ message = simple-message / complex-message
22
3- simple-message = [simple-start pattern ]
4- simple-start = simple-start-char / text-escape / placeholder
5- pattern = * (text-char / text-escape / placeholder )
6- placeholder = expression / markup
3+ simple-message = [simple-start pattern ]
4+ simple-start = simple-start-char / text-escape / placeholder
5+ pattern = * (text-char / text-escape / placeholder )
6+ placeholder = expression / markup
7+
8+ complex-message = * (declaration [s ]) complex-body
9+ declaration = input-declaration / local-declaration / reserved-statement
10+ complex-body = quoted-pattern / matcher
711
8- complex-message = * (declaration [s ]) complex-body
9- declaration = input-declaration / local-declaration / reserved-statement
1012input-declaration = input [s ] variable-expression
1113local-declaration = local s variable [s ] " =" [s ] expression
1214
13- complex-body = quoted-pattern / matcher
14- quoted-pattern = " {{" pattern " }}"
15+ quoted-pattern = " {{" pattern " }}"
1516
16- matcher = match-statement 1 * ([s ] variant )
17- match-statement = match 1 * ([s ] selector )
18- selector = expression
19- variant = key * (s key ) [s ] quoted-pattern
20- key = literal / " *"
17+ matcher = match-statement 1 * ([s ] variant )
18+ match-statement = match 1 * ([s ] selector )
19+ selector = expression
20+ variant = key * (s key ) [s ] quoted-pattern
21+ key = literal / " *"
2122
22- expression = literal-expression
23- / variable-expression
24- / annotation-expression
25- literal-expression = " {" [s ] literal [s annotation ] * (s attribute ) [s ] " }"
26- variable-expression = " {" [s ] variable [s annotation ] * (s attribute ) [s ] " }"
23+ ; Expressions
24+ expression = literal-expression
25+ / variable-expression
26+ / annotation-expression
27+ literal-expression = " {" [s ] literal [s annotation ] * (s attribute ) [s ] " }"
28+ variable-expression = " {" [s ] variable [s annotation ] * (s attribute ) [s ] " }"
2729annotation-expression = " {" [s ] annotation * (s attribute ) [s ] " }"
28- annotation = function
29- / private-use-annotation
30- / reserved-annotation
3130
31+ annotation = function
32+ / private-use-annotation
33+ / reserved-annotation
34+
35+ ; Markup; Note that standalone markup is part of the first line
3236markup = " {" [s ] markup-open * (s attribute ) [s ] [" /" ] " }"
3337 / " {" [s ] markup-close * (s attribute ) [s ] " }"
3438markup-open = " #" identifier * (s option )
3539markup-close = " /" identifier
3640
37- literal = quoted / unquoted
38- quoted = " |" * (quoted-char / quoted-escape ) " |"
39- unquoted = name / number-literal
40- variable = " $" name
41- function = " :" identifier * (s option )
42- option = identifier [s ] " =" [s ] (literal / variable )
43- attribute = " @" identifier [[s ] " =" [s ] (literal / variable )]
41+ ; Expression and literal parts
42+ function = " :" identifier * (s option )
43+ option = identifier [s ] " =" [s ] (literal / variable )
44+ ; Attributes are reserved for future standardization
45+ attribute = " @" identifier [[s ] " =" [s ] (literal / variable )]
46+
47+ variable = " $" name
48+ literal = quoted / unquoted
49+ quoted = " |" * (quoted-char / quoted-escape ) " |"
50+ unquoted = name / number-literal
51+ ; number-literal matches JSON number (https://www.rfc-editor.org/rfc/rfc8259#section-6)
52+ number-literal = [" -" ] (0 / ([1-9] * DIGIT )) [" ." 1 * DIGIT ] [%i " e" [" -" / " +" ] 1 * DIGIT ]
4453
54+ ; Keywords; Note that these are case-sensitive
4555input = %s " .input"
4656local = %s " .local"
4757match = %s " .match"
4858
4959; Reserve additional .keywords for use by future versions of this specification.
5060reserved-statement = reserved-keyword [s reserved-body ] 1 * ([s ] expression )
51- ; Note that the following expression is a simplification,
61+ ; Note that the following production is a simplification,
5262; as this rule MUST NOT be considered to match existing keywords
5363; (`.input`, `.local`, and `.match`).
54- reserved-keyword = " ." name
64+ reserved-keyword = " ." name
5565
5666; Reserve additional sigils for use by future versions of this specification.
57- reserved-annotation = reserved-annotation-start reserved-body
67+ reserved-annotation = reserved-annotation-start reserved-body
5868reserved-annotation-start = " !" / " %" / " *" / " +" / " <" / " >" / " ?" / " ~"
5969
60- reserved-body = * ([s ] 1 * (reserved-char / reserved-escape / quoted ))
61-
6270; Reserve sigils for private-use by implementations.
63- private-use-annotation = private-start reserved-body
64- private-start = " ^" / " &"
65-
66- ; number-literal matches JSON number
67- ; https://www.rfc-editor.org/rfc/rfc8259#section-6
68- number-literal = [" -" ] (0 / ([1-9] * DIGIT )) [" ." 1 * DIGIT ] [%i " e" [" -" / " +" ] 1 * DIGIT ]
71+ private-use-annotation = private-start reserved-body
72+ private-start = " ^" / " &"
73+ reserved-body = * ([s ] 1 * (reserved-char / reserved-escape / quoted ))
6974
75+ ; Names and identifiers
7076; identifier matches https://www.w3.org/TR/REC-xml-names/#NT-QName
7177; name matches https://www.w3.org/TR/REC-xml-names/#NT-NCName
7278identifier = [namespace " :" ] name
@@ -80,6 +86,7 @@ name-start = ALPHA / "_"
8086name-char = name-start / DIGIT / " -" / " ."
8187 / %x B7 / %x 300 -36F / %x 203F -2040
8288
89+ ; Restrictions on characters in various contexts
8390simple-start-char = content-char / s / " @" / " |"
8491text-char = content-char / s / " ." / " @" / " |"
8592quoted-char = content-char / s / " ." / " @" / " {" / " }"
@@ -94,9 +101,11 @@ content-char = %x00-08 ; omit HTAB (%x09) and LF (%x0A)
94101 / %x 7E -D7FF ; omit surrogates
95102 / %x E000 -10FFFF
96103
104+ ; Character escapes
97105text-escape = backslash ( backslash / " {" / " }" )
98106quoted-escape = backslash ( backslash / " |" )
99107reserved-escape = backslash ( backslash / " {" / " |" / " }" )
100108backslash = %x 5C ; U+005C REVERSE SOLIDUS "\"
101109
110+ ; Whitespace
102111s = 1 * ( SP / HTAB / CR / LF / %x 3000 )
0 commit comments