diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2023-05-08 20:58:59 -0400 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2023-05-12 11:28:13 +0000 |
commit | 142b84e3c56252004348f57c0822dca39d437395 (patch) | |
tree | b6f6cbf2603eebd3207331cd1914b4b028a754a3 /gcc/rust/parse/rust-parse.h | |
parent | dc809645295e424285cd05df655d8c0084e546b8 (diff) | |
download | gcc-142b84e3c56252004348f57c0822dca39d437395.zip gcc-142b84e3c56252004348f57c0822dca39d437395.tar.gz gcc-142b84e3c56252004348f57c0822dca39d437395.tar.bz2 |
Handle keywords in macro fragments
gcc/rust/ChangeLog:
* lex/rust-token.cc
(token_id_is_keyword): New.
(token_id_keyword_string): New.
* lex/rust-token.h
(token_id_is_keyword): New.
(token_id_keyword_string): New.
* expand/rust-macro-expand.cc
(MacroExpander::match_fragment): Match keywords for ident fragment.
* parse/rust-parse-impl.h
(Parser::parse_identifier_or_keyword_token): Add.
* parse/rust-parse.h
(Parser::parse_identifier_or_keyword_token): Add.
gcc/testsuite/ChangeLog:
* rust/compile/macro-issue2192.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 | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/rust/parse/rust-parse.h b/gcc/rust/parse/rust-parse.h index 6957b66..71f0ff1 100644 --- a/gcc/rust/parse/rust-parse.h +++ b/gcc/rust/parse/rust-parse.h @@ -148,6 +148,7 @@ public: std::vector<std::unique_ptr<AST::LifetimeParam> > parse_lifetime_params (); AST::Visibility parse_visibility (); std::unique_ptr<AST::IdentifierPattern> parse_identifier_pattern (); + std::unique_ptr<AST::Token> parse_identifier_or_keyword_token (); std::unique_ptr<AST::TokenTree> parse_token_tree (); std::tuple<AST::SimplePath, std::unique_ptr<AST::AttrInput>, Location> parse_attribute_body (); |