use .value() for instructions
This commit is contained in:
parent
6c894246f4
commit
56ca0b72a8
1 changed files with 3 additions and 5 deletions
|
@ -11,7 +11,7 @@ fn main() {
|
||||||
println!("{}", pt2(&input));
|
println!("{}", pt2(&input));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||||
enum Inst {
|
enum Inst {
|
||||||
Mul(i64, i64),
|
Mul(i64, i64),
|
||||||
Do,
|
Do,
|
||||||
|
@ -56,13 +56,11 @@ fn parse_mul(input: &mut &str) -> PResult<Inst> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_do(input: &mut &str) -> PResult<Inst> {
|
fn parse_do(input: &mut &str) -> PResult<Inst> {
|
||||||
let _ = "do()".parse_next(input)?;
|
"do()".value(Inst::Do).parse_next(input)
|
||||||
Ok(Inst::Do)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_dont(input: &mut &str) -> PResult<Inst> {
|
fn parse_dont(input: &mut &str) -> PResult<Inst> {
|
||||||
let _ = "don't()".parse_next(input)?;
|
"don't()".value(Inst::Dont).parse_next(input)
|
||||||
Ok(Inst::Dont)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_inst(input: &mut &str) -> PResult<Inst> {
|
fn parse_inst(input: &mut &str) -> PResult<Inst> {
|
||||||
|
|
Loading…
Reference in a new issue