Repository navigation
fix: keep unclosed subscript recovery linear - #20
Conversation
|
Thanks for the fix, @everton-dgn. I reviewed this against #14 and the results look good. What I tested (head b071427 vs its merge-base 61b82c2, which is current main; Node 24, built with plain
I did not find a concern. This is differential evidence over the corpora above, not a proof of equivalence. One reading note: the per-start-position cache is only filled from positions the search actually visited and only when no errors were recorded, which matches the comment about not caching inside skipped quote/comment syntax. The 28,192 targeted cases above did not find a case where that breaks down. |
|
Thanks for the review and for the differential runs against #14. Let me know if anything else is needed before merging. |
commit: |
|
Merged, thanks @everton-dgn, and thanks @jecruz for the detailed review. I retained your original commit and added follow-ups to collect exact failed positions during the existing delimiter scan and preserve the recovery cache across nested scans. This removes the extra scan and positive-result cache. Some malformed inputs now report local subscript errors instead of repeated nested errors; the regression tests cover valid syntax, recovery of later commands and bounded growth. CI is green, including the Node 14 smoke test. |
Resolves #14. Co-authored-by: Lars Kappert <[email protected]>
Repeated unclosed subscripts followed by a final
]make recovery scan the remaining input again for each command. This caches bracket results after a failed search, only at positions the lexer visited, so recovery can still reinterpret quotes and comments correctly.For the 256-line case in the issue, character reads fall from 204,539 to 10,737. The regression checks growth in reads rather than elapsed time and preserves the later-assignment checks.
The full 2,060-test suite passed on Node 24. After the final syntax adjustment, 263 focused tests, type checks, lint, formatting and the runtime smoke test passed. I couldn't run the Node 14 smoke test on this arm64 Mac; CI still needs to cover it.
Fixes #14