Repository navigation
COBOL func_start: a column-1 free-format paragraph keeps its whole name (part of #4203) - #4371
Merged
Merged
Conversation
…me (part of #4203) In free-format source a paragraph name may start in column 1, which puts its own hyphen in column 7 (`LOOKUP-RATE.`). func_start's optional fixed-format margin took `LOOKUP` as a sequence number, and the unit was recorded as `RATE`. The `\b` guard against this greedy-margin trap allowed the split because a hyphen is not a regex word character, although it is a COBOL name character. A name now starts only where no name character precedes it (estate-crucible H-0028). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
Contributor
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 #4203: only the H-0028 shape. The PROGRAM-ID-as-unit design question stays open.
What was broken
In free-format COBOL a paragraph name may start in column 1, so its own hyphen can sit in column 7. estate-crucible H-0028,
apps/MODN/cobol/MODRATE.cbl:25, hasLOOKUP-RATE.under>>SOURCE FORMAT FREE.func_start's optional fixed-format margin (columns 1-6 plus the column-7 indicator) tookLOOKUPas a sequence number, so the unit was recorded asRATE.The
\bmeant to catch this greedy-margin trap (TargetFunc.) did not fire. A hyphen is not a regex word character, so there is a\bbetween-andR, even though the hyphen is a COBOL name character.The fix
In
cobol.pyfunc_start, the name now starts only where no name character (letters, digits,_,-, national and wide characters) precedes it. When the margin-eater splits a word, the match backtracks to "no margin" and captures the whole name. The real fixed-format cases still lose their margin:000100 LOOKUP-RATE.→LOOKUP-RATE064100DDEBUG-LINE-A.→DEBUG-LINE-A, through the existing digit-sequence lookbehindTargetFunc.→TargetFuncEvidence
tests/extraction/languages/test_cobol_free_format_col1_4203.py(MODRATE shape plusABCDEF-GHIJ., whose 6-letter first word is the worst case). It fails on main:RATE/GHIJ. A margin-cases test pins the forms above.galaxyscope --db-onlyof MODRATE.cbl givesfunction_data=MAIN-PARA,LOOKUP-RATE.Estate-crucible v0.3.0 (main → this branch)
Nothing else moves.
Golden masters
crucible_check.py --update --yesagainst the siblinglanguage-crucibleat v1.7.0: no drift in either leg. The crucible has no column-1 hyphenated paragraph in free-format source, so no golden file changes. The real-scan check above shows the change reaches the scan.Ground-truth ledger
update: no change.check: clean.Local checks
tests/cobol_mainframe,tests/extractionandtests/core_engine(pinned corpora): 13,233 passed.mypy_audit/ruff_audit(0.16.0) /dead_key_audit --cireport nothing new.🤖 Generated with Claude Code
https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo