use std::marker::PhantomData; use crate::{representation::Representation, ParseResult, Parser}; pub struct AnnotatedParser
where
P: Parser,
{
inner: P,
name: Option Parser for AnnotatedParser
where
P: Parser,
{
fn parse(&self, input: I) -> ParseResult {
self.inner.parse(input)
}
fn name(&self) -> Option AnnotatedParser
where
P: Parser,
{
pub fn new(inner: P) -> Self {
Self {
inner,
name: None,
repr: None,
phantom: PhantomData,
}
}
pub fn with_name(self, name: &str) -> Self {
Self {
name: Some(name.to_string()),
..self
}
}
pub fn with_repr(self, repr: Representation) -> Self {
Self {
repr: Some(repr),
..self
}
}
}