Rename seq -> tuple2
This commit is contained in:
parent
c5b351e8ee
commit
95a6d935e4
@ -46,7 +46,7 @@ trait Parser<I, O, E> {
|
|||||||
E: 'a,
|
E: 'a,
|
||||||
P: Parser<I, O2, E> + 'a,
|
P: Parser<I, O2, E> + 'a,
|
||||||
{
|
{
|
||||||
BoxedParser::new(sequence::seq(self, next_parser))
|
BoxedParser::new(sequence::tuple2(self, next_parser))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::Parser;
|
use crate::Parser;
|
||||||
|
|
||||||
pub(crate) fn seq<P1, P2, I, O1, O2, E>(parser1: P1, parser2: P2) -> impl Parser<I, (O1, O2), E>
|
pub(crate) fn tuple2<P1, P2, I, O1, O2, E>(parser1: P1, parser2: P2) -> impl Parser<I, (O1, O2), E>
|
||||||
where
|
where
|
||||||
P1: Parser<I, O1, E>,
|
P1: Parser<I, O1, E>,
|
||||||
P2: Parser<I, O2, E>,
|
P2: Parser<I, O2, E>,
|
||||||
@ -21,8 +21,8 @@ mod test {
|
|||||||
use std::assert_matches::assert_matches;
|
use std::assert_matches::assert_matches;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_seq() {
|
fn test_tuple2() {
|
||||||
let p = seq(identifier, seq(literal(" "), literal("ruts")));
|
let p = tuple2(identifier, tuple2(literal(" "), literal("ruts")));
|
||||||
assert_matches!(p.parse("fort1 ruts"), Ok((r, "")) if r.0 == "fort1" && r.1 == (" ", "ruts") );
|
assert_matches!(p.parse("fort1 ruts"), Ok((r, "")) if r.0 == "fort1" && r.1 == (" ", "ruts") );
|
||||||
|
|
||||||
let p = identifier.then(literal(" ")).then(literal("ruts"));
|
let p = identifier.then(literal(" ")).then(literal("ruts"));
|
||||||
|
Loading…
Reference in New Issue
Block a user