tests/syntax/identifier/identifier_as_program.test
author Mario de Sousa <msousa@fe.up.pt>
Mon, 04 Apr 2011 15:22:42 +0100
changeset 275 af3d0e3ac65d
parent 108 f9e001952488
permissions -rwxr-xr-x
Leave standard function names hardcoded, as these are considered keywords even though
they may not be implemented in the library.
108
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
     1
(* Test whether the keyword XXXX may be used as an identifier for:
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
     2
 * Program identifier
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
     3
 *
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
     4
 * The XXXX names in the following code are merely a placeholder.
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
     5
 * They will be replaced by several identifiers before actual testing
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
     6
 * of the compiler.
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
     7
 *)
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
     8
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
     9
(* The identifiers that will replace the XXXX
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    10
 * must be placed on a line starting with #
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    11
 * All identifiers preceded by # are ignored!
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    12
 * The identifier list must be placed inside an IEC 61131-3 comment.
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    13
 *)
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    14
(* This file is specific for identifiers identical to IL operators.
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    15
 *  See the note following the identifier list
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    16
 *)
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    17
(*
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    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
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    19
#SFC_qualifiers D DS L N P #R #S SD SL
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    20
     NOTE: R and S are identical to IL operators!!
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    21
#Task_initialisers PRIORITY SINGLE INTERVAL
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    22
*)
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    23
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    24
(* NOTE: The identifier as a variable test has some special cases.
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    25
 *       Namely, when using IL operators as variable names.
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    26
 *       Even though the syntax of the IL language would not result
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    27
 *       in ambiguities in the above case, our parser does not currently
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    28
 *       allow the use of variables (with names identical to IL
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    29
 *       operators) within IL code.
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    30
 *
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    31
 *       The following test code must therefore consider two possibilities:
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    32
 *        - if the identifier under test is an IL operator
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    33
 *        - if the identifier under test is not an IL operator
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    34
 *)
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    35
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    36
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    37
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    38
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    39
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    40
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    41
PROGRAM XXXX
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    42
VAR_INPUT
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    43
  a_1 : BOOL;
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    44
END_VAR
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    45
  LD a_1
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    46
END_PROGRAM
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    47
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    48
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    49
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    50
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    51
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    52
CONFIGURATION config1
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    53
 TASK fast(PRIORITY := 4);
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    54
 PROGRAM P1 WITH fast:
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    55
       XXXX(a_1 := TRUE);
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    56
END_CONFIGURATION
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    57
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    58
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    59
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    60
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    61
(* Checking whether the use of XXXX will confuse any other
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    62
 * normal and correct IL or ST code.
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    63
 *)
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    64
{#include "basic_code.test" }
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    65
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    66