From 014ec49138ed95fd8bb30ee89b8ca8909d5b3246 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 12 Oct 2024 09:32:14 -0700 Subject: [PATCH] 2024: Add reserved syntax --- src/tokens.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/tokens.md b/src/tokens.md index 774a73b9f..1ba44b654 100644 --- a/src/tokens.md +++ b/src/tokens.md @@ -887,9 +887,24 @@ r[lex.token.reserved-prefix.edition2021] > lexes!{match"..." {}} > ``` +## Reserved guards + +> **Lexer 2024+**\ +> RESERVED_GUARDED_STRING_LITERAL : `#`+ [STRING_LITERAL]\ +> RESERVED_POUNDS : `#`2.. + +The reserved guards are syntax reserved for future use, and will generate a compile error if used. + +The *reserved guarded string literal* is a token of one or more `U+0023` (`#`) immediately followed by a [STRING_LITERAL]. + +The *reserved pounds* is a token of two or more `U+0023` (`#`). + +> **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. + [Inferred types]: types/inferred.md [Range patterns]: patterns.md#range-patterns [Reference patterns]: patterns.md#reference-patterns +[STRING_LITERAL]: tokens.md#string-literals [Subpattern binding]: patterns.md#identifier-patterns [Wildcard patterns]: patterns.md#wildcard-pattern [arith]: expressions/operator-expr.md#arithmetic-and-logical-binary-operators