struct Scanner {
frames: Vec<Frame>,
recent: Vec<Token>,
last: Option<Token>,
last_name: Option<String>,
name_before_last: Option<String>,
newline_after_last: bool,
pending: Option<(BlockKind, usize, bool)>,
closed_call_block: Option<BlockKind>,
closed_if: bool,
}Fields§
§frames: Vec<Frame>§recent: Vec<Token>Tokens other than line breaks, most recent last, up to LOOK_BACK.
last: Option<Token>§last_name: Option<String>§name_before_last: Option<String>The name scanned before last_name, which is an element’s when the two are a
top-level element and its name, as in window settings(.
newline_after_last: bool§pending: Option<(BlockKind, usize, bool)>The block the next { at this depth opens, set by fn, if and the like.
closed_call_block: Option<BlockKind>What a { right after the call just closed would open.
closed_if: boolImplementations§
Source§impl Scanner
impl Scanner
fn new() -> Self
fn token(&mut self, text: &str, token: Token)
Sourcefn pop(&mut self) -> Option<Frame>
fn pop(&mut self) -> Option<Frame>
Closes the innermost frame. The top level is never closed, so a stray closing bracket leaves the cursor at the top level.
fn expect_block(&mut self, kind: BlockKind, from_if: bool)
fn open_block(&mut self, closed_call_block: Option<BlockKind>)
fn open_paren(&mut self)
fn label_argument(&mut self)
fn enclosing_block(&self) -> BlockKind
fn kinds(&self) -> Vec<TokenKind>
Sourcefn last_name(&self) -> Option<String>
fn last_name(&self) -> Option<String>
The name just scanned; callers check the last token is a name.
fn in_string(&self) -> bool
fn innermost_call(&self) -> Option<Call>
fn slot(&self) -> Slot
fn block_slot(&self, kind: BlockKind, kinds: &[TokenKind]) -> Slot
Auto Trait Implementations§
impl Freeze for Scanner
impl RefUnwindSafe for Scanner
impl Send for Scanner
impl Sync for Scanner
impl Unpin for Scanner
impl UnsafeUnpin for Scanner
impl UnwindSafe for Scanner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more