Struct boa::syntax::lexer::Lexer

source ·
pub struct Lexer<'a> {
    pub tokens: Vec<Token>,
    /* private fields */
}
Expand description

A lexical analyzer for JavaScript source code

Fields

tokens: Vec<Token>

Implementations

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);

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.