Skip to content

Commit

Permalink
Merge pull request #1652 from ehuss/2024-unprefixed-guarded-strings
Browse files Browse the repository at this point in the history
2024: Add reserved syntax
  • Loading branch information
ehuss authored Nov 25, 2024
2 parents 3b28797 + 35ee2a9 commit a53efd6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -913,9 +913,31 @@ r[lex.token.reserved-prefix.edition2021]
> lexes!{'prefix#lt}
> ```
## Reserved guards
r[lex.token.reserved-guards]
r[lex.token.reserved-guards.syntax]
> **<sup>Lexer 2024+</sup>**\
> RESERVED_GUARDED_STRING_LITERAL : `#`<sup>+</sup> [STRING_LITERAL]\
> RESERVED_POUNDS : `#`<sup>2..</sup>
r[lex.token.reserved-guards.intro]
The reserved guards are syntax reserved for future use, and will generate a compile error if used.
r[lex.token.reserved-guards.string-literal]
The *reserved guarded string literal* is a token of one or more `U+0023` (`#`) immediately followed by a [STRING_LITERAL].
r[lex.token.reserved-guards.pounds]
The *reserved pounds* is a token of two or more `U+0023` (`#`).
r[lex.token.reserved-guards.edition2024]
> **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
Expand Down

0 comments on commit a53efd6

Please sign in to comment.