TermLexer

Struct TermLexer 

Source
pub struct TermLexer<I>
where I: FusedIterator<Item = u8>,
{ pub opers: OperDefs, /* private fields */ }

Fields§

§opers: OperDefs

Implementations§

Source§

impl<I> TermLexer<I>
where I: FusedIterator<Item = u8>,

Source

pub fn try_new(input: I, opers: Option<OperDefs>) -> Result<Self>

Trait Implementations§

Source§

impl<I> Lexer<Arena> for TermLexer<I>
where I: FusedIterator<Item = u8>,

Source§

type Input = I

The input stream type producing bytes for lexing.
Source§

type LexerData = LexData

The lexer data providing DFA tables and rule definitions. Must be provided by the implementer and must be the struct generated by parlex-gen’s lexer generator, Alex.
Source§

type Token = TermToken

The token type produced by the lexer. Must be provided by the implementor.
Source§

fn ctx(&self) -> &LexerCtx<Self::Input, Self::LexerData, Self::Token>

Returns a shared reference to the lexer context. Must be provided by the implementor and return &LexerCtx.
Source§

fn ctx_mut( &mut self, ) -> &mut LexerCtx<Self::Input, Self::LexerData, Self::Token>

Returns a mutable reference to the lexer context. Must be provided by the implementor and return &mut LexerCtx.
Source§

fn action( &mut self, arena: &mut Arena, rule: <Self::LexerData as LexerData>::LexerRule, ) -> Result<()>

Executes a lexer action based on the matched rule and user data. Must be provided by the implementor.
Source§

fn stats(&self) -> LexerStats

Returns current lexer statistics.
Source§

fn try_collect(&mut self, user_data: &mut U) -> Result<Vec<Self::Token>, Error>

Collects all tokens from the input until exhaustion.
Source§

fn try_next(&mut self, user_data: &mut U) -> Result<Option<Self::Token>, Error>

Attempts to fetch the next token from the input stream.
Source§

fn accum(&mut self)

Switches on accumulation of bytes into the buffer.
Source§

fn begin(&mut self, mode: <Self::LexerData as LexerData>::LexerMode)

Switches the lexer to a different mode.
Source§

fn yield_token(&mut self, token: Self::Token)

Emits a token into the output queue.
Source§

fn clear(&mut self)

Clears the current buffer and disables accumulation.
Source§

fn take_bytes(&mut self) -> Vec<u8>

Takes accumulated bytes from the main buffer.
Source§

fn take_bytes2(&mut self) -> Vec<u8>

Takes accumulated bytes from the secondary buffer.
Source§

fn take_str(&mut self) -> Result<SmartString<LazyCompact>, Error>

Takes accumulated bytes from the main buffer and converts them into a UTF-8 string.
Source§

fn take_str2(&mut self) -> Result<SmartString<LazyCompact>, Error>

Takes accumulated bytes from the secondary buffer and converts them into a UTF-8 string.
Source§

fn extend_buffer2_with_buffer(&mut self)

Extends the secondary buffer with the contents of the main buffer.

Auto Trait Implementations§

§

impl<I> Freeze for TermLexer<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for TermLexer<I>
where I: RefUnwindSafe,

§

impl<I> Send for TermLexer<I>
where I: Send,

§

impl<I> Sync for TermLexer<I>
where I: Sync,

§

impl<I> Unpin for TermLexer<I>
where I: Unpin,

§

impl<I> UnwindSafe for TermLexer<I>
where I: 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> 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V