pub(super) trait Tracker<'matcher> {
// Required methods
fn prepare(&mut self, which_matcher: WhichMatcher);
fn before_match_loc(
&mut self,
parser: &TtParser,
matcher: &'matcher MatcherLoc,
);
fn after_arm(
&mut self,
result: &ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>>,
);
fn failure(&mut self, parser: &Parser<'_>);
fn ambiguity(
&mut self,
parser: &Parser<'_>,
bb_locs: impl IntoIterator<Item = &'matcher MatcherLoc>,
next_locs: impl IntoIterator<Item = &'matcher MatcherLoc>,
);
fn description() -> &'static str;
fn recovery() -> Recovery;
}Required Methods§
Sourcefn prepare(&mut self, which_matcher: WhichMatcher)
fn prepare(&mut self, which_matcher: WhichMatcher)
Provide context on the arm that’s about to be matched.
Sourcefn before_match_loc(&mut self, parser: &TtParser, matcher: &'matcher MatcherLoc)
fn before_match_loc(&mut self, parser: &TtParser, matcher: &'matcher MatcherLoc)
This is called before trying to match next MatcherLoc on the current token.
Sourcefn after_arm(
&mut self,
result: &ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>>,
)
fn after_arm( &mut self, result: &ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>>, )
This is called after an arm has been parsed, either successfully or unsuccessfully. When
this is called, before_match_loc was called at least once (with a MatcherLoc::Eof).
Sourcefn failure(&mut self, parser: &Parser<'_>)
fn failure(&mut self, parser: &Parser<'_>)
The arm could not be matched successfully.
If the parser is located at token::Eof, it indicates an unexpected end of macro
invocation. Otherwise, the parser is located at a token in the middle of the input, and it
indicates that no rules in the arm expected the given token.
The parser will return NamedParseResult::Failure after calling this.
Sourcefn ambiguity(
&mut self,
parser: &Parser<'_>,
bb_locs: impl IntoIterator<Item = &'matcher MatcherLoc>,
next_locs: impl IntoIterator<Item = &'matcher MatcherLoc>,
)
fn ambiguity( &mut self, parser: &Parser<'_>, bb_locs: impl IntoIterator<Item = &'matcher MatcherLoc>, next_locs: impl IntoIterator<Item = &'matcher MatcherLoc>, )
An ambiguity error occurred.
The parser will return NamedParseResult::Ambiguity after calling this.
Sourcefn description() -> &'static str
fn description() -> &'static str
For tracing.
fn recovery() -> Recovery
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".