cl-parser: change match parse slightly
This commit is contained in:
parent
8c23aea4af
commit
cd2e3c3e32
@ -1101,13 +1101,14 @@ impl Parse<'_> for Match {
|
|||||||
/// [Match] = `match` [Expr] `{` [MatchArm],* `}`
|
/// [Match] = `match` [Expr] `{` [MatchArm],* `}`
|
||||||
fn parse(p: &mut Parser<'_>) -> PResult<Self> {
|
fn parse(p: &mut Parser<'_>) -> PResult<Self> {
|
||||||
p.match_type(TokenKind::Match, Parsing::Match)?;
|
p.match_type(TokenKind::Match, Parsing::Match)?;
|
||||||
let scrutinee = condition(p)?.into();
|
Ok(Match {
|
||||||
let arms = delim(
|
scrutinee: condition(p)?.into(),
|
||||||
sep(MatchArm::parse, TokenKind::Comma, CURLIES.1, Parsing::Match),
|
arms: delim(
|
||||||
CURLIES,
|
sep(MatchArm::parse, TokenKind::Comma, CURLIES.1, Parsing::Match),
|
||||||
Parsing::Match,
|
CURLIES,
|
||||||
)(p)?;
|
Parsing::Match,
|
||||||
Ok(Match { scrutinee, arms })
|
)(p)?,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user