Skip to content

Conversation

@yruslan
Copy link
Collaborator

@yruslan yruslan commented Nov 6, 2025

Closes #792

Summary by CodeRabbit

  • New Features

    • Parser accepts a comment policy and applies a configurable column offset for more accurate error positions.
    • Many single‑byte code pages now expose bidirectional ASCII↔EBCDIC mappings and a utility to derive reverse tables.
  • Bug Fixes

    • Error messages now optionally include column and field information for clearer diagnostics.
    • Encoding round‑trip consistency improved for EBCDIC↔Unicode.
  • Tests

    • Added/expanded round‑trip encoding tests (including Cyrillic/CP1025) and tightened syntax error validations.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 6, 2025

Walkthrough

The PR adds bidirectional ASCII↔EBCDIC mappings across single-byte code pages, refactors SingleByteCodePage to accept an explicit asciiToEbcdic Array and provides getReverseTable, and enhances parser error reporting by adding comment-aware position adjustment (CommentPolicy) and extending SyntaxErrorException with optional position and field metadata.

Changes

Cohort / File(s) Change Summary
Parser error handling & visitor
cobol-parser/src/main/scala/.../antlr/ANTLRParser.scala, cobol-parser/src/main/scala/.../antlr/ParserVisitor.scala
Injected CommentPolicy into ParserVisitor; compute adjPos from commentPolicy and pass it to ThrowErrorStrategy(adjPos); ThrowErrorStrategy now accepts posAdjustment and offsets reported column.
Error/exception types
cobol-parser/src/main/scala/.../exceptions/SyntaxErrorException.scala, cobol-parser/src/main/scala/.../asttransform/BinaryPropertiesAdder.scala
SyntaxErrorException constructor changed to (lineNumber: Int, posOpt: Option[Int], fieldOpt: Option[String], msg: String); message assembly updated; callsites (e.g., BinaryPropertiesAdder) updated to pass None/Some field options.
SingleByteCodePage core
cobol-parser/src/main/scala/.../encoding/codepage/SingleByteCodePage.scala
asciiToEbcdicMapping changed from Option[Int => Byte] to Array[Byte]; convert(string, length) uses direct array lookup; supportsEncoding always true; added SingleByteCodePage.getReverseTable.
Many single-byte code pages
cobol-parser/src/main/scala/.../encoding/codepage/CodePage*.scala (e.g. CodePage037.scala, CodePage1025.scala, CodePage1047.scala, CodePage1140.scala, CodePage1141.scala, CodePage1142.scala, CodePage1143.scala, CodePage1144.scala, CodePage1145.scala, CodePage1146.scala, CodePage1147.scala, CodePage1148.scala, CodePage1160.scala, CodePage273.scala, CodePage274.scala, CodePage275.scala, CodePage277.scala, CodePage278.scala, CodePage280.scala, CodePage284.scala, CodePage285.scala, CodePage297.scala, CodePage500.scala, CodePage838.scala, CodePage870.scala, CodePage875.scala, ...)
Each code page now exposes asciiToEbcdicMapping: Array[Byte] (typically via getReverseTable) and passes both mappings to SingleByteCodePage. Some files replaced function-based mapping with array-based mapping.
Common code pages & helpers
cobol-parser/src/main/scala/.../encoding/codepage/CodePageCommon.scala, cobol-parser/src/main/scala/.../encoding/codepage/CodePageCommonExt.scala
Removed hard-coded private data/function mapping; expose lazy val asciiToEbcdicMapping: Array[Byte] = SingleByteCodePage.getReverseTable(...) and pass it to superclass.
Tests & fixtures
cobol-parser/src/test/.../encoding/codepage/FakeCodePage.scala, cobol-parser/src/test/.../decoders/StringDecodersSpec.scala, cobol-parser/src/test/.../parse/{DataSizeSpec,PicValidationSpec,SyntaxErrorsSpec}.scala, spark-cobol/src/test/.../CustomCodePage.scala
Test fixtures updated to provide asciiToEbcdicMapping and codePageShortName; tests refactored to verify Unicode decoding + EBCDIC round-trip; parser tests updated to pass CommentPolicy() and use ThrowErrorStrategy(n); SyntaxErrorsSpec extended with a malformed-statement test and tightened assertions for posOpt/fieldOpt.

