-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathZenScript.source.sublime-syntax
153 lines (137 loc) · 3.89 KB
/
ZenScript.source.sublime-syntax
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
%YAML 1.2
---
name: ZenScript Source
file_extensions:
- zs
scope: source.zs
contexts:
main:
- comment: numbers
match: \b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)([LlFfUuDd]|UL|ul)?\b
scope: constant.numeric.zs
- comment: arrays
match: \b((?:[a-z]\w*\.)*[A-Z]+\w*)(?=\[)
scope: storage.type.object.array.zs
- include: code
brackets:
- comment: items and blocks
match: <((.*?):(.*?)(:(\*|\d+)?))|(\*)>
scope: keyword.other.zs
captures:
2: entity.name.zs
3: variable.parameter.zs
5: constant.numeric.zs
6: constant.numeric.zs
class:
- comment: class
match: (zenClass)\s+(\w+)
scope: meta.class.zs
captures:
1: storage.type.zs
2: entity.name.type.class.zs
class-constructor:
- comment: class constructor
match: \b(zenConstructor)\s*(?=\()
scope: meta.class.zs
captures:
1: entity.name.function.zs
code:
- include: class
- include: class-constructor
- include: functions
- include: function-call
- include: dots
- include: quotes
- include: brackets
- include: preprocessors
- include: comments
- include: var
- include: import
- include: keywords
- include: constants
- include: operators
comments:
- comment: inline comments
match: \s*((#|//).*$\n?)
scope: comment.line.number-sign
- match: /\*
scope: comment.block.zs
push:
- meta_scope: comment.block.zs
- match: \*/
scope: comment.block.zs
pop: true
constants:
- comment: constants (true, false, null)
match: \b(true|false|null)\b
scope: constant.language.zs
dots:
- comment: dots
match: \b(\w+)(\.)(\w+)((\.)(\w+))*
scope: source.zs
captures:
1: storage.type.zs
2: keyword.control.zs
5: keyword.control.zs
function-call:
- comment: function calls
match: (?!function)([A-Za-z_$][\w$]*)\s*(?=\()
scope: meta.function-call.zs
captures:
1: entity.name.function.zs
functions:
- comment: functions
match: function\s+([A-Za-z_$][\w$]*)\s*(?=\()
scope: meta.function.zs
captures:
0: storage.type.function.zs
1: entity.name.function.zs
import:
- comment: package import
match: (import) .*?(;)
captures:
1: keyword.other.import.zs
2: punctuation.terminator.zs
scope: meta.import.zs
keywords:
- comment: control keywords
match: \b(in|has|void|as|version|for|return|while|break|instanceof)\b
scope: keyword.control.zs
- comment: storage keywords
match: \b(any|bool|byte|short|int|long|float|double|string)\b
scope: storage.type.zs
- comment: as holder keywords
match: \b(?<=(as\s))[a-zA-Z]+\b
scope: storage.type.zs
- comment: function keyword
match: \b(function)\b
scope: storage.type.function.zs
- comment: statement keywords
match: \b(if|else)\b
scope: keyword.control.conditional.zs
operators:
- comment: math operators
match: (\.\.|\+=|\+|-=|-|\*=|\*|\/=|\/|%=|%|\|=|\||\|\||&=|&&|&|\^=|\^|\?|:|~=|~|;|<=|<|>=|>|==|=|!=|!|\$)
scope: keyword.operator
preprocessors:
- match: ^(\s*)(#)(debug|ignoreBracketErrors|norun|loader|priority|ikwid|profile|zslint|modloaded)
scope: constant.numeric.zs
captures:
1: keyword.control.zs
2: keyword.control.zs
3: variable.language.zs
quotes:
- comment: double quotes
match: \".*?\"
scope: string.quoted.double.zs
- match: \"
scope: invalid.illegal.stray-bracket-end
- comment: single quotes
match: \'.*?\'
scope: string.quoted.single.zs
- match: \'
scope: invalid.illegal.stray-bracket-end
var:
- comment: var
match: \b(var|val|static|global)\b
scope: storage.type