Skip to content

det: read continued apostrophe literals, "" inside literals, PROGRAM-ID without its period (#4523, #4462) - #4526

Merged
squid-protocol merged 2 commits into
mainfrom
fix/4523-det-grammar
Oct 6, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
fix/4523-det-grammar

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #4523. Part of #4462 (LNCALC; DECIMAL-POINT IS COMMA was looked at and stays refused).

What changed (det/source.py)

  • Continued apostrophe literals. The tree-sitter grammar continues a literal only in quotation marks: '... at column 72 followed by - '... did not parse. as_fixed_rows (det translator: re-wrap joined continuation lines to fixed form in det/source.as_fixed (recovers most parse failures) #4412) now writes every literal on a re-wrapped line in quotation marks for the grammar. The value is unchanged ('' is undoubled), and every reader takes the delimiter from the literal's first character (expr._unquote, layout._one).
  • "" inside a quotation-mark literal. The grammar read VALUE "IT""S" as two values (IT, S: silently wrong) and refused MOVE "IT""S". It reads 'IT''S' correctly. Each "" is now handed to the grammar as U+001E (source.QQ), and unwrap turns it back into "". A source that already contains U+001E is refused by name (unmodelled).
  • EXEC blocks keep their own quotes (in SQL an apostrophe marks a string and a quotation mark a name). The grammar never reads these lines: they are blanked or replaced by a placeholder CALL.
  • A doubled quote at column 72 of a re-wrapped row is no longer split across the continuation.
  • PROGRAM-ID LNCALC. (det translator: 32 programs refused across the keyed corpora and estate-crucible (code pages, free format, multi-program sources, grammar gaps); KYUYJP crashes #4462): logical_lines puts back the missing period, which Enterprise COBOL accepts with a warning.
  • DECIMAL-POINT IS COMMA stays refused. Supporting it needs a comma-aware numeric tokenizer in the statement grammar (0,5 vs A, B), VALUE parsing, edited PICTUREs with . and , swapped, and changes to runtime edited moves and DISPLAY. Its only program, ZINSBER, would still be refused because of its national-letter name BETRÄGE. The reason is recorded in det_port_design.md.

Effect (fact cross-check)

Newly translating: CardDemo CBSTM03A, DSF FO04F1X1, estate-crucible RPTHDR and LNCALC. Their translator-refuses-* entries leave the ledger (fact_crosscheck.py update). CBSTM03A brings 40 new disagreements, each assigned with assign:

Evidence

  • Tests: 15 new test cases in tests/cobol_mainframe/test_det_translate.py. They cover both quote styles with the continuation in Area B (columns 12 and 20), a doubled quote plus the other quote kind inside a continued literal, a doubled quote at column 72, "" in a VALUE and a MOVE, the U+001E refusal, an EXEC SQL line keeping its apostrophes, a hex literal on a wrapped line, and PROGRAM-ID in three forms. The selfscan venv has the translator extra, and 158/158 tests pass with no skips.
  • pr_gates.py: 7/7 pass (lint, audits, secrets, xray, gauntlet, golden, suite). Golden is unchanged, so nothing was re-blessed.
  • pr_gates.py --ratchets: 5/5 pass (ports, estate, fact-crosscheck, completeness, ground-truth), both before and after merging origin/main (det: SEND CONTROL and terminal RECEIVE (INTO/SET/LENGTH/MAXLENGTH/NOTRUNCATE, LENGERR, EOC) (#4413) #4500).
  • mypy audit run in a fresh py3.12 venv (mypy 2.4.0) on a git archive export of HEAD: no new errors.
  • Det sweep (proof_sweep.py --det-only --skip-db2): "as expected", so the baseline is unchanged.

Still open under #4462

DBCS / national text (KYUY), DECIMAL-POINT IS COMMA (ZINSBER, plus its BETRÄGE name), several programs in one source (PAYMAIN, refused first by its COPY collision), IDMS (LNIDMS01), and the grammar gaps in translator-refuses-grammar: SEARCH ALL / no open EVALUATE, DL/I, DSF ALPHABET / FD shapes, FUNCTION CURRENT-DATE (1:4) (KØBREG), CBIMPORT, lgtestc1, polloo2. A continued hex literal (X'... over two rows) still does not parse in either quote style.

🤖 Generated with Claude Code

https://claude.ai/code/session_01W3KVtYHQp8KsfKcHsdiPbR

squid-protocol and others added 2 commits October 5, 2026 22:39
…ID without its period (#4523, #4462)

The tree-sitter COBOL grammar continues a literal only in quotation marks and
splits "IT""S" into two literals. as_fixed_rows now hands it every literal of a
re-wrapped line in quotation marks (same value) and each "" as U+001E, which
unwrap restores; EXEC block lines keep their own quotes. A doubled quote at
column 72 of a re-wrapped row is kept together. logical_lines puts back the
period after PROGRAM-ID (estate-crucible LNCALC).

Newly translating: CardDemo CBSTM03A, DSF FO04F1X1, estate-crucible RPTHDR and
LNCALC. CBSTM03A's cross-check found the engine's group USAGE gap (#4525),
ledgered. DECIMAL-POINT IS COMMA stays refused (det_port_design.md says why).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01W3KVtYHQp8KsfKcHsdiPbR
@squid-protocol squid-protocol added bug Unintended behavior or logic failure in the engine legacy-modernization COBOL refractor, dead-code extraction, and JCL forging priority: high Core feature broken, but workarounds exist labels Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unintended behavior or logic failure in the engine legacy-modernization COBOL refractor, dead-code extraction, and JCL forging priority: high Core feature broken, but workarounds exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

det translator: single-quoted literal continued onto the next line is not parsed

1 participant