Skip to main content

Lexer

Struct Lexer 

Source
pub struct Lexer {
    pub source: Vec<char>,
    pub pos: usize,
    pub line: u32,
    pub column: u32,
    pub last_string_had_escape: bool,
    /* private fields */
}

Fields§

§source: Vec<char>§pos: usize§line: u32§column: u32§last_string_had_escape: bool

Implementations§

Source§

impl Lexer

Source

pub fn new(source: &str) -> Self

Source

pub fn next_token(&mut self) -> Option<Token>

Source

pub fn set_pos(&mut self, pos: usize)

Source

pub fn pos(&self) -> usize

Source

pub fn column(&self) -> u32

Source

pub fn set_column(&mut self, col: u32)

Source

pub fn last_token_kind(&self) -> LastTokenKind

Source

pub fn set_last_token_kind(&mut self, kind: LastTokenKind)

Source

pub fn line(&self) -> u32

Source

pub fn set_line(&mut self, line: u32)

Source

pub fn get_current_line(&self) -> String

Source

pub fn peek(&mut self) -> Option<Token>

Source

pub fn get_context(&self, chars: usize) -> String

Source

pub fn read_template_chars(&mut self) -> Option<String>

Source

pub fn scan_template_continuation(&mut self) -> Option<Token>

Source

pub fn source_from_pos(&self) -> String

Source

pub fn advance_char(&mut self) -> Option<char>

Source

pub fn at_str(&self, s: &str) -> bool

Auto Trait Implementations§

§

impl Freeze for Lexer

§

impl RefUnwindSafe for Lexer

§

impl Send for Lexer

§

impl Sync for Lexer

§

impl Unpin for Lexer

§

impl UnsafeUnpin for Lexer

§

impl UnwindSafe for Lexer

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.