8000 Collapse all escape sequence rules into one · unicode-org/message-format-wg@df21039 · GitHub
[go: up one dir, main page]

Skip to content

Commit df21039

Browse files
committed
Collapse all escape sequence rules into one
1 parent 6d7b4ba commit df21039

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

spec/message.abnf

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
message = simple-message / complex-message
22

33
simple-message = [simple-start pattern]
4-
simple-start = simple-start-char / text-escape / placeholder
5-
pattern = *(text-char / text-escape / placeholder)
4+
simple-start = simple-start-char / escaped-char / placeholder
5+
pattern = *(text-char / escaped-char / placeholder)
66
placeholder = expression / markup
77

88
complex-message = *(declaration [s]) complex-body
@@ -43,7 +43,7 @@ attribute = "@" identifier [[s] "=" [s] (literal / variable)]
4343

4444
variable = "$" name
4545
literal = quoted / unquoted
46-
quoted = "|" *(quoted-char / quoted-escape) "|"
46+
quoted = "|" *(quoted-char / escaped-char) "|"
4747
unquoted = name / number-literal
4848
; number-literal matches JSON number (https://www.rfc-editor.org/rfc/rfc8259#section-6)
4949
number-literal = ["-"] (%x30 / (%x31-39 *DIGIT)) ["." 1*DIGIT] [%i"e" ["-" / "+"] 1*DIGIT]
@@ -67,7 +67,7 @@ reserved-annotation-start = "!" / "%" / "*" / "+" / "<" / ">" / "?" / "~"
6767
; Reserve sigils for private-use by implementations.
6868
private-use-annotation = private-start reserved-body
6969
private-start = "^" / "&"
70-
reserved-body = *([s] 1*(reserved-char / reserved-escape / quoted))
70+
reserved-body = *([s] 1*(reserved-char / escaped-char / quoted))
7171

7272
; Names and identifiers
7373
; identifier matches https://www.w3.org/TR/REC-xml-names/#NT-QName
@@ -100,10 +100,8 @@ content-char = %x01-08 ; omit NULL (%x00), HTAB (%x09) and LF (%x0A)
100100
/ %xE000-10FFFF
101101

102102
; Character escapes
103-
text-escape = backslash ( backslash / "{" / "}" )
104-
quoted-escape = backslash ( backslash / "|" )
105-
reserved-escape = backslash ( backslash / "{" / "|" / "}" )
106-
backslash = %x5C ; U+005C REVERSE SOLIDUS "\"
103+
escaped-char = backslash ( backslash / "{" / "|" / "}" )
104+
backslash = %x5C ; U+005C REVERSE SOLIDUS "\"
107105

108106
; Whitespace
109107
s = 1*( SP / HTAB / CR / LF / %x3000 )

spec/syntax.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ An empty string is a valid _simple message_.
149149

150150
```abnf
151151
simple-message = [simple-start pattern]
152-
simple-start = simple-start-char / text-escape / placeholder
152+
simple-start = simple-start-char / escaped-char / placeholder
153153
```
154154

155155
A **_<dfn>complex message</dfn>_** is any _message_ that contains _declarations_,
@@ -255,7 +255,7 @@ Unless there is an error, resolving a _message_ always results in the formatting
255255
of a single _pattern_.
256256

257257
```abnf
258-
pattern = *(text-char / text-escape / placeholder)
258+
pattern = *(text-char / escaped-char / placeholder)
259259
```
260260
A _pattern_ MAY be empty.
261261

@@ -291,7 +291,7 @@ U+007B LEFT CURLY BRACKET `{`, and U+007D RIGHT CURLY BRACKET `}`
291291
MUST be escaped as `\\`, `\{`, and `\}` respectively.
292292
293293
In the ABNF, _text_ is represented by non-empty sequences of
294-
`simple-start-char`, `text-char`, and `text-escape`.
294+
`simple-start-char`, `text-char`, and `escaped-char`.
295295
The first of these is used at the start of a _simple message_,
296296
and matches `text-char` except for not allowing U+002E FULL STOP `.`.
297297
The ABNF uses `content-char` as a shared base for _text_ and _quoted literal_ characters.
@@ -656,7 +656,7 @@ unrecognized _reserved-annotations_ or _private-use-annotations_ have no meaning
656656
reserved-annotation = reserved-annotation-start reserved-body
657657
reserved-annotation-start = "!" / "%" / "*" / "+" / "<" / ">" / "?" / "~"
658658
659-
reserved-body = *([s] 1*(reserved-char / reserved-escape / quoted))
659+
reserved-body = *([s] 1*(reserved-char / escaped-char / quoted))
660660
```
661661
662662
## Markup
@@ -830,7 +830,7 @@ of number values in _operands_ or _options_, or as _keys_ for _variants_.
830830

831831
```abnf
832832
literal = quoted / unquoted
833-
quoted = "|" *(quoted-char / quoted-escape) "|"
833+
quoted = "|" *(quoted-char / escaped-char) "|"
834834
unquoted = name / number-literal
835835
number-literal = ["-"] (%x30 / (%x31-39 *DIGIT)) ["." 1*DIGIT] [%i"e" ["-" / "+"] 1*DIGIT]
836836
```
@@ -912,14 +912,13 @@ An **_<dfn>escape sequence</dfn>_** is a two-character sequence starting with
912912
U+005C REVERSE SOLIDUS `\`.
913913

914914
An _escape sequence_ allows the appearance of lexically meaningful characters
915-
in the body of _text_, _quoted_, or _reserved_ (which includes, in this case,
916-
_private-use_) sequences respectively:
915+
in the body of _text_, _quoted_, or _reserved_
916+
(which includes, in this case, _private-use_) sequences.
917+
Each _escape sequence_ represents the literal character immediately following the initial `\`.
917918

918919
```abnf
919-
text-escape = backslash ( backslash / "{" / "}" )
920-
quoted-escape = backslash ( backslash / "|" )
921-
reserved-escape = backslash ( backslash / "{" / "|" / "}" )
922-
backslash = %x5C ; U+005C REVERSE SOLIDUS "\"
920+
escaped-char = backslash ( backslash / "{" / "|" / "}" )
921+
backslash = %x5C ; U+005C REVERSE SOLIDUS "\"
923922
```
924923

925924
### Whitespace

0 commit comments

Comments
 (0)
0