]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Allow macro named macro_rules
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Tue, 10 Oct 2023 13:46:48 +0000 (15:46 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:09:17 +0000 (19:09 +0100)
commit68a8a5503729c6b45b58e0147ebba675db6fbfd5
treeab7ba8b59b6cd8f5e3ef5ab3d0dd492ea053e556
parent3d43c98bf857c42ec533cc605f157b8431aa1b4c
gccrs: Allow macro named macro_rules

Change the constraints around macro rules declaration in order to allow
macro_rules named macro as well as tighter constraint around macro rules
definitions.

gcc/rust/ChangeLog:

* parse/rust-parse-impl.h (Parser::is_macro_rules_def): Add a function
that checks tokens given by the lexer represents an accurate macro
definition. This will reduce code duplication.
(Parser::parse_item): Replace condition with call to new checking
function.
(Parser::parse_stmt): Likewise.
* parse/rust-parse.h: Add function prototype for is_macro_rules_def.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/parse/rust-parse-impl.h
gcc/rust/parse/rust-parse.h