Initial PROTEL 2026 toolchain import
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
% ERROR EXAMPLE — incompatible pointer assignment (§11.3 rule 5)
|
||||
% Expected: protel: type error: cannot assign PTR TO ...
|
||||
|
||||
SECTION err_ptr_mismatch;
|
||||
|
||||
TYPE integer {-32768 TO 32767};
|
||||
TYPE char {0 TO 255};
|
||||
|
||||
DCL demo PROC() IS
|
||||
BLOCK
|
||||
DCL i integer;
|
||||
DCL ch char;
|
||||
DCL ip PTR TO integer INIT NIL;
|
||||
DCL cp PTR TO char INIT NIL;
|
||||
cp -> ip;
|
||||
ENDBLOCK;
|
||||
@@ -0,0 +1,13 @@
|
||||
% ERROR EXAMPLE — integer assigned to BOOL (§11.3)
|
||||
% Expected: protel: type error: cannot assign ... to BOOL
|
||||
|
||||
SECTION err_int_to_bool;
|
||||
|
||||
TYPE integer {-32768 TO 32767};
|
||||
|
||||
DCL demo PROC() IS
|
||||
BLOCK
|
||||
DCL flag BOOL;
|
||||
DCL n integer INIT 1;
|
||||
n -> flag;
|
||||
ENDBLOCK;
|
||||
@@ -0,0 +1,14 @@
|
||||
% ERROR EXAMPLE — integer assigned to char (Reference Manual §11.3)
|
||||
% Expected: protel: type error: cannot assign integer to char
|
||||
|
||||
SECTION err_int_to_char;
|
||||
|
||||
TYPE char {0 TO 255};
|
||||
TYPE integer {-32768 TO 32767};
|
||||
|
||||
DCL demo PROC() IS
|
||||
BLOCK
|
||||
DCL ch char;
|
||||
DCL n integer INIT 65;
|
||||
n -> ch;
|
||||
ENDBLOCK;
|
||||
@@ -0,0 +1,14 @@
|
||||
% ERROR EXAMPLE — integer assigned to PACK byte (§7.2.3 / §11.3)
|
||||
% Expected: protel: type error: cannot assign wide integer to packed byte-sized type
|
||||
|
||||
SECTION err_int_to_packed;
|
||||
|
||||
TYPE integer {-32768 TO 32767};
|
||||
TYPE nibble PACK (4) {0 TO 15};
|
||||
|
||||
DCL demo PROC() IS
|
||||
BLOCK
|
||||
DCL slot nibble;
|
||||
DCL value integer INIT 9;
|
||||
value -> slot;
|
||||
ENDBLOCK;
|
||||
@@ -0,0 +1,12 @@
|
||||
% ERROR EXAMPLE — numeric literal out of subrange (§11.3)
|
||||
% Expected: protel: type error: value ... out of range for {0 TO 255}
|
||||
|
||||
SECTION err_out_of_range;
|
||||
|
||||
TYPE char {0 TO 255};
|
||||
|
||||
DCL demo PROC() IS
|
||||
BLOCK
|
||||
DCL ch char;
|
||||
300 -> ch;
|
||||
ENDBLOCK;
|
||||
@@ -0,0 +1,12 @@
|
||||
% ERROR EXAMPLE — RETURN type incompatible with RETURNS clause (§9.2 / §11.3)
|
||||
% Expected: protel: type error: RETURN type ... is not compatible with RETURNS BOOL
|
||||
|
||||
SECTION err_return_mismatch;
|
||||
|
||||
TYPE integer {-32768 TO 32767};
|
||||
|
||||
DCL demo PROC() RETURNS BOOL IS
|
||||
BLOCK
|
||||
DCL n integer INIT 0;
|
||||
RETURN n;
|
||||
ENDBLOCK;
|
||||
@@ -0,0 +1,11 @@
|
||||
% OK EXAMPLE — char literal within range (contrast with err_* examples)
|
||||
|
||||
SECTION ok_char_literal;
|
||||
|
||||
TYPE char {0 TO 255};
|
||||
|
||||
DCL demo PROC() IS
|
||||
BLOCK
|
||||
DCL ch char;
|
||||
65 -> ch;
|
||||
ENDBLOCK;
|
||||
Reference in New Issue
Block a user