diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2023-06-26 13:06:10 -0400 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2023-06-27 07:50:44 +0000 |
commit | 96ba341e0fd4799bcd22535fc2166a9ac96628ca (patch) | |
tree | 499e9808e9954aa1f00603443f6a24c822d4e12b /gcc/rust/parse/rust-parse.h | |
parent | 4c07c94212e2cc43bf4c01eb195347821791659b (diff) | |
download | gcc-96ba341e0fd4799bcd22535fc2166a9ac96628ca.zip gcc-96ba341e0fd4799bcd22535fc2166a9ac96628ca.tar.gz gcc-96ba341e0fd4799bcd22535fc2166a9ac96628ca.tar.bz2 |
Match tokens in macros more closely
gcc/rust/ChangeLog:
* expand/rust-macro-expand.cc
(MacroExpander::match_token): Match token instead of token id.
* parse/rust-parse-impl.h
(Parser::skip_token): Add token-skipping variant.
(Parser::expect_token): Likewise.
* parse/rust-parse.h
(Parser::skip_token): Likewise.
(Parser::expect_token): Likewise.
gcc/testsuite/ChangeLog:
* rust/compile/macro-issue2264.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust/parse/rust-parse.h')
-rw-r--r-- | gcc/rust/parse/rust-parse.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/rust/parse/rust-parse.h b/gcc/rust/parse/rust-parse.h index 6202574..1d49c95 100644 --- a/gcc/rust/parse/rust-parse.h +++ b/gcc/rust/parse/rust-parse.h @@ -112,6 +112,15 @@ public: bool skip_token (TokenId t); /** + * Consume a token, reporting an error if it isn't the next token + * + * @param token pointer to similar token to consume + * + * @return true if the token was next, false if it wasn't found + */ + bool skip_token (const_TokenPtr token); + + /** * Same as `skip_token` but allows for failure without necessarily reporting * an error * @@ -172,6 +181,7 @@ private: void skip_after_end_attribute (); const_TokenPtr expect_token (TokenId t); + const_TokenPtr expect_token (const_TokenPtr token_expect); void unexpected_token (const_TokenPtr t); bool skip_generics_right_angle (); |