Skip to content

Commit ce0b7cc

Browse files
committedMay 16, 2018
Fix grammar documentation wrt Unicode identifiers
The grammar defines identifiers in terms of XID_start and XID_continue, but this is referring to the unstable non_ascii_idents feature. The documentation implies that non_ascii_idents is forthcoming, but this is left over from pre-1.0 documentation; in reality, non_ascii_idents has been without even an RFC for several years now, and will not be stabilized anytime soon. Furthermore, according to the tracking issue at rust-lang#28979 , it's highly questionable whether or not this feature will use XID_start or XID_continue even when or if non_ascii_idents is stabilized. This commit fixes this by respecifying identifiers as the usual [a-zA-Z_][a-zA-Z0-9_]*
1 parent f0fdaba commit ce0b7cc

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed
 

‎src/doc/grammar.md

+6-11
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,15 @@ properties: `ident`, `non_null`, `non_eol`, `non_single_quote` and
101101

102102
### Identifiers
103103

104-
The `ident` production is any nonempty Unicode[^non_ascii_idents] string of
104+
The `ident` production is any nonempty Unicode string of
105105
the following form:
106106

107-
[^non_ascii_idents]: Non-ASCII characters in identifiers are currently feature
108-
gated. This is expected to improve soon.
107+
- The first character is in one of the following ranges `U+0041` to `U+005A`
108+
("A" to "Z"), `U+0061` to `U+007A` ("a" to "z"), or `U+005F` ("\_").
109+
- The remaining characters are in the range `U+0030` to `U+0039` ("0" to "9"),
110+
or any of the prior valid initial characters.
109111

110-
- The first character has property `XID_start`
111-
- The remaining characters have property `XID_continue`
112-
113-
that does _not_ occur in the set of [keywords](#keywords).
114-
115-
> **Note**: `XID_start` and `XID_continue` as character properties cover the
116-
> character ranges used to form the more familiar C and Java language-family
117-
> identifiers.
112+
as long as the identifier does _not_ occur in the set of [keywords](#keywords).
118113

119114
### Delimiter-restricted productions
120115

0 commit comments

Comments
 (0)