diff options
| author | Nick Sarten <gen.battle@gmail.com> | 2015-02-01 16:42:22 +1300 |
|---|---|---|
| committer | Nick Sarten <gen.battle@gmail.com> | 2015-02-01 16:42:22 +1300 |
| commit | b796c1d6141b0677b2d2401cf65215b5438901ef (patch) | |
| tree | c92f438a6554a37a22df0a547bbe4a38fd0736f7 /src/doc/reference.md | |
| parent | f1398d2736f132dd4af828b3d9134691f924b7e1 (diff) | |
| download | rust-b796c1d6141b0677b2d2401cf65215b5438901ef.tar.gz rust-b796c1d6141b0677b2d2401cf65215b5438901ef.zip | |
Updated unicode escape documentation to match current implementation.
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.
Diffstat (limited to 'src/doc/reference.md')
| -rw-r--r-- | src/doc/reference.md | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md index 936c0aac79f..156054871da 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -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 @@ -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' @@ -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. |
