pub struct Scanner { /* private fields */ }Expand description
Scanner that tokenizes TOON input into a sequence of tokens.
Implementations§
Source§impl Scanner
impl Scanner
Sourcepub fn set_active_delimiter(&mut self, delimiter: Option<Delimiter>)
pub fn set_active_delimiter(&mut self, delimiter: Option<Delimiter>)
Set the active delimiter for tokenizing array elements.
Sourcepub fn current_position(&self) -> (usize, usize)
pub fn current_position(&self) -> (usize, usize)
Get the current position (line, column).
pub fn get_line(&self) -> usize
pub fn get_column(&self) -> usize
pub fn peek(&self) -> Option<char>
pub fn count_leading_spaces(&self) -> usize
pub fn count_spaces_after_newline(&self) -> usize
pub fn peek_ahead(&self, offset: usize) -> Option<char>
pub fn advance(&mut self) -> Option<char>
pub fn skip_whitespace(&mut self)
Sourcepub fn scan_token(&mut self) -> Result<Token, ToonError>
pub fn scan_token(&mut self) -> Result<Token, ToonError>
Scan the next token from the input.
pub fn get_last_line_indent(&self) -> usize
Sourcepub fn read_rest_of_line_with_space_info(&mut self) -> (String, bool)
pub fn read_rest_of_line_with_space_info(&mut self) -> (String, bool)
Read the rest of the current line (until newline or EOF). Returns the content with a flag indicating if it started with whitespace.
Sourcepub fn read_rest_of_line(&mut self) -> String
pub fn read_rest_of_line(&mut self) -> String
Read the rest of the current line (until newline or EOF).
Sourcepub fn parse_value_string(&self, s: &str) -> Result<Token, ToonError>
pub fn parse_value_string(&self, s: &str) -> Result<Token, ToonError>
Parse a complete value string into a token.
pub fn detect_delimiter(&mut self) -> Option<Delimiter>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more