simplify loop logic a bit
This commit is contained in:
parent
d0f23af972
commit
13bec9f40b
|
|
@ -4,11 +4,9 @@ function isLeftAssociative(op) {
|
||||||
|
|
||||||
function popOps(opstack, queue, op) {
|
function popOps(opstack, queue, op) {
|
||||||
const prec = {"+": 1, "-": 1, "*": 2, "/": 2, "^": 3}
|
const prec = {"+": 1, "-": 1, "*": 2, "/": 2, "^": 3}
|
||||||
while (true) {
|
while (opstack.length > 0) {
|
||||||
const op2 = opstack.at(-1);
|
const op2 = opstack.at(-1);
|
||||||
if (op2 === undefined) {
|
if (op2 === "(") {
|
||||||
break;
|
|
||||||
} else if (op2 === "(") {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue