[][src]Struct char_lex::Lexer

pub struct Lexer<'l, T, W> where
    T: TokenTrait,
    W: TokenWrapper<T>, 
{ /* fields omitted */ }

The main lexer type from the module Char-Lex.

Generics

T: TokenTrait is the trait implemented by token attribute macro. W: TokenWrapper<T> is the trait that can wrap a token to contain more information, all TokenTrait objects automatically implement TokenWrapper<T>, so you don't need a wrapper!

Methods

impl<'l, T, W> Lexer<'l, T, W> where
    T: TokenTrait,
    W: TokenWrapper<T>, 
[src]

pub fn new(content: &'l str) -> Self[src]

Create new Lexer<'l, T, W>

Arguments

content: the string that is to be tokenized. ignored: an optional token that the lexer will ignore and give you the next.

pub fn next_ignored<M>(&mut self, m: M) -> Option<W> where
    M: TokenMatch<T>, 
[src]

Like the next methode but with the possibility to ignore certain Tokens with the TokenTrait by giving a TokenMatch<T> like a single Token or multiple [Tokens].

pub fn get_error(&self) -> Option<&Error>[src]

Returns the Error that was the reason for the lexer to return None from the next() method!

pub fn get_cursor(&self) -> usize[src]

Returns the current cursor position.

pub fn set_cursor(&mut self, cursor: usize)[src]

Sets the new cursor position.

Trait Implementations

impl<'l, T: Clone, W: Clone> Clone for Lexer<'l, T, W> where
    T: TokenTrait,
    W: TokenWrapper<T>, 
[src]

impl<'l, T: Copy, W: Copy> Copy for Lexer<'l, T, W> where
    T: TokenTrait,
    W: TokenWrapper<T>, 
[src]

impl<'l, T: Debug, W: Debug> Debug for Lexer<'l, T, W> where
    T: TokenTrait,
    W: TokenWrapper<T>, 
[src]

impl<'l, T: Eq, W: Eq> Eq for Lexer<'l, T, W> where
    T: TokenTrait,
    W: TokenWrapper<T>, 
[src]

impl<'l, T, W> Iterator for Lexer<'l, T, W> where
    T: TokenTrait,
    W: TokenWrapper<T>, 
[src]

type Item = W

The type of the elements being iterated over.

impl<'l, T: PartialEq, W: PartialEq> PartialEq<Lexer<'l, T, W>> for Lexer<'l, T, W> where
    T: TokenTrait,
    W: TokenWrapper<T>, 
[src]

impl<'l, T, W> StructuralEq for Lexer<'l, T, W> where
    T: TokenTrait,
    W: TokenWrapper<T>, 
[src]

impl<'l, T, W> StructuralPartialEq for Lexer<'l, T, W> where
    T: TokenTrait,
    W: TokenWrapper<T>, 
[src]

Auto Trait Implementations

impl<'l, T, W> RefUnwindSafe for Lexer<'l, T, W> where
    T: RefUnwindSafe,
    W: RefUnwindSafe

impl<'l, T, W> Send for Lexer<'l, T, W> where
    T: Send,
    W: Send

impl<'l, T, W> Sync for Lexer<'l, T, W> where
    T: Sync,
    W: Sync

impl<'l, T, W> Unpin for Lexer<'l, T, W> where
    T: Unpin,
    W: Unpin

impl<'l, T, W> UnwindSafe for Lexer<'l, T, W> where
    T: UnwindSafe,
    W: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.