-
Notifications
You must be signed in to change notification settings - Fork 25
WI #1752 Implements Replace :: by two characters :. #1787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| IDENTIFICATION DIVISION. | ||
| PROGRAM-ID. CPYRPL4C. | ||
| ENVIRONMENT DIVISION. | ||
| DATA DIVISION. | ||
| WORKING-STORAGE SECTION. | ||
| 01 xxxENT. COPY YxxxENT REPLACING ==::== BY ====. | ||
| PROCEDURE DIVISION. | ||
| MOVE 'A' TO xxxENT-FCT01-Var1. | ||
| END PROGRAM CPYRPL4C. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| IDENTIFICATION DIVISION. | ||
| PROGRAM-ID. CPYRPL4C. | ||
|
|
||
| ENVIRONMENT DIVISION. | ||
| DATA DIVISION. | ||
| WORKING-STORAGE SECTION. | ||
| 01 xxxENT. COPY YxxxENT2 REPLACING ==::== BY ====. | ||
| PROCEDURE DIVISION. | ||
| MOVE 'A' TO xxxENT-FCT01-Var1. | ||
| MOVE 'A' TO xxxENT2-FCT01-Var1. | ||
| END PROGRAM CPYRPL4C. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| IDENTIFICATION DIVISION. | ||
| PROGRAM-ID. CPYRPL4C. | ||
|
|
||
| ENVIRONMENT DIVISION. | ||
| DATA DIVISION. | ||
| WORKING-STORAGE SECTION. | ||
| 01 xxxENT. COPY YxxxENT3 REPLACING ==::== BY ====. | ||
| PROCEDURE DIVISION. | ||
| MOVE 'A' TO xxxENT-FCT01-Var1. | ||
| MOVE 'A' TO xxxENT2-FCT01-Var1. | ||
| MOVE 'A' TO xxxENT3-FCT01-Var1. | ||
| END PROGRAM CPYRPL4C. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| IDENTIFICATION DIVISION. | ||
| PROGRAM-ID. CPYRPL4C. | ||
|
|
||
| ENVIRONMENT DIVISION. | ||
| DATA DIVISION. | ||
| WORKING-STORAGE SECTION. | ||
| 01 xxxENT. COPY YxxxENT REPLACING ==::== BY ====. | ||
| 01 xxxENT2. COPY YxxxENT REPLACING ==::== BY ====. | ||
| PROCEDURE DIVISION. | ||
| MOVE 'A' TO xxxENT-FCT01-Var1 OF xxxENT. | ||
| MOVE 'A' TO xxxENT-FCT01-Var1 OF xxxENT2. | ||
| END PROGRAM CPYRPL4C. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| IDENTIFICATION DIVISION. | ||
| PROGRAM-ID. CPYRPL4C. | ||
|
|
||
| ENVIRONMENT DIVISION. | ||
| DATA DIVISION. | ||
| WORKING-STORAGE SECTION. | ||
| 01 xxxENT. COPY YxxxENT REPLACING ==::== BY ====. | ||
| 01 xxxENT2. COPY YxxxENT2 REPLACING ==::== BY ====. | ||
| PROCEDURE DIVISION. | ||
| MOVE 'A' TO xxxENT-FCT01-Var1 OF xxxENT. | ||
| MOVE 'A' TO xxxENT2-FCT01-Var1. | ||
| MOVE 'A' TO xxxENT-FCT01-Var1 OF xxxENT1. | ||
| END PROGRAM CPYRPL4C. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| IDENTIFICATION DIVISION. | ||
| PROGRAM-ID. CPYRPL4C. | ||
|
|
||
| ENVIRONMENT DIVISION. | ||
| DATA DIVISION. | ||
| WORKING-STORAGE SECTION. | ||
| 01 xxxENT2. COPY YxxxENT REPLACING ==::== BY ====. | ||
| 01 xxxENT3. COPY YxxxENT REPLACING ==::== BY ==S==. | ||
| PROCEDURE DIVISION. | ||
| MOVE 'A' TO xxxENTS-FCT01-Var1. | ||
| END PROGRAM CPYRPL4C. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| IDENTIFICATION DIVISION. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see the test method for this sample. |
||
| PROGRAM-ID. CPYRPL4C. | ||
| ENVIRONMENT DIVISION. | ||
| DATA DIVISION. | ||
| WORKING-STORAGE SECTION. | ||
| 01 xxxENT. COPY YxxxENT REPLACING ==== BY ====. | ||
| PROCEDURE DIVISION. | ||
| MOVE 'A' TO xxxENT-FCT01-Var1. | ||
| END PROGRAM CPYRPL4C. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| 05 xxxENT::-FCT01. | ||
| 10 xxxENT::-FCT01-Var1 PIC X(05). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| 05 xxxENT::-FCT01. | ||
| 10 xxxENT::-FCT01-Var1 PIC X(05). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| 05 xxxENT2::-FCT01. | ||
| 10 xxxENT2::-FCT01-Var1 PIC X(05). | ||
| 01 xxxENT1. COPY YxxxENT REPLACING ==::== BY ====. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| 05 xxxENT3::-FCT01. | ||
| 10 xxxENT3::-FCT01-Var1 PIC X(05). | ||
| 01 xxxENT2. COPY YxxxENT2 REPLACING ==::== BY ====. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| IDENTIFICATION DIVISION. | ||
| PROGRAM-ID. CPYRPL4C. | ||
|
|
||
| ENVIRONMENT DIVISION. | ||
| DATA DIVISION. | ||
| WORKING-STORAGE SECTION. | ||
| 01 xxxENT. COPY YxxxENT REPLACING ==::== BY ====. | ||
| PROCEDURE DIVISION. | ||
| MOVE 'A' TO xxxENT-FCT01-Var1. | ||
| END PROGRAM CPYRPL4C. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| IDENTIFICATION DIVISION. | ||
| PROGRAM-ID. CPYRPL4C. | ||
|
|
||
| ENVIRONMENT DIVISION. | ||
| DATA DIVISION. | ||
| WORKING-STORAGE SECTION. | ||
| 01 xxxENT. COPY YxxxENT2 REPLACING ==::== BY ====. | ||
| PROCEDURE DIVISION. | ||
| MOVE 'A' TO xxxENT-FCT01-Var1. | ||
| MOVE 'A' TO xxxENT2-FCT01-Var1. | ||
| END PROGRAM CPYRPL4C. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| IDENTIFICATION DIVISION. | ||
| PROGRAM-ID. CPYRPL4C. | ||
|
|
||
| ENVIRONMENT DIVISION. | ||
| DATA DIVISION. | ||
| WORKING-STORAGE SECTION. | ||
| 01 xxxENT. COPY YxxxENT3 REPLACING ==::== BY ====. | ||
| PROCEDURE DIVISION. | ||
| MOVE 'A' TO xxxENT-FCT01-Var1. | ||
| MOVE 'A' TO xxxENT2-FCT01-Var1. | ||
| MOVE 'A' TO xxxENT3-FCT01-Var1. | ||
| END PROGRAM CPYRPL4C. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| IDENTIFICATION DIVISION. | ||
| PROGRAM-ID. CPYRPL4C. | ||
|
|
||
| ENVIRONMENT DIVISION. | ||
| DATA DIVISION. | ||
| WORKING-STORAGE SECTION. | ||
| 01 xxxENT. COPY YxxxENT REPLACING ==::== BY ====. | ||
| 01 xxxENT2. COPY YxxxENT REPLACING ==::== BY ====. | ||
| PROCEDURE DIVISION. | ||
| MOVE 'A' TO xxxENT-FCT01-Var1 OF xxxENT. | ||
| MOVE 'A' TO xxxENT-FCT01-Var1 OF xxxENT2. | ||
| END PROGRAM CPYRPL4C. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| IDENTIFICATION DIVISION. | ||
| PROGRAM-ID. CPYRPL4C. | ||
|
|
||
| ENVIRONMENT DIVISION. | ||
| DATA DIVISION. | ||
| WORKING-STORAGE SECTION. | ||
| 01 xxxENT. COPY YxxxENT REPLACING ==::== BY ====. | ||
| 01 xxxENT2. COPY YxxxENT2 REPLACING ==::== BY ====. | ||
| PROCEDURE DIVISION. | ||
| MOVE 'A' TO xxxENT-FCT01-Var1 OF xxxENT. | ||
| MOVE 'A' TO xxxENT2-FCT01-Var1. | ||
| MOVE 'A' TO xxxENT-FCT01-Var1 OF xxxENT1. | ||
| END PROGRAM CPYRPL4C. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| IDENTIFICATION DIVISION. | ||
| PROGRAM-ID. CPYRPL4C. | ||
|
|
||
| ENVIRONMENT DIVISION. | ||
| DATA DIVISION. | ||
| WORKING-STORAGE SECTION. | ||
| 01 xxxENT2. COPY YxxxENT REPLACING ==::== BY ====. | ||
| 01 xxxENT3. COPY YxxxENT REPLACING ==::== BY ==S==. | ||
| PROCEDURE DIVISION. | ||
| MOVE 'A' TO xxxENTS-FCT01-Var1. | ||
| END PROGRAM CPYRPL4C. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty file ? Is the file actually required since no generation occurs because of previous errors ? |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| IDENTIFICATION DIVISION. | ||
| PROGRAM-ID. CPYRPL4C. | ||
| ENVIRONMENT DIVISION. | ||
| DATA DIVISION. | ||
| WORKING-STORAGE SECTION. | ||
| 01 xxxENT. COPY YxxxENT REPLACING ==== BY ====. | ||
| PROCEDURE DIVISION. | ||
| MOVE 'A' TO xxxENT-FCT01-Var1. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact the test also need to check that variable name inside the copy are correctly replaced; And this move: And also create the copy YxxxENT with same content as Codegen/test/resources/input/TypeCobol/CopyReplace4Colon/YxxxENT.cpy There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I need also further tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you also add a test with a mix of Empty and non-empty replacing, like: 01 :MDVZOSM:-A::.
05 :MDVZOSM:-A::-Var0 pic X.And the source: IDENTIFICATION division.
PROGRAM-ID. DVZS0OSM.
data division.
working-storage section.
COPY YDVZOSM replacing ==::== by ====
==:MDVZOSM:== by ==MDVZOSM==.
COPY YDVZOSM replacing ==::== by ==2==
==:MDVZOSM:== by ==Foo==.
procedure division.
move 'A' to MDVZOSM-A
move 'A' to Foo-A2
.
end program DVZS0OSM. |
||
| END PROGRAM CPYRPL4C. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| --- Diagnostics --- | ||
| Line 7[25,31] <27, Error, Syntax> - Syntax error : "REPLACE" Empty Comparison Pseudo Text. | ||
| Line 7[20,55] <28, Error, Directives> - Failed to load COPY : Cobol source file not found: YxxxENT | ||
| Line 7[12,17] <27, Error, Syntax> - Syntax error : A group item cannot be empty. OffendingSymbol=[12,17:xxxENT]<UserDefinedWord> | ||
| Line 9[24,40] <30, Error, Semantics> - Semantic error: Symbol xxxENT-FCT01-Var1 is not referenced OffendingSymbol=[24,40:xxxENT-FCT01-Var1]<UserDefinedWord> | ||
|
|
||
| --- Program --- | ||
| PROGRAM: CPYRPL4C common:False initial:False recursive:False | ||
| author: ? written: ? compiled: ? installation: ? security: ? | ||
| --- Intrinsic:Namespace:Program:Global:Local | ||
| -- DATA -------- | ||
| xxxENT:Alphanumeric | ||
| --- Intrinsic | ||
| -- TYPES ------- | ||
| BOOL:BOOL | ||
| DATE:DATE | ||
| CURRENCY:CURRENCY | ||
| STRING:STRING |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,11 +54,23 @@ public class CompilationDocument | |
| public List<RemarksDirective.TextNameVariation> CopyTextNamesVariations { get; set; } | ||
|
|
||
| public List<CopyDirective> MissingCopies { get; set; } | ||
| /// <summary> | ||
| /// Is this Compilation Document for a Copy. | ||
| /// </summary> | ||
| internal bool IsForCopy | ||
| { | ||
| get; | ||
| set; | ||
|
Comment on lines
+60
to
+63
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
|
|
||
| /// <summary> | ||
| /// Issue #315 | ||
| /// </summary> | ||
| private MultilineScanState initialScanStateForCopy; | ||
| public MultilineScanState InitialScanStateForCopy | ||
| { | ||
| get; | ||
| set; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Informations used to track the performance of each compilation step | ||
|
|
@@ -181,7 +193,7 @@ public CompilationDocument(TextSourceInfo textSourceInfo, IEnumerable<ITextLine> | |
| PerfStatsForScanner = new PerfStatsForCompilationStep(CompilationStep.Scanner); | ||
| PerfStatsForPreprocessor = new PerfStatsForParsingStep(CompilationStep.Preprocessor); | ||
|
|
||
| initialScanStateForCopy = scanState; | ||
| InitialScanStateForCopy = scanState; | ||
| } | ||
|
|
||
| /// <summary> | ||
|
|
@@ -476,14 +488,33 @@ public void UpdateTokensLines(System.Action onVersion = null) | |
| // Apply text changes to the compilation document | ||
| if (scanAllDocumentLines) | ||
| { | ||
| ScannerStep.ScanDocument(TextSourceInfo, compilationDocumentLines, CompilerOptions, CopyTextNamesVariations, initialScanStateForCopy); | ||
| bool saveOpt = CompilerOptions.AreForCopyParsing; | ||
| try | ||
| { | ||
| CompilerOptions.AreForCopyParsing = this.IsForCopy; | ||
| ScannerStep.ScanDocument(TextSourceInfo, compilationDocumentLines, CompilerOptions, CopyTextNamesVariations, InitialScanStateForCopy); | ||
| } | ||
| finally | ||
| { | ||
| CompilerOptions.AreForCopyParsing = saveOpt; | ||
| } | ||
| // Notify all listeners that the whole document has changed. | ||
| EventHandler wholeDocumentChanged = WholeDocumentChanged; // avoid race condition | ||
| wholeDocumentChanged?.Invoke(this, EventArgs.Empty); | ||
| } | ||
| else | ||
| { | ||
| IList<DocumentChange<ITokensLine>> documentChanges = ScannerStep.ScanTextLinesChanges(TextSourceInfo, compilationDocumentLines, textLineChanges, PrepareDocumentLineForUpdate, CompilerOptions, CopyTextNamesVariations, initialScanStateForCopy); | ||
| bool saveOpt = CompilerOptions.AreForCopyParsing; | ||
| IList<DocumentChange<ITokensLine>> documentChanges = null; | ||
| try | ||
| { | ||
| CompilerOptions.AreForCopyParsing = IsForCopy; | ||
| documentChanges = ScannerStep.ScanTextLinesChanges(TextSourceInfo, compilationDocumentLines, textLineChanges, PrepareDocumentLineForUpdate, CompilerOptions, CopyTextNamesVariations, InitialScanStateForCopy); | ||
| } | ||
| finally | ||
| { | ||
| CompilerOptions.AreForCopyParsing = saveOpt; | ||
| } | ||
|
|
||
| // Create a new version of the document to track these changes | ||
| currentTokensLinesVersion.changes = documentChanges; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe modify one of the test to have a non-empty replacement text.