impl atom parsing

This commit is contained in:
John Turner
2025-10-23 00:52:35 -04:00
parent 6e4b45027e
commit 2e7d8cfbb9
5 changed files with 358 additions and 0 deletions

10
src/useflag/mod.rs Normal file
View File

@@ -0,0 +1,10 @@
pub mod parsers;
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct UseFlag(String);
impl UseFlag {
pub fn get(&self) -> &str {
self.0.as_str()
}
}

10
src/useflag/parsers.rs Normal file
View File

@@ -0,0 +1,10 @@
use mon::{Parser, alpha1, alphanumeric, one_of, 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()))))
.recognize()
.map(|output: &str| UseFlag(output.to_string()))
}