-
-
Notifications
You must be signed in to change notification settings - Fork 163
/
GDShader.tmLanguage.json
263 lines (263 loc) · 7.35 KB
/
GDShader.tmLanguage.json
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
255
256
257
258
259
260
261
262
263
{
"name": "GDShader",
"scopeName": "source.gdshader",
"uuid": "3a95d25d-688b-481f-a581-eee47f00e5ca",
"fileTypes": [ "gdshader" ],
"patterns": [ { "include": "#any" } ],
"repository": {
"any": {
"patterns": [
{ "include": "#comment" },
{ "include": "#enclosed" },
{ "include": "#classifier" },
{ "include": "#definition" },
{ "include": "#keyword" },
{ "include": "#element" },
{ "include": "#separator" },
{ "include": "#operator" }
]
},
"comment": {
"patterns": [
{ "include": "#commentLine" },
{ "include": "#commentBlock" }
]
},
"commentLine": {
"name": "comment.line.double-slash.gdshader",
"begin": "//",
"end": "$"
},
"commentBlock": {
"name": "comment.block.gdshader",
"begin": "/\\*",
"end": "\\*/"
},
"enclosed": {
"name": "meta.parenthesis.gdshader",
"begin": "\\(",
"end": "\\)",
"captures": { "0": { "name": "punctuation.parenthesis.gdshader" } },
"patterns": [ { "include": "#any" } ]
},
"classifier": {
"name": "meta.classifier.gdshader",
"begin": "(?=\\b(?:shader_type|render_mode)\\b)",
"patterns": [
{ "include": "#comment" },
{ "include": "#keyword" },
{ "include": "#identifierClassification" },
{ "include": "#separator" }
],
"end": "(?<=;)"
},
"classifierKeyword": {
"name": "keyword.language.classifier.gdshader",
"match": "\\b(?:shader_type|render_mode)\\b"
},
"identifierClassification": {
"name": "entity.other.inherited-class.gdshader",
"match": "\\b[a-z_]+\\b"
},
"definition": {
"patterns": [ { "include": "#structDefinition" } ]
},
"arraySize": {
"name": "meta.array-size.gdshader",
"begin": "\\[",
"end": "\\]",
"captures": { "0": { "name": "punctuation.bracket.gdshader" } },
"patterns": [
{ "include": "#comment" },
{ "include": "#keyword" },
{ "include": "#element" },
{ "include": "#separator" }
]
},
"structDefinition": {
"begin": "(?=\\b(?:struct)\\b)",
"patterns": [
{ "include": "#comment" },
{ "include": "#keyword" },
{ "include": "#structName" },
{ "include": "#structDefinitionBlock" },
{ "include": "#separator" }
],
"end": "(?<=;)"
},
"structKeyword": {
"name": "keyword.other.struct.gdshader",
"match": "\\b(?:struct)\\b"
},
"structName": {
"name": "entity.name.type.struct.gdshader",
"match": "\\b[a-zA-Z_]\\w*\\b"
},
"structDefinitionBlock": {
"name": "meta.definition.block.struct.gdshader",
"begin": "\\{",
"end": "\\}",
"captures": { "0": { "name": "punctuation.definition.block.struct.gdshader" } },
"patterns": [
{ "include": "#comment" },
{ "include": "#precisionKeyword" },
{ "include": "#fieldDefinition" },
{ "include": "#keyword" },
{ "include": "#any" }
]
},
"fieldDefinition": {
"name": "meta.definition.field.gdshader",
"begin": "\\b[a-zA-Z_]\\w*\\b",
"beginCaptures": {
"0": {
"patterns": [
{ "include": "#typeKeyword" },
{
"match": ".+",
"name": "entity.name.type.gdshader"
}
]
}
},
"patterns": [
{ "include": "#comment" },
{ "include": "#keyword" },
{ "include": "#arraySize" },
{ "include": "#fieldName" },
{ "include": "#any" }
],
"end": "(?<=;)"
},
"fieldName": {
"name": "entity.name.variable.field.gdshader",
"match": "\\b[a-zA-Z_]\\w*\\b"
},
"keyword": {
"patterns": [
{ "include": "#classifierKeyword" },
{ "include": "#structKeyword" },
{ "include": "#controlKeyword" },
{ "include": "#modifierKeyword" },
{ "include": "#precisionKeyword" },
{ "include": "#typeKeyword" },
{ "include": "#hintKeyword" }
]
},
"controlKeyword": {
"name": "keyword.control.gdshader",
"match": "\\b(?:if|else|do|while|for|continue|break|switch|case|default|return|discard)\\b"
},
"modifierKeyword": {
"name": "storage.modifier.gdshader",
"match": "\\b(?:const|global|instance|uniform|varying|in|out|inout|flat|smooth)\\b"
},
"precisionKeyword": {
"name": "storage.type.built-in.primitive.precision.gdshader",
"match": "\\b(?:low|medium|high)p\\b"
},
"typeKeyword": {
"name": "support.type.gdshader",
"match": "\\b(?:void|bool|[biu]?vec[234]|u?int|float|mat[234]|[iu]?sampler(?:3D|2D(?:Array)?)|samplerCube)\\b"
},
"hintKeyword": {
"name": "support.type.annotation.gdshader",
"match": "\\b(?:source_color|hint_(?:color|range|(?:black_)?albedo|normal|(?:default_)?(?:white|black)|aniso|anisotropy|roughness_(?:[rgba]|normal|gray))|filter_(?:nearest|linear)(?:_mipmap(?:_anisotropic)?)?|repeat_(?:en|dis)able)\\b"
},
"element": {
"patterns": [
{ "include": "#literalFloat" },
{ "include": "#literalInt" },
{ "include": "#literalBool" },
{ "include": "#identifierType" },
{ "include": "#constructor" },
{ "include": "#processorFunction" },
{ "include": "#identifierFunction" },
{ "include": "#swizzling" },
{ "include": "#identifierField" },
{ "include": "#constantFloat" },
{ "include": "#languageVariable" },
{ "include": "#identifierVariable" }
]
},
"literalFloat": {
"name": "constant.numeric.float.gdshader",
"match": "\\b(?:\\d+[eE][-+]?\\d+|(?:\\d*[.]\\d+|\\d+[.])(?:[eE][-+]?\\d+)?)[fF]?"
},
"literalInt": {
"name": "constant.numeric.integer.gdshader",
"match": "\\b(?:0[xX][0-9A-Fa-f]+|\\d+[uU]?)\\b"
},
"literalBool": {
"name": "constant.language.boolean.gdshader",
"match": "\\b(?:false|true)\\b"
},
"identifierType": {
"name": "entity.name.type.gdshader",
"match": "\\b[a-zA-Z_]\\w*(?=(?:\\s*\\[\\s*\\w*\\s*\\])?\\s+[a-zA-Z_]\\w*\\b)"
},
"constructor": {
"name": "entity.name.type.constructor.gdshader",
"match": "\\b[a-zA-Z_]\\w*(?=\\s*\\[\\s*\\w*\\s*\\]\\s*[(])|\\b[A-Z]\\w*(?=\\s*[(])"
},
"processorFunction": {
"name": "support.function.gdshader",
"match": "\\b(?:vertex|fragment|light|start|process|sky|fog)(?=(?:\\s|/\\*(?:\\*(?!/)|[^*])*\\*/)*[(])"
},
"identifierFunction": {
"name": "entity.name.function.gdshader",
"match": "\\b[a-zA-Z_]\\w*(?=(?:\\s|/\\*(?:\\*(?!/)|[^*])*\\*/)*[(])"
},
"swizzling": {
"match": "([.])\\s*([xyzw]{2,4}|[rgba]{2,4}|[stpq]{2,4})\\b",
"captures": {
"1": { "name": "punctuation.accessor.gdshader" },
"2": { "name": "variable.other.property.gdshader" }
}
},
"identifierField": {
"match": "([.])\\s*([a-zA-Z_]\\w*)\\b(?!\\s*\\()",
"captures": {
"1": { "name": "punctuation.accessor.gdshader" },
"2": { "name": "entity.name.variable.field.gdshader" }
}
},
"constantFloat": {
"name": "constant.language.float.gdshader",
"match": "\\b(?:E|PI|TAU)\\b"
},
"languageVariable": {
"name": "variable.language.gdshader",
"match": "\\b(?:[A-Z][A-Z_0-9]*)\\b"
},
"identifierVariable": {
"name": "variable.name.gdshader",
"match": "\\b[a-zA-Z_]\\w*\\b"
},
"separator": {
"patterns": [
{
"match": "[.]",
"name": "punctuation.accessor.gdshader"
},
{ "include": "#separatorComma" },
{
"match": "[;]",
"name": "punctuation.terminator.statement.gdshader"
},
{
"match": "[:]",
"name": "keyword.operator.type.annotation.gdshader"
}
]
},
"separatorComma": {
"name": "punctuation.separator.comma.gdshader",
"match": "[,]"
},
"operator": {
"name": "keyword.operator.gdshader",
"match": "\\<\\<\\=?|\\>\\>\\=?|[-+*/&|<>=!]\\=|\\&\\&|[|][|]|[-+~!*/%<>&^|=]"
}
}
}