[][src]Struct mini_haskell::scanner::Scanner

pub struct Scanner<I> { /* fields omitted */ }

Scanner with a back buffer.

Implementations

impl<I: Read> Scanner<I>[src]

pub fn id_or_sym(&mut self) -> Result<Lexeme>[src]

Identifiers or operators.

impl<I: Read> Scanner<I>[src]

pub fn whitespace(&mut self) -> Result<()>[src]

Haskell 2010 Report (2.2.whitespace)

impl<I: Read> Scanner<I>[src]

pub fn numeric_literal(&mut self) -> Result<Lexeme>[src]

Numeric literals: integers or floats.

impl<I: Read> Scanner<I>[src]

pub fn char_or_string(&mut self) -> Result<Lexeme>[src]

Character literals or string literals.

impl<I: Read> Scanner<I>[src]

pub fn special(&mut self) -> Result<Lexeme>[src]

Special: delimiters.

impl<I: Read> Scanner<I>[src]

pub fn expected<T>(&mut self, t: LexemeType) -> Result<T>[src]

Fail fast with t as the expected lexeme type.

pub fn keep_trying<T>() -> Result<T>[src]

Fail for future recovery from alt!.

pub fn err_expected(&mut self, t: LexemeType) -> LexError[src]

Create a LexError with the expected lexeme type.

impl<I> Scanner<I>[src]

pub fn new(input: I) -> Self[src]

Create a new scanner from the back buffer.

pub fn anchored<R: Either>(&mut self, f: impl FnOnce(&mut Scanner<I>) -> R) -> R[src]

Set an anchor for possible revert in future. Use an Either for error indication.

pub fn many<ET: Either<Left = E>, EU: Either<Left = E>, E>(
    &mut self,
    f: impl FnMut(&mut Scanner<I>) -> ET,
    init: EU::Right,
    join: impl FnMut(&mut EU::Right, ET::Right)
) -> EU
[src]

Match many of this rule.

pub fn many_<ET: Either<Left = E>, ER: Either<Left = E>, E>(
    &mut self,
    f: impl FnMut(&mut Scanner<I>) -> ET
) -> ER where
    ER::Right: From<()>, 
[src]

Match many of this rule, ignore the results.

pub fn some<ET: Either<Left = E>, EU: Either<Left = E>, E>(
    &mut self,
    f: impl FnMut(&mut Scanner<I>) -> ET,
    init: EU::Right,
    join: impl FnMut(&mut EU::Right, ET::Right)
) -> EU
[src]

Match many of this rule.

pub fn some_<ET: Either<Left = E>, ER: Either<Left = E>, E>(
    &mut self,
    f: impl FnMut(&mut Scanner<I>) -> ET
) -> ER where
    ER::Right: From<()>, 
[src]

Match many of this rule, ignore the results.

pub fn sep_by<ET: Either<Left = E>, EU: Either<Left = E>, ER: Either<Left = E>, E>(
    &mut self,
    f: impl FnMut(&mut Scanner<I>) -> ET,
    g: impl FnMut(&mut Scanner<I>) -> ER,
    init: EU::Right,
    join: impl FnMut(&mut EU::Right, ET::Right)
) -> EU
[src]

Match many of this rule separated by some other rule.

pub fn sep_by_<ET, EU, ER, E>(
    &mut self,
    f: impl FnMut(&mut Scanner<I>) -> ET,
    g: impl FnMut(&mut Scanner<I>) -> ER
) -> EU where
    ET: Either<Left = E>,
    ER: Either<Left = E>,
    EU: Either<Left = E>,
    EU::Right: From<()>, 
[src]

Match many of this rule separated by some other rule, ignore the results.

pub fn end_by<ET: Either<Left = E>, EU: Either<Left = E>, ER: Either<Left = E>, E>(
    &mut self,
    f: impl FnMut(&mut Scanner<I>) -> ET,
    g: impl FnMut(&mut Scanner<I>) -> ER,
    init: EU::Right,
    join: impl FnMut(&mut EU::Right, ET::Right)
) -> EU
[src]

Match many of this rule ended by some other rule.

impl<I: Read> Scanner<I>[src]

pub fn next_lexeme(&mut self) -> Result<Lexeme>[src]

Get the next lexeme from the Scanner.

Trait Implementations

impl<I: Read> From<Scanner<I>> for RawLexemeIterator<I>[src]

impl<I: Read> Stream for Scanner<I>[src]

Auto Trait Implementations

impl<I> !RefUnwindSafe for Scanner<I>

impl<I> !Send for Scanner<I>

impl<I> !Sync for Scanner<I>

impl<I> Unpin for Scanner<I>

impl<I> !UnwindSafe for Scanner<I>

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