2020: bump nom version
I was getting a compilation error (something in the latest Rust compiler?), related to a nom dependency (bitvec v0.19), but nom 7 does not depend on bitvec by default anymore, yay! The move + clone closures feel kind of wrong though
This commit is contained in:
parent
4f36262761
commit
0446f11a46
3 changed files with 17 additions and 61 deletions
|
|
@ -10,7 +10,7 @@ edition = "2021"
|
|||
aoc = { path = "../aoc" }
|
||||
anyhow = "1.0"
|
||||
itertools = "0.9"
|
||||
nom = "6.0"
|
||||
nom = "7.0"
|
||||
|
||||
[lib]
|
||||
path = "src/lib.rs"
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ fn operator_expr(input: &str) -> IResult<&str, Expr> {
|
|||
|
||||
fold_many0(
|
||||
pair(delimited(char(' '), operator, char(' ')), term),
|
||||
first_term,
|
||||
move || first_term.clone(),
|
||||
|acc, (op, val)| Expr::Op(Box::new(acc), op, Box::new(val)),
|
||||
)(i)
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ fn plus(input: &str) -> IResult<&str, Expr> {
|
|||
delimited(char(' '), char('+'), char(' ')),
|
||||
term_plus_priority,
|
||||
),
|
||||
first_term,
|
||||
move || first_term.clone(),
|
||||
|acc, (_, val)| Expr::Op(Box::new(acc), Operator::Addition, Box::new(val)),
|
||||
)(i)
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ fn mul(input: &str) -> IResult<&str, Expr> {
|
|||
|
||||
fold_many0(
|
||||
pair(delimited(char(' '), char('*'), char(' ')), plus),
|
||||
first_factor,
|
||||
move || first_factor.clone(),
|
||||
|acc, (_, val)| Expr::Op(Box::new(acc), Operator::Multiplication, Box::new(val)),
|
||||
)(i)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue