diff options
Diffstat (limited to 'src/ebuild/parsers.rs')
| -rw-r--r-- | src/ebuild/parsers.rs | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/ebuild/parsers.rs b/src/ebuild/parsers.rs index 73603a2..aa801e8 100644 --- a/src/ebuild/parsers.rs +++ b/src/ebuild/parsers.rs @@ -1,6 +1,8 @@ use std::path::PathBuf; -use mon::{Parser, ParserIter, alpha1, alphanumeric, r#if, one_of, tag, whitespace1}; +use mon::{ + Parser, ParserIter, ascii_alpha1, ascii_alphanumeric, ascii_whitespace1, r#if, one_of, tag, +}; use crate::{ Parseable, @@ -22,7 +24,7 @@ impl<'a> Parseable<'a, &'a str> for Uri { type Parser = impl Parser<&'a str, Output = Self>; fn parser() -> Self::Parser { - let protocol = alpha1::<&str>() + let protocol = ascii_alpha1::<&str>() .followed_by(tag("://")) .map(|output: &str| output.to_string()); let path = r#if(|c: &char| !c.is_ascii_whitespace()) @@ -67,8 +69,11 @@ impl<'a> Parseable<'a, &'a str> for License { type Parser = impl Parser<&'a str, Output = Self>; fn parser() -> Self::Parser { - let start = alphanumeric().or(one_of("_".chars())); - let rest = alphanumeric().or(one_of("+_.-".chars())).repeated().many(); + let start = ascii_alphanumeric().or(one_of("_".chars())); + let rest = ascii_alphanumeric() + .or(one_of("+_.-".chars())) + .repeated() + .many(); start .and(rest) @@ -81,8 +86,11 @@ impl<'a> Parseable<'a, &'a str> for Eapi { type Parser = impl Parser<&'a str, Output = Self>; fn parser() -> Self::Parser { - let start = alphanumeric().or(one_of("_".chars())); - let rest = alphanumeric().or(one_of("+_.-".chars())).repeated().many(); + let start = ascii_alphanumeric().or(one_of("_".chars())); + let rest = ascii_alphanumeric() + .or(one_of("+_.-".chars())) + .repeated() + .many(); start .and(rest) @@ -116,23 +124,23 @@ where |it| { let exprs = || { Depend::parser() - .separated_by_with_trailing(whitespace1()) + .separated_by_with_trailing(ascii_whitespace1()) .at_least(1) - .delimited_by(tag("(").followed_by(whitespace1()), tag(")")) + .delimited_by(tag("(").followed_by(ascii_whitespace1()), tag(")")) }; let all_of_group = exprs().map(|exprs| Depend::AllOf(exprs)); let any_of_group = exprs() - .preceded_by(tag("||").followed_by(whitespace1())) + .preceded_by(tag("||").followed_by(ascii_whitespace1())) .map(|exprs| Depend::AnyOf(exprs)); let one_of_group = exprs() - .preceded_by(tag("^^").followed_by(whitespace1())) + .preceded_by(tag("^^").followed_by(ascii_whitespace1())) .map(|exprs| Depend::OneOf(exprs)); let conditional_group = Conditional::parser() - .followed_by(whitespace1()) + .followed_by(ascii_whitespace1()) .and(exprs()) .map(|(conditional, exprs)| Depend::ConditionalGroup(conditional, exprs)); @@ -189,7 +197,7 @@ mod test { let it = InputIter::new("flag? ( || ( foo/bar foo/bar ) )"); Depend::<Atom>::parser() - .separated_by(whitespace1()) + .separated_by(ascii_whitespace1()) .many() .check_finished(it) .unwrap(); |
