Skip to content

Commit aa780d2

Browse files
authored
Port ABNF changes and fomatting to syntax document (#657)
* Port ABNF changes and formatting to syntax document * Revert syntax document matching ABNF whitespace, format for snippet context
1 parent 3e30503 commit aa780d2

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

spec/syntax.md

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ An empty string is a valid _simple message_.
136136

137137
```abnf
138138
simple-message = [simple-start pattern]
139-
simple-start = simple-start-char / text-escape / placeholder
139+
simple-start = simple-start-char / text-escape / placeholder
140140
```
141141

142142
A **_<dfn>complex message</dfn>_** is any _message_ that contains _declarations_,
@@ -167,7 +167,7 @@ For compatibility with later MessageFormat 2 specification versions,
167167
_declarations_ MAY also include _reserved statements_.
168168

169169
```abnf
170-
declaration = input-declaration / local-declaration / reserved-statement
170+
declaration = input-declaration / local-declaration / reserved-statement
171171
input-declaration = input [s] variable-expression
172172
local-declaration = local s variable [s] "=" [s] expression
173173
```
@@ -209,8 +209,8 @@ a similarly wide range of content as _reserved annotations_,
209209
but it MUST end with one or more _expressions_.
210210
211211
```abnf
212-
reserved-statement = reserved-keyword [s reserved-body] 1*expression
213-
reserved-keyword = "." 2*(%x61-7A)
212+
reserved-statement = reserved-keyword [s reserved-body] 1*([s] expression)
213+
reserved-keyword = "." name
214214
```
215215
216216
> [!Note]
@@ -289,6 +289,8 @@ be preserved during formatting.
289289
```abnf
290290
simple-start-char = content-char / s / "@" / "|"
291291
text-char = content-char / s / "." / "@" / "|"
292+
quoted-char = content-char / s / "." / "@" / "{" / "}"
293+
reserved-char = content-char / "."
292294
content-char = %x00-08 ; omit HTAB (%x09) and LF (%x0A)
293295
/ %x0B-0C ; omit CR (%x0D)
294296
/ %x0E-19 ; omit SP (%x20)
@@ -346,7 +348,7 @@ satisfied:
346348
or contain a _variable_ that directly or indirectly references a _declaration_ with an _annotation_.
347349

348350
```abnf
349-
matcher = match-statement 1*([s] variant)
351+
matcher = match-statement 1*([s] variant)
350352
match-statement = match 1*([s] selector)
351353
```
352354

@@ -412,7 +414,7 @@ Whitespace is permitted but not required between the last _key_ and the _quoted
412414
413415
```abnf
414416
variant = key *(s key) [s] quoted-pattern
415-
key = literal / "*"
417+
key = literal / "*"
416418
```
417419
418420
#### Key
@@ -444,9 +446,11 @@ optionally followed by an _annotation_.
444446
An **_<dfn>annotation-expression</dfn>_** contains an _annotation_ without an _operand_.
445447

446448
```abnf
447-
expression = literal-expression / variable-expression / annotation-expression
448-
literal-expression = "{" [s] literal [s annotation] *(s attribute) [s] "}"
449-
variable-expression = "{" [s] variable [s annotation] *(s attribute) [s] "}"
449+
expression = literal-expression
450+
/ variable-expression
451+
/ annotation-expression
452+
literal-expression = "{" [s] literal [s annotation] *(s attribute) [s] "}"
453+
variable-expression = "{" [s] variable [s annotation] *(s attribute) [s] "}"
450454
annotation-expression = "{" [s] annotation *(s attribute) [s] "}"
451455
```
452456

@@ -605,7 +609,7 @@ A _private-use annotation_ MAY be empty after its introducing sigil.
605609
606610
```abnf
607611
private-use-annotation = private-start reserved-body
608-
private-start = "^" / "&"
612+
private-start = "^" / "&"
609613
```
610614
611615
> [!Note]
@@ -647,11 +651,10 @@ While a reserved sequence is technically "well-formed",
647651
unrecognized _reserved-annotations_ or _private-use-annotations_ have no meaning.
648652
649653
```abnf
650-
reserved-annotation = reserved-annotation-start reserved-body
654+
reserved-annotation = reserved-annotation-start reserved-body
651655
reserved-annotation-start = "!" / "%" / "*" / "+" / "<" / ">" / "?" / "~"
652656
653-
reserved-body = *([s] 1*(reserved-char / reserved-escape / quoted))
654-
reserved-char = content-char / "."
657+
reserved-body = *([s] 1*(reserved-char / reserved-escape / quoted))
655658
```
656659
657660
## Markup
@@ -785,13 +788,9 @@ A _number-literal_ uses the same syntax as JSON and is intended for the encoding
785788
of number values in _operands_ or _options_, or as _keys_ for _variants_.
786789

787790
```abnf
788-
literal = quoted / unquoted
789-
791+
literal = quoted / unquoted
790792
quoted = "|" *(quoted-char / quoted-escape) "|"
791-
quoted-char = content-char / s / "." / "@" / "{" / "}"
792-
793-
unquoted = name
794-
/ number-literal
793+
unquoted = name / number-literal
795794
number-literal = ["-"] (%x30 / (%x31-39 *DIGIT)) ["." 1*DIGIT] [%i"e" ["-" / "+"] 1*DIGIT]
796795
```
797796

@@ -848,8 +847,8 @@ Support for _namespaces_ and their interpretation is implementation-defined
848847
in this release.
849848
850849
```abnf
851-
variable = "$" name
852-
option = identifier [s] "=" [s] (literal / variable)
850+
variable = "$" name
851+
option = identifier [s] "=" [s] (literal / variable)
853852
854853
identifier = [namespace ":"] name
855854
namespace = name
@@ -873,10 +872,10 @@ in the body of _text_, _quoted_, or _reserved_ (which includes, in this case,
873872
_private-use_) sequences respectively:
874873

875874
```abnf
876-
text-escape = backslash ( backslash / "{" / "}" )
877-
quoted-escape = backslash ( backslash / "|" )
878-
reserve-escape = backslash ( backslash / "{" / "|" / "}" )
879-
backslash = %x5C ; U+005C REVERSE SOLIDUS "\"
875+
text-escape = backslash ( backslash / "{" / "}" )
876+
quoted-escape = backslash ( backslash / "|" )
877+
reserved-escape = backslash ( backslash / "{" / "|" / "}" )
878+
backslash = %x5C ; U+005C REVERSE SOLIDUS "\"
880879
```
881880

882881
### Whitespace

0 commit comments

Comments
 (0)