forked from beefsack/GDScript-sublime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGDResource.sublime-syntax
148 lines (147 loc) · 5.3 KB
/
GDResource.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
%YAML 1.2
---
# http://www.sublimetext.com/docs/syntax.html
scope: source.gdresource
file_extensions:
- tres
- tscn
contexts:
main:
- include: embedded_shader
- include: embedded_gdscript
- include: comment
- include: heading
- include: key_value
comment:
- match: (;).*$\n?
scope: comment.line.gdresource
captures:
1: punctuation.definition.comment.gdresource
data:
- include: comment
- match: '(?<!\w)(\{)\s*'
captures:
1: punctuation.definition.table.inline.gdresource
push:
- match: '\s*(\})(?!\w)'
captures:
1: punctuation.definition.table.inline.gdresource
pop: true
- include: key_value
- include: data
- match: '(?<!\w)(\[)\s*'
captures:
1: punctuation.definition.array.gdresource
push:
- match: '\s*(\])(?!\w)'
captures:
1: punctuation.definition.array.gdresource
pop: true
- include: data
- match: '"""'
push:
- meta_scope: string.quoted.triple.basic.block.gdresource
- match: '"""'
pop: true
- match: '\\([btnfr"\\\n/ ]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})'
scope: constant.character.escape.gdresource
- match: '\\[^btnfr/"\\\n]'
scope: invalid.illegal.escape.gdresource
- match: '"res:\/\/[^"\\]*(?:\\.[^"\\]*)*"'
scope: support.function.any-method.gdresource
- match: '(?<=type=)"[^"\\]*(?:\\.[^"\\]*)*"'
scope: support.class.library.gdresource
- match: '(?<=NodePath\(|parent=|name=)"[^"\\]*(?:\\.[^"\\]*)*"'
scope: constant.character.escape.gdresource
- match: '"'
push:
- meta_scope: string.quoted.double.basic.line.gdresource
- match: '"'
pop: true
- match: '\\([btnfr"\\\n/ ]|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})'
scope: constant.character.escape.gdresource
- match: '\\[^btnfr/"\\\n]'
scope: invalid.illegal.escape.gdresource
- match: '''.*?'''
scope: string.quoted.single.literal.line.gdresource
- match: (?<!\w)(true|false)(?!\w)
scope: 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)'
scope: constant.numeric.float.gdresource
- match: '(?<!\w)((?:[\+\-]?(0|([1-9](([0-9]|_[0-9])+)?))))(?!\w)'
scope: constant.numeric.integer.gdresource
- match: '(?<!\w)([\+\-]?inf)(?!\w)'
scope: constant.numeric.inf.gdresource
- match: '(?<!\w)([\+\-]?nan)(?!\w)'
scope: constant.numeric.nan.gdresource
- match: '(?<!\w)((?:0x(([0-9a-fA-F](([0-9a-fA-F]|_[0-9a-fA-F])+)?))))(?!\w)'
scope: constant.numeric.hex.gdresource
- match: '(?<!\w)(0o[0-7](_?[0-7])*)(?!\w)'
scope: constant.numeric.oct.gdresource
- match: '(?<!\w)(0b[01](_?[01])*)(?!\w)'
scope: constant.numeric.bin.gdresource
- match: (?<!\w)(Vector2|Vector2i|Vector3|Vector3i|Color|Rect2|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?
captures:
1: support.class.library.gdresource
push:
- match: \s?(\))
pop: true
- include: key_value
- include: data
- match: (?<!\w)(ExtResource|SubResource)(\()\s?
captures:
1: keyword.control.gdresource
push:
- match: \s?(\))
pop: true
- include: key_value
- include: data
embedded_gdscript:
- match: (script/source) = "
comment: meta.embedded.block.gdscript
captures:
1: variable.other.property.gdresource
push:
- match: '"'
pop: true
- include: scope:source.gdscript
embedded_shader:
- match: (code) = "
captures:
1: variable.other.property.gdresource
push:
- meta_scope: meta.embedded.block.gdshader
- match: '"'
pop: true
- include: scope:source.gdshader
heading:
- match: '\[([a-z_]*)\s?'
captures:
1: keyword.control.gdresource
push:
- match: '\]'
pop: true
- include: heading_properties
- include: data
heading_properties:
- match: '(\s*[A-Za-z_\-][A-Za-z0-9_\-]*\s*=)(?=\s*$)'
scope: invalid.illegal.noValue.gdresource
- match: '\s*([A-Za-z_-][^\s]*|".+"|''.+''|[0-9]+)\s*(=)\s*'
captures:
1: variable.other.property.gdresource
2: punctuation.definition.keyValue.gdresource
push:
- match: '($|(?==)|\,?|\s*(?=\}))'
pop: true
- include: data
key_value:
- match: '(\s*[A-Za-z_\-][A-Za-z0-9_\-]*\s*=)(?=\s*$)'
scope: invalid.illegal.noValue.gdresource
- match: '\s*([A-Za-z_-][^\s]*|".+"|''.+''|[0-9]+)\s*(=)\s*'
captures:
1: variable.other.property.gdresource
2: punctuation.definition.keyValue.gdresource
push:
- match: '($|(?==)|\,|\s*(?=\}))'
pop: true
- include: data