use super::{IndentedTracer, NoopTracer, ParseError, ParseTracer};
pub trait PegParser: Sized {
fn parse(s: &str) -> Result<Self, ParseError>;
fn parse_with_trace(s: &str) -> Result<Self, ParseError>;
}
impl<T: PegParserAdvanced<()>> PegParser for T {
fn parse(s: &str) -> Result<Self, ParseError> {
Self::parse_advanced::<NoopTracer>(s, &ParseSettings::default(), ())
}
fn parse_with_trace(s: &str) -> Result<Self, ParseError> {
Self::parse_advanced::<IndentedTracer>(s, &ParseSettings::default(), ())
}
}
pub trait PegParserAdvanced<TUD>: Sized {
fn parse_advanced<TT: ParseTracer>(
s: &str,
settings: &ParseSettings,
user_context: TUD,
) -> Result<Self, ParseError>;
}
#[derive(Debug, Default)]
#[non_exhaustive]
pub struct ParseSettings {}