pub(super) trait Tracker<'matcher> {
type Failure;
// Required methods
fn build_failure(
tok: Token,
position: u32,
msg: &'static str,
) -> Self::Failure;
fn description() -> &'static str;
// Provided methods
fn before_match_loc(
&mut self,
_parser: &TtParser,
_matcher: &'matcher MatcherLoc,
) { ... }
fn after_arm(
&mut self,
_result: &ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>, Self::Failure>,
) { ... }
fn recovery() -> Recovery { ... }
fn set_expected_token(&mut self, _tok: &'matcher Token) { ... }
fn get_expected_token(&self) -> Option<&'matcher Token> { ... }
}
Required Associated Types§
Required Methods§
sourcefn build_failure(tok: Token, position: u32, msg: &'static str) -> Self::Failure
fn build_failure(tok: Token, position: u32, msg: &'static str) -> Self::Failure
Arm failed to match. If the token is token::Eof
, it indicates an unexpected
end of macro invocation. Otherwise, it indicates that no rules expected the given token.
The usize is the approximate position of the token in the input token stream.
sourcefn description() -> &'static str
fn description() -> &'static str
For tracing.
Provided Methods§
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>, Self::Failure>,
)
fn after_arm( &mut self, _result: &ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>, Self::Failure>, )
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
).
fn recovery() -> Recovery
fn set_expected_token(&mut self, _tok: &'matcher Token)
fn get_expected_token(&self) -> Option<&'matcher Token>
Object Safety§
This trait is not object safe.