Sequence Diagram(s)

sequenceDiagram
    participant API as ANTLRParser.parse
    participant Policy as CommentPolicy
    participant Visitor as ParserVisitor
    participant Strategy as ThrowErrorStrategy
    participant Exc as SyntaxErrorException

    API->>Policy: read commentPolicy (truncateComments ...)
    Policy-->>API: return policy
    API->>API: compute adjPos from policy
    API->>Strategy: instantiate ThrowErrorStrategy(adjPos)
    API->>Visitor: new ParserVisitor(..., commentPolicy, ...)
    Note over API,Strategy: on syntax error during parse
    Strategy->>Strategy: recover() calculates offset column = col - adjPos
    Strategy->>Exc: throw SyntaxErrorException(line, Some(adjCol), fieldOpt, msg)
    Exc->>API: error propagated (message built using posOpt & fieldOpt)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Areas needing extra attention:
    • Correctness and boundary handling in SingleByteCodePage.getReverseTable and array-based lookups.
    • Equivalence and performance of convert(string, length) vs previous implementation.
    • adjPos computation in ANTLRParser and offset logic in ThrowErrorStrategy.
    • All updated SyntaxErrorException call sites (parser, BinaryPropertiesAdder, tests) and message formatting.
    • Widespread but mechanical changes across many codepage files — verify no accidental miss of a codepage.

Possibly related PRs

Poem

🐰 I hop through bytes and tables fine,

I map ASCII back to EBCDIC line by line.
When comments shift the column sight,
I nudge the error to the right,
Two-way hops, and parsing's bright.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Linked Issues check ❓ Inconclusive The PR implements bidirectional mapping support for all single-byte code pages (encoder/decoder), but the linked issue specifically requests performance measurement and comparison of three implementation approaches before selection. Verify that the chosen implementation (lazy-evaluated array-based reverse mapping) was performance-tested against match-case and HashMap approaches as requested in issue #792.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding EBCDIC to ASCII encoders for all single byte code pages, which is directly related to the changeset's primary objective.
Out of Scope Changes check ✅ Passed All changes are directly related to adding EBCDIC-to-ASCII encoding support across code pages. No unrelated modifications to error handling, syntax validation, or test infrastructure were introduced outside the scope of the objective.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/792-add-more-encoders

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a1bc838 and 57be16a.

