diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-03-25 10:23:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-25 10:23:43 +0000 |
commit | a7e723469220b6765463d27b3e19ffd27f1baadd (patch) | |
tree | 2466ee1fda8728f68cada39716855edc35b66534 /gcc/rust/ast/rust-macro.h | |
parent | 89ad4f21f25a2501bb9bb96338be4a6edb89bbcd (diff) | |
parent | 7ea35487a215ccd9a34c46a5a17194c61dbfb9d9 (diff) | |
download | gcc-a7e723469220b6765463d27b3e19ffd27f1baadd.zip gcc-a7e723469220b6765463d27b3e19ffd27f1baadd.tar.gz gcc-a7e723469220b6765463d27b3e19ffd27f1baadd.tar.bz2 |
Merge #1055
1055: Allow keeping list of last matches to check against r=CohenArthur a=CohenArthur
When trying to figure out if a match can follow another, we must figure
out whether or not that match is in the follow-set of the other. If that
match is zeroable (i.e a repetition using the * or ? kleene operators),
then we must be able to check the match after them: should our current
match not be present, the match after must be part of the follow-set.
This commits allows us to performs such checks properly and to "look
past" zeroable matches. This is not done with any lookahead, simply by
keeping a list of pointers to possible previous matches and checking all
of them for ambiguities.
Addresses #947
Closes #947
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
Diffstat (limited to 'gcc/rust/ast/rust-macro.h')
-rw-r--r-- | gcc/rust/ast/rust-macro.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-macro.h b/gcc/rust/ast/rust-macro.h index 2b50ac1..1d92283 100644 --- a/gcc/rust/ast/rust-macro.h +++ b/gcc/rust/ast/rust-macro.h @@ -291,6 +291,10 @@ public: MacroRepOp get_op () const { return op; } const std::unique_ptr<MacroRepSep> &get_sep () const { return sep; } std::vector<std::unique_ptr<MacroMatch> > &get_matches () { return matches; } + const std::vector<std::unique_ptr<MacroMatch> > &get_matches () const + { + return matches; + } protected: /* Use covariance to implement clone function as returning this object rather @@ -366,6 +370,10 @@ public: DelimType get_delim_type () const { return delim_type; } std::vector<std::unique_ptr<MacroMatch> > &get_matches () { return matches; } + const std::vector<std::unique_ptr<MacroMatch> > &get_matches () const + { + return matches; + } protected: /* Use covariance to implement clone function as returning this object rather |