tests/syntax/identifier/identifier_as_program.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  * Program identifier
       
     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 (* This file is specific for identifiers identical to IL operators.
       
    15  *  See the note following the identifier list
       
    16  *)
       
    17 (*
       
    18 #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
       
    19 #SFC_qualifiers D DS L N P #R #S SD SL
       
    20      NOTE: R and S are identical to IL operators!!
       
    21 #Task_initialisers PRIORITY SINGLE INTERVAL
       
    22 *)
       
    23 
       
    24 (* NOTE: The identifier as a variable test has some special cases.
       
    25  *       Namely, when using IL operators as variable names.
       
    26  *       Even though the syntax of the IL language would not result
       
    27  *       in ambiguities in the above case, our parser does not currently
       
    28  *       allow the use of variables (with names identical to IL
       
    29  *       operators) within IL code.
       
    30  *
       
    31  *       The following test code must therefore consider two possibilities:
       
    32  *        - if the identifier under test is an IL operator
       
    33  *        - if the identifier under test is not an IL operator
       
    34  *)
       
    35 
       
    36 
       
    37 
       
    38 
       
    39 
       
    40 
       
    41 PROGRAM XXXX
       
    42 VAR_INPUT
       
    43   a_1 : BOOL;
       
    44 END_VAR
       
    45   LD a_1
       
    46 END_PROGRAM
       
    47 
       
    48 
       
    49 
       
    50 
       
    51 
       
    52 CONFIGURATION config1
       
    53  TASK fast(PRIORITY := 4);
       
    54  PROGRAM P1 WITH fast:
       
    55        XXXX(a_1 := TRUE);
       
    56 END_CONFIGURATION
       
    57 
       
    58 
       
    59 
       
    60 
       
    61 (* Checking whether the use of XXXX will confuse any other
       
    62  * normal and correct IL or ST code.
       
    63  *)
       
    64 {#include "basic_code.test" }
       
    65 
       
    66