Repository navigation
core.cobol_preprocessor: one COPY / REPLACING rule for the scanner and the translator (Part of #5648, Fixes #5645) - #5654
Conversation
…scanner and the translator (Part of #5648, Fixes #5645) The translator's own COPY regex missed a quoted file literal with an extension (`COPY "ws-state.cpy".`). The COPY statement rule, its statement end and the REPLACING parse/apply now live once in gitgalaxy/core/cobol_preprocessor.py; det/source.py, mainframe_boundary and galaxy_ir import them and their copies are deleted. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
No description provided. |
|
No description provided. |
|
No description provided. |
|
CI shepherd: the head of this PR (c2768d7) is not the one a maintainer labelled |
|
No description provided. |
|
No description provided. |
|
PR #5654 @ c2768d7: 2 failed check(s) == full-suite (failure) -- real == full-suite part 3/3 (failure) -- real |
…lator now reads (Part of #5648) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…churn/5648-20261019T1449Z
|
No description provided. |
|
No description provided. |
|
PR #5654 @ 0220846: 2 failed check(s) == full-suite (failure) -- real == full-suite part 3/3 (failure) -- real |
|
No description provided. |
|
No description provided. |
Part of #5648, Fixes #5645
What
First slice of the shared COBOL preprocessor:
gitgalaxy/core/cobol_preprocessor.pyholds the COPY statement rule, its statement end, the REPLACING parse and the one-pass REPLACING apply once. The translator (det/source.py) and the scanner (mainframe_boundary,galaxy_ir) import them; their duplicates are deleted."ws-state.cpy") +OF/IN librarydet/source.py_COPY(no extension form, #5645)cobol_preprocessor.COPY_STATEMENT/copy_statements()det/source.py_statement_endstatement_endmainframe_boundary._copy_replacing+det/source.py_replacingcopy_replacinggalaxy_ir._replace_text+det/source.py_replace(sequential substring)replace_textThe translator now resolves
COPY "ws-state.cpy"/'state.inc'by the literal file name first, then the member stem (#5645), and applies REPLACING the way the scanner does (whole words unless:tag:/(tag)pseudo-text or LEADING/TRAILING). Every REPLACING shape in the burned corpora (==:TAG:==,==(TESTVAR1)==, word-by-word, literal-by-literal,==SORTCODE==,==NUMBER-OF-ACCOUNTS.==) gives the same text both ways.Class: COPY/REPLACING text rules kept twice (scanner vs translator) — one fixed, the other kept the blind spot.
Owner decisions
Owner OK (2026-10-19)
Proof
tests/cobol_mainframe/test_cobol_preprocessor_5648.py(24 tests, own fixtures): every spelling, library forms, extension needs its closing quote, statement end, one-pass REPLACING, scanner/translator share the same objects, fixed + free format expansion, missing literal refused by name, full translate.pr_gates.py --fast: 6/6 pass.det_port.py check: 135/135 ports unchanged (byte-identical translations vs origin/main; the EPSCSMRT parity warnings are pre-existing).crucible_check.py(golden-lock): full_precision PASS, zero_dependency PASS, no re-bless.pr_gates.py --ratchets: all pass. fact-crosscheck did not grow; estate, ground-truth, ports, cics-spec and time all pass.audit_check.py: all clear.det_port.py check(byte comparison of translations against origin/main).Remaining slices
_COPY_IN_ENTRY/_COPY_LIBRARYfrom the core rule (left alone here to avoid conflicting with COBOL: quoted copybook literals with an extension keep IN/REPLACING; plain section COPYs get a row (Fixes #5618) #5626).cobol_source_format): detlogical_lines,_free_code,_comment_at,_open_literal; mainframe_boundary_continued_literal.>>IF/>>ELSE/>>END-IF/>>DEFINEpercore.compiler_options.as_fixed/as_fixed_rows.docs/language_status/fact_ownership.mdnote.Sibling gaps
gitgalaxy/tools/cobol_to_cobol/cobol_graveyard_finder.py: its own_REPLACING_PAIRand_COPYBOOK_EXTS.EXEC SQL INCLUDEhandling, separate from the scanner's combined regex.COPY ... SUPPRESSphrase: not checked on either side.🤖 Generated with Claude Code