blob: e008160d34cbe54616ab811426de7688f90c9706 [file] [log] [blame]
Doug Kearns68a89472024-01-05 17:59:04 +01001(* Modula-2 PIM Test File for Vim Syntax Colouring *)
2
3(* --------------------------------------------------
4 * THIS FILE IS LICENSED UNDER THE VIM LICENSE
5 * see https://github.com/vim/vim/blob/master/LICENSE
6 * -------------------------------------------------- *)
7
8DEFINITION MODULE Foobar; (*!m2pim*)
9
10FROM SYSTEM IMPORT WORD, ADDRESS;
11
12CONST MaxFoo = 1.0; LF = CHR(10);
13
14TYPE Foo = POINTER TO Bar;
15
16(* predefined constants *)
17FALSE NIL TRUE
18
19(* predefined types *)
20BITSET BOOLEAN CHAR PROC CARDINAL INTEGER LONGINT REAL LONGREAL
21
22(* predefined procedures *)
23CAP DEC EXCL HALT INC INCL
24
25(* predefined functions *)
26ABS CHR FLOAT HIGH MAX MIN ODD ORD SIZE TRUNC VAL
27
28(* predefined macros *)
29NEW DISPOSE
30
31(* unsafe builtins *)
32ADDRESS PROCESS WORD ADR TSIZE NEWPROCESS TRANSFER SYSTEM
33
34(* non-standard language extensions *)
35BYTE LONGCARD LONGBITSET
36
37(* user defined identifiers *)
38foobar Foobar FooBar foo123 foo_bar
39
40(* string literals *)
41str := "foo 'bar' baz";
42str := 'foo "bar" baz';
43
44(* numeric literals *)
450FFFH, 1.23, 1.23e-45, 1000
46
47(* octal literals *)
48n := 0377B; ch := 0377C;
49
50(* pragmas *)
51(*$foo*)
52
53(* block comments with emphasis *)
54(* copyright (c) Jurrasic Inc.
55 author Fred Flintstone Sr.
56 license see LICENSE file. *)
57
58(* pre-conditions: foo bar baz bam boo doodle wah.
59 post-conditions: foodle babble bozo bim bam dang.
60 error-conditions: dada jingle jungle boggle dee boo. *)
61
62(* technical debt markers *)
63(* TODO: ... *)
64(* FIXME *)
65(* DEPRECATED *)
66
67(* procedures *)
68PROCEDURE NewFooWithBar ( VAR foo: Foo; bar : INTEGER );
69BEGIN
70 NEW(foo);
71 foo^.bar := bar;
72 RETURN
73END SetBar;
74
75(* functions *)
76PROCEDURE bar ( foo : Foo ) : INTEGER;
77BEGIN
78 IF foo = NIL THEN
79 HALT
80 ELSE
81 RETURN foo^.bar
82 END (* IF *)
83END bar;
84
85(* disabled code *)
86?<
87WHILE foo = bar DO
88 baz(bam, boo)
89END (* WHILE *);
90>?
91
92(* synonyms *)
93& ~
94
95(* illegal characters *)
96` ! @ $ % \ ? _
97
98(* illegal identifiers *)
99
100_bar _bar_baz _bar_baz__bam _bar_baz__bam_boo
101
102bar_ bar_baz_ bar_baz__bam_ bar_baz__bam_boo_
103
104__bar __bar_baz __bar_baz__bam __bar_baz__bam_boo
105
106bar__ bar_baz__ bar_baz__bam__ bar_baz__bam_boo__
107
108bar__baz __bar_baz__ __bar__baz__ __
109
110
111END Foobar.