diff --git a/src/sequence/mod.rs b/src/sequence/mod.rs index 08bebad..a982a51 100644 --- a/src/sequence/mod.rs +++ b/src/sequence/mod.rs @@ -1,4 +1,4 @@ -use crate::parser::{ParseResult, Parser, ParserInput}; +use crate::parser::{ParseResult, Parser, ParserInput, Representation}; pub fn tuple2(parser1: P1, parser2: P2) -> impl Parser where @@ -14,7 +14,9 @@ where I: ParserInput, T: Sequence, { - move |input| sequence.parse(input) + let rep = sequence.representation(); + let p = move |input| sequence.parse(input); + (p, rep) } /* TODO - eventually rewrite this parser combinator in Schala. Seeing what this @@ -24,6 +26,9 @@ where pub trait Sequence { fn parse(&self, input: I) -> ParseResult; + fn representation(&self) -> Representation { + Representation::new("SEQ NOT DONE YET") + } } impl Sequence for (P1, P2) diff --git a/tests/json_parser.rs b/tests/json_parser.rs index f57daa7..d7b4971 100644 --- a/tests/json_parser.rs +++ b/tests/json_parser.rs @@ -244,4 +244,5 @@ fn test_representations() { json_bool().representation(), Representation::new("true | false") ); + assert_eq!(json_number().representation(), Representation::new("null")); }