forked from beefsack/GDScript-sublime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGDScript.sublime-syntax
132 lines (132 loc) · 4.9 KB
/
GDScript.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
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: GDScript (Godot Engine)
file_extensions:
- gd
scope: source.gdscript
contexts:
main:
- match: (#).*$\n?
scope: comment.line.number-sign.gdscript
captures:
1: punctuation.definition.comment.number-sign.gdscript
- match: ^(""")
captures:
1: punctuation.definition.comment.triple-quote.gdscript
push:
- meta_scope: comment.block.triple-quote
- match: (""")
captures:
1: punctuation.definition.comment.triple-quote.gdscript
pop: true
- match: '"'
push:
- meta_scope: string.quoted.double.gdscript
- match: (?<!\\)"
pop: true
- match: "'"
push:
- meta_scope: string.quoted.single.gdscript
- match: (?<!\\)'
pop: true
- match: '"""'
push:
- meta_scope: string.quoted.triple.gdscript
- match: (?<!\\)"""
pop: true
- match: '@"'
push:
- meta_scope: string.quoted.double.node-path.gdscript
- match: (?<!\\)"
pop: true
- match: \b(?i:0x\h*)\b
scope: constant.numeric.integer.hexadecimal.gdscript
- match: '\b(?i:(\d+\.\d*(e[\-\+]?\d+)?))\b'
scope: constant.numeric.float.gdscript
- match: '\b(?i:(\.\d+(e[\-\+]?\d+)?))\b'
scope: constant.numeric.float.gdscript
- match: '\b(?i:(\d+e[\-\+]?\d+))\b'
scope: constant.numeric.float.gdscript
- match: \b\d+\b
scope: constant.numeric.integer.gdscript
- match: \b(?i:elif|else|for|if|while|break|continue|pass|return)\b
scope: keyword.control.flow.gdscript
- match: \b(?i:&&|and|in|is|!|not|\|\||or)\b
scope: keyword.operator.logical.gdscript
- match: <=|>=|==|<|>|!=
scope: keyword.operator.comparison.gdscript
- match: \+=|-=|\*=|/=|%=|&=|\|=|\*|/|%|\+|-|<<|>>|&|\||\^|~
scope: keyword.operator.arithmetic.gdscript
- match: "="
scope: keyword.operator.assignment.gdscript
- match: \b(bool|int|float|String|funcref)\b
scope: support.type.basic.gdscript
- match: '\b(Vector[23]|Rect2|Matrix32?|Plane|Quat|AABB|Transform)\b'
scope: support.type.vector.gdscript
- match: \b(Color|Image|NodePath|RID|Object|InputEvent)\b
scope: support.type.engine.gdscript
- match: '\b(Array|Dictionary|ByteArray|IntArray|FloatArray|StringArray|Vector[23]Array|ColorArray)\b'
scope: support.type.container.gdscript
- match: '^\s*(?i:(class))\s+([a-zA-Z_][a-zA-Z_0-9]*)\s*:'
captures:
1: storage.type.class.gdscript
2: entity.name.type.class.gdscript
- match: '^\s*(?i:(?:(static)\s+)?(func))\s+([a-zA-Z_][a-zA-Z_0-9]*)\s*\('
captures:
1: storage.modifier.static-function.gdscript
2: storage.type.function.gdscript
3: entity.name.function.gdscript
push:
- match: '\)\s*((\-\>)\s*([a-zA-Z_][a-zA-Z_0-9]*))?\s*:'
pop: true
- match: "[a-zA-Z_][a-zA-Z_0-9]*"
scope: variable.parameter.gdscript
- match: '^\s*(?i:(signal))\s+([a-zA-Z_][a-zA-Z_0-9]*)\s*\('
captures:
1: storage.type.signal.gdscript
2: entity.name.function.siglan.gdscript
push:
- match: '\)\s*((\-\>)\s*([a-zA-Z_][a-zA-Z_0-9]*))?\s*:'
pop: true
- match: "[a-zA-Z_][a-zA-Z_0-9]*"
scope: variable.parameter.gdscript
- match: '(?i:\b(?:(onready)\s+)?(var))\s+([a-zA-Z_][a-zA-Z_0-9]*)'
captures:
1: keyword.other.onready.gdscript
2: storage.type.var.gdscript
3: variable.other.gdscript
- match: '\b(?i:(const))\s+([a-zA-Z_][a-zA-Z_0-9]*)'
captures:
1: storage.type.const.gdscript
2: variable.other.gdscript
- match: \b(?i:extends|assert|breakpoint)\b
scope: keyword.other.gdscript
- match: '(?<=extends)\s+[a-zA-Z_][a-zA-Z_0-9]*(\.([a-zA-Z_][a-zA-Z_0-9]*))?'
scope: entity.other.inherited-class.gdscript
- match: \b(?i:true|false|null)\b
scope: constant.language.gdscript
- match: \b(?i:export|tool)\b
scope: storage.modifier.static.gdscript
- match: '\b((?i:setget))\b\s+(?:,?([a-zA-Z_][a-zA-Z_0-9]*)|([a-zA-Z_][a-zA-Z_0-9]*)\s*,\s*([a-zA-Z_][a-zA-Z_0-9]*))'
captures:
1: keyword.operator.setget.gdscript
2: entity.name.function.gdscript
3: entity.name.function.gdscript
4: entity.name.function.gdscript
- match: \b(?i:yield)\b
scope: keyword.control.flow.yield.gdscript
- match: \b(?i:var|const|onready|class|func|signal)\b
scope: invalid.illegal
- match: "([A-Z][a-zA-Z_0-9]*)"
scope: entity.name.type.class-type.gdscript
- match: "([a-z_][a-zA-Z_0-9]*)"
scope: entity.name.type.variant.gdscript
- match: '([a-z][a-zA-Z_0-9]*)\s*\('
captures:
1: entity.name.function.reference.gdscript
push:
- match: \)
pop: true
- match: "([a-zA-Z_][a-zA-Z_0-9]*)"
scope: variable.parameter.gdscript