-
Notifications
You must be signed in to change notification settings - Fork 18
/
syntax_test_gdscript.gd
224 lines (197 loc) · 7.81 KB
/
syntax_test_gdscript.gd
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
# SYNTAX TEST "Packages/User/GDScript-sublime/GDScript.sublime-syntax"
""" # still a block comment """
# ^ comment.block.documentation.gdscript
""" indented block comment """
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.documentation.gdscript
# ^^^ punctuation.definition.comment.begin.gdscript
# ^^^ punctuation.definition.comment.end.gdscript
""" \" """
# ^^ constant.character.escape.gdscript
var x = """ # not a comment """
# ^^^^^^^^^^^^^^^^^^^^^^^ meta.string.gdscript string.quoted.double.block.gdscript
# ^^^ punctuation.definition.string.begin.gdscript
# ^^^ punctuation.definition.string.end.gdscript
var x = """ " lone quote does not end the string
# ^ string.quoted.double.block.gdscript
"""
var x = """ \""" """
# ^^ constant.character.escape.gdscript
" # not a comment"
#^^^^^^^^^^^^^^^^^ meta.string.gdscript string.quoted.double.gdscript
# <- punctuation.definition.string.begin.gdscript
# ^ punctuation.definition.string.end.gdscript
' # not a comment'
#^^^^^^^^^^^^^^^^^ meta.string.gdscript string.quoted.single.gdscript
# <- punctuation.definition.string.begin.gdscript
# ^ punctuation.definition.string.end.gdscript
'escaped quote \' foo'
# ^^ constant.character.escape.gdscript
"escaped quote \" foo"
# ^^ constant.character.escape.gdscript
"\\"
#^^ constant.character.escape.gdscript
# ^ punctuation.definition.string.end.gdscript
'\\'
#^^ constant.character.escape.gdscript
# ^ punctuation.definition.string.end.gdscript
123 # this actually won't compile outside a function
# <- constant.numeric.integer.gdscript
# ^ punctuation.definition.comment.number-sign.gdscript
func foo(): pass
# <- storage.type.function.gdscript
# ^^^ entity.name.function.gdscript
# ^^^^ keyword.control.flow.gdscript
static func f(): pass
# <- storage.modifier.gdscript
remote func f(): pass
# <- storage.modifier.gdscript
sync func f(): pass
# <- storage.modifier.gdscript
master func f(): pass
# <- storage.modifier.gdscript
slave func f(): pass
# <- storage.modifier.gdscript
func foo () :
#^^^^^^^^ meta.function.gdscript
# ^^ meta.function.parameters.gdscript
# ^ punctuation.section.function.begin.gdscript
# ^^ meta.function.gdscript
pass
func foo(bar, # something
# ^ punctuation.section.parameters.begin.gdscript
# ^^^ variable.parameter.gdscript
# ^ punctuation.separator.parameters.gdscript
# ^^^^^^^^^^^ comment.line
baz): pass
# ^^^^^^^^^^^ meta.function.parameters.gdscript
# ^ punctuation.section.parameters.end.gdscript
func foo \
(): pass
# <- meta.function.parameters.gdscript
func foo \ # nothing allowed after
# ^ punctuation.separator.continuation.line.gdscript
# ^^^^^^^^^^^^^^^^^^^^^^^^^ invalid.illegal.unexpected-text.gdscript
(): pass # not actually legal after the bad line continuation
# <- meta.function.parameters.gdscript
func foo() -> int:
# ^^ keyword.operator.arrow.forward.gdscript
# ^^^ storage.type.basic.gdscript
int(1)
# ^^^ storage.type.basic.gdscript
func foo() -> Vector2:
# ^^ keyword.operator.arrow.forward.gdscript
# ^^^^^^^ storage.type.vector.gdscript
Vector2(1,2)
# ^^^^^^^ storage.type.vector.gdscript
func foo() -> void: pass
# ^^^^ storage.type.basic.gdscript
func foo() -> FuncRef: pass
# ^^^^^^^ support.class.gdscript
signal foo
# <- storage.type.signal.gdscript
# ^^^ entity.name.signal.gdscript
signal foo()
#^^^^^^^^^ meta.signal.gdscript
# ^^ meta.signal.parameters.gdscript
# ^ punctuation.section.parameters.begin.gdscript
# ^ punctuation.section.parameters.end.gdscript
signal foo(bar, baz)
# ^^^ variable.parameter.gdscript
# ^ punctuation.separator.parameters.gdscript
signal foo \
()
# < meta.signal.parameters.gdscript
var x setget set_x
# ^^^^^ variable.function.setter.gdscript
var x setget set_x, get_x
# ^^^^^ variable.function.setter.gdscript
# ^ punctuation.separator.parameters.gdscript
# ^^^^^ variable.function.getter.gdscript
var x setget, get_x
# ^^^^^ variable.function.getter.gdscript
var x setget set_x ,get_x
# ^^^^^ variable.function.setter.gdscript
# ^^^^^ variable.function.getter.gdscript
func foo():
bar()
# ^^^ meta.function-call.gdscript variable.function.gdscript
bar('foo', 1 + 1)
# ^^^^^^^^^^^^^^ meta.function-call.arguments.gdscript
# ^^^^^ meta.string.gdscript string.quoted.single.gdscript
bar('foo', 1 + 1)
# ^ punctuation.section.arguments.end.gdscript
# ^ punctuation.separator.arguments.gdscript
# ^ punctuation.section.arguments.begin.gdscript
yield()
# ^^^^^ keyword.control.flow.yield.gdscript
yield('foo', 1 + 1)
# ^^^^^ meta.string.gdscript string.quoted.single.gdscript
yield('foo', 1 + 1)
# ^ punctuation.section.arguments.end.gdscript
# ^ punctuation.separator.arguments.gdscript
# ^ punctuation.section.arguments.begin.gdscript
print(yield())
# ^^^^^ keyword.control.flow.yield.gdscript
func foo():
var a = {}
# ^ meta.mapping.gdscript punctuation.section.mapping.begin.gdscript
# ^ meta.mapping.gdscript punctuation.section.mapping.end.gdscript
# ^^ meta.mapping.gdscript
var b = {'foo': 1}
# ^^^^^ meta.mapping.key.gdscript meta.string.gdscript string.quoted.single.gdscript
# ^ meta.mapping.gdscript punctuation.separator.mapping.key-value.gdscript
# ^ meta.mapping.value.gdscript constant.numeric.integer.gdscript
var c = {key: 1}
# ^^^ meta.mapping.key.gdscript
var d = { # things
# ^^^^^^^^ comment.line
'foo':
# ^^^^^ meta.mapping.key.gdscript
'bar'
# ^^^^^ meta.mapping.value.gdscript
}
{int = foo}
var e = {yield(): 'foo'}
# ^^^^^ keyword.control.flow.yield.gdscript
var x = {func = 1 + 1,
# ^^^^ meta.mapping.key.gdscript
# ^ punctuation.separator.mapping.key-value.gdscript
# ^^^^^ meta.mapping.value.gdscript
# ^ meta.mapping.gdscript punctuation.separator.mapping.gdscript
signal = 2,
# ^^^^^^ meta.mapping.key.gdscript
yield = 3,
# ^^^^^ meta.mapping.key.gdscript
int=4 }
# ^^^ meta.mapping.key.gdscript
var y = {signal = 3}
# ^^^^^^ meta.mapping.key.gdscript
enum {}
# <- storage.type.enum.gdscript
enum FOO {BAR}
# ^^^ entity.name.enum.gdscript
# ^^^ entity.name.type.gdscript
#^^^ storage.type.enum.gdscript
enum {X, Y,Z}
# ^ meta.mapping.key.gdscript entity.name.enum.gdscript
# ^ meta.mapping.key.gdscript entity.name.enum.gdscript
# ^ punctuation.separator.mapping.key-value.gdscript
# ^ punctuation.section.mapping.end.gdscript
enum TEST {
A, B, C
# ^ meta.mapping.key.gdscript entity.name.enum.gdscript
# ^ meta.mapping.key.gdscript entity.name.enum.gdscript
# ^ meta.mapping.key.gdscript entity.name.enum.gdscript
}
match state:
# ^^^^^ keyword.control.flow.gdscript
STATE.INTRO:
print("intro")
class Thing:
# ^^^^^ storage.type.class.gdscript
# ^^^^^ entity.name.type.class.gdscript
class Thing extends Reference:
# ^^^^^ storage.type.class.gdscript
# ^^^^^ entity.name.type.class.gdscript
# ^^^^^^ keyword.other.gdscript
# ^^^^^^^^^ entity.other.inherited-class.gdscript