Struct rustc_expand::mbe::macro_parser::TtParser
source · [−]pub struct TtParser<'tt> {
macro_name: Ident,
cur_items: Vec<Box<MatcherPos<'tt>>>,
next_items: Vec<Box<MatcherPos<'tt>>>,
bb_items: Vec<Box<MatcherPos<'tt>>>,
}Fields
macro_name: Identcur_items: Vec<Box<MatcherPos<'tt>>>The set of current items to be processed. This should be empty by the end of a successful
execution of parse_tt_inner.
next_items: Vec<Box<MatcherPos<'tt>>>The set of newly generated items. These are used to replenish cur_items in the function
parse_tt.
bb_items: Vec<Box<MatcherPos<'tt>>>The set of items that are waiting for the black-box parser.
Implementations
sourceimpl<'tt> TtParser<'tt>
impl<'tt> TtParser<'tt>
pub(super) fn new(macro_name: Ident) -> TtParser<'tt>
sourcefn parse_tt_inner(
&mut self,
sess: &ParseSess,
ms: &[TokenTree],
token: &Token
) -> Option<ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>>>
fn parse_tt_inner(
&mut self,
sess: &ParseSess,
ms: &[TokenTree],
token: &Token
) -> Option<ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>>>
Process the matcher positions of cur_items until it is empty. In the process, this will
produce more items in next_items and bb_items.
For more info about the how this happens, see the module-level doc comments and the inline comments of this function.
Returns
Some(result) if everything is finished, None otherwise. Note that matches are kept
track of through the items generated.
sourcepub(super) fn parse_tt(
&mut self,
parser: &mut Cow<'_, Parser<'_>>,
ms: &'tt [TokenTree]
) -> ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>>
pub(super) fn parse_tt(
&mut self,
parser: &mut Cow<'_, Parser<'_>>,
ms: &'tt [TokenTree]
) -> ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>>
Use the given slice of token trees (ms) as a matcher. Match the token stream from the
given parser against it and return the match.
fn ambiguity_error(
&self,
token_span: Span
) -> ParseResult<FxHashMap<MacroRulesNormalizedIdent, NamedMatch>>
Auto Trait Implementations
impl<'tt> !RefUnwindSafe for TtParser<'tt>
impl<'tt> !Send for TtParser<'tt>
impl<'tt> !Sync for TtParser<'tt>
impl<'tt> Unpin for TtParser<'tt>
impl<'tt> !UnwindSafe for TtParser<'tt>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
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: 88 bytes