diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-03-23 09:00:05 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-23 09:00:05 +0000 |
commit | b9720caa100efa6758a5f0d54d3764072d83be41 (patch) | |
tree | 5b1cf22e2ed1065889d29ef358bf55968beebf3c /gcc/rust/parse/rust-parse.h | |
parent | 1d34c120c4754b921ac0520585cfef0e7a0bbb29 (diff) | |
parent | 35ca685200830626e5abd623f65a850649beace2 (diff) | |
download | gcc-b9720caa100efa6758a5f0d54d3764072d83be41.zip gcc-b9720caa100efa6758a5f0d54d3764072d83be41.tar.gz gcc-b9720caa100efa6758a5f0d54d3764072d83be41.tar.bz2 |
Merge #1044
1044: Restrict follow-up tokens on `expr` and `stmt` r=CohenArthur a=CohenArthur
This adds a base for respecting the [Macro Follow-Set Ambiguity specification](https://doc.rust-lang.org/reference/macro-ambiguity.html).
If the design is validated, adding more restrictions on other fragment specifiers should not be difficult
Addresses #947
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
Diffstat (limited to 'gcc/rust/parse/rust-parse.h')
-rw-r--r-- | gcc/rust/parse/rust-parse.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/rust/parse/rust-parse.h b/gcc/rust/parse/rust-parse.h index 9a31fb6..c86d194 100644 --- a/gcc/rust/parse/rust-parse.h +++ b/gcc/rust/parse/rust-parse.h @@ -702,6 +702,18 @@ private: std::string extract_module_path (const AST::AttrVec &inner_attrs, const AST::AttrVec &outer_attrs, const std::string &name); + +/** + * Check if a MacroMatch is allowed to follow the last parsed MacroMatch. + * + * @param last_match Last matcher parsed before the current match + * @param match Current matcher to check + * + * @return true if the follow-up is valid, false otherwise + */ +bool +is_match_compatible (AST::MacroMatch &last_match, + AST::MacroMatch ¤t_match); } // namespace Rust // as now template, include implementations of all methods |