diff options
Diffstat (limited to 'src/useflag/parsers.rs')
| -rw-r--r-- | src/useflag/parsers.rs | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/src/useflag/parsers.rs b/src/useflag/parsers.rs deleted file mode 100644 index ca5929d..0000000 --- a/src/useflag/parsers.rs +++ /dev/null @@ -1,40 +0,0 @@ -use mon::{Parser, ParserIter, ascii_alphanumeric, one_of, tag}; - -use crate::{ - Parseable, - useflag::{IUseFlag, UseFlag}, -}; - -impl<'a> Parseable<'a, &'a str> for UseFlag { - type Parser = impl Parser<&'a str, Output = Self>; - - fn parser() -> Self::Parser { - let start = ascii_alphanumeric(); - let rest = ascii_alphanumeric() - .or(one_of("+_@-".chars())) - .repeated() - .many(); - - start - .and(rest) - .recognize() - .map(|output: &str| UseFlag(output.to_string())) - } -} - -impl<'a> Parseable<'a, &'a str> for IUseFlag { - type Parser = impl Parser<&'a str, Output = Self>; - - fn parser() -> Self::Parser { - UseFlag::parser() - .preceded_by(tag("+")) - .map(|flag| IUseFlag { - default: true, - flag, - }) - .or(UseFlag::parser().map(|flag| IUseFlag { - default: false, - flag, - })) - } -} |
