Repository navigation
#3942 / #3943: VALUES [ARE] is a VALUE clause; a copybook keeps a decimal-comma literal as written - #3948
Merged
Conversation
…imal-comma literal as written #3943: the record VALUE capture now accepts the plural VALUES and IS / ARE, with a COBOL-name boundary (not \b) so HIGH-VALUES is never read as the keyword. 88-level VALUES lists record their first literal, as VALUE does. #3942: a copybook (no DATA / PROCEDURE DIVISION header) has no SPECIAL-NAMES; DECIMAL-POINT IS COMMA belongs to the COPYing program. A separator comma is comma + space, so 12345,67 there is one literal: kept as written, right in every program that includes it. Programs without the clause are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ues; bogus TO / SECTION values gone Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Fixes #3942
Fixes #3943
Leftovers from #3911 (#3940). Both are in the COBOL record VALUE capture (
mainframe_boundary._cobol_records).#3943:
VALUES [ARE]is a VALUE clause_VALUE_CLAUSEmatched only the singularVALUE. Condition-names written with the plural (88 OK VALUES 1, 2, 3.,88 WS-PASS VALUES ARE 041 THRU 100.), and single items writtenVALUES "CABANA", recorded no value at all. The capture now acceptsVALUES?withIS/ARE, and records the first literal, as the singular form does.The keyword boundary is now a COBOL-name boundary (
(?<![A-Z<national>0-9-])) instead of\b. That fixes a second, older bug.\bVALUEmatched inside hyphenated names, and the last data item's text window runs on into the PROCEDURE DIVISION. SoMOVE LOW-VALUE TO …gave CBSA's last COMMAREA items the valueTO(9 programs), and cobol-check's paragraph100-COMPUTE-VALUE SECTIONgaveTEXT-3the valueSECTION.HIGH-VALUESas a value is unaffected (tested).#3942: a copybook keeps a decimal-comma literal as written
A copybook has no SPECIAL-NAMES: DECIMAL-POINT IS COMMA belongs to the program that COPYs it, so the per-file scan can't know it. But a separator comma is always a comma followed by a space, so
12345,67in a copybook can only be one literal. It is now kept as written when the stream is a copybook, meaning it has neither a DATA nor a PROCEDURE DIVISION header. That is correct in every program that includes it, and the reader applies that program's decimal point (#3911's contract).A program that doesn't declare DECIMAL-POINT IS COMMA is unchanged: it still stops at the comma. This is simpler than the issue's per-compilation-unit suggestion. It needs no cross-file resolution and can't conflict when programs with different settings share a copybook.
Golden masters (re-blessed, 22 differences per mode)
I diffed every COBOL file in the crucible corpus between main and this branch. There are 52 record changes, all intended:
VALUESclause: CardDemo'sFLG-*-ISVALID88s (Y),WS-NO-INFO-MESSAGE VALUES SPACES LOW-VALUES(SPACES),WS-PASS VALUES ARE 041 THRU 100(041),WS-CIUDAD PIC X(20) VALUES "CABANA", and so on.TOon 9 CBSA COMMAREA items andSECTIONon one cobol-check item.Tests
tests/cobol_mainframe/test_values_and_copybook_comma.py:VALUES,VALUES ARE … THRU,VALUE IS;HIGH-VALUES/HIGH-VALUEas values;12345,67next to aVALUES 1, 2, 3list;VALUES 1,5 2,5.Gates
pr_gates.py: lint, audits, secrets, xray, gauntlet and suite PASS. Golden failed only on the intended drift above, then passed after the re-bless.🤖 Generated with Claude Code