From 1e9d9813a0fef8b810454b2d34ab39fe7ab729ac Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 23 Aug 2024 09:53:03 -0500 Subject: [PATCH] refactor(varcon): Flatten description parsing --- crates/varcon-core/src/parser.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/crates/varcon-core/src/parser.rs b/crates/varcon-core/src/parser.rs index ebedca4..d576bc0 100644 --- a/crates/varcon-core/src/parser.rs +++ b/crates/varcon-core/src/parser.rs @@ -993,21 +993,21 @@ impl Entry { fn parse_description(input: &mut &str) -> PResult { trace("description", move |input: &mut &str| { - let (_abbr, _plural, pos, archaic, note, description) = ( - winnow::combinator::opt((winnow::ascii::space1, "")), - winnow::combinator::opt((winnow::ascii::space1, "")), - winnow::combinator::opt(( - winnow::ascii::space1, - delimited('<', cut_err(Pos::parse_), cut_err('>')), - )), - winnow::combinator::opt((winnow::ascii::space1, "(-)")), - winnow::combinator::opt((winnow::ascii::space1, "--")), - winnow::combinator::opt(( - winnow::ascii::space1, - winnow::token::take_till(0.., ('\n', '\r', '#')), - )), - ) - .parse_next(input)?; + let _ = winnow::combinator::opt((winnow::ascii::space1, "")).parse_next(input)?; + let _ = winnow::combinator::opt((winnow::ascii::space1, "")).parse_next(input)?; + let pos = winnow::combinator::opt(( + winnow::ascii::space1, + delimited('<', cut_err(Pos::parse_), cut_err('>')), + )) + .parse_next(input)?; + let archaic = + winnow::combinator::opt((winnow::ascii::space1, "(-)")).parse_next(input)?; + let note = winnow::combinator::opt((winnow::ascii::space1, "--")).parse_next(input)?; + let description = winnow::combinator::opt(( + winnow::ascii::space1, + winnow::token::take_till(0.., ('\n', '\r', '#')), + )) + .parse_next(input)?; let variants = Vec::new(); let pos = pos.map(|(_, p)| p);