]> git.proxmox.com Git - rustc.git/blob - src/doc/reference/src/identifiers.md
New upstream version 1.21.0+dfsg1
[rustc.git] / src / doc / reference / src / identifiers.md
1 # Identifiers
2
3 > **<sup>Lexer:<sup>**
4 > IDENTIFIER :
5 > &nbsp;&nbsp; &nbsp;&nbsp; XID_start XID_continue<sup>\*</sup>
6 > &nbsp;&nbsp; | `_` XID_continue<sup>+</sup>
7
8 An identifier is any nonempty Unicode[^non_ascii_idents] string of the following form:
9
10 Either
11
12 * The first character has property [`XID_start`]
13 * The remaining characters have property [`XID_continue`]
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 have property [`XID_continue`]
20
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.