Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1de49c8

Browse files
authored
Recommend not escaping all the things (#793)
* Recommend not escaping all the things * Update spec/syntax.md
1 parent 86a9ee2 commit 1de49c8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spec/syntax.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,16 @@ escaped-char = backslash ( backslash / "{" / "|" / "}" )
943943
backslash = %x5C ; U+005C REVERSE SOLIDUS "\"
944944
```
945945

946+
> [!NOTE]
947+
> The `escaped-char` rule allows escaping some characters in places where
948+
> they do not need to be escaped, such as braces in a _quoted_ _literal_.
949+
> For example, `|foo {bar}|` and `|foo \{bar\}|` are synonymous.
950+
951+
When writing or generating a _message_, escape sequences SHOULD NOT be used
952+
unless required by the syntax.
953+
That is, inside _literals_ only escape `|`
954+
and inside _patterns_ only escape `{` and `}`.
955+
946956
### Whitespace
947957

948958
**_<dfn>Whitespace</dfn>_** is defined as one or more of

0 commit comments

Comments
 (0)