Skip to content

Commit 0626d06

Browse files
authored
Update Umka.sublime-syntax
1 parent c7d905e commit 0626d06

File tree

1 file changed

+79
-5
lines changed

1 file changed

+79
-5
lines changed

Umka.sublime-syntax

Lines changed: 79 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
file_extensions:
55
- um
66
scope: source.umka
7+
variables:
8+
ident: '[A-Za-z_][A-Za-z_0-9]*'
9+
space: '\s*'
710
contexts:
8-
main:
11+
prototype:
912
# Line comments
1013
- match: '//'
1114
scope: punctuation.definition.comment.umka
@@ -16,20 +19,75 @@ contexts:
1619
scope: punctuation.definition.comment.begin.umka
1720
push: block_comment
1821

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+
1954
# Keywords
2055
- match: '\b(break|case|const|continue|default|else|enum|for|fn|import|interface|if|in|map|return|str|struct|switch|type|var|weak)\b'
2156
scope: keyword.control.umka
2257

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+
2377
# Operators
2478
- match: '\+|\-|\*|/|%|&|\||~|<<|>>|\+=|\-=|\*=|/=|%=|&=|\|=|~=|<<=|>>=|&&|\|\||\?|!|\++|\--|==|<|>|!=|<=|>=|=|:='
2579
scope: keyword.operator.umka
2680

2781
# Punctuation
2882
- match: '\(|\)|\[|\]|\{|\}|\^|;|:|::|\.'
2983
scope: punctuation.separator.umka
84+
85+
# Hex literals
86+
- match: '\b(0[Xx])[0-9A-F]+\b'
87+
scope: constant.numeric.umka
3088

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'
3391
scope: constant.numeric.umka
3492

3593
# String literals
@@ -48,7 +106,17 @@ contexts:
48106

49107
# Predeclared types
50108
- 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
52120

53121
double_quoted_string:
54122
- meta_scope: string.quoted.double.umka
@@ -70,9 +138,15 @@ contexts:
70138
- meta_scope: comment.line.umka
71139
- match: $
72140
pop: true
141+
- include: todos
73142

74143
block_comment:
75144
- meta_scope: comment.block.umka
76145
- match: '\*/'
77146
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

Comments
 (0)