From 13bec9f40be0fb5059be53cc4f849a90302856b9 Mon Sep 17 00:00:00 2001 From: filifa Date: Thu, 11 Dec 2025 23:49:34 -0500 Subject: [PATCH] simplify loop logic a bit --- modules/parser.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/parser.js b/modules/parser.js index 85f2caa..ebb5754 100644 --- a/modules/parser.js +++ b/modules/parser.js @@ -4,11 +4,9 @@ function isLeftAssociative(op) { function popOps(opstack, queue, op) { const prec = {"+": 1, "-": 1, "*": 2, "/": 2, "^": 3} - while (true) { + while (opstack.length > 0) { const op2 = opstack.at(-1); - if (op2 === undefined) { - break; - } else if (op2 === "(") { + if (op2 === "(") { break; }