-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #47752 - mark-i-m:at-most-once-rep, r=nikomatsakis
Implement `?` macro repetition See rust-lang/rfcs#2298 (with disposition merge)
- Loading branch information
Showing
12 changed files
with
374 additions
and
56 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/doc/unstable-book/src/language-features/macro-at-most-once-rep.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# `macro_at_most_once_rep` | ||
|
||
The tracking issue for this feature is: TODO(mark-i-m) | ||
|
||
With this feature gate enabled, one can use `?` as a Kleene operator meaning "0 | ||
or 1 repetitions" in a macro definition. Previously only `+` and `*` were allowed. | ||
|
||
For example: | ||
```rust | ||
macro_rules! foo { | ||
(something $(,)?) // `?` indicates `,` is "optional"... | ||
=> {} | ||
} | ||
``` | ||
|
||
------------------------ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.