Skip to content

Commit bf03819

Browse files
authored
Merge pull request #999 from crlf0710/non-ascii-idents
Move non-ascii-idents content from unstable book to reference.
2 parents e1abb17 + 28d6281 commit bf03819

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/identifiers.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
> **<sup>Lexer:<sup>**\
44
> IDENTIFIER_OR_KEYWORD :\
5-
> &nbsp;&nbsp; &nbsp;&nbsp; \[`a`-`z` `A`-`Z`]&nbsp;\[`a`-`z` `A`-`Z` `0`-`9` `_`]<sup>\*</sup>\
6-
> &nbsp;&nbsp; | `_` \[`a`-`z` `A`-`Z` `0`-`9` `_`]<sup>+</sup>
5+
> &nbsp;&nbsp; &nbsp;&nbsp; XID_start XID_continue<sup>\*</sup>\
6+
> &nbsp;&nbsp; | `_` XID_continue<sup>+</sup>
77
>
88
> RAW_IDENTIFIER : `r#` IDENTIFIER_OR_KEYWORD <sub>*Except `crate`, `self`, `super`, `Self`*</sub>
99
>
@@ -12,18 +12,22 @@
1212
> IDENTIFIER :\
1313
> NON_KEYWORD_IDENTIFIER | RAW_IDENTIFIER
1414
15-
An identifier is any nonempty ASCII string of the following form:
15+
An identifier is any nonempty Unicode string of the following form:
1616

1717
Either
1818

19-
* The first character is a letter.
20-
* The remaining characters are alphanumeric or `_`.
19+
* The first character has property [`XID_start`].
20+
* The remaining characters have property [`XID_continue`].
2121

2222
Or
2323

2424
* The first character is `_`.
2525
* The identifier is more than one character. `_` alone is not an identifier.
26-
* The remaining characters are alphanumeric or `_`.
26+
* The remaining characters have property [`XID_continue`].
27+
28+
> **Note**: [`XID_start`] and [`XID_continue`] as character properties cover the
29+
> character ranges used to form the more familiar C and Java language-family
30+
> identifiers.
2731
2832
A raw identifier is like a normal identifier, but prefixed by `r#`. (Note that
2933
the `r#` prefix is not included as part of the actual identifier.)
@@ -32,3 +36,5 @@ keyword except the ones listed above for `RAW_IDENTIFIER`.
3236

3337
[strict]: keywords.md#strict-keywords
3438
[reserved]: keywords.md#reserved-keywords
39+
[`XID_start`]: http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Start%3A%5D&abb=on&g=&i=
40+
[`XID_continue`]: http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Continue%3A%5D&abb=on&g=&i=

0 commit comments

Comments
 (0)