diff options
Diffstat (limited to 'chewed')
-rw-r--r-- | chewed/src/parse.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/chewed/src/parse.rs b/chewed/src/parse.rs index 58bb94c..65e9272 100644 --- a/chewed/src/parse.rs +++ b/chewed/src/parse.rs @@ -21,7 +21,7 @@ pub trait Parser { P::parse(self) } - fn take_str(&mut self, s: &'static str) -> Result<(), TakeError> { + fn consume_str(&mut self, s: &'static str) -> Result<(), TakeError> { let mut count = 0; for exp in s.chars() { @@ -114,6 +114,14 @@ pub trait Parse: Sized { Ok(res) } } + + fn take_str(input: &str) -> Result<Self, TakeError> { + Self::take(&mut IterWrapper::new(input.chars())) + } + + fn parse_str(input: &str) -> Result<Self, ParseError> { + Self::parse(IterWrapper::new(input.chars())) + } } impl Parse for () { |