pub(super) trait Tracker<'matcher> {
// Required methods
fn prepare(
&mut self,
which_matcher: WhichMatcher,
matcher: &'matcher [MatcherLoc],
);
fn before_match_loc(
&mut self,
parser: &TtParser,
matcher: &'matcher MatcherLoc,
);
fn matched_one(&mut self, parser: &Parser<'_>, loc_index: usize);
fn after_arm(
&mut self,
result: &ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>>,
);
fn failure(&mut self, parser: &Parser<'_>);
fn ambiguity(&mut self, parser: &Parser<'_>);
fn description() -> &'static str;
fn recovery() -> Recovery;
}Required Methods§
Sourcefn prepare(
&mut self,
which_matcher: WhichMatcher,
matcher: &'matcher [MatcherLoc],
)
fn prepare( &mut self, which_matcher: WhichMatcher, matcher: &'matcher [MatcherLoc], )
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 matched_one(&mut self, parser: &Parser<'_>, loc_index: usize)
fn matched_one(&mut self, parser: &Parser<'_>, loc_index: usize)
A MatcherLoc successfully consumed input from the parser.
This is called for MatcherLoc::Token and MatcherLoc::SequenceSep, which consume
single tokens, when they successfully match Parser::token. It is also called for
MatcherLoc::MetaVarDecl when non-terminal parsing is guaranteed to occur (i.e. after
Parser::nonterminal_may_begin_with() returns true).
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<'_>)
fn ambiguity(&mut self, parser: &Parser<'_>)
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".