2
2
3
3
> ** <sup >Lexer:<sup >** \
4
4
> IDENTIFIER_OR_KEYWORD :\
5
- >   ;  ;   ;  ; \[ ` a ` - ` z ` ` A ` - ` Z ` ] & nbsp ; \[ ` a ` - ` z ` ` A ` - ` Z ` ` 0 ` - ` 9 ` ` _ ` ] <sup >\* </sup >\
6
- >   ;  ; | ` _ ` \[ ` a ` - ` z ` ` A ` - ` Z ` ` 0 ` - ` 9 ` ` _ ` ] <sup >+</sup >
5
+ >   ;  ;   ;  ; XID_start XID_continue <sup >\* </sup >\
6
+ >   ;  ; | ` _ ` XID_continue <sup >+</sup >
7
7
>
8
8
> RAW_IDENTIFIER : ` r# ` IDENTIFIER_OR_KEYWORD <sub >* Except ` crate ` , ` self ` , ` super ` , ` Self ` * </sub >
9
9
>
12
12
> IDENTIFIER :\
13
13
> NON_KEYWORD_IDENTIFIER | RAW_IDENTIFIER
14
14
15
- An identifier is any nonempty ASCII string of the following form:
15
+ An identifier is any nonempty Unicode string of the following form:
16
16
17
17
Either
18
18
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 ` ] .
21
21
22
22
Or
23
23
24
24
* The first character is ` _ ` .
25
25
* 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.
27
31
28
32
A raw identifier is like a normal identifier, but prefixed by ` r# ` . (Note that
29
33
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`.
32
36
33
37
[ strict ] : keywords.md#strict-keywords
34
38
[ 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