use new mon parsers

This commit is contained in:
John Turner
2025-11-13 23:21:46 +00:00
parent 58b4592b7b
commit 50ab68c9c5
3 changed files with 23 additions and 30 deletions

View File

@@ -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)