Skip to content

Commit

Permalink
fix: support SUPPRESS keyword in the copy statement #1816
Browse files Browse the repository at this point in the history
Signed-off-by: Aman Prashant <aman.prashant@broadcom.com>
  • Loading branch information
ap891843 committed Apr 13, 2023
1 parent d6ba9c6 commit dcd10ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ workingStorageSection

// copy statement
copyStatement
: COPY copySource (replacingPhrase | SUPPRESS)? DOT_FS
: COPY copySource SUPPRESS? replacingPhrase? DOT_FS
;

// sql include statement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ class TestCopybookReplacePatterns {
+ "8 PROCEDURE DIVISION.\n"
+ "9 MOVE 0 TO {$ACC_ID}.";

private static final String TEXT10 =
BASE
+ "5 COPY {~REPL9} SUPPRESS REPLACING =='XXX'_ID== BY ==ACC_ID==.\n"
+ "8 PROCEDURE DIVISION.\n"
+ "9 MOVE 0 TO {$ACC_ID}.";

private static final String REPL = "0 01 {$*TAG_ID} PIC 9.\n";
private static final String REPL_NAME = "REPL";

Expand Down Expand Up @@ -189,4 +195,10 @@ void testPartialQuotedTextAreReplaced() {
UseCaseEngine.runTest(
TEXT9, ImmutableList.of(new CobolText(REPL9_NAME, REPL9)), ImmutableMap.of());
}

@Test
void testCopySuppressReplacing() {
UseCaseEngine.runTest(
TEXT10, ImmutableList.of(new CobolText(REPL9_NAME, REPL9)), ImmutableMap.of());
}
}

0 comments on commit dcd10ab

Please sign in to comment.