Repository navigation
fix(det): re-wrap joined continuation lines to fixed form for the parser (#4412) - #4433
Merged
Merged
Conversation
…e errors (#4411) The det translator now refuses, by name, what it used to accept and ignore: - det/cics.OPTIONS lists the options each modelled EXEC CICS command honours; any other option is a hole ("<verb> <opt>: option not modelled"): RETURN IMMEDIATE, READ GTEQ / GENERIC, STARTBR / READNEXT / ENDBR GENERIC / REQID, LINK SYNCONRETURN / DATALENGTH / SYSID, ASSIGN beyond its five, FORMATTIME forms it does not write, RECEIVE MAP ASIS, READQ TS SET, a TD option read as TS, SEND TEXT CURSOR(value) ... - KEYLENGTH only as the file's full key, a known value on a known file; READ / READNEXT / READPREV LENGTH only as the INTO area's own length. - det/stmt.parse: an ERROR / MISSING node outside the PROCEDURE DIVISION node refuses the program (it had dropped whole paragraphs: ENTRY ... USING in DBUNLDGS / PAUDBLOD / PAUDBUNL); one nested in a statement is a hole, in an IF / EVALUATE / WHEN header an unparsed condition. - det/layout.parse: an ERROR / MISSING inside a data entry, and an unquoted VALUE word that is no number, refuse instead of being read as text. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…their own refusal (#4411) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…arser (#4412) det/source.as_fixed kept a joined continuation as one line past column 72, which the tree-sitter COBOL grammar fails on. as_fixed_rows now wraps such a line back into fixed form (split at a space outside literals, or a literal continued with '-' in column 7 and the quote again in column 10) and returns a row map to the expanded lines: - det/stmt.parse: origin() maps parser rows through the row map; statement, EXEC and SORT text has the continuation markers joined again (unwrap). - det/layout: _txt joins them too, and a continued literal's string node (to the grammar only its last row's piece) starts at the quote still open on its first row; item lines and errors map through the row map. Lines within column 72 reach the parser byte-identical, so all 54 det-ported programs' parser input is unchanged (det_port.py check: 55/55 ports unchanged). #4378 bake-off corpora: unported 118 -> 131 of 149, NIST CCVS85 39 -> 143 of 150; all 355 re-wrapped VALUE literals decode verbatim. Single-quoted continuations (CardDemo CBSTM03A) still fail: a separate shape. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Imports: union of #4412's as_fixed_rows/unwrap and #4430's cobol_parser. Error lines keep #4412's line_of row map. Tests: keep both blocks. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VrujbRefDqQ8ptAwTBQTaz
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.
Closes #4412. Stacked on #4432 (#4411). This branch contains #4432's two commits, so review only the last commit. It targets
mainso that CI runs; once #4432 merges, the diff shrinks to this change.Change (about 30 lines of logic, as #4378's bake-off comment describes)
det/source.as_fixed_rows: a line longer than columns 8-72 (a joined continuation) is wrapped back into fixed form. It splits at a space outside literals; a literal still open at column 72 continues on the next row with-in column 7 and the quote again in column 10. The function also returns a row map to the expanded lines.as_fixedreturns its text.unwrapjoins the continuations again.det/stmt.parse:origin()maps parser rows through the row map. Statement, EXEC and SORT text is unwrapped before the hand parsers read it.det/layout:_txtstrips the continuation markers. One fix beyond the bake-off prototype: the grammar'sstringnode for a continued literal covers only its last row's piece, so on the prototype a 99-character VALUE decoded as its final 33 characters._literal_startstarts the literal at the quote still open on its first row. Item lines and DATA errors map through the row map.Evidence
Ported programs: parser input byte-identical. No ported program has a line past column 72. The bytes fed to tree-sitter by
layout.parseandstmt.parse, hashed per program, are identical for 54/54.det_port.py checkagainst #4432's translation gives 55/55 ports unchanged.Parse coverage. Measured with the translator's own front end on the #4378 bake-off corpora: DATA and PROC parsed with no ERROR region, the bake-off's criterion.
No program lost its parse. Every re-wrapped VALUE literal decodes verbatim: 355/355, checked against the joined source line.
Newly parsed programs: refuse vs translate. 117 programs are newly parsed: 13 unported, which are all NIST copies in the robust-src set, plus 104 NIST. All are batch; none uses CICS.
6 refused whole, all with
no open EVALUATE: a SEARCH … WHEN, whose WHEN the walker reads as an EVALUATE's. This is a translator gap that predates this change.111 translated with statement holes, none clean. Top hole reasons (programs):
WRITE … ADVANCING: 111. Every NIST program writes its print file with it.INDEXED BY) taken for a data item (SET/MOVE/IF … no such item): 60+;DECLARATIVES: 20;COMPUTE … ALL: 9;PERFORM VARYING … AFTER: 6.The translation was run with a placeholder stub and no generated project. So "no repository for this file" holes on file I/O are left out of these counts: they are an artefact of the measurement setup.
Known gap, not chased. Single-quoted continued literals still fail (CardDemo CBSTM03A:
DATA DIVISION does not parse).Tests (72 pass):
Gates:
pr_gates.py --fast5/5 pass. Coordination: nothing under the crucible ports, the harness or the evidence tooling is touched (#4425). #4349 (#4342) works in the same area and is paused.🤖 Generated with Claude Code