forked from dylan-lang/dylan-emacs-support
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dylan-test.dylan
192 lines (174 loc) · 4.84 KB
/
dylan-test.dylan
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
Module: dylan-test
Synopsis: This file can be used to test dylan-mode indentation, and to some extent
the highlighting code. It's not meant to be compiled. Pressing the Tab
key on any line in this file should not cause any changes; if it does it's
a bug.
// *** Pressing Tab on the previous line (i.e., at the end of the header) should indent
// to just below "a bug."
// Notes for developers:
// * It may be useful to customize the dylan group during development to make it easier
// to see the effects of your changes. e.g., setting dylan-continuation-indent to 8.
// * Lines marked with "// ***" currently have known problems, i.e., they change when
// tabbed. Note that in some cases adding this comment may itself have impact on the
// indentation of subsequent lines, which is also a bug.
define library foo
use lib1;
use lib2,
import: {
mod1, // ***
mod2 // ***
}, // ***
rename: {
mod1 => mod3, // ***
mod2 => mod1 // ***
};
end;
define module foo
use mod1;
use mod2, import: {
mod1, // ***
mod2 // ***
}, // ***
rename: {
mod1 => mod3, // ***
mod2 => mod1 // ***
}; // ***
create
foo,
bar;
create foo,
bar; // ***
end;
define method arglist-on-same-line (foo, bar, #rest foo)
=> (#rest values)
test();
test();
block ()
foo();
end;
end;
define function arglist-on-multiple-lines
(arg1 :: <string>, #rest args,
#key key1 :: false-or(<x>) = #f,
key2 = 2, // *** key2, key3 should colorize
key3 = 3)
=> ()
foo();
bar();
block (return)
let v = really-long-function-name-that-goes-on-for-miles(
arg1, arg2, // ***
arg3, arg4); // ***
let v = fn(arg1, arg2,
arg3, arg4);
if (thing)
let (super, extra, long, variable, list)
= fn();
else
other-thing()
end;
let v = #[a,
b,
c];
let foo = #[
a, // ***
b // ***
]; // ***
let foo = #[a,
b];
end block;
local
method foo () => ()
foo(bar,
test(1, 2,
3, 4),
baz);
end,
method bar () 8 end,
method baz (x)
x
end;
local method foo (x)
x
end,
method bar (x) x end; // ***
// test
if (this("a" "b"))
x;
y;
z
elseif (f())
that
end;
select (x)
'x' => test;
test; // ***
'y' =>
test;
test;
otherwise =>
test;
end;
case
foo => test;
test; // ***
bar =>
test;
test;
end;
end function foo;
// Below is just an idea. I would like "slot" to line up so it's easier to see
// the names of the slots and which ones are constant/virtual/each-subclass.
// OTOH maybe syntax highlighting is good enough.
define open abstract class <flight> (<object>)
constant slot itinerary-variations :: <sequence>,
init-keyword: itinerary-variations:,
init-value: 21;
slot carrier, required-init-keyword: carrier:; // ***
end;
define macro foo-definer
{ define foo ?class:name = ?expr:expression } // ***
=> { define class "<" ## ?class ## ">" (<object>) // ***
slot one = ?expr;
slot two = 2;
end
} // ***
{ stuff }
=> { define function foo // ***
()
=> (test)
end;
clauses: // ***
{ stuff }
=> { other stuff } // ***
end;
define test foo (option: bar)
assert-true(#t);
assert-false(#f);
end;
define benchmark b ()
benchmark-repeat ()
x();
y(); // ***
end; // ***
end;
define suite s ()
benchmark b;
test t;
suite s;
end suite;
define inline function test-highlight-inline () end;
define may-inline function test-highlight-may-inline () end;
define not-inline function test-highlight-not-inline () end;
define inline-only function test-highlight-inline-only () end;
define default-inline function test-highlight-default-inline () end;
define function foo ()
with-open-file (stream = "/tmp/foo") end;
without-interrupts () body() end;
printing-object (o, s) end;
doing-this () end;
end function;
let 0d0 = x; // *** 0d0 not valid name, shouldn't highlight.
let 0dd = x; // 0dd is valid name, should highlight.
let x~ = ~x; // x~ is valid name, should highlight fully.
let $x = y; // With point on =, M-b should move point onto x, not $.