From 36689acb6bb577b27e546b9d166a40f503a47eac Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 15 Jul 2025 14:11:18 -0300 Subject: Use `shouldConcat()` in decision of `escapingStateSte()` * src/paca.mjs (escapingStateStep): Use `shouldConcat()` instead of only checking if we're on the last char. We abuse it a bit by passing `null` as the first argument, since it is being escaped. (nonConcatOperators, shouldConcat): Hoist the definition of both above `escapingStateStep()`, so that they're defined before being used. * tests/paca.mjs (test_shouldConcat): Add test case where `null` is explicitly passed as the first argument. --- tests/paca.mjs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/paca.mjs') diff --git a/tests/paca.mjs b/tests/paca.mjs index e9c3a6b..2c44f9e 100644 --- a/tests/paca.mjs +++ b/tests/paca.mjs @@ -511,6 +511,10 @@ const test_shouldConcat = t => { t.assertEq(shouldConcat("a", "|"), false); t.assertEq(shouldConcat("a", ")"), false); }); + + t.testing("only consider the `next` char", () => { + t.assertEq(shouldConcat(null, "\\"), true); + }); }; const test_isOperator = t => { -- cgit v1.2.3