tests/syntax/identifier/identifier_as_configuration.test
author Mario de Sousa <msousa@fe.up.pt>
Wed, 13 Feb 2013 18:56:25 +0000
changeset 810 d9c48ad646f1
parent 108 f9e001952488
permissions -rwxr-xr-x
Add a new node to the abstract symtax tree, which will let us do datatype checking of FB variable declarations using the standard algorithm, and no special cases.
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