rpn(1): changes to error message
This commit is contained in:
parent
258881dbb2
commit
885f167afc
12
src/rpn.rs
12
src/rpn.rs
@ -129,18 +129,18 @@ fn eval(
|
|||||||
};
|
};
|
||||||
|
|
||||||
match x {
|
match x {
|
||||||
Val(x_) => stack.push_back(x_),
|
Val(v) => stack.push_back(v),
|
||||||
_ => ops.push_back(x),
|
_ => ops.push_back(x),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for op in &ops {
|
for op in &ops {
|
||||||
match op {
|
match op {
|
||||||
Val(_) => {
|
Val(v) => {
|
||||||
return Err(EvaluationError {
|
return Err(EvaluationError { message: format!(
|
||||||
message: "Unexpected value in the operator stack."
|
"{}: Unexpected value in the operator stack.",
|
||||||
.to_string()
|
v
|
||||||
})
|
)});
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
let (x, y) = (
|
let (x, y) = (
|
||||||
|
Loading…
Reference in New Issue
Block a user