Mercurial > vim
comparison runtime/syntax/testdir/input/modula2_r10.def @ 34092:ff27442e7851 v9.1.0013
patch 9.1.0013: Modula2 filetype support lacking
Commit: https://github.com/vim/vim/commit/68a89470693c7687d4e736ca056c05de632e3ac7
Author: Doug Kearns <dougkearns@gmail.com>
Date: Fri Jan 5 17:59:04 2024 +0100
patch 9.1.0013: Modula2 filetype support lacking
Problem: Modula2 filetype support lacking
Solution: Improve the Modula-2 runtime support, add additional modula2
dialects, add compiler plugin, update syntax highlighting,
include syntax tests, update Makefiles (Doug Kearns)
closes: #6796
closes: #8115
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Benjamin Kowarsch <trijezdci@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 05 Jan 2024 18:15:04 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
34091:27bd5d0816e0 | 34092:ff27442e7851 |
---|---|
1 (* Modula-2 R10 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 | |
8 DEFINITION MODULE Foobar; (*!m2r10*) | |
9 | |
10 IMPORT UNSAFE ALIAS BYTE, WORD, ADDRESS; | |
11 | |
12 CONST MaxFoo = 1.0; | |
13 | |
14 TYPE Foo = ALIAS OF Bar; | |
15 | |
16 (* predefined constants *) | |
17 NIL FALSE TRUE | |
18 | |
19 (* predefined types *) | |
20 BOOLEAN CHAR UNICHAR OCTET CARDINAL LONGCARD INTEGER LONGINT REAL LONGREAL | |
21 | |
22 (* predefined procedures *) | |
23 APPEND INSERT REMOVE SORT SORTNEW | |
24 | |
25 (* predefined functions *) | |
26 CHR ORD ODD ABS SGN MIN MAX LOG2 POW2 ENTIER PRED SUCC PTR CAPACITY COUNT LENGTH | |
27 | |
28 (* predefined macros *) | |
29 NOP TMIN TMAX TSIZE TLIMIT | |
30 | |
31 (* unsafe builtins *) | |
32 UNSAFE | |
33 | |
34 (* unsafe builtin types *) | |
35 BYTE WORD LONGWORD ADDRESS OCTETSEQ | |
36 | |
37 (* unsafe builtin procedures *) | |
38 ADD SUB DEC INC SETBIT HALT | |
39 | |
40 (* unsafe builtin functions *) | |
41 ADR CAST BIT SHL SHR BWNOT BWAND BWOR | |
42 | |
43 (* non-portable language extensions *) | |
44 ASSEMBLER ASM REG | |
45 | |
46 (* user defined identifiers *) | |
47 foobar Foobar FooBar foo_bar foo0 | |
48 | |
49 | |
50 (* string literals *) | |
51 str := "foo 'bar' baz"; | |
52 str := 'foo "bar" baz'; | |
53 | |
54 (* numeric literals *) | |
55 0b0110'0011'0110'0000, 0u0A, 0x0123, 0xCAFE'D00D | |
56 1'000'000.00, 1.23, 1.23e+10, 1.234'567'890e-1'000 | |
57 | |
58 | |
59 (* language defined pragmas *) | |
60 <*MSG=INFO:"foobar"*> <*ENCODING="UTF8"*> <*INLINE*> <*NOINLINE*> <*FFI="C"*> | |
61 | |
62 (* implementation defined pragmas *) | |
63 <*GM2.Foobar|W=Bazbam*> | |
64 | |
65 | |
66 (* single line comment *) | |
67 ! foo bar baz bam boo | |
68 | |
69 (* block comments with emphasis *) | |
70 (* copyright (c) 2016 Modula-2 Foundation. | |
71 authors B.Kowarsch and R.Sutcliffe | |
72 license see LICENSE *) | |
73 | |
74 (* pre-conditions: foo bar baz bam boo doodle wah. | |
75 post-conditions: foodle babble bozo bim bam dang. | |
76 error-conditions: dada jingle jungle boggle dee boo. *) | |
77 | |
78 (* (* *) *) | |
79 | |
80 (* bindings *) | |
81 PROCEDURE [+] sum ( a, b : BCD ) : BCD; | |
82 | |
83 PROCEDURE [MOD] modulus ( n, m : INT64 ) : INT64; | |
84 | |
85 PROCEDURE [RETAIN] Retain ( foo : Foo ); | |
86 | |
87 PROCEDURE [LENGTH] length ( str : String ) : LONGCARD; | |
88 | |
89 | |
90 (* procedures *) | |
91 PROCEDURE NewFooWithBar ( VAR foo: Foo; bar : INTEGER ); | |
92 BEGIN | |
93 NEW(foo); | |
94 foo^.bar := bar; | |
95 RETURN | |
96 END NewFooWithBar; | |
97 | |
98 END END; | |
99 | |
100 (* functions *) | |
101 PROCEDURE bar ( foo : Foo ) : INTEGER; | |
102 BEGIN | |
103 IF foo = NIL THEN | |
104 UNSAFE.HALT | |
105 ELSE | |
106 RETURN foo^.bar | |
107 END (* IF *) | |
108 END bar; | |
109 | |
110 | |
111 (* technical debt *) | |
112 TO DO ( 1234, Weight.Major ) (* foo *) | |
113 "redesign foo", 2d; | |
114 "replace foo", 2d; | |
115 "test new foo", 1d | |
116 END (* TO DO *); | |
117 | |
118 PROCEDURE SetBaba <*DEPRECATED*> ( n : CARDINAL ); | |
119 | |
120 | |
121 (* disabled code *) | |
122 ?< | |
123 WHILE foo = bar DO | |
124 baz(bam, boo) | |
125 END (* WHILE *); | |
126 >? | |
127 | |
128 | |
129 (* illegal characters *) | |
130 ` ~ $ % ? _ | |
131 | |
132 (* illegal identifiers *) | |
133 | |
134 _bar _bar_baz _bar_baz__bam _bar_baz__bam_boo | |
135 | |
136 bar_ bar_baz_ bar_baz__bam_ bar_baz__bam_boo_ | |
137 | |
138 __bar __bar_baz __bar_baz__bam __bar_baz__bam_boo | |
139 | |
140 bar__ bar_baz__ bar_baz__bam__ bar_baz__bam_boo__ | |
141 | |
142 bar__baz __bar_baz__ __bar__baz__ __ | |
143 | |
144 | |
145 (* module end *) | |
146 END Foobar. |