#![allow(non_camel_case_types)]
use crate::{parser::Parser, Error, Result};
#[derive(Copy, Clone)]
pub struct any();
impl Parser for any {
type Output = char;
fn p_arse<'a>(&self, tail: &'a str) -> Result<'a, Self::Output> {
let mut chars = tail.chars();
let first =
chars.next().ok_or_else(|| Error::expecting("any", tail))?;
let tail = chars.as_str();
Ok((first, tail))
}
}
#[derive(Copy, Clone)]
pub struct eoi();
impl Parser for eoi {
type Output = ();
fn p_arse<'a>(&self, tail: &'a str) -> Result<'a, Self::Output> {
if tail.is_empty() {
Ok(((), tail))
} else {
Err(Error::expecting("eoi", tail))
}
}
}