Skip to content

Commit

Permalink
Updated unicode escape documentation to match current implementation.
Browse files Browse the repository at this point in the history
Unicode escapes were changed in [this
RFC](https://github.com/rust-lang/rfcs/blob/28aeb3c391c9afd344f124d3a69bdc2a420638b2/text/0446-es6-unicode-escapes.md)
to use the ES6 \u{00FFFF} syntax with a variable number of digits from
1-6, eliminating the need for two different syntaxes for unicode
literals.
  • Loading branch information
genbattle committed Feb 1, 2015
1 parent f1398d2 commit b796c1d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/doc/grammar.md
Expand Up @@ -196,8 +196,7 @@ raw_string : '"' raw_string_body '"' | '#' raw_string '#' ;
common_escape : '\x5c'
| 'n' | 'r' | 't' | '0'
| 'x' hex_digit 2
unicode_escape : 'u' hex_digit 4
| 'U' hex_digit 8 ;
unicode_escape : 'u' '{' hex_digit+ 6 '}';
hex_digit : 'a' | 'b' | 'c' | 'd' | 'e' | 'f'
| 'A' | 'B' | 'C' | 'D' | 'E' | 'F'
Expand Down
16 changes: 6 additions & 10 deletions src/doc/reference.md
Expand Up @@ -250,8 +250,7 @@ cases mentioned in [Number literals](#number-literals) below.
##### Unicode escapes
| | Name |
|---|------|
| `\u7FFF` | 16-bit character code (exactly 4 digits) |
| `\U7EEEFFFF` | 32-bit character code (exactly 8 digits) |
| `\u{7FFF}` | 24-bit Unicode character code (up to 6 digits) |

##### Numbers

Expand Down Expand Up @@ -286,8 +285,8 @@ raw_string : '"' raw_string_body '"' | '#' raw_string '#' ;
common_escape : '\x5c'
| 'n' | 'r' | 't' | '0'
| 'x' hex_digit 2
unicode_escape : 'u' hex_digit 4
| 'U' hex_digit 8 ;
unicode_escape : 'u' '{' hex_digit+ 6 '}';
hex_digit : 'a' | 'b' | 'c' | 'd' | 'e' | 'f'
| 'A' | 'B' | 'C' | 'D' | 'E' | 'F'
Expand Down Expand Up @@ -320,12 +319,9 @@ following forms:
* An _8-bit codepoint escape_ escape starts with `U+0078` (`x`) and is
followed by exactly two _hex digits_. It denotes the Unicode codepoint
equal to the provided hex value.
* A _16-bit codepoint escape_ starts with `U+0075` (`u`) and is followed
by exactly four _hex digits_. It denotes the Unicode codepoint equal to
the provided hex value.
* A _32-bit codepoint escape_ starts with `U+0055` (`U`) and is followed
by exactly eight _hex digits_. It denotes the Unicode codepoint equal to
the provided hex value.
* A _24-bit codepoint escape_ starts with `U+0075` (`u`) and is followed
by up to six _hex digits_ surrounded by braces `U+007B` (`{`) and `U+007D`
(`}`). It denotes the Unicode codepoint equal to the provided hex value.
* A _whitespace escape_ is one of the characters `U+006E` (`n`), `U+0072`
(`r`), or `U+0074` (`t`), denoting the unicode values `U+000A` (LF),
`U+000D` (CR) or `U+0009` (HT) respectively.
Expand Down

0 comments on commit b796c1d

Please sign in to comment.