pub(super) struct Lexer<'a> {
source: &'a str,
position: usize,
}Fields§
§source: &'a str§position: usizeImplementations§
Source§impl<'a> Lexer<'a>
impl<'a> Lexer<'a>
pub(super) const fn is_line_terminator(character: char) -> bool
const fn is_whitespace(character: char) -> bool
fn is_identifier_start(character: char) -> bool
fn is_identifier_part(character: char) -> bool
const fn error(offset: usize, kind: JsonErrorKind) -> JsonError
fn rest(&self) -> &'a str
fn peek(&self) -> Option<char>
fn peek_at(&self, index: usize) -> Option<char>
fn bump(&mut self) -> Option<char>
fn eat(&mut self, expected: char) -> bool
Sourcefn eat_while(&mut self, accept: impl Fn(char) -> bool) -> usize
fn eat_while(&mut self, accept: impl Fn(char) -> bool) -> usize
Consume characters while accept holds and count them.
fn token(&mut self) -> Result<Option<Token<'a>>, JsonError>
fn punctuation(&mut self, kind: TokenKind) -> TokenKind
fn comment(&mut self) -> Result<TokenKind, JsonError>
fn string(&mut self, quote: char) -> Result<Option<String>, JsonError>
fn push(decoded: &mut Option<String>, character: char)
Sourcefn escape(
&mut self,
string_start: usize,
decoded: &mut Option<String>,
) -> Result<(), JsonError>
fn escape( &mut self, string_start: usize, decoded: &mut Option<String>, ) -> Result<(), JsonError>
Read the rest of an escape in a string. The backslash is consumed.
Sourcefn surrogate_pair(&mut self, high: u32) -> Option<char>
fn surrogate_pair(&mut self, high: u32) -> Option<char>
Combine a high surrogate with a following \uXXXX low surrogate.
fn hex_digits(&mut self, count: usize) -> Option<u32>
fn identifier(&mut self) -> Result<String, JsonError>
fn number(&mut self) -> Result<TokenKind, JsonError>
Auto Trait Implementations§
impl<'a> Freeze for Lexer<'a>
impl<'a> RefUnwindSafe for Lexer<'a>
impl<'a> Send for Lexer<'a>
impl<'a> Sync for Lexer<'a>
impl<'a> Unpin for Lexer<'a>
impl<'a> UnsafeUnpin for Lexer<'a>
impl<'a> UnwindSafe for Lexer<'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