summaryrefslogtreecommitdiffstats
path: root/runtime/syntax/testdir/input/modula2_pim.def
blob: e008160d34cbe54616ab811426de7688f90c9706 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
(* Modula-2 PIM Test File for Vim Syntax Colouring *)

(* --------------------------------------------------
 * THIS FILE IS LICENSED UNDER THE VIM LICENSE
 * see https://github.com/vim/vim/blob/master/LICENSE
 * -------------------------------------------------- *)

DEFINITION MODULE Foobar; (*!m2pim*)

FROM SYSTEM IMPORT WORD, ADDRESS;

CONST MaxFoo = 1.0; LF = CHR(10);

TYPE Foo = POINTER TO Bar;

(* predefined constants *)
FALSE NIL TRUE

(* predefined types *)
BITSET BOOLEAN CHAR PROC CARDINAL INTEGER LONGINT REAL LONGREAL

(* predefined procedures *)
CAP DEC EXCL HALT INC INCL

(* predefined functions *)
ABS CHR FLOAT HIGH MAX MIN ODD ORD SIZE TRUNC VAL

(* predefined macros *)
NEW DISPOSE

(* unsafe builtins *)
ADDRESS PROCESS WORD ADR TSIZE NEWPROCESS TRANSFER SYSTEM

(* non-standard language extensions *)
BYTE LONGCARD LONGBITSET

(* user defined identifiers *)
foobar Foobar FooBar foo123 foo_bar

(* string literals *)
str := "foo 'bar' baz";
str := 'foo "bar" baz';

(* numeric literals *)
0FFFH, 1.23, 1.23e-45, 1000

(* octal literals *)
n := 0377B; ch := 0377C;

(* pragmas *)
(*$foo*)

(* block comments with emphasis *)
(* copyright (c) Jurrasic Inc.
   author Fred Flintstone Sr.
   license see LICENSE file. *)

(* pre-conditions: foo bar baz bam boo doodle wah.
   post-conditions: foodle babble bozo bim bam dang.
   error-conditions: dada jingle jungle boggle dee boo. *)

(* technical debt markers *)
(* TODO: ... *)
(* FIXME *)
(* DEPRECATED *)

(* procedures *)
PROCEDURE NewFooWithBar ( VAR foo: Foo; bar : INTEGER );
BEGIN
  NEW(foo);
  foo^.bar := bar;
  RETURN
END SetBar;

(* functions *)
PROCEDURE bar ( foo : Foo ) : INTEGER;
BEGIN
  IF foo = NIL THEN
    HALT
  ELSE
    RETURN foo^.bar
  END (* IF *)
END bar;
  
(* disabled code *)
?<
WHILE foo = bar DO
  baz(bam, boo)
END (* WHILE *);
>?

(* synonyms *)
&  ~

(* illegal characters *)
`  !  @  $  %  \  ?  _

(* illegal identifiers *)

_bar  _bar_baz  _bar_baz__bam  _bar_baz__bam_boo

bar_  bar_baz_  bar_baz__bam_  bar_baz__bam_boo_

__bar  __bar_baz  __bar_baz__bam  __bar_baz__bam_boo

bar__  bar_baz__  bar_baz__bam__  bar_baz__bam_boo__

bar__baz  __bar_baz__  __bar__baz__  __


END Foobar.