Skip to content

Commit 014ec49

Browse files
committed
2024: Add reserved syntax
1 parent da0f6da commit 014ec49

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/tokens.md

+15
Original file line numberDiff line numberDiff line change
@@ -887,9 +887,24 @@ r[lex.token.reserved-prefix.edition2021]
887887
> lexes!{match"..." {}}
888888
> ```
889889
890+
## Reserved guards
891+
892+
> **<sup>Lexer 2024+</sup>**\
893+
> RESERVED_GUARDED_STRING_LITERAL : `#`<sup>+</sup> [STRING_LITERAL]\
894+
> RESERVED_POUNDS : `#`<sup>2..</sup>
895+
896+
The reserved guards are syntax reserved for future use, and will generate a compile error if used.
897+
898+
The *reserved guarded string literal* is a token of one or more `U+0023` (`#`) immediately followed by a [STRING_LITERAL].
899+
900+
The *reserved pounds* is a token of two or more `U+0023` (`#`).
901+
902+
> **Edition differences**: Before the 2024 edition, reserved guards are accepted by the lexer and interpreted as multiple tokens. For example, the `#"foo"#` form is interpreted as three tokens. `##` is interpreted as two tokens.
903+
890904
[Inferred types]: types/inferred.md
891905
[Range patterns]: patterns.md#range-patterns
892906
[Reference patterns]: patterns.md#reference-patterns
907+
[STRING_LITERAL]: tokens.md#string-literals
893908
[Subpattern binding]: patterns.md#identifier-patterns
894909
[Wildcard patterns]: patterns.md#wildcard-pattern
895910
[arith]: expressions/operator-expr.md#arithmetic-and-logical-binary-operators

0 commit comments

Comments
 (0)