Skip to content

Commit

Permalink
update pat2015/2021 parts
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-i-m committed Apr 22, 2021
1 parent 100fa06 commit 4b574ca
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/macros-by-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
>
> _MacroFragSpec_ :\
>       `block` | `expr` | `ident` | `item` | `lifetime` | `literal`\
>    | `meta` | `pat` | `pat2015` | `pat2021` | `path` | `stmt` | `tt` | `ty` | `vis`
>    | `meta` | `pat` | `pat_param` | `path` | `stmt` | `tt` | `ty` | `vis`
>
> _MacroRepSep_ :\
> &nbsp;&nbsp; [_Token_]<sub>_except delimiters and repetition operators_</sub>
Expand Down Expand Up @@ -122,9 +122,8 @@ fragment specifiers are:
* `block`: a [_BlockExpression_]
* `stmt`: a [_Statement_] without the trailing semicolon (except for item
statements that require semicolons)
* `pat2015`: a [_PatternNoTopAlt_]
* `pat2021`: a [_Pattern_]
* `pat`: equivalent to either `pat2015` or `pat2021`, depending on edition (see note below).
* `pat_param`: a [_PatternNoTopAlt_]
* `pat`: equivalent to `pat_param`
* `expr`: an [_Expression_]
* `ty`: a [_Type_]
* `ident`: an [IDENTIFIER_OR_KEYWORD]
Expand All @@ -135,11 +134,6 @@ fragment specifiers are:
* `vis`: a possibly empty [_Visibility_] qualifier
* `literal`: matches `-`<sup>?</sup>[_LiteralExpression_]

> **Edition Differences**: In Editions 2015 and 2018, `pat` fragment-specifiers
> do not allow top-level or-patterns (i.e. they accept [_PatternNoTopAlt_]). In
> Edition 2021, this was changed so that top-level or-patterns are accepted by
> `pat` (i.e. [_Pattern_]).
In the transcriber, metavariables are referred to simply by `$`_name_, since
the fragment kind is specified in the matcher. Metavariables are replaced with
the syntax element that matched them. The keyword metavariable `$crate` can be
Expand Down Expand Up @@ -495,7 +489,6 @@ For more detail, see the [formal specification].
[_Item_]: items.md
[_LiteralExpression_]: expressions/literal-expr.md
[_MetaListIdents_]: attributes.md#meta-item-attribute-syntax
[_Pattern_]: patterns.md
[_PatternNoTopAlt_]: patterns.md
[_Statement_]: statements.md
[_TokenTree_]: macros.md#macro-invocation
Expand Down

0 comments on commit 4b574ca

Please sign in to comment.