Skip to content

Commit a8e1afb

Browse files
committed
Add a grammar rule for reserved tokens
This adds a grammar rule that collects all the reserved token forms into a single production rule so that we can define what a "token" is by referring to this.
1 parent 420f4d3 commit a8e1afb

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/tokens.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,26 @@ them are referred to as "token trees" in [macros]. The three types of brackets
902902
| `[` `]` | Square brackets |
903903
| `(` `)` | Parentheses |
904904

905+
r[lex.token.reserved]
906+
## Reserved tokens
907+
908+
r[lex.token.reserved.intro]
909+
Several token forms are reserved for future use. It is an error for the source input to match one of these forms.
910+
911+
r[lex.token.reserved.syntax]
912+
913+
> **<sup>Lexer</sup>**\
914+
> RESERVED_TOKEN :\
915+
> &nbsp;&nbsp; &nbsp;&nbsp; RESERVED_GUARDED_STRING_LITERAL\
916+
> &nbsp;&nbsp; | RESERVED_NUMBER\
917+
> &nbsp;&nbsp; | RESERVED_POUNDS\
918+
> &nbsp;&nbsp; | RESERVED_RAW_IDENTIFIER\
919+
> &nbsp;&nbsp; | RESERVED_RAW_LIFETIME\
920+
> &nbsp;&nbsp; | RESERVED_TOKEN_DOUBLE_QUOTE\
921+
> &nbsp;&nbsp; | RESERVED_TOKEN_LIFETIME\
922+
> &nbsp;&nbsp; | RESERVED_TOKEN_POUND\
923+
> &nbsp;&nbsp; | RESERVED_TOKEN_SINGLE_QUOTE
924+
905925
r[lex.token.reserved-prefix]
906926
## Reserved prefixes
907927

0 commit comments

Comments
 (0)