pub struct TtParser {
    macro_name: Ident,
    cur_mps: Vec<MatcherPos>,
    next_mps: Vec<MatcherPos>,
    bb_mps: Vec<MatcherPos>,
    empty_matches: Rc<Vec<NamedMatch>>,
}

Fields§

§macro_name: Ident§cur_mps: Vec<MatcherPos>

The set of current mps to be processed. This should be empty by the end of a successful execution of parse_tt_inner.

§next_mps: Vec<MatcherPos>

The set of newly generated mps. These are used to replenish cur_mps in the function parse_tt.

§bb_mps: Vec<MatcherPos>

The set of mps that are waiting for the black-box parser.

§empty_matches: Rc<Vec<NamedMatch>>

Pre-allocate an empty match array, so it can be cloned cheaply for macros with many rules that have no metavars.

Implementations§

source§

impl TtParser

source

pub(super) fn new(macro_name: Ident) -> TtParser

source

pub(super) fn has_no_remaining_items_for_step(&self) -> bool

source

fn parse_tt_inner<'matcher, T: Tracker<'matcher>>( &mut self, matcher: &'matcher [MatcherLoc], token: &Token, approx_position: usize, track: &mut T ) -> Option<ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>, T::Failure>>

Process the matcher positions of cur_mps until it is empty. In the process, this will produce more mps in next_mps and bb_mps.

Returns

Some(result) if everything is finished, None otherwise. Note that matches are kept track of through the mps generated.

source

pub(super) fn parse_tt<'matcher, T: Tracker<'matcher>>( &mut self, parser: &mut Cow<'_, Parser<'_>>, matcher: &'matcher [MatcherLoc], track: &mut T ) -> ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>, T::Failure>

Match the token stream from parser against matcher.

source

fn ambiguity_error<F>( &self, matcher: &[MatcherLoc], token_span: Span ) -> ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>, F>

source

fn nameize<I: Iterator<Item = NamedMatch>, F>( &self, matcher: &[MatcherLoc], res: I ) -> ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>, F>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 96 bytes