Skip to content

Commit 4a33624

Browse files
committed
---
yaml --- r: 1440 b: refs/heads/master c: dabccad h: refs/heads/master v: v3
1 parent 379173f commit 4a33624

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 69464aae62aef5a65fcf5bb79ab18f8967f32206
2+
refs/heads/master: dabccadd3202513ab0bcb424e2c62c90ab23062d

trunk/doc/rust.texi

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -592,10 +592,12 @@ or interrupted by ignored characters.
592592

593593
Most tokens in Rust follow rules similar to the C family.
594594

595-
Most tokens (including identifiers, whitespace, keywords, operators and
596-
structural symbols) are drawn from the ASCII-compatible range of
597-
Unicode. String and character literals, however, may include the full range of
598-
Unicode characters.
595+
Most tokens (including whitespace, keywords, operators and structural symbols)
596+
are drawn from the ASCII-compatible range of Unicode. Identifiers are drawn
597+
from Unicode characters specified by the @code{XID_start} and
598+
@code{XID_continue} rules given by UAX #31@footnote{Unicode Standard Annex
599+
#31: Unicode Identifier and Pattern Syntax}. String and character literals may
600+
include the full range of Unicode characters.
599601

600602
@emph{TODO: formalize this section much more}.
601603

@@ -638,18 +640,22 @@ token or a syntactic extension token. Multi-line comments may be nested.
638640
@c * Ref.Lex.Ident:: Identifier tokens.
639641
@cindex Identifier token
640642

641-
Identifiers follow the pattern of C identifiers: they begin with a
642-
@emph{letter} or @emph{underscore}, and continue with any combination of
643-
@emph{letters}, @emph{decimal digits} and underscores, and must not be equal
644-
to any keyword or reserved token. @xref{Ref.Lex.Key}. @xref{Ref.Lex.Res}.
643+
Identifiers follow the rules given by Unicode Standard Annex #31, in the form
644+
closed under NFKC normalization, @emph{excluding} those tokens that are
645+
otherwise defined as keywords or reserved
646+
tokens. @xref{Ref.Lex.Key}. @xref{Ref.Lex.Res}.
645647

646-
A @emph{letter} is a Unicode character in the ranges U+0061-U+007A and
647-
U+0041-U+005A (@code{'a'}-@code{'z'} and @code{'A'}-@code{'Z'}).
648+
That is: an identifier starts with any character having derived property
649+
@code{XID_Start} and continues with zero or more characters having derived
650+
property @code{XID_Continue}; and such an identifier is NFKC-normalized during
651+
lexing, such that all subsequent comparison of identifiers is performed on the
652+
NFKC-normalized forms.
648653

649-
An @dfn{underscore} is the character U+005F ('_').
654+
@emph{TODO: define relationship between Unicode and Rust versions}.
650655

651-
A @dfn{decimal digit} is a character in the range U+0030-U+0039
652-
(@code{'0'}-@code{'9'}).
656+
@footnote{This identifier syntax is a superset of the identifier syntaxes of C
657+
and Java, and is modeled on Python PEP #3131, which formed the definition of
658+
identifiers in Python 3.0 and later.}
653659

654660
@node Ref.Lex.Key
655661
@subsection Ref.Lex.Key

0 commit comments

Comments
 (0)