Add Representation

This commit is contained in:
Greg Shuflin 2024-01-30 00:05:20 -08:00
parent 5141cdadd9
commit b042e06084
3 changed files with 13 additions and 1 deletions

View File

@ -1,6 +1,6 @@
use std::marker::PhantomData; use std::marker::PhantomData;
use crate::{ParseResult, Parser}; use crate::{representation::Representation, ParseResult, Parser};
pub struct AnnotatedParser<P, I, O, E> pub struct AnnotatedParser<P, I, O, E>
where where
@ -8,6 +8,7 @@ where
{ {
inner: P, inner: P,
name: Option<String>, name: Option<String>,
repr: Option<Representation>,
phantom: PhantomData<(I, O, E)>, phantom: PhantomData<(I, O, E)>,
} }
@ -32,6 +33,7 @@ where
Self { Self {
inner, inner,
name: None, name: None,
repr: None,
phantom: PhantomData, phantom: PhantomData,
} }
} }
@ -42,4 +44,11 @@ where
..self ..self
} }
} }
pub fn with_repr(self, repr: Representation) -> Self {
Self {
repr: Some(repr),
..self
}
}
} }

View File

@ -5,6 +5,7 @@ mod combinators;
mod map; mod map;
mod parser; mod parser;
mod primitives; mod primitives;
mod representation;
mod sequence; mod sequence;
#[cfg(test)] #[cfg(test)]

2
src/representation.rs Normal file
View File

@ -0,0 +1,2 @@
#[derive(Debug)]
pub struct Representation {}