diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-03-07 08:47:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-07 08:47:19 +0000 |
commit | 366c53371ad40025984a98e01b02d452d49816aa (patch) | |
tree | c43d12ae5fa1058e4a944682720a5100c9111eb9 /gcc/rust/ast/rust-macro.h | |
parent | b82408fd6a17762fcb6fc7b5efe9307a3e59f8b7 (diff) | |
parent | 0c7e16e1258b67ba8efa1b019802bee4d802d4a5 (diff) | |
download | gcc-366c53371ad40025984a98e01b02d452d49816aa.zip gcc-366c53371ad40025984a98e01b02d452d49816aa.tar.gz gcc-366c53371ad40025984a98e01b02d452d49816aa.tar.bz2 |
Merge #991
991: Match and expand macro separators properly r=CohenArthur a=CohenArthur
More nice recursive macros:
```rust
macro_rules! add {
($e:expr | $($es:expr) | *) => {
$e + add!($($es) | *)
};
($e:expr) => {
$e
};
}
add!(1 | 2 | 3 | 4 | 5 | 6);
```
Closes #968
This PR needs #986 to be merged first, as it depends on it for the test cases. You can skip reviewing the first two commits which are just from #986
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
Diffstat (limited to 'gcc/rust/ast/rust-macro.h')
-rw-r--r-- | gcc/rust/ast/rust-macro.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-macro.h b/gcc/rust/ast/rust-macro.h index 2b39624..d625ad2d 100644 --- a/gcc/rust/ast/rust-macro.h +++ b/gcc/rust/ast/rust-macro.h @@ -206,6 +206,7 @@ public: } MacroRepOp get_op () const { return op; } + const std::unique_ptr<MacroRepSep> &get_sep () const { return sep; } std::vector<std::unique_ptr<MacroMatch> > &get_matches () { return matches; } protected: |