Skip to content

Commit

Permalink
op_modifier: unwrap inner do_parse!()
Browse files Browse the repository at this point in the history
  • Loading branch information
vthriller committed Sep 12, 2021
1 parent 2231446 commit 058e41c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/expr.rs
Expand Up @@ -294,17 +294,19 @@ fn op_modifier(input: &[u8]) -> IResult<&[u8], OpMod> {
))) >>
labels: label_list >>
// TODO > Grouping modifiers can only be used for comparison and arithmetic. Operations as and, unless and or operations match with all possible entries in the right vector by default.
group: opt!(do_parse!(
side: call!(alt((
group: opt!(call!(map(tuple((
alt((
map(tag("group_left"), |_| OpGroupSide::Left),
map(tag("group_right"), |_| OpGroupSide::Right),
))) >>
labels: map!(
opt!(label_list),
)),
map(
opt(label_list),
|labels| labels.unwrap_or_default()
) >>
),
)),
|(side, labels)|
(OpGroupMod { side, labels })
)) >>
))) >>
(OpMod { action, labels, group })
))(input)
}
Expand Down

0 comments on commit 058e41c

Please sign in to comment.