summaryrefslogtreecommitdiff
path: root/src/useflag
diff options
context:
space:
mode:
Diffstat (limited to 'src/useflag')
-rw-r--r--src/useflag/parsers.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/useflag/parsers.rs b/src/useflag/parsers.rs
index e6e228b..a430b3d 100644
--- a/src/useflag/parsers.rs
+++ b/src/useflag/parsers.rs
@@ -1,10 +1,15 @@
-use mon::{Parser, alpha1, alphanumeric, one_of, take_while};
+use mon::{Parser, r#if, take_while};
use crate::useflag::UseFlag;
pub fn useflag<'a>() -> impl Parser<&'a str, Output = UseFlag> {
- alpha1()
- .and(alphanumeric().or(take_while(one_of("+_@-".chars()))))
+ let start = r#if(|c: &char| c.is_ascii_alphanumeric());
+ let rest = take_while(r#if(|c: &char| {
+ c.is_ascii_alphanumeric() || "+_@-".contains(*c)
+ }));
+
+ start
+ .and(rest)
.recognize()
.map(|output: &str| UseFlag(output.to_string()))
}