pub struct Scanner<'a> { /* private fields */ }Implementations§
Source§impl<'a> Scanner<'a>
impl<'a> Scanner<'a>
pub fn new(src: &'a str) -> Self
pub fn pos(&self) -> Position
pub fn src(&self) -> &'a str
pub fn src_slice(&self, start: usize, end: usize) -> &'a str
Sourcepub fn set_pos(&mut self, pos: Position)
pub fn set_pos(&mut self, pos: Position)
Set position. Used for backtracking when a heuristic match fails.
pub fn is_eof(&self) -> bool
pub fn peek(&self) -> Option<u8>
pub fn peek_at(&self, offset: usize) -> Option<u8>
pub fn advance(&mut self) -> Option<u8>
pub fn skip_line(&mut self)
Sourcepub fn skip_trivia(&mut self)
pub fn skip_trivia(&mut self)
Skip whitespace and Erlang % ... comments. Stops at the first
non-trivia byte.
Sourcepub fn consume_string(&mut self)
pub fn consume_string(&mut self)
Consume a string literal starting at ", leaving the cursor
just past the closing quote. Handles escaped characters minimally.
Sourcepub fn consume_quoted_atom(&mut self)
pub fn consume_quoted_atom(&mut self)
Consume a quoted-atom literal starting at ', leaving the cursor
just past the closing quote. Does not validate the contents.
Sourcepub fn consume_char_literal(&mut self)
pub fn consume_char_literal(&mut self)
Consume a $c, $\n, or $\^X character literal.
Sourcepub fn consume_identifier(&mut self) -> &'a str
pub fn consume_identifier(&mut self) -> &'a str
Read an unquoted identifier (atom or variable). Returns the slice of source covered.
Sourcepub fn consume_macro_ref(&mut self) -> &'a str
pub fn consume_macro_ref(&mut self) -> &'a str
Read a ?MACRO reference returning the macro name without the ?.
Sourcepub fn skip_balanced_parens(&mut self) -> u32
pub fn skip_balanced_parens(&mut self) -> u32
Skip a balanced parenthesized expression, beginning at (.
Tracks nested (), [], {}, strings, and atoms.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Scanner<'a>
impl<'a> RefUnwindSafe for Scanner<'a>
impl<'a> Send for Scanner<'a>
impl<'a> Sync for Scanner<'a>
impl<'a> Unpin for Scanner<'a>
impl<'a> UnsafeUnpin for Scanner<'a>
impl<'a> UnwindSafe for Scanner<'a>
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