summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-05-26 21:45:27 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2018-05-26 21:45:27 +0200
commit700990b7ba69081007d253e2cf3aa9c015a6599c (patch)
treec8c51784f5dc18d6b9f600ceed9458c114ea9823
inital commit
-rw-r--r--eo.sublime-syntax346
-rw-r--r--struct-sample.eo66
2 files changed, 412 insertions, 0 deletions
diff --git a/eo.sublime-syntax b/eo.sublime-syntax
new file mode 100644
index 0000000..8e87440
--- /dev/null
+++ b/eo.sublime-syntax
@@ -0,0 +1,346 @@
1%YAML 1.2
2---
3name: Eo / Eot files
4file_extensions: [eo, eot]
5scope: eo
6
7contexts:
8 main:
9 - include: struct
10 - include: enum
11 - include: class
12 - include: import
13 import:
14 - match: "import"
15 scope: keyword.other
16 set: [semicolon, file_name]
17
18#class matcher
19 class:
20 - match: "(class|interface|abstract|mixin) "
21 scope: keyword.other
22 set: [class.inheritence ,typename]
23 class.inheritence:
24 #case for no inheritence definition
25 - match: "\\{"
26 set: class.body
27 - match: "\\("
28 set:
29 - match: "[A-Za-z0-9_]+"
30 scope: entity.name
31 push:
32 - match: ","
33 pop: true
34 - match: ""
35 pop: true
36 - match: "\\)"
37 set:
38 - match: "\\{"
39 set: class.body
40
41 class.body:
42 - include: comments
43 - include: close_rule
44 - include: eo_prefix_define
45 - include: event_prefix_define
46 - include: legacy_prefix_define
47 - include: data_define
48 - match: "methods"
49 scope: keyword.other
50 push:
51 - match: "\\{"
52 set: class.methods
53
54 - match: "implements"
55 scope: keyword.other
56 push:
57 - match: "\\{"
58 set: class.implements
59
60 - match: "events"
61 scope: keyword.other
62 push:
63 - match: "\\{"
64 set: class.events
65 - match: "constructors"
66 scope: keyword.other
67 push:
68 - match: "\\{"
69 set: class.constructors
70
71 class.constructors:
72 - include: close_rule
73
74
75 class.methods:
76 - include: comments
77 - include: close_rule
78 - match: "\\@property"
79 scope: storage.type
80 push: [class.method.property.define, class.method.property.mods, func_name]
81 - match: "[\\.]?[A-Za-z0-9_]+"
82 push: [class.method.define, class.method.mods]
83
84 class.method.property.define:
85 - include: close_rule
86 - include: comments
87 - match: "values"
88 scope: keyword.other
89 push: [class.method.property.values]
90 - match: "(get|set)"
91 scope: keyword.other
92 push: [class.method.property.getset]
93 - match: "keys"
94 scope: keyword.other
95 push: [class.method.property.keys]
96
97 class.method.property.keys:
98 - include: comments
99 - include: close_rule
100 - match: "[A-Za-z0-9_]+"
101 scope: entity.name
102 push: [semicolon, type.definition, colon]
103
104 class.method.property.getset:
105 - include: comments
106 - include: close_rule
107 - include: legacy_define
108 - include: return_define
109 - match: "values"
110 scope: storage.type
111 push: [class.method.property.values]
112
113 class.method.property.values:
114 - include: comments
115 - include: close_rule
116 - match: "[A-Za-z0-9_]+"
117 scope: entity.name
118 push: [semicolon, type.definition, colon]
119
120 class.method.property.mods:
121 - match: "(@protected|@class)"
122 scope: storage.type
123 - match: "\\{"
124 pop: true
125
126 class.method.define:
127 - include: comments
128 - include: close_rule
129 - include: legacy_define
130 - include: return_define
131 - match: "params"
132 scope: keyword.other
133 push: [class.method.params]
134
135 class.method.params:
136 - include: comments
137 - include: close_rule
138 - match: "[A-Za-z0-9_]+"
139 scope: entity.name
140 push: [semicolon, type.definition, colon]
141 #TODO in out inout
142
143 class.method.mods:
144 - match: "(@protected|@const|@class)"
145 scope: storage.type
146 - match: "\\{"
147 pop: true
148
149
150
151 class.implements:
152 - include: close_rule
153 - match: ""
154 #TODO highlight the names!
155
156 class.events:
157 - include: close_rule
158 - match: ""
159 #TODO highlight
160
161 func_name:
162 - match: "[.]?[A-Za-z0-9_]*"
163 pop: true
164
165
166#enum matcher
167 enum:
168 - match: "enum "
169 scope: keyword.other
170 set: [enum.body, curly_brace_open, typename]
171
172 enum.body:
173 - include: close_rule
174 - include: comments
175 - include: legacy_define
176 #TODO make a real and usefull formular parser
177 - match: "[A-Za-z0-9_]+"
178 scope: entity.name
179 - match: "="
180 - match: "(\\+|\\-|\\/|\\*|\\<<|\\>>|\\(|\\))"
181 - match: ","
182
183#struct matcher
184 struct:
185 - match: "struct "
186 scope: keyword.other
187 set: [struct.def, typename]
188
189 struct.def:
190 - match: ";"
191 pop: true
192 - match: curly_brace_open
193 set: [struct.body]
194
195 struct.body:
196 - include: comments
197 - include: close_rule
198 - match: "[A-Za-z0-9_]+"
199 scope: entity.name
200 push: [semicolon, type.definition, colon]
201
202#typedefinitions according to eolian
203 type.definition:
204 - match: "(list|array|accessor|iterator|hash)"
205 scope: storage.type
206 set: [type.definition.pointer, tag_close, type.definition, tag_open]
207 - match: "free "
208 scope: storage.type
209 set: [brace_close, c_type_name, comma, type.definition, brace_open]
210 - match: "free\\("
211 scope: storage.type
212 set: [brace_close, c_type_name, comma, type.definition]
213 - match: "(own |const )"
214 scope: storage.type
215 set: [type.definition.pointer, brace_close, type.definition, brace_open]
216 - match: "(own\\(|const\\()"
217 scope: storage.type
218 set: [type.definition.pointer, brace_close, type.definition]
219 - match: "[A-Za-z0-9_]+[.]"
220 scope: entity.name.type
221 set: [type.definition.pointer, typename]
222 - match: "[A-Za-z0-9_]+"
223 scope: entity.name.type
224 set: [type.definition.pointer]
225
226
227# there could be a pointer but it does not have to
228 type.definition.pointer:
229 - match: ""
230
231 - match: "[\\*]?"
232 scope: storage.type
233 pop: true
234
235 comments:
236 - match: "\\[\\["
237 scope: comment.block
238 push:
239 - match: "[[:alnum:]]*"
240 scope: comment.block
241 - match: "\\]\\]"
242 scope: comment.block
243 pop: true
244 - match: "\\/\\*"
245 scope: comment.block
246 push:
247 - match: "\\*\\/"
248 scope: comment.block
249 pop: true
250 - match: "[[:alnum:]]*"
251 scope: comment.block
252
253
254
255
256# include helpers
257
258 legacy_define:
259 - match: "legacy"
260 scope: keyword.other
261 push: [semicolon, c_type_name, colon]
262
263 return_define:
264 - match: "return"
265 scope: keyword.other
266 push: [semicolon,type.definition,colon]
267
268 eo_prefix_define:
269 - match: "eo_prefix"
270 scope: keyword.other
271 push: [semicolon, c_type_name, colon]
272 legacy_prefix_define:
273 - match: "legacy_prefix"
274 scope: keyword.other
275 push: [semicolon, c_type_name, colon]
276 event_prefix_define:
277 - match: "event_prefix"
278 scope: keyword.other
279 push: [semicolon, c_type_name, colon]
280 data_define:
281 - match: "data"
282 scope: keyword.other
283 push: [semicolon, c_type_name, colon]
284
285# some little helpers
286 file_name:
287 - match: "[A-Za-z0-9_]+"
288 scope: storage.type
289 pop: true
290
291# matches a typename according to the eo typenames
292 typename:
293 - match: "([A-Za-z0-9_]+)[.]"
294 #pop: true
295 #push : typename
296 captures:
297 1: entity.name
298 - match: "([A-Za-z0-9_]+)"
299 scope: entity.name
300 pop: true
301
302# matches a typename according to c
303 c_type_name:
304 - match: "[A-Za-z0-9_]+"
305 scope: entity.name
306 pop: true
307
308 close_rule:
309 - match: "\\}"
310 pop: true
311
312 tag_open:
313 - match: "<"
314 pop: true
315
316 tag_close:
317 - match: ">"
318 pop: true
319
320 brace_open:
321 - match: "\\("
322 pop: true
323
324 brace_close:
325 - match: "\\)"
326 pop: true
327
328 semicolon:
329 - match: "\\;"
330 pop: true
331
332 colon:
333 - match: "\\:"
334 pop: true
335
336 curly_brace_open:
337 - match: "\\{"
338 pop: true
339
340 equal:
341 - match: "="
342 pop: true
343
344 comma:
345 - match: ","
346 pop: true
diff --git a/struct-sample.eo b/struct-sample.eo
new file mode 100644
index 0000000..0a0dfa7
--- /dev/null
+++ b/struct-sample.eo
@@ -0,0 +1,66 @@
1struct bla.test {
2 [[test]]
3;
4}
5
6
7struct b.b {
8 [[asdf]]
9 [[asdf]]
10 a:list<bla>;
11 b:own(list<bla*>*)*;
12}
13
14enum asdf.a {
15 [[asdf]]
16}
17
18struct a.a.a {
19 [[asdfasd]]
20 ;
21}
22
23
24enum asdf {
25 asdf = (234asdfasd* 234) << a,
26 asdf = (asdf* asdf) << b
27}
28
29
30enum asdf {
31
32}
33
34class asdf2 {
35
36}
37
38abstract asdf2 (asdf) {
39
40}
41
42interface asdf2(asdf,asdf)
43{
44 methods {
45 @property asd {
46
47 }
48 asdfasd {
49 params {
50 bla : const(list<bla*>);
51 }
52 }
53 }
54
55 events {
56
57 }
58
59 implements {
60
61 }
62
63 constructors {
64
65 }
66} \ No newline at end of file