diff options
Diffstat (limited to '')
| -rw-r--r-- | src/paca.mjs | 12 | ||||
| -rw-r--r-- | tests/paca.mjs | 18 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/paca.mjs b/src/paca.mjs index c1bead1..6843c20 100644 --- a/src/paca.mjs +++ b/src/paca.mjs @@ -121,6 +121,18 @@ const TRANSITION_FNS = { where: "from", }, }), + "[": ({ out, _state, _context }, _char, _index, _next) => ({ + out, + state: ConcatStep.CLASS, + context: { + set: [], + range: { + from: [], + to: [], + where: "from", + }, + }, + }), }; const stateTransitionOperators = new Set(Object.keys(TRANSITION_FNS)); diff --git a/tests/paca.mjs b/tests/paca.mjs index b259968..a7cd929 100644 --- a/tests/paca.mjs +++ b/tests/paca.mjs @@ -73,6 +73,24 @@ const test_TRANSITION_FNS = t => { }, ); }); + + t.testing("\"[\" only depends on `out`", () => { + t.assertEq( + TRANSITION_FNS["["]({ out: 123 }, null, null, null), + { + out: 123, + state: "class", + context: { + set: [], + range: { + from: [], + to: [], + where: "from", + }, + }, + }, + ); + }); }; const test_shouldConcat = t => { |
