diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-03-18 16:20:47 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-03-23 09:56:23 +0100 |
commit | 35ca685200830626e5abd623f65a850649beace2 (patch) | |
tree | aed3eeb63995c6cced4bdeed0f327ceaf3d618e8 /gcc/rust/expand/rust-macro-expand.cc | |
parent | cc6e405912c83aee41efd3015d9157cdbe9134fe (diff) | |
download | gcc-35ca685200830626e5abd623f65a850649beace2.zip gcc-35ca685200830626e5abd623f65a850649beace2.tar.gz gcc-35ca685200830626e5abd623f65a850649beace2.tar.bz2 |
macros: Add base functions to check for follow-set ambiguities
Rust does not allow for all macro fragments to be followed by any kind
of tokens: We must check tokens following those fragments that might
contain restrictions and make sure that they are allowed, conforming to
the Macro Follow-Set Ambiguity specification
Co-authored-by: philberty <philip.herron@embecosm.com>
macro-frag-spec: Transform enum into a class
This allows us to add methods on the fragment specifier, which are
needed to make sure that follow-set ambiguities are respected
tests: Add tests for forbidden follow-up tokens
This also fix a test that was previously accepted but invalid: rustc
also rejected it
Diffstat (limited to 'gcc/rust/expand/rust-macro-expand.cc')
-rw-r--r-- | gcc/rust/expand/rust-macro-expand.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc index 6b26f98..35bd84a 100644 --- a/gcc/rust/expand/rust-macro-expand.cc +++ b/gcc/rust/expand/rust-macro-expand.cc @@ -439,7 +439,7 @@ bool MacroExpander::match_fragment (Parser<MacroInvocLexer> &parser, AST::MacroMatchFragment &fragment) { - switch (fragment.get_frag_spec ()) + switch (fragment.get_frag_spec ().get_kind ()) { case AST::MacroFragSpec::EXPR: parser.parse_expr (); |