(* Modula-2 ISO 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; (*!m2iso*)

FROM SYSTEM IMPORT LOC, WORD, ADDRESS;

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

TYPE Foo = POINTER TO Bar;

(* predefined constants *)
FALSE NIL TRUE INTERRUPTIBLE UNINTERRUPTIBLE 

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

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

(* predefined functions *)
ABS CHR CMPLX FLOAT HIGH IM INT LENGTH LFLOAT MAX MIN ODD ORD RE SIZE TRUNC VAL

(* predefined macros *)
NEW DISPOSE

(* unsafe builtins *)
ADDRESS BYTE LOC WORD ADR CAST TSIZE SYSTEM
MAKEADR ADDADR SUBADR DIFADR ROTATE SHIFT

(* non-standard language extensions *)
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.
