Skip to content

Commit

Permalink
Update parse.js
Browse files Browse the repository at this point in the history
  • Loading branch information
dy committed Mar 7, 2024
1 parent 2bbeff8 commit 9375f1e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ export let idx, cur,
throw EvalError(`${msg} at ${lines.length}:${last.length} \`${idx >= 108 ? '…' : ''}${before}${after}\``, 'font-weight: bold')
},

// advance until condition meets
next = (is, from = idx, l) => {
while (l = is(cur.charCodeAt(idx))) idx += l
return cur.slice(from, idx)
},

// consume n characters
skip = (n = 1, from = idx) => (idx += n, cur.slice(from, idx)),

// a + b - c
Expand Down

0 comments on commit 9375f1e

Please sign in to comment.