forked from seiyria/sublime-dreams
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.dm
254 lines (227 loc) · 3.88 KB
/
test.dm
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/*
TODO
-escaped brackets should not be highlit
-leftmost expressions (like /datum) that aren't already a keyword
-parameter highlighting
-support world/New as well as world/\n\tNew()
-step should only be higlight in a for() loop header
-add procs to autocomplete
*/
// this is a test file to make sure the DM syntax is correctly highlighted
/*
this is a multi line comment
it has multiple lines
it also has some keywords in it like for, to, do
and some comment starters!
*/
//warning macro
#warning TEST
//macro functions
#define test cake
#define MACRO(x, y) return x + y
//nested macros
#ifdef test
#define cake 2
#endif
/*
variables
global
const
string
double quote
single quote
number (all numbers (integers, decimals) should be hilighted. However, in DM the negative symbol in negs is not; things like 1.#INF, where only the 1 is hilighted)
*/
var
global
x = 500
const
y = "test string"
icon = 'test icon'
/*
top level type definition
variables
list
new objects
procs
proc name
*/
datum
var
//is this even allowed in DM?
//t = 0xBEEFFACE
u = 01000
y = x ? z : POOP
//z = x > 2 : 1 < 4
test = new list()
obj/cake/pie = new()
proc
functionName(x, y, defaultArg = 1) {
return abs(-5)
}
proc
/*
a proc with braces
*/
braced_function() {
world << 1
}
/*
function call with semicolon
*/
proc
test()
sleep(20);
/*
do/while loop in braces
*/
var count = 1
for (var i = 0; i < count; ++i)
world << 1
/* code */
do {
x++
} while(y<100)
do_a_thing()
/*
do/while loop
*/
do
x++
while(y < 100)
/*
constants checking
*/
var
x = SOUTHEAST
y = UP
z = BLIND
a = SEE_MOBS
b = SEE_OBJS
c = SEEINVIS
d = MOB_PERSPECTIVE
e = EYE_PERSPECTIVE
f = FLOAT_LAYER
g = EFFECTS_LAYER
h = TOPDOWN_MAP
i = ISOMETRIC_MAP
j = NO_STEPS
k = FORWARD_STEPS
l = MALE
m = FEMALE
n = MOUSE_INACTIVE_POINTER
o = MOUSE_ACTIVE_POINTER
p = MOUSE_DRAG_POINTER
q = MOUSE_LEFT_BUTTON
r = MOUSE_RIGHT_BUTTON
s = MOUSE_CTRL_KEY
t = MOUSE_SHIFT_KEY
u = CONTROL_FREAK_ALL
v = CONTROL_FREAK_SKIN
w = MS_WINDOWS
xx = ASSERT
yy = SOUND_MUTE
zz = SOUND_PAUSED
aa = ICON_ADD
bb = ICON_AND
cc = ICON_OVERLAY
dd = ICON_UNDERLAY
/*
blocks are not currently highlit correctly because the regex looks for braces
*/
sleep(10)
spawn(20)
world << 1
/*
for loop
*/
for(var/x=0; x<100, x++)
world << TRUE
src << x
usr << "a string!"
/*
for loop with to/step, step should only be hilighted in the case it's after "for("
*/
for(var/x=1 to 10 step 4)
/*
switch statement
*/
switch(x)
/*
break from switch
*/
if(1) break
if(2) world << "never happens"
/*
cases that aren't supposed to highlight
*/
default
case
/*
text macros
*/
world << "\r \n"
/*
while loop
*/
while(TRUE)
world << "this is the song that never ends!"
/*
return statement
*/
return 5
/*
text document syntax
*/
world << {"poop
poop
poop"}
/*
escaped line end
*/
world << "poop \
poop"
/*
embedded expressions
*/
world << "poop: [x]"
/*
escaped things
*/
world << "poop: \[x]" // only first bracket cancels the expression
world << "poop \"hi\" " //both quotes have to be escaped
/*
. and : as path operators (are you doing path hilighting anyways?)
*/
mob:.:.:.:.:.:.:.:.:.:.Login()
world << "Hello, world!"
..()
.poop
mob.poop.verb.hi()
world << "hi"
//stolen from the DM Guide
mob/cock.verb:fdf()
world << "hi"
mob:cock
verb/stupid()
world << "hi"
mob
var/species_alignment
dragon
species_alignment = .dragon
black
species_alignment = .black
snake
species_alignment = .snake
cobra
winged
species_alignment = .dragon
pit_viper
species_alignment = .dragon/black
obj/corpse
icon = 'corpse.dmi'
mob
dragon
icon = 'dragon.dmi'
:corpse //add to corpse definition
var/dragon_meat