Skip to content

Commit 7bfc70e

Browse files
authored
Merge pull request #111 from brauliobz/grammar_identifiers
Non-ASCII chars in identifiers aren't supported yet
2 parents 16c2cc2 + 0e4342e commit 7bfc70e

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

src/identifiers.md

+7-19
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,20 @@
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:
99

1010
Either
1111

12-
* The first character has property [`XID_start`]
13-
* The remaining characters have property [`XID_continue`]
12+
* The first character is a letter
13+
* The remaining characters are alphanumeric or `_`
1414

1515
Or
1616

1717
* The first character is `_`
1818
* The identifier is more than one character, `_` alone is not an identifier
19-
* The remaining characters have property [`XID_continue`]
19+
* The remaining characters are alphanumeric or `_`
2020

21-
that does _not_ occur in the set of [keywords].
22-
23-
> **Note**: [`XID_start`] and [`XID_continue`] as character properties cover the
24-
> character ranges used to form the more familiar C and Java language-family
25-
> identifiers.
26-
27-
28-
29-
[`XID_start`]: http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Start%3A%5D&abb=on&g=&i=
30-
[`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.
21+
[^non_ascii_idents] Non-ASCII characters in identifiers are currently feature-gated. See [issue #28979](https://github.com/rust-lang/rust/issues/28979).

0 commit comments

Comments
 (0)