📒 Files selected for processing (2)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3 hunks)
  • cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/parse/SyntaxErrorsSpec.scala (9 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/TwoByteCodePage.scala (3)
  • convert (35-92)
  • convert (94-96)
  • supportsEncoding (98-98)
cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/parse/SyntaxErrorsSpec.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/CopybookParser.scala (2)
  • CopybookParser (42-490)
  • parseTree (198-241)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Spark 2.4.8 on Scala 2.11.12
  • GitHub Check: Spark 3.5.7 on Scala 2.13.17
  • GitHub Check: test (2.12.20, 2.12, 3.3.4, 0, 80, 20)
  • GitHub Check: Spark 3.5.7 on Scala 2.12.20
  • GitHub Check: Spark 3.4.4 on Scala 2.12.20
🔇 Additional comments (6)
cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/parse/SyntaxErrorsSpec.scala (2)

44-45: LGTM! Enhanced error assertions validate new exception metadata.

The assertions correctly validate the new posOpt and fieldOpt fields added to SyntaxErrorException. The pattern is consistent and logical:

  • Semantic errors (e.g., redefines, invalid SIGN SEPARATE placement) have field names but no position
  • Syntax/parser errors (e.g., invalid tokens) have positions but no field names
  • Data type constraint errors have both position and field name

The use of Option methods (.isEmpty, .contains()) is correct throughout.

Also applies to: 78-80, 93-94, 108-109, 124-125, 140-141, 155-156, 182-183, 198-199


49-63: LGTM! Good addition for malformed statement coverage.

The new test case properly validates parser-level syntax errors with position tracking. The position calculation (13) is correct for where "SUB-FLD1" begins in the malformed line.

Note: Line 62 uses exact message matching (==) rather than substring matching (.contains()). While this is acceptable for unit tests, it's more brittle if the error message format evolves.

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (4)

24-24: Constructor refactored to require bidirectional mapping.

The constructor now requires an explicit asciiToEbcdicMapping: Array[Byte] parameter instead of the previous optional function. This breaking change enables consistent encoding support across all single-byte EBCDIC code pages, aligning with the PR objectives.


65-73: Surrogate pair handling correctly implemented.

The encoding logic now properly handles Unicode supplementary characters by maintaining separate input and output position counters. Each code point occupies exactly one output byte (or defaults to space 0x40 if unmappable), and the input cursor advances by Character.charCount(unicodeCodePoint) to correctly skip surrogate pairs.

This implementation addresses the concern raised in the past review comment about double-consuming surrogate pairs.


78-78: Encoding support now unconditional.

Correctly returns true since asciiToEbcdicMapping is now a required parameter in the constructor.


82-95: No critical issues found. The concern about ArrayIndexOutOfBoundsException is theoretically valid but practically impossible.

All EBCDIC code pages in the repository contain characters with ASCII values well above 32 (e.g., lowercase letters 'a'-'z' = 97-122). Therefore, maxVal will always exceed 32, and line 93 will safely execute. Additionally, line 87 pre-fills reverseMap(32) with 0x40, making line 93 redundant but harmless. The code is defensive and correct.


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Nov 6, 2025

JaCoCo code coverage report - 'cobol-parser'

Overall Project 91.55% -0.13% 🍏
Files changed 95.09% 🍏

File Coverage
BinaryPropertiesAdder.scala 100% 🍏
CodePage280.scala 100% 🍏
CodePage1142.scala 100% 🍏
CodePage273.scala 100% 🍏
CodePage278.scala 100% 🍏
CodePage275.scala 100% 🍏
CodePage1148.scala 100% 🍏
CodePage1147.scala 100% 🍏
CodePage1141.scala 100% 🍏
CodePage277.scala 100% 🍏
CodePage297.scala 100% 🍏
CodePage1146.scala 100% 🍏
CodePage1025.scala 100% 🍏
CodePage1140.scala 100% 🍏
CodePageCommon.scala 100% 🍏
CodePage1143.scala 100% 🍏
CodePage284.scala 100% 🍏
CodePage838.scala 100% 🍏
CodePage285.scala 100% 🍏
CodePage1160.scala 100% 🍏
CodePage1145.scala 100% 🍏
CodePage274.scala 100% 🍏
CodePage1144.scala 100% 🍏
CodePage500.scala 100% 🍏
CodePage037Ext.scala 99.73% -0.27% 🍏
CodePage1047.scala 99.72% -0.28% 🍏
CodePage870.scala 99.72% -0.28% 🍏
CodePage875.scala 99.72% -0.28% 🍏
CodePage037.scala 99.72% -0.28% 🍏
SyntaxErrorException.scala 91.54% -8.46% 🍏
CodePageCommonExt.scala 90.63% -9.38% 🍏
ParserVisitor.scala 89.44% -0.76% 🍏
SingleByteCodePage.scala 88.14% -1.03% 🍏
ANTLRParser.scala 86.88% -0.45% 🍏

@github-actions
Copy link

github-actions bot commented Nov 6, 2025

JaCoCo code coverage report - 'spark-cobol'

There is no coverage information present for the Files changed

Total Project Coverage 80.16% 🍏

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/decoders/StringDecodersSpec.scala (1)

85-519: Consider parameterized tests to reduce duplication.

The test structure is highly repetitive across code pages. Consider refactoring to use ScalaTest's parameterized test features (e.g., TableDrivenPropertyChecks) to reduce duplication while maintaining coverage.

Example approach:

forAll(Table(
  ("codePage", "expectedUnicode", "ebcdicBytes"),
  (new CodePage273, " {Ä!~Ü^...", Array(0x40, 0x43, ...)),
  (new CodePage274, " æÄ!üÜ^...", Array(0x40, 0x9C, ...)),
  // ...
)) { (enc, expected, bytes) =>
  val actualUnicode = decodeEbcdicString(bytes, KeepAll, enc, false)
  val actualEbcdicBytes = enc.convert(expected, expected.length)
  assert(actualUnicode == expected)
  assert(actualEbcdicBytes.sameElements(bytes))
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 75a05b0 and da77768.

📒 Files selected for processing (40)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/antlr/ANTLRParser.scala (3 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/antlr/ParserVisitor.scala (5 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/asttransform/BinaryPropertiesAdder.scala (1 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage037.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage037Ext.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1025.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1047.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1140.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1141.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1142.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1143.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1144.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1145.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1146.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1147.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1148.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1160.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage273.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage274.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage275.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage277.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage278.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage280.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage284.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage285.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage297.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage500.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage838.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage870.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage875.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePageCommon.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePageCommonExt.scala (2 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3 hunks)
  • cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/exceptions/SyntaxErrorException.scala (1 hunks)
  • cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/decoders/StringDecodersSpec.scala (8 hunks)
  • cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/FakeCodePage.scala (2 hunks)
  • cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/parse/DataSizeSpec.scala (3 hunks)
  • cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/parse/PicValidationSpec.scala (3 hunks)
  • cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/parse/SyntaxErrorsSpec.scala (9 hunks)
  • spark-cobol/src/test/scala/za/co/absa/cobrix/spark/cobol/source/utils/CustomCodePage.scala (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-19T09:12:31.865Z
Learnt from: yruslan
Repo: AbsaOSS/cobrix PR: 775
File: spark-cobol/src/test/scala/za/co/absa/cobrix/spark/cobol/writer/FixedLengthEbcdicWriterSuite.scala:0-0
Timestamp: 2025-08-19T09:12:31.865Z
Learning: In Cobrix COBOL writer, null values are encoded as zero bytes (0x00) for all field types, including PIC X fields, rather than using traditional COBOL padding (EBCDIC spaces 0x40 for PIC X). This design decision prioritizes consistency with the reader side, which already treats zero bytes as nulls, ensuring round-trip fidelity between reading and writing operations.

Applied to files:

  • cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/parse/PicValidationSpec.scala
🧬 Code graph analysis (37)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage297.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1147.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/antlr/ParserVisitor.scala (2)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/policies/CommentPolicy.scala (1)
  • CommentPolicy (19-23)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/antlr/ANTLRParser.scala (1)
  • truncateComments (105-119)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage037Ext.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage284.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage870.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePageCommonExt.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1148.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1141.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage875.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage500.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/parse/DataSizeSpec.scala (2)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/policies/CommentPolicy.scala (1)
  • CommentPolicy (19-23)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/policies/StringTrimmingPolicy.scala (1)
  • StringTrimmingPolicy (19-46)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage274.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage277.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1143.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/parse/PicValidationSpec.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/policies/CommentPolicy.scala (1)
  • CommentPolicy (19-23)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage280.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
spark-cobol/src/test/scala/za/co/absa/cobrix/spark/cobol/source/utils/CustomCodePage.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1160.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1145.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/TwoByteCodePage.scala (3)
  • convert (35-92)
  • convert (94-96)
  • supportsEncoding (98-98)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage275.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage273.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage037.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1025.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/FakeCodePage.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/decoders/StringDecodersSpec.scala (2)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/decoders/StringDecoders.scala (1)
  • decodeEbcdicString (48-63)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (2)
  • convert (37-45)
  • convert (54-76)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1140.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage285.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1146.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage278.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage838.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1142.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1047.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/parse/SyntaxErrorsSpec.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/CopybookParser.scala (2)
  • CopybookParser (42-490)
  • parseTree (198-241)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1144.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePageCommon.scala (1)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/SingleByteCodePage.scala (3)
  • SingleByteCodePage (24-79)
  • SingleByteCodePage (81-96)
  • getReverseTable (82-95)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: test (2.12.20, 2.12, 3.3.4, 0, 80, 20)
  • GitHub Check: Spark 3.4.4 on Scala 2.12.20
  • GitHub Check: Spark 3.5.7 on Scala 2.12.20
  • GitHub Check: Spark 2.4.8 on Scala 2.11.12
  • GitHub Check: Spark 3.5.7 on Scala 2.13.17
🔇 Additional comments (43)
cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/asttransform/BinaryPropertiesAdder.scala (1)

56-56: LGTM! Exception constructor correctly adapted.

The update to the new SyntaxErrorException signature is correct, properly passing optional field metadata.

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1145.scala (1)

23-23: LGTM! Bidirectional mapping correctly implemented.

The constructor now passes both forward and reverse mappings to SingleByteCodePage, and the reverse mapping is computed lazily using getReverseTable. This enables ASCII-to-EBCDIC encoding support for CP1145.

Also applies to: 56-56

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/antlr/ParserVisitor.scala (2)

45-45: LGTM! CommentPolicy integration enables accurate error positions.

The new commentPolicy parameter allows the parser to adjust error positions based on whether comment truncation is enabled, improving the accuracy of syntax error reporting.


561-562: The review comment is incorrect and should be ignored.

The position adjustment does not assume single-byte characters; it operates on character positions (code points) throughout. The code uses character-based indexing on all sides:

  • commentsUpToChar (Int = 6 by default) represents a COBOL column number
  • Scala's String.slice() and String.drop() operations in ANTLRParser.scala work on character indices, not bytes
  • ANTLR 4.7.2's getCharPositionInLine() returns character positions (code points), not byte positions
  • The calculation commentPolicy.commentsUpToChar + 1 and ctx.stop.getCharPositionInLine are both character-position values

COBOL fixed format is inherently character-based (column positions), not byte-based. Multi-byte UTF-8 characters are correctly represented as single characters in this model, so the position adjustment handles them correctly.

Likely an incorrect or invalid review comment.

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage277.scala (1)

22-22: LGTM! Bidirectional mapping correctly implemented.

The changes follow the same pattern as other code pages, enabling ASCII-to-EBCDIC encoding support for CP277.

Also applies to: 55-55

cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/FakeCodePage.scala (1)

19-19: LGTM! Test code updated to match new API.

The test code page correctly implements the two-mapping constructor pattern, ensuring test coverage for the bidirectional encoding functionality.

Also applies to: 29-29

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1147.scala (1)

23-23: LGTM! Bidirectional mapping correctly implemented.

The changes enable ASCII-to-EBCDIC encoding support for CP1147, consistent with the pattern applied across all single-byte code pages.

Also applies to: 56-56

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage285.scala (1)

22-22: LGTM! Bidirectional mapping correctly implemented.

The changes enable ASCII-to-EBCDIC encoding support for CP285, following the established pattern.

Also applies to: 55-55

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1142.scala (1)

25-25: LGTM! Bidirectional mapping correctly implemented.

The changes enable ASCII-to-EBCDIC encoding support for CP1142, consistent with the pattern applied across all single-byte code pages.

Also applies to: 58-58

cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/parse/SyntaxErrorsSpec.scala (3)

44-46: LGTM! Enhanced error assertions validate position and field metadata.

The updated assertions now verify posOpt.isEmpty and fieldOpt.contains("GRP_FIELD"), ensuring the error reporting enhancements work correctly for group field validation errors.


49-63: LGTM! New test validates position reporting for malformed statements.

The test verifies that parser syntax errors include accurate position information (line 2, position 13), which is essential for developer experience when debugging copybook issues.


78-79: LGTM! Comprehensive test coverage for enhanced error reporting.

All existing tests are updated to verify the new posOpt and fieldOpt fields, ensuring consistent error reporting behavior across different syntax error scenarios.

Also applies to: 93-94, 108-109, 124-126, 140-141, 155-156, 182-183, 198-199

cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/parse/PicValidationSpec.scala (1)

29-29: Test setup correctly updated for new API.

The changes properly align with the new ParserVisitor constructor signature requiring CommentPolicy and the updated error strategy accepting position adjustment.

Also applies to: 38-38, 59-59

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage275.scala (1)

22-22: Bidirectional mapping correctly implemented.

The changes properly add ASCII-to-EBCDIC reverse mapping support by passing both mappings to the base class and lazily computing the reverse table. This pattern is consistent across all code pages in this PR.

Also applies to: 54-55

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePageCommonExt.scala (1)

25-25: LGTM.

Consistent with the bidirectional mapping pattern applied across all code pages.

Also applies to: 92-93

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1141.scala (1)

26-26: LGTM.

Bidirectional mapping correctly implemented following the established pattern.

Also applies to: 58-59

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1143.scala (1)

25-25: LGTM.

Changes follow the consistent bidirectional mapping pattern.

Also applies to: 57-58

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage274.scala (1)

22-22: LGTM.

Bidirectional mapping implementation is consistent with the PR pattern.

Also applies to: 54-55

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage284.scala (1)

22-22: LGTM.

The bidirectional mapping changes are correctly applied.

Also applies to: 54-55

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1148.scala (1)

26-26: LGTM.

Bidirectional mapping correctly implemented, completing the consistent pattern across all code pages in this PR.

Also applies to: 58-59

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1025.scala (1)

22-22: LGTM! Bidirectional mapping support added correctly.

The addition of asciiToEbcdicMapping enables ASCII-to-EBCDIC encoding for this code page. The lazy evaluation ensures the reverse table is computed only when needed, and the use of SingleByteCodePage.getReverseTable provides a consistent implementation across all code pages.

Also applies to: 59-60

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1160.scala (1)

23-23: LGTM! Consistent bidirectional mapping implementation.

The changes follow the same pattern as other code pages in this PR, enabling ASCII-to-EBCDIC encoding with lazy evaluation of the reverse mapping.

Also applies to: 72-73

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1047.scala (1)

23-23: LGTM! Bidirectional mapping support added.

The implementation is consistent with the PR's objective to add ASCII-to-EBCDIC encoding support for all single-byte code pages.

Also applies to: 58-59

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage037Ext.scala (1)

24-24: LGTM! Bidirectional mapping correctly implemented.

The addition of asciiToEbcdicMapping enables encoding support for the extended Code Page 037, consistent with the refactoring pattern across all code pages.

Also applies to: 56-57

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1140.scala (1)

26-26: LGTM! Encoding support added for Code Page 1140.

The bidirectional mapping implementation follows the consistent pattern established across all code pages in this PR.

Also applies to: 58-59

cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/parse/DataSizeSpec.scala (1)

28-28: LGTM! Test adapted to parser API changes.

The addition of CommentPolicy() and the update to ThrowErrorStrategy(6) correctly adapt this test to the enhanced error reporting with comment-aware position adjustment introduced in the broader parser refactoring.

Also applies to: 38-38, 59-59

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage870.scala (1)

23-23: LGTM! Bidirectional mapping support added for Code Page 870.

The implementation follows the consistent pattern across all code pages, enabling ASCII-to-EBCDIC encoding for the Latin-2 charset.

Also applies to: 60-61

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1146.scala (1)

23-23: LGTM! Bidirectional mapping correctly implemented.

The addition of asciiToEbcdicMapping completes the consistent refactoring pattern across all code pages in this PR, enabling ASCII-to-EBCDIC encoding for Code Page 1146.

Also applies to: 55-56

cobol-parser/src/test/scala/za/co/absa/cobrix/cobol/parser/decoders/StringDecodersSpec.scala (2)

86-96: LGTM! Excellent round-trip testing.

The updated test pattern now verifies both Unicode decoding and EBCDIC encoding round-trips, ensuring bidirectional mapping correctness. The approach of comparing actualEbcdicBytes.sameElements(ebcdicBytes) validates that the reverse mapping is accurate.


296-314: LGTM! Good coverage for Cyrillic characters.

The new CP1025 test validates both Cyrillic and Latin character support with round-trip verification, following the same robust pattern used for other code pages.

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage273.scala (1)

24-24: LGTM! Bidirectional mapping correctly implemented.

The changes properly enable EBCDIC↔ASCII conversion by:

  • Passing both mappings to the superclass constructor (line 24)
  • Lazily computing the reverse mapping via getReverseTable (line 57)

The lazy val appropriately defers computation until first use, and the pattern aligns with the broader PR changes across all code pages.

Also applies to: 57-57

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage278.scala (1)

22-22: LGTM! Consistent with other code page updates.

The bidirectional mapping implementation follows the same pattern as CodePage273 and other code pages in this PR.

Also applies to: 55-55

spark-cobol/src/test/scala/za/co/absa/cobrix/spark/cobol/source/utils/CustomCodePage.scala (1)

21-21: LGTM! Test helper updated correctly.

The test code page now supports bidirectional mapping, enabling comprehensive testing of the encoding/decoding paths.

Also applies to: 54-54

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage838.scala (1)

22-22: LGTM! Thai script code page updated correctly.

The bidirectional mapping support is properly implemented following the established pattern.

Also applies to: 73-73

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage500.scala (1)

22-22: LGTM! International code page updated correctly.

The implementation is consistent with other code pages in this PR.

Also applies to: 55-55

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePageCommon.scala (1)

24-24: LGTM! Common code page refactored correctly.

The change from an optional/function-based approach to a direct Array[Byte] mapping simplifies the implementation and aligns with the refactored SingleByteCodePage base class.

Also applies to: 59-59

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/exceptions/SyntaxErrorException.scala (1)

19-40: LGTM! Enhanced error reporting with optional metadata.

The updated exception properly handles optional position and field information:

  • Position: Formats as "line X:Y" when available, "line X" otherwise
  • Field: Appends ", field " when available
  • Gracefully handles all combinations of present/absent optional values

The implementation improves error diagnostics while maintaining backward compatibility for cases where position/field information isn't available.

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/encoding/codepage/CodePage1144.scala (2)

25-25: LGTM! Bidirectional encoding support enabled.

The updated constructor correctly passes both ebcdicToAsciiMapping and asciiToEbcdicMapping to enable ASCII-to-EBCDIC conversion for the Spark writer, aligning with the PR objectives.


58-58: LGTM! Efficient reverse mapping generation.

The lazy evaluation ensures the reverse table is only computed when ASCII-to-EBCDIC encoding is actually needed, which is appropriate for this potentially expensive operation.

cobol-parser/src/main/scala/za/co/absa/cobrix/cobol/parser/antlr/ANTLRParser.scala (4)

32-41: LGTM! Configurable position adjustment for accurate error reporting.

The posAdjustment parameter correctly shifts error column positions to account for truncated comments, ensuring error messages reference positions in the original copybook rather than the processed version.


69-69: LGTM! ParserVisitor now receives comment policy.

Passing commentPolicy to the ParserVisitor enables it to handle comment-aware position adjustments during parsing.


71-71: LGTM! Position adjustment correctly accounts for leading comment truncation.

The adjPos calculation properly sets the offset to match the number of leading characters removed from each line, ensuring error positions are reported relative to the original copybook.


86-86: LGTM! Error handler properly configured with position adjustment.

The error handler instantiation correctly passes adjPos to enable comment-aware error position reporting throughout the parsing process.

yruslan and others added 2 commits November 6, 2025 10:38
…transform/BinaryPropertiesAdder.scala

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@yruslan yruslan merged commit 4b427f6 into master Nov 6, 2025
7 checks passed
@yruslan yruslan deleted the feature/792-add-more-encoders branch November 6, 2025 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for singly-byte EBCDIC code pages for the Spark writer

2 participants