]> git.proxmox.com Git - rustc.git/blame - src/doc/reference/src/identifiers.md
New upstream version 1.21.0+dfsg1
[rustc.git] / src / doc / reference / src / identifiers.md
CommitLineData
8bb4bdeb
XL
1# Identifiers
2
3b2f2976
XL
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
8bb4bdeb
XL
8An identifier is any nonempty Unicode[^non_ascii_idents] string of the following form:
9
10Either
11
7cac9316
XL
12 * The first character has property [`XID_start`]
13 * The remaining characters have property [`XID_continue`]
8bb4bdeb
XL
14
15Or
16
17 * The first character is `_`
18 * The identifier is more than one character, `_` alone is not an identifier
7cac9316 19 * The remaining characters have property [`XID_continue`]
8bb4bdeb
XL
20
21that does _not_ occur in the set of [keywords].
22
7cac9316 23> **Note**: [`XID_start`] and [`XID_continue`] as character properties cover the
8bb4bdeb
XL
24> character ranges used to form the more familiar C and Java language-family
25> identifiers.
26
7cac9316
XL
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=
3b2f2976 31[keywords]: keywords.html
8bb4bdeb
XL
32[^non_ascii_idents]: Non-ASCII characters in identifiers are currently feature
33 gated. This is expected to improve soon.