CommonTokenStream

Struct CommonTokenStream 

Source
pub struct CommonTokenStream<'input, T: TokenSource<'input>> { /* private fields */ }
Expand description

Default token stream that skips token that not correspond to current channel.

Implementations§

Source§

impl<'input, T: TokenSource<'input>> CommonTokenStream<'input, T>

Source

pub fn new(lexer: T) -> CommonTokenStream<'input, T>

Creates CommonTokenStream that produces tokens from TOKEN_DEFAULT_CHANNEL

Source

pub fn with_channel(lexer: T, channel: isize) -> CommonTokenStream<'input, T>

Creates CommonTokenStream that produces tokens from channel

Source

pub fn reset(&mut self)

Restarts this token stream

Source

pub fn iter(&mut self) -> IterWrapper<'_, Self>

Creates iterator over this token stream

Trait Implementations§

Source§

impl<'input, T: Debug + TokenSource<'input>> Debug for CommonTokenStream<'input, T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'input, T: TokenSource<'input>> IntStream for CommonTokenStream<'input, T>

Source§

fn consume(&mut self)

Consumes the current symbol in the stream. Advances this stream to the next element. Read more
Source§

fn la(&mut self, i: isize) -> isize

Lookaheads (or loopbacks if i is negative) Read more
Source§

fn mark(&mut self) -> isize

After this call subsequent calls to seek must succeed if seek index is greater than mark index Read more
Source§

fn release(&mut self, _marker: isize)

Releases marker
Source§

fn index(&self) -> isize

Returns current position of the input stream Read more
Source§

fn seek(&mut self, index: isize)

Put stream back in state it was when it was in index position Read more
Source§

fn size(&self) -> isize

Returns the total number of symbols in the stream.
Source§

fn get_source_name(&self) -> String

Returns name of the source this stream operates over if any
Source§

impl<'input, T: TokenSource<'input>> TokenStream<'input> for CommonTokenStream<'input, T>

Source§

type TF = <T as TokenSource<'input>>::TF

Token factory that created tokens in this stream
Source§

fn lt(&mut self, k: isize) -> Option<&<Self::TF as TokenFactory<'input>>::Tok>

Lookahead for tokens, same as IntSteam::la but return reference to full token
Source§

fn get(&self, index: isize) -> &<Self::TF as TokenFactory<'input>>::Tok

Returns reference to token at index
Source§

fn get_token_source(&self) -> &dyn TokenSource<'input, TF = Self::TF>

Token source that produced data for tokens for this stream
Source§

fn get_text_from_interval(&self, start: isize, stop: isize) -> String

Get combined text of tokens in start..=stop interval
Source§

fn get_all_text(&self) -> String

Get combined text of all tokens in this stream
Source§

fn get_text_from_tokens<T: Token + ?Sized>(&self, a: &T, b: &T) -> String
where Self: Sized,

Get combined text of tokens in between a and b
Source§

impl<'input, T> TidAble<'input> for CommonTokenStream<'input, T>
where T: TokenSource<'input> + TidAble<'input>,

Auto Trait Implementations§

§

impl<'input, T> Freeze for CommonTokenStream<'input, T>
where T: Freeze,

§

impl<'input, T> RefUnwindSafe for CommonTokenStream<'input, T>
where T: RefUnwindSafe, <<T as TokenSource<'input>>::TF as TokenFactory<'input>>::Tok: RefUnwindSafe,

§

impl<'input, T> Send for CommonTokenStream<'input, T>
where T: Send, <<T as TokenSource<'input>>::TF as TokenFactory<'input>>::Tok: Send,

§

impl<'input, T> Sync for CommonTokenStream<'input, T>
where T: Sync, <<T as TokenSource<'input>>::TF as TokenFactory<'input>>::Tok: Sync,

§

impl<'input, T> Unpin for CommonTokenStream<'input, T>
where T: Unpin, <<T as TokenSource<'input>>::TF as TokenFactory<'input>>::Tok: Unpin,

§

impl<'input, T> UnwindSafe for CommonTokenStream<'input, T>
where T: UnwindSafe, <<T as TokenSource<'input>>::TF as TokenFactory<'input>>::Tok: 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> AnyExt for T
where T: Any + ?Sized,

Source§

fn downcast_ref<T>(this: &Self) -> Option<&T>
where T: Any,

Attempts to downcast this to T behind reference
Source§

fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>
where T: Any,

Attempts to downcast this to T behind mutable reference
Source§

fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>
where T: Any,

Attempts to downcast this to T behind Rc pointer
Source§

fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>
where T: Any,

Attempts to downcast this to T behind Arc pointer
Source§

fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>
where T: Any,

Attempts to downcast this to T behind Box pointer
Source§

fn downcast_move<T>(this: Self) -> Option<T>
where T: Any, Self: Sized,

Attempts to downcast owned Self to T, useful only in generic context as a workaround for specialization
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, X> CoerceTo<T> for X
where T: CoerceFrom<X> + ?Sized,

Source§

fn coerce_rc_to(self: Rc<X>) -> Rc<T>

Source§

fn coerce_box_to(self: Box<X>) -> Box<T>

Source§

fn coerce_ref_to(&self) -> &T

Source§

fn coerce_mut_to(&mut self) -> &mut T

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<'a, T> Tid<'a> for T
where T: TidAble<'a> + ?Sized,

Source§

fn self_id(&self) -> TypeId

Returns type id of the type of self Read more
Source§

fn id() -> TypeId

Returns type id of this type
Source§

impl<'a, X> TidExt<'a> for X
where X: Tid<'a> + ?Sized,

Source§

fn is<T>(&self) -> bool
where T: Tid<'a>,

Returns true if type behind self is equal to the type of T.
Source§

fn downcast_ref<'b, T>(&'b self) -> Option<&'b T>
where T: Tid<'a>,

Attempts to downcast self to T behind reference
Source§

fn downcast_mut<'b, T>(&'b mut self) -> Option<&'b mut T>
where T: Tid<'a>,

Attempts to downcast self to T behind mutable reference
Source§

fn downcast_rc<T>(self: Rc<Self>) -> Result<Rc<T>, Rc<Self>>
where T: Tid<'a>,

Attempts to downcast self to T behind Rc pointer
Source§

fn downcast_arc<T>(self: Arc<Self>) -> Result<Arc<T>, Arc<Self>>
where T: Tid<'a>,

Attempts to downcast self to T behind Arc pointer
Source§

fn downcast_box<T>(self: Box<Self>) -> Result<Box<T>, Box<Self>>
where T: Tid<'a>,

Attempts to downcast self to T behind Box pointer
Source§

fn downcast_move<T>(self) -> Option<T>
where T: Tid<'a>, Self: Sized,

Attempts to downcast owned Self to T, useful only in generic context as a workaround for specialization
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.