tests/syntax/identifier/identifier_as_configuration.test
author mjsousa
Sun, 13 Jul 2014 13:47:16 +0100
changeset 910 a0518971127d
parent 108 f9e001952488
permissions -rwxr-xr-x
Narrow array subscripts correctly, even in the presence of other datatype errors (so we do not generate error messages for array subscripts that do not contain errors).
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
 * CONFIGURATION 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
(*
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    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
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    16
#SFC_qualifiers D DS L N P #R #S SD SL
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    17
     NOTE: R and S are identical to IL operators!!
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    18
#Task_initialisers PRIORITY SINGLE INTERVAL
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    19
*)
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    20
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    21
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
(* a helper program *)
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    24
PROGRAM bar000
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    25
VAR_INPUT
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    26
  a_1 : BOOL;
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    27
END_VAR
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    28
VAR_OUTPUT
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    29
  b_1 : BOOL;
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    30
END_VAR
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    31
  a_1 := TRUE;
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    32
END_PROGRAM
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    33
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
 (* using in program parameter *)
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    36
CONFIGURATION XXXX
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    37
 TASK fast(PRIORITY := 4);
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    38
 PROGRAM foo WITH fast:
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    39
       bar000(a_1 := TRUE);
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    40
END_CONFIGURATION
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    41
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    42
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    43
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    44
(* Checking whether the use of XXXX will confuse any other
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    45
 * normal and correct IL or ST code.
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    46
 *)
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    47
{#include "basic_code.test" }
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    48