[−][src]Struct mini_haskell::scanner::Scanner
Scanner with a back buffer.
Implementations
impl<I: Read> Scanner<I>[src]
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]
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]
&mut self,
f: impl FnMut(&mut Scanner<I>) -> ET,
init: EU::Right,
join: impl FnMut(&mut EU::Right, ET::Right)
) -> EU
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]
&mut self,
f: impl FnMut(&mut Scanner<I>) -> ET
) -> ER where
ER::Right: From<()>,
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]
&mut self,
f: impl FnMut(&mut Scanner<I>) -> ET,
init: EU::Right,
join: impl FnMut(&mut EU::Right, ET::Right)
) -> EU
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]
&mut self,
f: impl FnMut(&mut Scanner<I>) -> ET
) -> ER where
ER::Right: From<()>,
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]
&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
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]
&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<()>,
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]
&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
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]
fn peek(&mut self) -> Option<char>[src]
fn next(&mut self) -> Option<char>[src]
fn match<'a>(&mut self, s: &'a str) -> Option<&'a str>[src]
fn span<T>(
&mut self,
f: impl FnMut(char) -> bool,
init: T,
join: impl FnMut(&mut T, char)
) -> T[src]
&mut self,
f: impl FnMut(char) -> bool,
init: T,
join: impl FnMut(&mut T, char)
) -> T
fn span_collect(&mut self, f: impl FnMut(char) -> bool) -> Vec<char>[src]
fn span_collect_string(&mut self, f: impl FnMut(char) -> bool) -> String[src]
fn span_(&mut self, f: impl FnMut(char) -> bool)[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,