File tree Expand file tree Collapse file tree 3 files changed +21
-8
lines changed Expand file tree Collapse file tree 3 files changed +21
-8
lines changed Original file line number Diff line number Diff line change 11# Identifiers
22
33> ** <sup >Lexer:<sup >**
4- > IDENTIFIER :
4+ > IDENTIFIER_OR_KEYWORD :
55>   ;  ;   ;  ; [ ` a ` -` z ` ` A ` -` Z ` ]   ; [ ` a ` -` z ` ` A ` -` Z ` ` 0 ` -` 9 ` ` _ ` ] <sup >\* </sup >
66>   ;  ; | ` _ ` [ ` a ` -` z ` ` A ` -` Z ` ` 0 ` -` 9 ` ` _ ` ] <sup >+</sup >
7+ >
8+ > IDENTIFIER :
9+ > IDENTIFIER_OR_KEYWORD <sub >* Except a [ strict] or [ reserved] keyword* </sub >
710
811An identifier is any nonempty ASCII string of the following form:
912
1013Either
1114
12- * The first character is a letter
13- * The remaining characters are alphanumeric or ` _ `
15+ * The first character is a letter.
16+ * The remaining characters are alphanumeric or ` _ ` .
1417
1518Or
1619
17- * The first character is ` _ `
18- * The identifier is more than one character, ` _ ` alone is not an identifier
19- * The remaining characters are alphanumeric or ` _ `
20+ * The first character is ` _ ` .
21+ * The identifier is more than one character. ` _ ` alone is not an identifier.
22+ * The remaining characters are alphanumeric or ` _ ` .
23+
24+ [ strict ] : keywords.html#strict-keywords
25+ [ reserved ] : keywords.html#reserved-keywords
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ syntax named by _designator_. Valid designators are:
2626* ` pat ` : a [ pattern]
2727* ` expr ` : an [ expression]
2828* ` ty ` : a [ type]
29- * ` ident ` : an [ identifier]
29+ * ` ident ` : an [ identifier] or [ keyword ]
3030* ` path ` : a [ path]
3131* ` tt ` : a token tree (a single [ token] by matching ` () ` , ` [] ` , or ` {} ` )
3232* ` meta ` : the contents of an [ attribute]
@@ -38,6 +38,7 @@ syntax named by _designator_. Valid designators are:
3838[ expression ] : expressions.html
3939[ type ] : types.html
4040[ identifier ] : identifiers.html
41+ [ keyword ] : keyword.html
4142[ path ] : paths.html
4243[ token ] : tokens.html
4344[ attribute ] : attributes.html
Original file line number Diff line number Diff line change @@ -486,10 +486,16 @@ The two values of the boolean type are written `true` and `false`.
486486## Lifetimes and loop labels
487487
488488> ** <sup >Lexer</sup >**
489+ > LIFETIME_TOKEN
490+ >   ;  ;   ;  ; ` ' ` [ IDENTIFIER_OR_KEYWORD] [ identifier ]
491+ >   ;  ; | ` '_ `
492+ >
489493> LIFETIME_OR_LABEL:
490494>   ;  ;   ;  ; ` ' ` [ IDENTIFIER] [ identifier ]
491495
492- Lifetime parameters and [ loop labels] both use this syntax.
496+ Lifetime parameters and [ loop labels] use LIFETIME_OR_LABEL tokens. Any
497+ LIFETIME_TOKEN will be accepted by the lexer, and for example, can be used in
498+ macros.
493499
494500[ loop labels ] : expressions/loop-expr.html
495501
You can’t perform that action at this time.
0 commit comments