summaryrefslogtreecommitdiff
path: root/src/ebuild
diff options
context:
space:
mode:
Diffstat (limited to 'src/ebuild')
-rw-r--r--src/ebuild/parsers.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/ebuild/parsers.rs b/src/ebuild/parsers.rs
index f685df3..8ab2978 100644
--- a/src/ebuild/parsers.rs
+++ b/src/ebuild/parsers.rs
@@ -1,6 +1,6 @@
use std::path::PathBuf;
-use mon::{Parser, ParserIter, alpha1, r#if, tag, whitespace1};
+use mon::{Parser, ParserIter, alpha1, alphanumeric, r#if, one_of, tag, whitespace1};
use crate::{
Parseable,
@@ -48,6 +48,7 @@ impl<'a> Parseable<'a, &'a str> for SrcUri {
.recognize()
.map(|output: &str| PathBuf::from(output))
};
+
let uri = UriPrefix::parser()
.opt()
.and(Uri::parser())
@@ -66,10 +67,8 @@ impl<'a> Parseable<'a, &'a str> for License {
type Parser = impl Parser<&'a str, Output = Self>;
fn parser() -> Self::Parser {
- let start = r#if(|c: &char| c.is_ascii_alphanumeric() || "_".contains(*c));
- let rest = r#if(|c: &char| c.is_ascii_alphanumeric() || "+_.-".contains(*c))
- .repeated()
- .many();
+ let start = alphanumeric().or(one_of("_".chars()));
+ let rest = alphanumeric().or(one_of("+_.-".chars())).repeated().many();
start
.and(rest)
@@ -82,10 +81,8 @@ impl<'a> Parseable<'a, &'a str> for Eapi {
type Parser = impl Parser<&'a str, Output = Self>;
fn parser() -> Self::Parser {
- let start = r#if(|c: &char| c.is_ascii_alphanumeric() || "_".contains(*c));
- let rest = r#if(|c: &char| c.is_ascii_alphanumeric() || "+_.-".contains(*c))
- .repeated()
- .many();
+ let start = alphanumeric().or(one_of("_".chars()));
+ let rest = alphanumeric().or(one_of("+_.-".chars())).repeated().many();
start
.and(rest)