Repository navigation
det parser: NOT split from its relational operator across lines; ZERO in condition arithmetic (#4674, #4656) - #4680
Merged
Conversation
Contributor
This was referenced Oct 8, 2026
squid-protocol
marked this pull request as ready for review
October 8, 2026 14:40
squid-protocol
added a commit
that referenced
this pull request
Oct 8, 2026
…n-holes stmt.py: main's _join_not_breaks (#4680) runs first, then this PR's abbreviated AND/OR NOT = rewrite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MQNoe4wPJgr7dbUvs3DG6D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4674, Fixes #4656
Part of #4270.
What
det/stmt.py_join_not_breaks(new, called fromparse): the grammar refuses a NOT split from its relational operator by a line break, and with it the whole PROCEDURE DIVISION. Two shapes are rejoined before parsing, keeping the line count (the break moves after the operator, with the next line's indent):NOTat a line end (IF S3 NOT/< 3,NOT/= x,IS NOT/GREATER THAN,NOTalone on a line,OR NOT/< 100, in IF / EVALUATE WHEN / PERFORM UNTIL), and aNOT <op>that starts a line afterAND/OR. Literals with an odd quote count before the NOT are left alone.det/expr.pyParser._paren_is_condition(+ARITH_OPS): ZERO is a class word only after an operand; first in a parenthesised group or after an arithmetic operator it is a number, soIF (ZERO + 3) / 12 NOT > D0andIF (ZERO / 12) * P0 > S3parse. (TheWHEN D0 + ZERO > xshape already parses on main; a regression test is added.)Touched functions only:
stmt.parse(one call),stmt._join_not_breaks,expr.Parser._paren_is_condition.Tests
test_det_translate.py:test_a_relation_split_across_lines_or_with_zero_in_arithmetic_parses(10 shapes; 9 fail on main) andtest_a_when_with_zero_in_arithmetic_is_a_condition; they also assert the statement after the IF keeps its line.test_det_programs.py: programsSPLITNOTandZEROARITHagainst cobc, bytes / typed / groups (6 cells; fail on main, pass now).det_port.py check --base-ref origin/main: 68/68 ports unchanged (no corpus program was refused for this reason; no ledger change).pr_gates.py --fast: 5/5 pass;--ratchets: 7 pass, 0 skipped.Not covered
Fuzz seeds 12 and 23 from the #4655 run (the #4674 hits) now translate, but fail at runtime with a division by zero: that is #4655 / #4677 (zero divisor), not this PR.
🤖 Generated with Claude Code