package tm-grammars

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file tm_grammar_gdresource.ml

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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
let lang_id = "gdresource"
let json = {json|{
  "displayName": "GDResource",
  "name": "gdresource",
  "patterns": [
    {
      "include": "#embedded_shader"
    },
    {
      "include": "#embedded_gdscript"
    },
    {
      "include": "#comment"
    },
    {
      "include": "#heading"
    },
    {
      "include": "#key_value"
    }
  ],
  "repository": {
    "comment": {
      "captures": {
        "1": {
          "name": "punctuation.definition.comment.gdresource"
        }
      },
      "match": "(;).*$\\n?",
      "name": "comment.line.gdresource"
    },
    "data": {
      "patterns": [
        {
          "include": "#comment"
        },
        {
          "begin": "(?<!\\w)(\\{)\\s*",
          "beginCaptures": {
            "1": {
              "name": "punctuation.definition.table.inline.gdresource"
            }
          },
          "end": "\\s*(})(?!\\w)",
          "endCaptures": {
            "1": {
              "name": "punctuation.definition.table.inline.gdresource"
            }
          },
          "patterns": [
            {
              "include": "#key_value"
            },
            {
              "include": "#data"
            }
          ]
        },
        {
          "begin": "(?<!\\w)(\\[)\\s*",
          "beginCaptures": {
            "1": {
              "name": "punctuation.definition.array.gdresource"
            }
          },
          "end": "\\s*(])(?!\\w)",
          "endCaptures": {
            "1": {
              "name": "punctuation.definition.array.gdresource"
            }
          },
          "patterns": [
            {
              "include": "#data"
            }
          ]
        },
        {
          "begin": "\"\"\"",
          "end": "\"\"\"",
          "name": "string.quoted.triple.basic.block.gdresource",
          "patterns": [
            {
              "match": "\\\\([\\n \"/\\\\bfnrt]|u\\h{4}|U\\h{8})",
              "name": "constant.character.escape.gdresource"
            },
            {
              "match": "\\\\[^\\n\"/\\\\bfnrt]",
              "name": "invalid.illegal.escape.gdresource"
            }
          ]
        },
        {
          "match": "\"res://[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"",
          "name": "support.function.any-method.gdresource"
        },
        {
          "match": "(?<=type=)\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"",
          "name": "support.class.library.gdresource"
        },
        {
          "match": "(?<=NodePath\\(|parent=|name=)\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"",
          "name": "constant.character.escape.gdresource"
        },
        {
          "begin": "\"",
          "end": "\"",
          "name": "string.quoted.double.basic.line.gdresource",
          "patterns": [
            {
              "match": "\\\\([\\n \"/\\\\bfnrt]|u\\h{4}|U\\h{8})",
              "name": "constant.character.escape.gdresource"
            },
            {
              "match": "\\\\[^\\n\"/\\\\bfnrt]",
              "name": "invalid.illegal.escape.gdresource"
            }
          ]
        },
        {
          "match": "'.*?'",
          "name": "string.quoted.single.literal.line.gdresource"
        },
        {
          "match": "(?<!\\w)(true|false)(?!\\w)",
          "name": "constant.language.gdresource"
        },
        {
          "match": "(?<!\\w)([-+]?(0|([1-9](([0-9]|_[0-9])+)?))(?:(?:\\.(0|([1-9](([0-9]|_[0-9])+)?)))?[Ee][-+]?[1-9]_?[0-9]*|\\.[0-9_]*))(?!\\w)",
          "name": "constant.numeric.float.gdresource"
        },
        {
          "match": "(?<!\\w)([-+]?(0|([1-9](([0-9]|_[0-9])+)?)))(?!\\w)",
          "name": "constant.numeric.integer.gdresource"
        },
        {
          "match": "(?<!\\w)([-+]?inf)(?!\\w)",
          "name": "constant.numeric.inf.gdresource"
        },
        {
          "match": "(?<!\\w)([-+]?nan)(?!\\w)",
          "name": "constant.numeric.nan.gdresource"
        },
        {
          "match": "(?<!\\w)(0x((\\h((_??\\h)+)?)))(?!\\w)",
          "name": "constant.numeric.hex.gdresource"
        },
        {
          "match": "(?<!\\w)(0o[0-7](_?[0-7])*)(?!\\w)",
          "name": "constant.numeric.oct.gdresource"
        },
        {
          "match": "(?<!\\w)(0b[01](_?[01])*)(?!\\w)",
          "name": "constant.numeric.bin.gdresource"
        },
        {
          "begin": "(?<!\\w)(Vector2i??|Vector3i??|Color|Rect2i??|Array|Basis|Dictionary|Plane|Quat|RID|Rect3|Transform|Transform2D|Transform3D|AABB|String|Color|NodePath|Object|PoolByteArray|PoolIntArray|PoolRealArray|PoolStringArray|PoolVector2Array|PoolVector3Array|PoolColorArray|bool|int|float|StringName|Quaternion|PackedByteArray|PackedInt32Array|PackedInt64Array|PackedFloat32Array|PackedFloat64Array|PackedStringArray|PackedVector2Array|PackedVector2iArray|PackedVector3Array|PackedVector3iArray|PackedColorArray)(\\()\\s?",
          "beginCaptures": {
            "1": {
              "name": "support.class.library.gdresource"
            }
          },
          "end": "\\s?(\\))",
          "patterns": [
            {
              "include": "#key_value"
            },
            {
              "include": "#data"
            }
          ]
        },
        {
          "begin": "(?<!\\w)((?:Ext|Sub)Resource)(\\()\\s?",
          "beginCaptures": {
            "1": {
              "name": "keyword.control.gdresource"
            }
          },
          "end": "\\s?(\\))",
          "patterns": [
            {
              "include": "#key_value"
            },
            {
              "include": "#data"
            }
          ]
        }
      ]
    },
    "embedded_gdscript": {
      "begin": "(script/source) = \"",
      "beginCaptures": {
        "1": {
          "name": "variable.other.property.gdresource"
        }
      },
      "end": "\"",
      "patterns": [
        {
          "include": "source.gdscript"
        }
      ]
    },
    "embedded_shader": {
      "begin": "(code) = \"",
      "beginCaptures": {
        "1": {
          "name": "variable.other.property.gdresource"
        }
      },
      "end": "\"",
      "name": "meta.embedded.block.gdshader",
      "patterns": [
        {
          "include": "source.gdshader"
        }
      ]
    },
    "heading": {
      "begin": "\\[([_a-z]*)\\s?",
      "beginCaptures": {
        "1": {
          "name": "keyword.control.gdresource"
        }
      },
      "end": "]",
      "patterns": [
        {
          "include": "#heading_properties"
        },
        {
          "include": "#data"
        }
      ]
    },
    "heading_properties": {
      "patterns": [
        {
          "match": "(\\s*[-A-Z_a-z][-0-9A-Z_a-z]*\\s*=)(?=\\s*$)",
          "name": "invalid.illegal.noValue.gdresource"
        },
        {
          "begin": "\\s*([-A-Z_a-z]\\S*|\".+\"|'.+'|[0-9]+)\\s*(=)\\s*",
          "beginCaptures": {
            "1": {
              "name": "variable.other.property.gdresource"
            },
            "2": {
              "name": "punctuation.definition.keyValue.gdresource"
            }
          },
          "end": "($|(?==)|,?|\\s*(?=}))",
          "patterns": [
            {
              "include": "#data"
            }
          ]
        }
      ]
    },
    "key_value": {
      "patterns": [
        {
          "match": "(\\s*[-A-Z_a-z][-0-9A-Z_a-z]*\\s*=)(?=\\s*$)",
          "name": "invalid.illegal.noValue.gdresource"
        },
        {
          "begin": "\\s*([-A-Z_a-z]\\S*|\".+\"|'.+'|[0-9]+)\\s*(=)\\s*",
          "beginCaptures": {
            "1": {
              "name": "variable.other.property.gdresource"
            },
            "2": {
              "name": "punctuation.definition.keyValue.gdresource"
            }
          },
          "end": "($|(?==)|,|\\s*(?=}))",
          "patterns": [
            {
              "include": "#data"
            }
          ]
        }
      ]
    }
  },
  "scopeName": "source.gdresource"
}|json}