-
Notifications
You must be signed in to change notification settings - Fork 25
WI #1991 Check reference modifiers #2033
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
aeaf907
WI #1991 Add checks to reference modifiers
delevoye 83a476e
WI #1991 Correct tabs
delevoye e219cd4
WI #1991 Clarify the diagnostic message and uncomment a line in test
delevoye acd0f76
WI #1991 Fix previous commit by replecaing a deleted AddError call
delevoye e95a1b3
Merge branch 'develop' into 1991_CheckReferenceModifiers
delevoye File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
TypeCobol.Test/Parser/Programs/Cobol85/ReferenceModifiers.rdz.cbl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| IDENTIFICATION DIVISION. | ||
| PROGRAM-ID. Pgm. | ||
| DATA DIVISION. | ||
| WORKING-STORAGE SECTION. | ||
| 01 item PIC X(20). | ||
| 01 part PIC X(20). | ||
| 01 var0 PIC 9 VALUE 0. | ||
| 01 var1 PIC 9 VALUE 1. | ||
|
|
||
| PROCEDURE DIVISION. | ||
| * OK this is a shorthand | ||
| MOVE item(2:) TO part | ||
| * KO zero position | ||
| MOVE item(0:) TO part | ||
| * KO negative position | ||
| MOVE item(-1:) TO part | ||
| * KO by a previous step | ||
| MOVE item(:2) TO part | ||
|
|
||
| * KO zero position | ||
| MOVE item(0:5) TO part | ||
| * KO zero length | ||
| MOVE item(1:0) TO part | ||
| * KO*2 zero values | ||
| MOVE item(0:0) TO part | ||
| * KO negative position | ||
| MOVE item(-1:5) TO part | ||
| * KO negative length | ||
| MOVE item(1:-5) TO part | ||
| * KO*2 negative values | ||
| MOVE item(-1:-5) TO part | ||
| * OK | ||
| MOVE item(1.32:5) TO part | ||
| * OK | ||
| MOVE item(1:5.84) TO part | ||
| * OK | ||
| MOVE item(1.32:5.84) TO part | ||
| * KO zero position | ||
| MOVE item(0.0:5) TO part | ||
| * KO zero length | ||
| MOVE item(1:0.0) TO part | ||
| * KO*2 zero values | ||
| MOVE item(0.0:0.0) TO part | ||
| * KO negative position | ||
| MOVE item(-1.32:5) TO part | ||
| * KO negative length | ||
| MOVE item(1:-5.84) TO part | ||
| * KO*2 negative values | ||
| MOVE item(-1.32:-5.84) TO part | ||
|
|
||
| * OK Variables are not checked | ||
| MOVE item(var0:) TO part | ||
| MOVE item(var1:) TO part | ||
| MOVE item(2:var0) TO part | ||
| MOVE item(2:var1) TO part | ||
|
|
||
| * OK Expressions are not checked | ||
| MOVE item(2 * 3 : 4 ) TO part | ||
| MOVE item(2 : 4 * 2 ) TO part | ||
| MOVE item(2 * 2 : 4 * 2 ) TO part | ||
| MOVE item(-2 + 1 : 2 ) TO part | ||
| MOVE item(2 : 4 * -2) TO part | ||
| . | ||
| END PROGRAM Pgm. | ||
83 changes: 83 additions & 0 deletions
83
TypeCobol.Test/Parser/Programs/Cobol85/ReferenceModifiers.rdzMix.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| IDENTIFICATION DIVISION. | ||
| PROGRAM-ID. Pgm. | ||
| DATA DIVISION. | ||
| WORKING-STORAGE SECTION. | ||
| 01 item PIC X(20). | ||
| 01 part PIC X(20). | ||
| 01 var0 PIC 9 VALUE 0. | ||
| 01 var1 PIC 9 VALUE 1. | ||
|
|
||
| PROCEDURE DIVISION. | ||
| * OK this is a shorthand | ||
| MOVE item(2:) TO part | ||
| * KO zero position | ||
| Line 14[22,22] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| MOVE item(0:) TO part | ||
| * KO negative position | ||
| Line 16[22,23] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| MOVE item(-1:) TO part | ||
| * KO by a previous step | ||
| Line 18[21,21] <27, Error, Syntax> - Syntax error : mismatched input '(' expecting TO | ||
| MOVE item(:2) TO part | ||
|
|
||
| * KO zero position | ||
| Line 21[22,22] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| MOVE item(0:5) TO part | ||
| * KO zero length | ||
| Line 23[22,22] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| MOVE item(1:0) TO part | ||
| * KO*2 zero values | ||
| Line 25[22,22] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| Line 25[22,22] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| MOVE item(0:0) TO part | ||
| * KO negative position | ||
| Line 27[22,23] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| MOVE item(-1:5) TO part | ||
| * KO negative length | ||
| Line 29[22,22] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| MOVE item(1:-5) TO part | ||
| * KO*2 negative values | ||
| Line 31[22,23] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| Line 31[22,23] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| MOVE item(-1:-5) TO part | ||
| * OK | ||
| MOVE item(1.32:5) TO part | ||
| * OK | ||
| MOVE item(1:5.84) TO part | ||
| * OK | ||
| MOVE item(1.32:5.84) TO part | ||
| * KO zero position | ||
| Line 39[22,24] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| MOVE item(0.0:5) TO part | ||
| * KO zero length | ||
| Line 41[22,22] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| MOVE item(1:0.0) TO part | ||
| * KO*2 zero values | ||
| Line 43[22,24] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| Line 43[22,24] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| MOVE item(0.0:0.0) TO part | ||
| * KO negative position | ||
| Line 45[22,26] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| MOVE item(-1.32:5) TO part | ||
| * KO negative length | ||
| Line 47[22,22] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| MOVE item(1:-5.84) TO part | ||
| * KO*2 negative values | ||
| Line 49[22,26] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| Line 49[22,26] <27, Error, Syntax> - Syntax error : Reference modifiers should be positive non-zero values. | ||
| MOVE item(-1.32:-5.84) TO part | ||
|
|
||
| * OK Variables are not checked | ||
| MOVE item(var0:) TO part | ||
| MOVE item(var1:) TO part | ||
| MOVE item(2:var0) TO part | ||
| MOVE item(2:var1) TO part | ||
|
|
||
| * OK Expressions are not checked | ||
| MOVE item(2 * 3 : 4 ) TO part | ||
| MOVE item(2 : 4 * 2 ) TO part | ||
| MOVE item(2 * 2 : 4 * 2 ) TO part | ||
| MOVE item(-2 + 1 : 2 ) TO part | ||
| MOVE item(2 : 4 * -2) TO part | ||
| . | ||
| END PROGRAM Pgm. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.