pub struct Lexer<'src> { /* private fields */ }
Expand description
Just language lexer
The lexer proceeds character-by-character, as opposed to using regular expressions to lex tokens or semi-tokens at a time. As a result, it is verbose and straightforward. Just used to have a regex-based lexer, which was slower and generally godawful. However, this should not be taken as a slight against regular expressions, the lexer was just idiosyncratically bad.
Implementationsยง
Sourceยงimpl<'src> Lexer<'src>
impl<'src> Lexer<'src>
Sourcepub fn lex(
path: &'src Path,
src: &'src str,
) -> Result<Vec<Token<'src>>, CompileError<'src>>
pub fn lex( path: &'src Path, src: &'src str, ) -> Result<Vec<Token<'src>>, CompileError<'src>>
Lex src
Sourcepub fn is_identifier(text: &str) -> bool
pub fn is_identifier(text: &str) -> bool
True if text
could be an identifier
Sourcepub fn is_identifier_start(c: char) -> bool
pub fn is_identifier_start(c: char) -> bool
True if c
can be the first character of an identifier
Sourcepub fn is_identifier_continue(c: char) -> bool
pub fn is_identifier_continue(c: char) -> bool
True if c
can be a continuation character of an identifier
Auto Trait Implementationsยง
impl<'src> Freeze for Lexer<'src>
impl<'src> RefUnwindSafe for Lexer<'src>
impl<'src> Send for Lexer<'src>
impl<'src> Sync for Lexer<'src>
impl<'src> Unpin for Lexer<'src>
impl<'src> UnwindSafe for Lexer<'src>
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