Skip to content

Commit b7ea86c

Browse files
committed
Non-ASCII chars in identifiers aren't supported yet
1 parent b5aeaa2 commit b7ea86c

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

src/identifiers.md

+29-8
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,34 @@
22

33
> **<sup>Lexer:<sup>**
44
> IDENTIFIER :
5-
> &nbsp;&nbsp; &nbsp;&nbsp; XID_start XID_continue<sup>\*</sup>
6-
> &nbsp;&nbsp; | `_` XID_continue<sup>+</sup>
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>
77
8-
An identifier is any nonempty Unicode[^non_ascii_idents] string of the following form:
8+
An identifier is any nonempty ASCII[^non_ascii_idents] string of the following form:
9+
10+
Either
11+
12+
* The first character is a letter
13+
* The remaining characters are alphanumeric or `_`
14+
15+
Or
16+
17+
* The first character is `_`
18+
* The identifier is more than one character, `_` alone is not an identifier
19+
* The remaining characters are alphanumeric or `_`
20+
21+
[keywords]: keywords.html
22+
23+
[^non_ascii_idents] Non-ASCII characters in identifiers are currently feature-gated. See [issue #28979](https://github.com/rust-lang/rust/issues/28979).
24+
25+
<!-- When non-ascii identifiers are actually supported:
26+
27+
> **<sup>Lexer:<sup>**
28+
> IDENTIFIER :
29+
> &nbsp;&nbsp; &nbsp;&nbsp; XID_start XID_continue<sup>\*</sup>
30+
> &nbsp;&nbsp; | `_` XID_continue<sup>+</sup>
31+
32+
An identifier is any nonempty Unicode string of the following form:
933
1034
Either
1135
@@ -23,11 +47,8 @@ that does _not_ occur in the set of [keywords].
2347
> **Note**: [`XID_start`] and [`XID_continue`] as character properties cover the
2448
> character ranges used to form the more familiar C and Java language-family
2549
> identifiers.
26-
27-
2850
2951
[`XID_start`]: http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Start%3A%5D&abb=on&g=&i=
3052
[`XID_continue`]: http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Continue%3A%5D&abb=on&g=&i=
31-
[keywords]: keywords.html
32-
[^non_ascii_idents]: Non-ASCII characters in identifiers are currently feature
33-
gated. This is expected to improve soon.
53+
54+
-->

0 commit comments

Comments
 (0)