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>
impl<'a> Tokenizer<'a>
pub fn new(input: &str) -> Tokenizer<'_>
pub fn look_for_var_or_env_functions(&mut self)
pub fn seen_var_or_env_functions(&mut self) -> bool
pub fn see_function(&mut self, name: &str)
pub fn next(&mut self) -> Result<Token<'a>, ()>
pub fn position(&self) -> SourcePosition
pub fn current_source_location(&self) -> SourceLocation
pub fn current_source_map_url(&self) -> Option<&'a str>
pub fn current_source_url(&self) -> Option<&'a str>
pub fn state(&self) -> ParserState
pub fn reset(&mut self, state: &ParserState)
pub(crate) fn slice_from(&self, start_pos: SourcePosition) -> &'a str
pub(crate) fn slice(&self, range: Range<SourcePosition>) -> &'a str
pub fn current_source_line(&self) -> &'a str
pub fn next_byte(&self) -> Option<u8>
fn is_eof(&self) -> bool
fn has_at_least(&self, n: usize) -> bool
pub fn advance(&mut self, n: usize)
fn next_byte_unchecked(&self) -> u8
fn byte_at(&self, offset: usize) -> u8
fn consume_4byte_intro(&mut self)
fn consume_continuation_byte(&mut self)
fn consume_known_byte(&mut self, byte: u8)
fn next_char(&self) -> char
fn consume_newline(&mut self)
fn has_newline_at(&self, offset: usize) -> bool
fn consume_char(&mut self) -> char
fn starts_with(&self, needle: &[u8]) -> bool
pub fn skip_whitespace(&mut self)
pub fn skip_cdc_and_cdo(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Tokenizer<'a>
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> 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)