Skip to content

Commit

Permalink
Avoid passing unnecessary precedence
Browse files Browse the repository at this point in the history
  • Loading branch information
dy committed Jun 11, 2024
1 parent c55dbac commit f11ff85
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export let idx, cur,
prev = lookup[c],
word = op.toUpperCase() !== op // make sure word boundary comes after word operator
) => lookup[c] = (a, curPrec, from = idx) =>
(curPrec < prec && (l < 2 || cur.substr(idx, l) == op) && (!word || !parse.id(cur.charCodeAt(idx + l))) && (idx += l, map(a, curPrec))) ||
(curPrec < prec && (l < 2 || cur.substr(idx, l) == op) && (!word || !parse.id(cur.charCodeAt(idx + l))) && (idx += l, map(a))) ||
(idx = from, prev?.(a, curPrec)),

// right assoc is indicated by negative precedence (meaning go from right to left)
Expand Down

0 comments on commit f11ff85

Please sign in to comment.