aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/expand/rust-macro-expand.h
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-02-22 09:39:25 +0000
committerGitHub <noreply@github.com>2022-02-22 09:39:25 +0000
commit133beb6d0f286b022600682f024d9c3c77705029 (patch)
treefb93d10fdaa54592ae8d451dbf7bf352cbd72558 /gcc/rust/expand/rust-macro-expand.h
parent796465596faa9fa69ffede1c16d944e6a6e24458 (diff)
parent91aca2c19eba35a46d1e3276d71ccdd6e2f752c0 (diff)
downloadgcc-133beb6d0f286b022600682f024d9c3c77705029.zip
gcc-133beb6d0f286b022600682f024d9c3c77705029.tar.gz
gcc-133beb6d0f286b022600682f024d9c3c77705029.tar.bz2
Merge #955
955: matched_fragment: Track and set fragment match amount r=CohenArthur a=CohenArthur Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
Diffstat (limited to 'gcc/rust/expand/rust-macro-expand.h')
-rw-r--r--gcc/rust/expand/rust-macro-expand.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/rust/expand/rust-macro-expand.h b/gcc/rust/expand/rust-macro-expand.h
index d49c775..94f495c 100644
--- a/gcc/rust/expand/rust-macro-expand.h
+++ b/gcc/rust/expand/rust-macro-expand.h
@@ -99,12 +99,22 @@ struct MatchedFragment
std::string fragment_ident;
size_t token_offset_begin;
size_t token_offset_end;
+ size_t match_amount;
+
+ MatchedFragment (std::string identifier, size_t token_offset_begin,
+ size_t token_offset_end, size_t match_amount = 0)
+ : fragment_ident (identifier), token_offset_begin (token_offset_begin),
+ token_offset_end (token_offset_end), match_amount (match_amount)
+ {}
std::string as_string () const
{
return fragment_ident + "=" + std::to_string (token_offset_begin) + ":"
- + std::to_string (token_offset_end);
+ + std::to_string (token_offset_end) + " (matched "
+ + std::to_string (match_amount) + " times)";
}
+
+ void set_match_amount (size_t new_amount) { match_amount = new_amount; }
};
class SubstitutionScope