cl-parser: change match parse slightly

This commit is contained in:
John 2025-05-05 04:16:37 -04:00
parent 8c23aea4af
commit cd2e3c3e32

View File

@ -1101,13 +1101,14 @@ impl Parse<'_> for Match {
/// [Match] = `match` [Expr] `{` [MatchArm],* `}`
fn parse(p: &mut Parser<'_>) -> PResult<Self> {
p.match_type(TokenKind::Match, Parsing::Match)?;
let scrutinee = condition(p)?.into();
let arms = delim(
sep(MatchArm::parse, TokenKind::Comma, CURLIES.1, Parsing::Match),
CURLIES,
Parsing::Match,
)(p)?;
Ok(Match { scrutinee, arms })
Ok(Match {
scrutinee: condition(p)?.into(),
arms: delim(
sep(MatchArm::parse, TokenKind::Comma, CURLIES.1, Parsing::Match),
CURLIES,
Parsing::Match,
)(p)?,
})
}
}