-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add parser diagnostics about END statement (#468)
- Loading branch information
Showing
18 changed files
with
132 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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
13 changes: 13 additions & 0 deletions
13
libs/natparse/src/test/java/org/amshove/natparse/parsing/EndStatementTests.java
This file contains 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,13 @@ | ||
package org.amshove.natparse.parsing; | ||
|
||
import org.junit.jupiter.api.DynamicTest; | ||
import org.junit.jupiter.api.TestFactory; | ||
|
||
class EndStatementTests extends ResourceFolderBasedTest | ||
{ | ||
@TestFactory | ||
Iterable<DynamicTest> testForEndStatement() | ||
{ | ||
return testFolder("endstatement"); | ||
} | ||
} |
This file contains 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 |
---|---|---|
|
@@ -22,4 +22,5 @@ INSERT INTO ANOTHER-TABLE | |
(COL1) VALUES (VAL1) | ||
FOR I4 = 1 TO 10 | ||
IGNORE | ||
END-FOR | ||
END-FOR | ||
END |
3 changes: 3 additions & 0 deletions
3
.../src/test/resources/org/amshove/natparse/parsing/endstatement/assignmentAfterEndStatement
This file contains 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,3 @@ | ||
END | ||
* This is a comment | ||
ABC := 0 /* !{D:ERROR:NPP054} |
6 changes: 6 additions & 0 deletions
6
...c/test/resources/org/amshove/natparse/parsing/endstatement/endStatementsAfterEndStatement
This file contains 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,6 @@ | ||
END | ||
* This is a comment | ||
/* Comment another way | ||
**Yet another | ||
**ISN this is not *ISN | ||
END /* !{D:ERROR:NPP054} |
1 change: 1 addition & 0 deletions
1
...natparse/src/test/resources/org/amshove/natparse/parsing/endstatement/missingEndStatement
This file contains 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 @@ | ||
WRITE 'Hello' /* !{D:ERROR:NPP055} |
5 changes: 5 additions & 0 deletions
5
...rc/test/resources/org/amshove/natparse/parsing/endstatement/onlyCommentsAfterEndStatement
This file contains 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,5 @@ | ||
END | ||
* This is a comment | ||
/* Comment another way | ||
**Yet another | ||
**ISN this is not *ISN |
3 changes: 3 additions & 0 deletions
3
.../src/test/resources/org/amshove/natparse/parsing/endstatement/statementsAfterEndStatement
This file contains 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,3 @@ | ||
END | ||
* This is a comment | ||
WRITE 'Hello' /* !{D:ERROR:NPP054} |
5 changes: 5 additions & 0 deletions
5
libs/natparse/src/test/resources/projects/copycodetests/Natural-Libraries/LIBONE/ENDCC.NSC
This file contains 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,5 @@ | ||
* >Natural Source Header 000000 | ||
* :Mode S | ||
* :LineIncrement 10 | ||
* <Natural Source Header | ||
END |
3 changes: 3 additions & 0 deletions
3
libs/natparse/src/test/resources/projects/copycodetests/Natural-Libraries/LIBONE/ENDSUB.NSN
This file contains 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,3 @@ | ||
* INCLUDE ENDCC activate this when CC are fully handled. | ||
END /* Double END detected | ||
END /* remove this when CC are fully handled. |
3 changes: 3 additions & 0 deletions
3
.../natparse/src/test/resources/projects/copycodetests/Natural-Libraries/LIBONE/NOENDSUB.NSN
This file contains 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,3 @@ | ||
INCLUDE DECLSUB | ||
END | ||
* INCLUDE ENDCC activate this when CC are fully handled. |
This file contains 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,12 @@ | ||
name: No source allowed after the END statement | ||
priority: BLOCKER | ||
tags: compile-time | ||
type: BUG | ||
description: | ||
The END statement indicates the end of the source of a Natural object. | ||
No other statements or comment lines are allowed after the END | ||
statement. | ||
|
||
A probable cause of this error is the misspelling of a name or the | ||
omission of 'PAGE', 'DATA', 'TRANSACTION' from the statements | ||
AT END OF PAGE, AT END OF DATA, END TRANSACTION respectively. |
This file contains 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,7 @@ | ||
name: END statement missing | ||
priority: BLOCKER | ||
tags: compile-time | ||
type: BUG | ||
description: | ||
The last statement of a Natural program must always be END. | ||
Alternatively, a period '.' may be used. |