Lexer

Struct Lexer 

Source
pub struct Lexer<'input, Iter: Iterator<Item = char> + Clone, Token, State, Error, Wrapper> {
    pub __state: usize,
    pub __done: bool,
    pub __initial_state: usize,
    pub __iter: Peekable<Iter>,
    /* private fields */
}
Expand description

Common parts in lexers generated by lexgen.

Fields are used by lexgen-generated code and should not be used directly.

Fields§

§__state: usize§__done: bool§__initial_state: usize§__iter: Peekable<Iter>

Implementations§

Source§

impl<I: Iterator<Item = char> + Clone, T, S: Default, E, W> Lexer<'static, I, T, S, E, W>

Source

pub fn new_from_iter(iter: I) -> Self

Source§

impl<I: Iterator<Item = char> + Clone, T, S, E, W> Lexer<'static, I, T, S, E, W>

Source

pub fn new_from_iter_with_state(iter: I, state: S) -> Self

Source§

impl<'input, T, S: Default, E, W> Lexer<'input, Chars<'input>, T, S, E, W>

Source

pub fn new(input: &'input str) -> Self

Source§

impl<'input, T, S, E, W> Lexer<'input, Chars<'input>, T, S, E, W>

Source

pub fn new_with_state(input: &'input str, state: S) -> Self

Source§

impl<'input, I: Iterator<Item = char> + Clone, T, S, E, W> Lexer<'input, I, T, S, E, W>

Source

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

Source

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

Source

pub fn backtrack( &mut self, ) -> Result<for<'lexer> fn(&'lexer mut W) -> SemanticActionResult<Result<T, E>>, LexerError<E>>

Source

pub fn reset_accepting_state(&mut self)

Source

pub fn set_accepting_state( &mut self, semantic_action_fn: for<'lexer> fn(&'lexer mut W) -> SemanticActionResult<Result<T, E>>, )

Source

pub fn reset_match(&mut self)

Source

pub fn match_(&self) -> &'input str

Source

pub fn match_loc(&self) -> (Loc, Loc)

Source

pub fn state(&mut self) -> &mut S

Trait Implementations§

Source§

impl<'input, Iter: Clone + Iterator<Item = char> + Clone, Token: Clone, State: Clone, Error: Clone, Wrapper: Clone> Clone for Lexer<'input, Iter, Token, State, Error, Wrapper>

Source§

fn clone(&self) -> Lexer<'input, Iter, Token, State, Error, Wrapper>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'input, Iter: Debug + Iterator<Item = char> + Clone, Token: Debug, State: Debug, Error: Debug, Wrapper: Debug> Debug for Lexer<'input, Iter, Token, State, Error, Wrapper>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'input, Iter, Token, State, Error, Wrapper> Freeze for Lexer<'input, Iter, Token, State, Error, Wrapper>
where State: Freeze, Iter: Freeze,

§

impl<'input, Iter, Token, State, Error, Wrapper> RefUnwindSafe for Lexer<'input, Iter, Token, State, Error, Wrapper>
where State: RefUnwindSafe, Iter: RefUnwindSafe,

§

impl<'input, Iter, Token, State, Error, Wrapper> Send for Lexer<'input, Iter, Token, State, Error, Wrapper>
where State: Send, Iter: Send,

§

impl<'input, Iter, Token, State, Error, Wrapper> Sync for Lexer<'input, Iter, Token, State, Error, Wrapper>
where State: Sync, Iter: Sync,

§

impl<'input, Iter, Token, State, Error, Wrapper> Unpin for Lexer<'input, Iter, Token, State, Error, Wrapper>
where State: Unpin, Iter: Unpin,

§

impl<'input, Iter, Token, State, Error, Wrapper> UnwindSafe for Lexer<'input, Iter, Token, State, Error, Wrapper>
where State: UnwindSafe, Iter: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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 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.