tests/syntax/identifier/identifier_as_label.test
author Mario de Sousa <msousa@fe.up.pt>
Fri, 08 Jun 2012 19:47:45 +0100
changeset 570 cb704eca7e37
parent 108 f9e001952488
permissions -rwxr-xr-x
cosmetic changes.
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
 * IL label name/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 
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    16
#IL_operators #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
    17
#SFC_qualifiers D DS L N P #R #S SD SL
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    18
     NOTE: R and S are identical to IL operators!!
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    19
#Task_initialisers PRIORITY SINGLE INTERVAL
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
(* NOTE: Currently the matiec compiler does not yet support
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    23
 *       the use of identifiers identical to IL operators
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    24
 *       in IL code. In ther words, in IL code we cannot use 
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    25
 *       identifiers identical to IL operators to identify variables,
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    26
 *       functions, etc...
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    27
 *       Identifiers identical to IL operators are therefore
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    28
 *       commented out.
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    29
 *)
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
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    32
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
function foo : int
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    36
 var
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    37
  e, f : bool;
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    38
 end_var
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
 XXXX: R e
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    41
  JMP XXXX
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    42
end_function
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
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    45
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    46
function bar : int
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    47
 var
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    48
  e, f : bool;
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    49
 end_var
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
  JMP XXXX
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    52
 XXXX: R e
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    53
end_function
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    54
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    55
f9e001952488 Regression tests. Test correct parsing of identifiers.
mario
parents:
diff changeset
    56
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