Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion text/mbe-macro-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Captures are written as a dollar (`$`) followed by an identifier, a colon (`:`),
* `path`: a path (e.g. `foo`, `::std::mem::replace`, `transmute::<_, int>`, …)
* `meta`: a meta item; the things that go inside `#[...]` and `#![...]` attributes
* `tt`: a single token tree
* `literal`: a literal (e.g. "string", 'c', 1)

For example, here is a macro which captures its input as an expression:

Expand Down Expand Up @@ -105,7 +106,7 @@ Patterns can contain repetitions. These allow a sequence of tokens to be matche
* `$` is a literal dollar token.
* `( ... )` is the paren-grouped pattern being repeated.
* `sep` is an *optional* separator token. Common examples are `,`, and `;`.
* `rep` is the *required* repeat control. Currently, this can be *either* `*` (indicating zero or more repeats) or `+` (indicating one or more repeats). You cannot write "zero or one" or any other more specific counts or ranges.
* `rep` is the *required* repeat control. Currently, this can be *either* `*` (indicating zero or more repeats), `+` (indicating one or more repeats), or `?` (indicating zero or one repeats). You cannot write "one or two" or any other more specific counts or ranges.

Repetitions can contain any other valid pattern, including literal token trees, captures, and other repetitions.

Expand Down