tests/syntax/identifier/identifier_as_enumerationvalue.test
changeset 108 f9e001952488
equal deleted inserted replaced
107:ff5c92df0c78 108:f9e001952488
       
     1 (* Test whether the keyword XXXX may be used as an identifier for:
       
     2  * enumeration value
       
     3  *
       
     4  * The XXXX names in the following code are merely a placeholder.
       
     5  * They will be replaced by several identifiers before actual testing
       
     6  * of the compiler.
       
     7  *)
       
     8 
       
     9 (* The identifiers that will replace the XXXX
       
    10  * must be placed on a line starting with #
       
    11  * All identifiers preceded by # are ignored!
       
    12  * The identifier list must be placed inside an IEC 61131-3 comment.
       
    13  *)
       
    14 (*
       
    15 #IL_operators ANDN CAL CALC CALCN CD CLK CU IN JMP JMPC JMPCN LD LDN ORN PT PV R R1 RET RETC RETCN S S1 ST STN XORN
       
    16 #SFC_qualifiers D DS L N P #R #S SD SL
       
    17      NOTE: R and S are identical to IL operators!!
       
    18 #Task_initialisers PRIORITY SINGLE INTERVAL
       
    19 *)
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 TYPE
       
    25  enum_type00 : (enum_v1, XXXX, enum_v2) := XXXX;
       
    26 END_TYPE
       
    27 
       
    28 TYPE
       
    29  enum_type01 : (XXXX, enum_v2) := XXXX;
       
    30 END_TYPE
       
    31 
       
    32 TYPE
       
    33  enum_type02 : (enum_v1, XXXX) := XXXX;
       
    34 END_TYPE
       
    35 
       
    36 TYPE
       
    37  enum_type03 : (XXXX) := XXXX;
       
    38 END_TYPE
       
    39 
       
    40 
       
    41 
       
    42 
       
    43 function foo : int
       
    44  var_input
       
    45   a_1, b_1: int;
       
    46  end_var
       
    47  var
       
    48   c_1, d_1: enum_type00;
       
    49  end_var
       
    50   c_1 := enum_type00#XXXX;
       
    51   c_1 := XXXX;
       
    52 end_function
       
    53 
       
    54 
       
    55 
       
    56 (* Checking whether the use of XXXX will confuse any other
       
    57  * normal and correct IL or ST code.
       
    58  *)
       
    59 {#include "basic_code.test" }
       
    60