- 
                Notifications
    You must be signed in to change notification settings 
- Fork 25
1752 handle copy replacing with 4colon ol #1794
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
Conversation
        
          
                Codegen/test/resources/input/TypeCobol/CopyReplace4Colon/CopyReplace4Colon7.rdz.cbl
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                Codegen/test/resources/input/TypeCobol/CopyReplace4Colon/YxxxENT
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                Codegen/test/resources/input/TypeCobol/CopyReplace4Colon/CopyReplace4Colon.rdz.cbl
          
            Show resolved
            Hide resolved
        
              
          
                TypeCobol.Test/Parser/Programs/Cobol85/CopyReplace4Colon.rdzPGM.txt
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | internal bool IsForCopy | ||
| { | ||
| get; | ||
| set; | ||
| } | 
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.
Should be private readonly. Set via constructors.
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.
There are so many parameters in constructors, I prefer to let FileCompiler set this specific and contextual option.
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.
This is also the case for CustomSymbols
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.
As the CompilationDocument is always for Copy and CompilationUnit is always for Program, you can simplify with:
internal virtual bool IsForCopy => true;
And override it CompilationUnit.
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.
No longer needed
| public MultilineScanState InitialScanStateForCopy | ||
| { | ||
| get; | ||
| set; | ||
| } | 
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.
Not required, this field should be private readonly.
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.
ok done
| @@ -1,13 +1,15 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Text; | |||
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.
The two new using directives are the only changes in this file, they are not required.
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.
ok removed.
| /// Look for pattern ':' (cobol word chars)+ ':' | ||
| /// </summary> | ||
| private bool CheckForPartialCobolWordPattern(int startIndex, out int patternEndIndex) | ||
| private bool CheckForPartialCobolWordPattern(MultilineScanState currentState, int startIndex, out int patternEndIndex) | 
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.
the state can be read directly by the method using the instance field tokensLine so the new parameter is not required.
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.
ok
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.
done
| 01 xxxENT3. COPY YxxxENT REPLACING ==::== BY ==S==. | ||
| PROCEDURE DIVISION. | ||
| MOVE 'A' TO xxxENTS-FCT01-Var1. | ||
| END PROGRAM CPYRPL4C. | 
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.
Not much, but for this test we could simply use the following working-storage
01 xxxENT. COPY YxxxENT REPLACING ==::== BY ==S==.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.
The goal here is to test multiple COPY inclusion.
        
          
                TypeCobol.Test/Parser/Programs/Cobol85/CopyReplace4Colon.rdzPGM.txt
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                Codegen/test/resources/input/TypeCobol/CopyReplace4Colon/CopyReplace4Colon.rdz.cbl
          
            Show resolved
            Hide resolved
        
              
          
                TypeCobol/Compiler/FileCompiler.cs
              
                Outdated
          
        
      | if (isCopyFile) | ||
| { | ||
| CompilationResultsForCopy = new CompilationDocument(TextDocument.Source, TextDocument.Lines, compilerOptions, documentProvider, scanState, copyTextNameVariations); | ||
| CompilationResultsForCopy = new CompilationDocument(TextDocument.Source, TextDocument.Lines, compilerOptions, documentProvider, scanState, copyTextNameVariations); | 
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.
Unneeded whitespace
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.
done in 25c29f9
| @@ -0,0 +1,2 @@ | |||
| 01 :MDVZOSM:-A::. | |||
| 05 :MDVZOSM:-A::-Var0 pic X. No newline at end of file | |||
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.
My remark is only a detail, but for more consistency with the copy name, the copy should be :
       01  :DVZOSM:-A::.
           05 :DVZOSM:-A::-Var0 pic X. 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.
done in ba16d41
| move 'A' to MDVZOSM-A | ||
| move 'A' to Foo-A2 | ||
| . | ||
| end program DVZS0OSM. No newline at end of file | 
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.
Following my remark on copy YDVZOSM, the 'M' prefix for all MDVZOSM could be removed.
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.
done in ba16d41
| xxxENT2:Alphanumeric | ||
| xxxENT2-FCT01:Alphanumeric | ||
| xxxENT2-FCT01-Var1:Alphanumeric | ||
| xxxENT1:Alphanumeric | 
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.
Not sure I understand how these variables are sorted but they are all there.
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.
Nothing to say
Fixes #1752