Skip to content

Commit 6d0d8b0

Browse files
committed
2024: Add reserved syntax
1 parent 7ce3563 commit 6d0d8b0

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
@@ -756,9 +756,24 @@ Similarly the `r`, `b`, `br`, `c`, and `cr` prefixes used in raw string literals
756756
> lexes!{match"..." {}}
757757
> ```
758758
759+
## Reserved guards
760+
761+
> **<sup>Lexer 2024+</sup>**\
762+
> RESERVED_GUARDED_STRING_LITERAL : `#`<sup>+</sup> [STRING_LITERAL]\
763+
> RESERVED_POUNDS : `#`<sup>2..</sup>
764+
765+
The reserved guards are syntax reserved for future use, and will generate a compile error if used.
766+
767+
The *reserved guarded string literal* is a token of one or more `U+0023` (`#`) immediately followed by a [STRING_LITERAL].
768+
769+
The *reserved pounds* is a token of two or more `U+0023` (`#`).
770+
771+
> **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.
772+
759773
[Inferred types]: types/inferred.md
760774
[Range patterns]: patterns.md#range-patterns
761775
[Reference patterns]: patterns.md#reference-patterns
776+
[STRING_LITERAL]: tokens.md#string-literals
762777
[Subpattern binding]: patterns.md#identifier-patterns
763778
[Wildcard patterns]: patterns.md#wildcard-pattern
764779
[arith]: expressions/operator-expr.md#arithmetic-and-logical-binary-operators

0 commit comments

Comments
 (0)