1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use super::*;
use nom::{branch::alt, sequence::tuple};
impl TailwindBorderCollapse {
pub fn parser<'a>() -> impl FnMut(&'a str) -> ParsedList<'a> {
move |input| {
as_list(alt((Self::parser_kind("collapse", Self::Collapse), Self::parser_kind("separate", Self::Collapse)))(input))
}
}
pub fn parser_kind<'a>(kind: &'static str, item: Self) -> impl Fn(&'a str) -> ParsedItem {
move |input| match tuple((
tag("border"),
tag("-"),
tag(kind),
))(input)
{
Ok((s, _)) => Ok((s, Box::new(item))),
Err(e) => Err(e),
}
}
}
impl TailwindTableLayout {
pub fn parser<'a>() -> impl FnMut(&'a str) -> ParsedList<'a> {
move |input| as_list(alt((Self::parser_kind("auto", Self::Auto), Self::parser_kind("fixed", Self::Fixed)))(input))
}
pub fn parser_kind<'a>(kind: &'static str, item: Self) -> impl Fn(&'a str) -> ParsedItem {
move |input| match tuple((
tag("table"),
tag("-"),
tag(kind),
))(input)
{
Ok((s, _)) => Ok((s, Box::new(item))),
Err(e) => Err(e),
}
}
}