pub struct Tokenizer<'a> {
    input: &'a str,
    position: usize,
    current_line_start_position: usize,
    current_line_number: u32,
    var_or_env_functions: SeenStatus,
    source_map_url: Option<&'a str>,
    source_url: Option<&'a str>,
}

Fields§

§input: &'a str§position: usize

Counted in bytes, not code points. From 0.

§current_line_start_position: usize

The position at the start of the current line; but adjusted to ensure that computing the column will give the result in units of UTF-16 characters.

§current_line_number: u32§var_or_env_functions: SeenStatus§source_map_url: Option<&'a str>§source_url: Option<&'a str>

Implementations§

source§

impl<'a> Tokenizer<'a>

source

pub fn new(input: &str) -> Tokenizer<'_>

source

pub fn look_for_var_or_env_functions(&mut self)

source

pub fn seen_var_or_env_functions(&mut self) -> bool

source

pub fn see_function(&mut self, name: &str)

source

pub fn next(&mut self) -> Result<Token<'a>, ()>

source

pub fn position(&self) -> SourcePosition

source

pub fn current_source_location(&self) -> SourceLocation

source

pub fn current_source_map_url(&self) -> Option<&'a str>

source

pub fn current_source_url(&self) -> Option<&'a str>

source

pub fn state(&self) -> ParserState

source

pub fn reset(&mut self, state: &ParserState)

source

pub(crate) fn slice_from(&self, start_pos: SourcePosition) -> &'a str

source

pub(crate) fn slice(&self, range: Range<SourcePosition>) -> &'a str

source

pub fn current_source_line(&self) -> &'a str

source

pub fn next_byte(&self) -> Option<u8>

source

fn is_eof(&self) -> bool

source

fn has_at_least(&self, n: usize) -> bool

source

pub fn advance(&mut self, n: usize)

source

fn next_byte_unchecked(&self) -> u8

source

fn byte_at(&self, offset: usize) -> u8

source

fn consume_4byte_intro(&mut self)

source

fn consume_continuation_byte(&mut self)

source

fn consume_known_byte(&mut self, byte: u8)

source

fn next_char(&self) -> char

source

fn consume_newline(&mut self)

source

fn has_newline_at(&self, offset: usize) -> bool

source

fn consume_char(&mut self) -> char

source

fn starts_with(&self, needle: &[u8]) -> bool

source

pub fn skip_whitespace(&mut self)

source

pub fn skip_cdc_and_cdo(&mut self)

Trait Implementations§

source§

impl<'a> Clone for Tokenizer<'a>

source§

fn clone(&self) -> Tokenizer<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Tokenizer<'a>

§

impl<'a> Send for Tokenizer<'a>

§

impl<'a> Sync for Tokenizer<'a>

§

impl<'a> Unpin for Tokenizer<'a>

§

impl<'a> UnwindSafe for Tokenizer<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.