TermParser

Struct TermParser 

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

Implementations§

Source§

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

Source

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

Source

pub fn try_collect_terms(&mut self, arena: &mut Arena) -> Result<Vec<Term>>

Source

pub fn try_next_term(&mut self, arena: &mut Arena) -> Result<Option<Term>>

Source

pub fn define_opers<J: FusedIterator<Item = u8>>( &mut self, arena: &mut Arena, defs_input: J, opers: Option<OperDefs>, ) -> Result<()>

Trait Implementations§

Source§

impl<I> Parser<Arena> for TermParser<I>
where I: FusedIterator<Item = u8>,

Source§

type Lexer = TermLexer<I>

Source§

type ParserData = ParData

Source§

fn ctx(&self) -> &ParserCtx<Self::Lexer, Self::ParserData, Arena>

Source§

fn ctx_mut(&mut self) -> &mut ParserCtx<Self::Lexer, Self::ParserData, Arena>

Source§

fn stats(&self) -> ParserStats

Source§

fn resolve_ambiguity( &mut self, _arena: &mut Arena, ambig: AmbigID, tok2: &TermToken, ) -> Result<Action>

Source§

fn reduce( &mut self, arena: &mut Arena, prod: ProdID, token: &TermToken, ) -> Result<()>

Source§

fn tokens_peek<'a>( &'a self, index: usize, ) -> &'a <Self::Lexer as Lexer<U>>::Token
where U: 'a,

Returns a reference to the token counted from the end: 0 = last, 1 = second last, etc.
Panics if index ≥ number of tokens.
Source§

fn tokens_mut_peek<'a>( &'a mut self, index: usize, ) -> &'a mut <Self::Lexer as Lexer<U>>::Token
where U: 'a,

Returns a mutable reference to the token counted from the end: 0 = last, 1 = second last, etc.
Panics if index ≥ number of tokens.
Source§

fn tokens_pop(&mut self) -> Result<<Self::Lexer as Lexer<U>>::Token, Error>

Source§

fn tokens_push(&mut self, token: <Self::Lexer as Lexer<U>>::Token)

Source§

fn dump_state(&self, incoming: &<Self::Lexer as Lexer<U>>::Token)

Source§

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

Source§

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

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<I> UnwindSafe for TermParser<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