From d3085968d3913781ea6c19251a1d9170f09e018c Mon Sep 17 00:00:00 2001 From: John Turner Date: Thu, 13 Nov 2025 23:02:40 +0000 Subject: make alpha, numeric, alphanumeric, and whitespace return I::Item --- src/lib.rs | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index d96eb4c..013782f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -995,15 +995,12 @@ where Eof } -pub fn alpha() -> impl Parser +pub fn alpha() -> impl Parser where I: Input, I::Item: Character, { r#if(|c: &I::Item| c.is_alphabetic()) - .repeated() - .many() - .recognize() } pub fn alpha1() -> impl Parser @@ -1017,15 +1014,12 @@ where .recognize() } -pub fn numeric() -> impl Parser +pub fn numeric() -> impl Parser where I: Input, I::Item: Character, { r#if(|c: &I::Item| c.is_numeric()) - .repeated() - .many() - .recognize() } pub fn numeric1() -> impl Parser @@ -1039,15 +1033,12 @@ where .recognize() } -pub fn alphanumeric() -> impl Parser +pub fn alphanumeric() -> impl Parser where I: Input, I::Item: Character, { r#if(|c: &I::Item| c.is_alphanumeric()) - .repeated() - .many() - .recognize() } pub fn alphanumeric1() -> impl Parser @@ -1061,15 +1052,12 @@ where .recognize() } -pub fn whitespace() -> impl Parser +pub fn whitespace() -> impl Parser where I: Input, I::Item: Character, { r#if(|c: &I::Item| c.is_whitespace()) - .repeated() - .many() - .recognize() } pub fn whitespace1() -> impl Parser @@ -1129,7 +1117,7 @@ mod test { let input = "a b c"; let it = InputIter::new(input); - alpha1() + alpha() .separated_by(whitespace()) .at_least(1) .check_finished(it) -- cgit v1.2.3