diff --git a/src/lib.rs b/src/lib.rs index 68fce03..21bc95a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,7 +46,7 @@ trait Parser { E: 'a, P: Parser + 'a, { - BoxedParser::new(sequence::seq(self, next_parser)) + BoxedParser::new(sequence::tuple2(self, next_parser)) } } diff --git a/src/sequence.rs b/src/sequence.rs index f4db4e2..8673451 100644 --- a/src/sequence.rs +++ b/src/sequence.rs @@ -1,6 +1,6 @@ use crate::Parser; -pub(crate) fn seq(parser1: P1, parser2: P2) -> impl Parser +pub(crate) fn tuple2(parser1: P1, parser2: P2) -> impl Parser where P1: Parser, P2: Parser, @@ -21,8 +21,8 @@ mod test { use std::assert_matches::assert_matches; #[test] - fn test_seq() { - let p = seq(identifier, seq(literal(" "), literal("ruts"))); + fn test_tuple2() { + let p = tuple2(identifier, tuple2(literal(" "), literal("ruts"))); assert_matches!(p.parse("fort1 ruts"), Ok((r, "")) if r.0 == "fort1" && r.1 == (" ", "ruts") ); let p = identifier.then(literal(" ")).then(literal("ruts"));