refactor(varcon): Flatten description parsing

This commit is contained in:
Ed Page 2024-08-23 09:53:03 -05:00
parent 095c7aecc2
commit 1e9d9813a0

View file

@ -993,21 +993,21 @@ impl Entry {
fn parse_description(input: &mut &str) -> PResult<Self, ()> { fn parse_description(input: &mut &str) -> PResult<Self, ()> {
trace("description", move |input: &mut &str| { trace("description", move |input: &mut &str| {
let (_abbr, _plural, pos, archaic, note, description) = ( let _ = winnow::combinator::opt((winnow::ascii::space1, "<abbr>")).parse_next(input)?;
winnow::combinator::opt((winnow::ascii::space1, "<abbr>")), let _ = winnow::combinator::opt((winnow::ascii::space1, "<pl>")).parse_next(input)?;
winnow::combinator::opt((winnow::ascii::space1, "<pl>")), let pos = winnow::combinator::opt((
winnow::combinator::opt(( winnow::ascii::space1,
winnow::ascii::space1, delimited('<', cut_err(Pos::parse_), cut_err('>')),
delimited('<', cut_err(Pos::parse_), cut_err('>')), ))
)), .parse_next(input)?;
winnow::combinator::opt((winnow::ascii::space1, "(-)")), let archaic =
winnow::combinator::opt((winnow::ascii::space1, "--")), winnow::combinator::opt((winnow::ascii::space1, "(-)")).parse_next(input)?;
winnow::combinator::opt(( let note = winnow::combinator::opt((winnow::ascii::space1, "--")).parse_next(input)?;
winnow::ascii::space1, let description = winnow::combinator::opt((
winnow::token::take_till(0.., ('\n', '\r', '#')), winnow::ascii::space1,
)), winnow::token::take_till(0.., ('\n', '\r', '#')),
) ))
.parse_next(input)?; .parse_next(input)?;
let variants = Vec::new(); let variants = Vec::new();
let pos = pos.map(|(_, p)| p); let pos = pos.map(|(_, p)| p);