Shared COBOL preprocessor in gitgalaxy/core: one layout/continuation/COPY/REPLACING/conditional expander with a line map, used by both the scanner and the COBOL→Java translator
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 38/100
Direzione di ricerca
Start by reading gitgalaxy/tools/cobol_to_java/det/source.py and gitgalaxy/core/mainframe_boundary.py, then inspect core/cobol_source_format.py, core/copy_libraries.py, and core.compiler_options for reusable behavior. The work spans a shared preprocessor, recursive COPY handling, substitutions, line mapping, removal of duplicate paths, tests, and documentation in docs/language_status/fact_ownership.md; done means both consumers use one module and all crucible, equivalence, and cross-check cases pass as specified.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Why
The scanner and the COBOL→Java translator each turn COBOL files into "the program the compiler sees", separately. The fact cross-check gate (#4273, fact-crosscheck.yml) catches them disagreeing, but not sharing a blind spot: on 2026-10-19 both missed COPY "ws-state.cpy". (scanner #5618 / PR #5626, translator #5645), so they agreed and the gate stayed green. BMS already follows the shared pattern (the translator imports core.bms_screen_fields / core.bms_symbolic), as do core.cobol_source_format, core.source_text.read_source and core.compiler_options. Do the same for the rest of the text-level front end.
What the preprocessor does (one module in gitgalaxy/core, no tree-sitter, zero-dependency)
Input: a COBOL source file + copy libraries. Output: the expanded program text plus a line map (every expanded line → original file and line).
- Layout: fixed format (sequence area 1-6, indicator 7:
*/comment,Ddebug,-continuation; text past 72) and free format (*>),>>SOURCE FORMATswitching. Reusecore/cobol_source_format.py. - Continuations: join continued literals and words (
-in column 7). - COPY: find
COPY name [OF|IN lib]in every spelling (unquoted, quoted, quoted with extension"x.cpy"), resolve the member (core/copy_libraries.py, the engine already owns resolution since #4468), insert it, recursively, with cycle detection. - Substitution:
COPY … REPLACING(==pseudo-text==, partial words,:TAG:templates), theREPLACEstatement, conditional compilation (>>IF/>>ELSE/>>END-IF,>>DEFINE) per the compiler options already parsed bycore.compiler_options. - Line map, so findings and generated Java point at
CUSTREC.cpy:12, not a line of the expanded text.
Out of scope:EXEC SQL/CICS/DLIblocks pass through untouched; statement parsing and record layouts stay where they are (the translator's tree-sitter grammar is byte-proven against GnuCOBOL, #4378).
Where it replaces duplicate code
- Translator:
gitgalaxy/tools/cobol_to_java/det/source.pyexpand()(:728),_replacing/_replace(:809/:820),copy_names/_copy_match/_COPY(:652-:665), comment/free-format helpers (:288, :574, :581),as_fixed/as_fixed_rows(:1001). - Scanner:
gitgalaxy/core/mainframe_boundary.py_copy_replacing(:641),_continued_literal(:552); the REPLACING application ingitgalaxy/tools/cobol_to_cobol/galaxy_ir.py(#4457); any COPY regex instandards/language_standards/languages/cobol.py.
Acceptance
- One module used by both sides; the translator and the scanner no longer contain their own COPY/REPLACING/continuation code.
- Fixes #5645 (translator
COPY "x.cpy".) here; the scanner fix from #5618/PR #5626 is subsumed (keep its tests). - Re-proof: every crucible port and equivalence case still passes byte-for-byte (CICS crucible, estate crucible, golden crucible), the fact cross-check ledger does not grow (it should shrink where the two sides now share text), COBOL goldens unchanged or drift explained.
- Tests per step and shape, fixed and free format, our own fixtures (licensing rule: no third-party code).
- Note in
docs/language_status/fact_ownership.md: the expanded text is a shared input, no longer a duplicated channel.
Part of the CICS→Java path (Training Montage). Follow-up: #5649 (translator consumes engine layouts).
🤖 Generated with Claude Code
- Lingua principale
- Python
- Stelle
- 57
- Fork
- 11
- Merge medio
- 1h 51m
- PR unite (30g)
- 982
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di squid-protocol/gitgalaxy
-
enhancement scope:core
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
squid-protocol/gitgalaxy#5919 ·
I maintainer di solito rispondono entro 1 giorno
-
bug scope:frontier
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
squid-protocol/gitgalaxy#5909 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
squid-protocol/gitgalaxy#5897 ·
I maintainer di solito rispondono entro 1 giorno
-
ci-cd github-actions performance scope:infra
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
squid-protocol/gitgalaxy#5882 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Graph Accuracy Audit: re-baseline Python call-graph recall on pyan3 2.9.0 (reference moved in #5241)Apertaclaim:nyx lane:nyx
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
squid-protocol/gitgalaxy#5877 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di squid-protocol/gitgalaxy
Issue simili
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
yunaremaia/proto-drift#22 ·
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
yunaremaia/memwatch#96 ·
-
bug good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
yunaremaia/ci-gate-watch#34 ·
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
yunaremaia/agent-capability-attestation#64 ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
yunaremaia/agent-call-graph#43 ·
I maintainer di solito rispondono entro 1 giorno