Expand description
A lexical analyzer for JavaScript source code
Fields
tokens: Vec<Token>
Implementations
sourceimpl<'a> Lexer<'a>
impl<'a> Lexer<'a>
sourcepub fn new(buffer: &'a str) -> Lexer<'a>
pub fn new(buffer: &'a str) -> Lexer<'a>
Returns a Lexer with a buffer inside
Arguments
buffer
- A string slice that holds the source code.
The buffer needs to have a lifetime as long as the Lexer instance itself
Example
let buffer = std::fs::read_to_string("yourSourceCode.js").unwrap();
let lexer = boa::syntax::lexer::Lexer::new(&buffer);
pub fn lex(&mut self) -> Result<(), LexerError>
Auto Trait Implementations
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> UnwindSafe for Lexer<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more