Repository navigation
det reader: the REPLACE statement is applied (REPLACE ==a== BY ==b==, REPLACE OFF), refused by name where it cannot be (Part of #8412) - #9019
Merged
Conversation
…F), or refused by name where it cannot be (Part of #8412) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
|
No description provided. |
Contributor
13 tasks done
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.
Part of #8412. Checklist: done [c:1e95fd31]
What
The line asks whether tab characters and the REPLACE statement (not COPY REPLACING) reach the det path correctly. #8654, #8991, #8999 and #9009 pinned the answer as "refused by name" for REPLACE. This PR replaces the refusal with the real behaviour for the forms it can apply soundly.
det/replace.py, called at the end ofsource.program_lines(after COPY ... REPLACING, as IBM orders them):REPLACE ==a== BY ==b== [...]rewrites the text that follows (member text included) until the next REPLACE orREPLACE OFF; the statement is removed. Matching is the COPY REPLACING rule (replace_text: whole words, case-insensitive,:TAG:partial words, one left-to-right pass), applied outside literals. Multi-line statements and text after the statement's period are read.END PROGRAM.REPLACE FAKEOLD BY FAKENEW.(no pseudo-text) used to pass through silently; it is now refused.CSLKPCDY.cpy, proven), text after a tab there is refused (det reader: a tab in columns 1-7 followed by text inside them is refused by name (Part of #8412) #9009), a tab between tokens is read.Evidence
tests/cobol_mainframe/test_det_tab_replace_8412.py(authored programs, invented names): application, case-insensitivity, whole-word, REPLACE OFF, a second REPLACE superseding the first, multi-line + tail + literal untouched, COPY member text replaced after COPY REPLACING, the five refusals, END PROGRAM, replaced names reachinglayout.records. 22 pass with the engine-side file; neighbouring det tests 636 passed..cbl/.cob/.cpyunder the mainframe corpora finds 0 REPLACE statements, so no port moves;det_port.py checknot run for that reason.audit_check.py(ruff, mypy, dead-key, doc-refs, ast-accuracy, signal-coverage) OK; pinned ruff 0.17.1 format clean. Not run:pr_gates --ratchets, golden bless (no extraction/detector/language-standards change; det translator source reader only).Class / Sibling gaps
Class: source-text rewrites and column-layout irregularities reaching the det reader (REPLACE statement, COPY REPLACING, tabs) in the program and in COPY members. Handled: REPLACE in the program, applied (this PR); REPLACE OFF (this PR); REPLACE after COPY REPLACING (this PR); REPLACE in a member, refused by name (#8999); tab in columns 1-7 with text after it, refused (#9009); tab-led blank lines and tabs between tokens, read (#8654, #8991, #9009); COPY REPLACING (#4265).
Sibling gaps (member, status, why not here):
END PROGRAM(batch compile): refused; scope rules need a per-program pass.extract_boundary) still does not apply REPLACE (names as written, pinned Engine scan side: tabs and the REPLACE statement pinned on authored programs (Part of #8412) #8991): the engine scan, not the det path.replace_textis not literal-aware); the REPLACE statement here is. Not changed (path shared with the scanner).Lessons for agents
det/source.pylogical_linesraised on a REPLACE statement for every caller (bll.py,cics.py,dli.py); the newkeep_replaceflag lets onlyprogram_lineskeep it fordet/replace.py: other readers still refuse.Co-Authored-By: Claude Sonnet 5.5 [email protected]
🤖 Generated with Claude Code