Struct rustc_parse::parser::TokenCursor
source · struct TokenCursor {
tree_cursor: TokenTreeCursor,
stack: Vec<(TokenTreeCursor, Delimiter, DelimSpan)>,
desugar_doc_comments: bool,
num_next_calls: usize,
break_last_token: bool,
}
Expand description
Iterator over a TokenStream
that produces Token
s. It’s a bit odd that
we (a) lex tokens into a nice tree structure (TokenStream
), and then (b)
use this type to emit them as a linear sequence. But a linear sequence is
what the parser expects, for the most part.
Fields§
§tree_cursor: TokenTreeCursor
§stack: Vec<(TokenTreeCursor, Delimiter, DelimSpan)>
§desugar_doc_comments: bool
§num_next_calls: usize
§break_last_token: bool
Implementations§
source§impl TokenCursor
impl TokenCursor
fn next(&mut self, desugar_doc_comments: bool) -> (Token, Spacing)
sourcefn inlined_next(&mut self, desugar_doc_comments: bool) -> (Token, Spacing)
fn inlined_next(&mut self, desugar_doc_comments: bool) -> (Token, Spacing)
This always-inlined version should only be used on hot code paths.
fn desugar( &mut self, attr_style: AttrStyle, data: Symbol, span: Span ) -> Vec<TokenTree>
Trait Implementations§
source§impl Clone for TokenCursor
impl Clone for TokenCursor
source§fn clone(&self) -> TokenCursor
fn clone(&self) -> TokenCursor
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for TokenCursor
impl !Send for TokenCursor
impl !Sync for TokenCursor
impl Unpin for TokenCursor
impl !UnwindSafe for TokenCursor
Blanket Implementations§
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: 56 bytes