4
4
file_extensions :
5
5
- um
6
6
scope : source.umka
7
+ variables :
8
+ ident : ' [A-Za-z_][A-Za-z_0-9]*'
9
+ space : ' \s*'
7
10
contexts :
8
- main :
11
+ prototype :
9
12
# Line comments
10
13
- match : ' //'
11
14
scope : punctuation.definition.comment.umka
@@ -16,20 +19,75 @@ contexts:
16
19
scope : punctuation.definition.comment.begin.umka
17
20
push : block_comment
18
21
22
+ import_named_string :
23
+ - match : " \" "
24
+ scope : punctuation.definition.string.begin.umka
25
+ push : double_quoted_string
26
+ pop : true
27
+
28
+ import :
29
+ # Exit
30
+ - match : ' \)'
31
+ scope : keyword.control.umka
32
+ pop : true
33
+
34
+ # Import default
35
+ - match : " \" "
36
+ scope : punctuation.definition.string.begin.umka
37
+ push : module_string
38
+
39
+ # Import named
40
+ - match : ' \b({{ident}}){{space}}(\=)'
41
+ captures :
42
+ 1 : entity.name.module.umka
43
+ 2 : keyword.operator.umka
44
+ push : import_named_string
45
+
46
+ - include : main
47
+
48
+ main :
49
+ # Imports
50
+ - match : ' \bimport{{space}}\('
51
+ scope : keyword.control.umka
52
+ push : import
53
+
19
54
# Keywords
20
55
- match : ' \b(break|case|const|continue|default|else|enum|for|fn|import|interface|if|in|map|return|str|struct|switch|type|var|weak)\b'
21
56
scope : keyword.control.umka
22
57
58
+ # Closure parameters
59
+ - match : ' (\|[^\|]+\|){{space}}(\{)'
60
+ captures :
61
+ 1 : variable.parameter.umka
62
+
63
+ # Function call
64
+ - match : ' \b({{ident}}){{space}}(\*?){{space}}(\()'
65
+ captures :
66
+ 1 : support.function.umka
67
+ 2 : support.function.umka
68
+
69
+ # Member
70
+ - match : ' (?<=::|\.){{space}}({{ident}})'
71
+ scope : variable.parameter.umka
72
+
73
+ # Module
74
+ - match : ' \b({{ident}}){{space}}(?=::)'
75
+ scope : entity.name.module.umka
76
+
23
77
# Operators
24
78
- match : ' \+|\-|\*|/|%|&|\||~|<<|>>|\+=|\-=|\*=|/=|%=|&=|\|=|~=|<<=|>>=|&&|\|\||\?|!|\++|\--|==|<|>|!=|<=|>=|=|:='
25
79
scope : keyword.operator.umka
26
80
27
81
# Punctuation
28
82
- match : ' \(|\)|\[|\]|\{|\}|\^|;|:|::|\.'
29
83
scope : punctuation.separator.umka
84
+
85
+ # Hex literals
86
+ - match : ' \b(0[Xx])[0-9A-F]+\b'
87
+ scope : constant.numeric.umka
30
88
31
- # Numeric literals
32
- - match : ' \b(0[Xx])? [0-9.]+([Ee][+-]?[0-9]*)?\b'
89
+ # Decimal literals
90
+ - match : ' \b[0-9.]+([Ee][+-]?[0-9]*)?\b'
33
91
scope : constant.numeric.umka
34
92
35
93
# String literals
@@ -48,7 +106,17 @@ contexts:
48
106
49
107
# Predeclared types
50
108
- match : ' \b(void|int8|int16|int32|int|uint8|uint16|uint32|uint|bool|char|real32|real|fiber|any)\b'
51
- scope : storage.type.umka
109
+ scope : storage.type.umka
110
+
111
+ module_string :
112
+ - meta_scope : string.quoted.double.umka
113
+ - match : ' \\.'
114
+ scope : constant.character.escape.umka
115
+ - match : " {{ident}}(?=.um)"
116
+ scope : entity.name.module.umka
117
+ - match : ' "'
118
+ scope : punctuation.definition.string.end.umka
119
+ pop : true
52
120
53
121
double_quoted_string :
54
122
- meta_scope : string.quoted.double.umka
@@ -70,9 +138,15 @@ contexts:
70
138
- meta_scope : comment.line.umka
71
139
- match : $
72
140
pop : true
141
+ - include : todos
73
142
74
143
block_comment :
75
144
- meta_scope : comment.block.umka
76
145
- match : ' \*/'
77
146
scope : punctuation.definition.comment.end.umka
78
- pop : true
147
+ pop : true
148
+ - include : todos
149
+
150
+ todos :
151
+ - match : ' (TODO|FIXME|BUG|HACK|NOTE|XXX)'
152
+ scope : markup.bold.umka
0 commit comments