use crate::input::{Show, Length};
pub trait Token<I: Input>: Show + PartialEq<I::Token> { }
pub trait Slice<I: Input>: Show + Length + PartialEq<I::Slice> { }
impl<I: Input, T> Token<I> for T where T: Show + PartialEq<I::Token> { }
impl<I: Input, S> Slice<I> for S where S: Show + Length + PartialEq<I::Slice> { }
#[derive(Debug, Copy, Clone)]
pub struct ParserInfo {
pub name: &'static str,
pub raw: bool,
}
pub trait Rewind: Sized + Input {
fn rewind_to(&mut self, marker: Self::Marker);
}
pub trait Input: Sized {
type Token: Token<Self>;
type Slice: Slice<Self>;
type Many: Length;
type Marker: Copy;
type Context: Show;
fn token(&mut self) -> Option<Self::Token>;
fn slice(&mut self, n: usize) -> Option<Self::Slice>;
fn peek<F>(&mut self, cond: F) -> bool
where F: FnMut(&Self::Token) -> bool;
fn peek_slice<F>(&mut self, n: usize, cond: F) -> bool
where F: FnMut(&Self::Slice) -> bool;
fn eat<F>(&mut self, cond: F) -> Option<Self::Token>
where F: FnMut(&Self::Token) -> bool;
fn eat_slice<F>(&mut self, n: usize, cond: F) -> Option<Self::Slice>
where F: FnMut(&Self::Slice) -> bool;
fn take<F>(&mut self, cond: F) -> Self::Many
where F: FnMut(&Self::Token) -> bool;
fn skip<F>(&mut self, cond: F) -> usize
where F: FnMut(&Self::Token) -> bool;
fn has(&mut self, n: usize) -> bool;
#[allow(unused_variables)]
fn mark(&mut self, info: &ParserInfo) -> Self::Marker;
fn context(&mut self, _mark: Self::Marker) -> Self::Context;
}