Skip to content

Commit c4dff64

Browse files
committed
Allow bare underscore identifiers
1 parent a6da03a commit c4dff64

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

text/0000-non-ascii-idents.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ The lexer defines identifiers as:
6868
> **<sup>Lexer:<sup>**
6969
> IDENTIFIER_OR_KEYWORD:
7070
> &nbsp;&nbsp; XID_Start&nbsp;XID_Continue<sup>\*</sup>
71-
> &nbsp;&nbsp; | `_` XID_Continue<sup>+</sup>
71+
> &nbsp;&nbsp; | `_` XID_Continue<sup>*</sup>
7272
>
7373
> IDENTIFIER :
7474
> IDENTIFIER_OR_KEYWORD <sub>*Except a [strict] or [reserved] keyword*</sub>
7575
76-
`XID_Start` and `XID_Continue` are used as defined in the aforementioned standard. The definition of identifiers is forward compatible with each successive release of Unicode as only appropriate new characters are added to the classes but none are removed.
76+
`XID_Start` and `XID_Continue` are used as defined in the aforementioned standard. The definition of identifiers is forward compatible with each successive release of Unicode as only appropriate new characters are added to the classes but none are removed. We effectively are using UAX 31's default definition of valid identifier, with a tailoring that underscores are included with `XID_Start`. (Note that this allows bare underscores to be identifiers, that is currently also the case with `_` in identifier contexts being a reserved keyword)
7777

7878
Parsers for Rust syntax normalize identifiers to [NFC][UAX15]. Every API accepting raw identifiers (such as `proc_macro::Ident::new` normalizes them to NFC and APIs returning them as strings (like `proc_macro::Ident::to_string`) return the normalized form. This means two identifiers are equal if their NFC forms are equal.
7979

0 commit comments

Comments
 (0)