From ea6a51357242b913ff8b97bd702d7194c74575ce Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Mon, 29 Jan 2024 02:57:09 -0800 Subject: [PATCH] more choice impls --- src/choice.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/choice.rs b/src/choice.rs index 069136f..271d319 100644 --- a/src/choice.rs +++ b/src/choice.rs @@ -47,3 +47,28 @@ where choice_loop(input, &[&self.0, &self.1, &self.2]) } } + +impl Choice for (P1, P2, P3, P4) +where + P1: Parser, + P2: Parser, + P3: Parser, + P4: Parser, +{ + fn parse_choice(&self, input: I) -> Result<(O, I), (E, I)> { + choice_loop(input, &[&self.0, &self.1, &self.2, &self.3]) + } +} + +impl Choice for (P1, P2, P3, P4, P5) +where + P1: Parser, + P2: Parser, + P3: Parser, + P4: Parser, + P5: Parser, +{ + fn parse_choice(&self, input: I) -> Result<(O, I), (E, I)> { + choice_loop(input, &[&self.0, &self.1, &self.2, &self.3, &self.4]) + } +}