-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Update error codes, add description
- Loading branch information
Showing
7 changed files
with
85 additions
and
27 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
17 changes: 17 additions & 0 deletions
17
compiler/plc_diagnostics/src/diagnostics/error_codes/E114.md
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,17 @@ | ||
# Property defined in non-stateful POU type | ||
|
||
Properties may only be defined in stateful POUs such as a `PROGRAM`,`CLASS` or `FUNCTION_BLOCK`. | ||
Defining the property in any other POU results in this error. | ||
|
||
|
||
Errouneus code example: | ||
``` | ||
FUNCTION foo | ||
// Invalid definition | ||
PROPERTY bar : DINT | ||
GET | ||
bar := 42; | ||
END_GET | ||
END_PROPERTY | ||
END_FUNCTION | ||
``` |
16 changes: 16 additions & 0 deletions
16
compiler/plc_diagnostics/src/diagnostics/error_codes/E115.md
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,16 @@ | ||
# Property defined in non-supported variable block | ||
|
||
Properties only allow for variable blocks of type `VAR`. Using something like `VAR_INPUT` is considered | ||
invalid and will result in this error. | ||
|
||
Errouneus code example: | ||
``` | ||
FUNCTION foo | ||
PROPERTY bar : DINT | ||
GET | ||
VAR /* ... */ END_VAR | ||
VAR_INPUT /* ... */ END_VAR // Invalid | ||
END_GET | ||
END_PROPERTY | ||
END_FUNCTION | ||
``` |
24 changes: 24 additions & 0 deletions
24
compiler/plc_diagnostics/src/diagnostics/error_codes/E116.md
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,24 @@ | ||
# Property with invalid number of GET and/or SET blocks | ||
|
||
Properties must be non empty and at most contain one block of type GET or SET. | ||
|
||
Errouneus code example: | ||
``` | ||
FUNCTION foo | ||
PROPERTY bar : DINT | ||
// Invalid, empty (no GET or SET block) | ||
END_PROPERTY | ||
PROPERTY baz : DINT | ||
// Invalid, two GET blocks | ||
GET END_GET | ||
GET END_GET | ||
END_PROPERTY | ||
PROPERTY qux : DINT | ||
// Invalid, two SET blocks | ||
SET END_SET | ||
SET END_SET | ||
END_PROPERTY | ||
END_FUNCTION | ||
``` |
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