diff --git a/spec/message.abnf b/spec/message.abnf index 465c7fd89b..05cd05997c 100644 --- a/spec/message.abnf +++ b/spec/message.abnf @@ -1,8 +1,8 @@ message = simple-message / complex-message simple-message = [simple-start pattern] -simple-start = simple-start-char / text-escape / placeholder -pattern = *(text-char / text-escape / placeholder) +simple-start = simple-start-char / escaped-char / placeholder +pattern = *(text-char / escaped-char / placeholder) placeholder = expression / markup complex-message = *(declaration [s]) complex-body @@ -43,7 +43,7 @@ attribute = "@" identifier [[s] "=" [s] (literal / variable)] variable = "$" name literal = quoted / unquoted -quoted = "|" *(quoted-char / quoted-escape) "|" +quoted = "|" *(quoted-char / escaped-char) "|" unquoted = name / number-literal ; number-literal matches JSON number (https://www.rfc-editor.org/rfc/rfc8259#section-6) number-literal = ["-"] (%x30 / (%x31-39 *DIGIT)) ["." 1*DIGIT] [%i"e" ["-" / "+"] 1*DIGIT] @@ -68,7 +68,7 @@ reserved-annotation-start = "!" / "%" / "*" / "+" / "<" / ">" / "?" / "~" private-use-annotation = private-start [[s] reserved-body] private-start = "^" / "&" reserved-body = reserved-body-part *([s] reserved-body-part) -reserved-body-part = reserved-char / reserved-escape / quoted +reserved-body-part = reserved-char / escaped-char / quoted ; Names and identifiers ; identifier matches https://www.w3.org/TR/REC-xml-names/#NT-QName @@ -101,10 +101,8 @@ content-char = %x01-08 ; omit NULL (%x00), HTAB (%x09) and LF (%x0A) / %xE000-10FFFF ; Character escapes -text-escape = backslash ( backslash / "{" / "}" ) -quoted-escape = backslash ( backslash / "|" ) -reserved-escape = backslash ( backslash / "{" / "|" / "}" ) -backslash = %x5C ; U+005C REVERSE SOLIDUS "\" +escaped-char = backslash ( backslash / "{" / "|" / "}" ) +backslash = %x5C ; U+005C REVERSE SOLIDUS "\" ; Whitespace s = 1*( SP / HTAB / CR / LF / %x3000 ) diff --git a/spec/syntax.md b/spec/syntax.md index f1073675e1..b7bfced64f 100644 --- a/spec/syntax.md +++ b/spec/syntax.md @@ -149,7 +149,7 @@ An empty string is a valid _simple message_. ```abnf simple-message = [simple-start pattern] -simple-start = simple-start-char / text-escape / placeholder +simple-start = simple-start-char / escaped-char / placeholder ``` A **_complex message_** is any _message_ that contains _declarations_, @@ -255,7 +255,7 @@ Unless there is an error, resolving a _message_ always results in the formatting of a single _pattern_. ```abnf -pattern = *(text-char / text-escape / placeholder) +pattern = *(text-char / escaped-char / placeholder) ``` A _pattern_ MAY be empty. @@ -291,7 +291,7 @@ U+007B LEFT CURLY BRACKET `{`, and U+007D RIGHT CURLY BRACKET `}` MUST be escaped as `\\`, `\{`, and `\}` respectively. In the ABNF, _text_ is represented by non-empty sequences of -`simple-start-char`, `text-char`, and `text-escape`. +`simple-start-char`, `text-char`, and `escaped-char`. The first of these is used at the start of a _simple message_, and matches `text-char` except for not allowing U+002E FULL STOP `.`. The ABNF uses `content-char` as a shared base for _text_ and _quoted literal_ characters. @@ -666,7 +666,7 @@ reserved-annotation = reserved-annotation-start [[s] reserved-body] reserved-annotation-start = "!" / "%" / "*" / "+" / "<" / ">" / "?" / "~" reserved-body = reserved-body-part *([s] reserved-body-part) -reserved-body-part = reserved-char / reserved-escape / quoted +reserved-body-part = reserved-char / escaped-char / quoted ``` ## Markup @@ -843,7 +843,7 @@ of number values in _operands_ or _options_, or as _keys_ for _variants_. ```abnf literal = quoted / unquoted -quoted = "|" *(quoted-char / quoted-escape) "|" +quoted = "|" *(quoted-char / escaped-char) "|" unquoted = name / number-literal number-literal = ["-"] (%x30 / (%x31-39 *DIGIT)) ["." 1*DIGIT] [%i"e" ["-" / "+"] 1*DIGIT] ``` @@ -925,14 +925,13 @@ An **_escape sequence_** is a two-character sequence starting with U+005C REVERSE SOLIDUS `\`. An _escape sequence_ allows the appearance of lexically meaningful characters -in the body of _text_, _quoted_, or _reserved_ (which includes, in this case, -_private-use_) sequences respectively: +in the body of _text_, _quoted_, or _reserved_ +(which includes, in this case, _private-use_) sequences. +Each _escape sequence_ represents the literal character immediately following the initial `\`. ```abnf -text-escape = backslash ( backslash / "{" / "}" ) -quoted-escape = backslash ( backslash / "|" ) -reserved-escape = backslash ( backslash / "{" / "|" / "}" ) -backslash = %x5C ; U+005C REVERSE SOLIDUS "\" +escaped-char = backslash ( backslash / "{" / "|" / "}" ) +backslash = %x5C ; U+005C REVERSE SOLIDUS "\" ``` ### Whitespace