summaryrefslogtreecommitdiff
path: root/src/paca.mjs
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-07-13 21:01:47 -0300
committerEuAndreh <eu@euandre.org>2025-07-13 21:01:47 -0300
commitfb4d96b2937973646ee23b1bb34f946b6a3a0913 (patch)
tree4af3c8a237b110cb81ace90d1285a4971edd6408 /src/paca.mjs
parentAdd first test for `rangeStateStep()` (diff)
downloadpaca-fb4d96b2937973646ee23b1bb34f946b6a3a0913.tar.gz
paca-fb4d96b2937973646ee23b1bb34f946b6a3a0913.tar.xz
src/paca.mjs (rangeStateStep): Return ValueError when range number decreases
Diffstat (limited to '')
-rw-r--r--src/paca.mjs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/paca.mjs b/src/paca.mjs
index c5102c3..74e24bc 100644
--- a/src/paca.mjs
+++ b/src/paca.mjs
@@ -5,6 +5,7 @@ import {
export class SyntaxError extends Error {}
+export class ValueError extends Error {}
const ConcatStep = {
ACCEPTING: "accepting",
@@ -46,7 +47,7 @@ const rangeStateStep = ({ out, state, context }, char, index, next) => {
out,
state,
context,
- error: new Error(
+ error: new ValueError(
`bad range values: {${from},${to}}`,
),
});