gob-lang 1.0.0-aarch64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +17 -0
- data/exe/gob +8 -0
- data/exe/stree-go +12 -0
- data/ext/gipper/gipper.go +172 -0
- data/ext/gipper/libgipper.h +95 -0
- data/ext/gipper/libgipper.so +0 -0
- data/ext/goformatter/format/LICENSE +27 -0
- data/ext/goformatter/format/format.go +132 -0
- data/ext/goformatter/format/internal.go +174 -0
- data/ext/goformatter/go.mod +3 -0
- data/ext/goformatter/libgoformatter.h +95 -0
- data/ext/goformatter/libgoformatter.so +0 -0
- data/ext/goformatter/main.go +34 -0
- data/gob-lang.gemspec +57 -0
- data/lib/gipper.rb +24 -0
- data/lib/go_formatter.rb +33 -0
- data/lib/gob/cli/base.rb +53 -0
- data/lib/gob/cli/commands/build.rb +29 -0
- data/lib/gob/cli/commands/fmt.rb +31 -0
- data/lib/gob/cli/commands/run.rb +21 -0
- data/lib/gob/cli/commands/transpile.rb +20 -0
- data/lib/gob/cli/commands/version.rb +19 -0
- data/lib/gob/cli/commands/vet.rb +33 -0
- data/lib/gob/cli/errors.rb +50 -0
- data/lib/gob/cli.rb +53 -0
- data/lib/gob/go/dsl.rb +196 -0
- data/lib/gob/go/printer.rb +412 -0
- data/lib/gob/go/runner.rb +42 -0
- data/lib/gob/matcher.rb +34 -0
- data/lib/gob/transpilation/rules/core.rb +1184 -0
- data/lib/gob/transpiler.rb +815 -0
- data/lib/gob/validation/offence.rb +24 -0
- data/lib/gob/validation/rules/class_rules.rb +78 -0
- data/lib/gob/validation/rules/config.yml +16 -0
- data/lib/gob/validation/rules/cop.rb +15 -0
- data/lib/gob/validation/rules/function_rules.rb +33 -0
- data/lib/gob/validation/rules/module_rules.rb +78 -0
- data/lib/gob/validation/rules/program_rules.rb +72 -0
- data/lib/gob/validation/rules.rb +93 -0
- data/lib/gob/version.rb +5 -0
- data/lib/gob.rb +41 -0
- data/lib/syntax_tree/go/format.rb +176 -0
- data/lib/syntax_tree/go/json_visitor.rb +34 -0
- data/lib/syntax_tree/go/match_visitor.rb +103 -0
- data/lib/syntax_tree/go/materializer.rb +92 -0
- data/lib/syntax_tree/go/node.rb +50 -0
- data/lib/syntax_tree/go/nodes.rb +2147 -0
- data/lib/syntax_tree/go/pretty_print_visitor.rb +76 -0
- data/lib/syntax_tree/go/schema.json +1455 -0
- data/lib/syntax_tree/go/visitor.rb +71 -0
- data/lib/syntax_tree/go.rb +55 -0
- data/lib/thor/help_header.rb +23 -0
- metadata +292 -0
|
@@ -0,0 +1,2147 @@
|
|
|
1
|
+
module SyntaxTree::Go
|
|
2
|
+
class Comment < Node
|
|
3
|
+
SEMANTIC_FIELDS = { text: :string }.freeze
|
|
4
|
+
attr_reader(:slash, :text, :location, :comments)
|
|
5
|
+
def initialize(
|
|
6
|
+
slash: nil,
|
|
7
|
+
text: nil,
|
|
8
|
+
location: SyntaxTree::Location.default,
|
|
9
|
+
comments: []
|
|
10
|
+
)
|
|
11
|
+
@slash = slash
|
|
12
|
+
@text = text
|
|
13
|
+
@location = location
|
|
14
|
+
@comments = comments
|
|
15
|
+
end
|
|
16
|
+
def accept(visitor)
|
|
17
|
+
visitor.visit_comment(self)
|
|
18
|
+
end
|
|
19
|
+
def child_nodes
|
|
20
|
+
[]
|
|
21
|
+
end
|
|
22
|
+
alias deconstruct child_nodes
|
|
23
|
+
def deconstruct_keys(_keys)
|
|
24
|
+
{ slash: @slash, text: @text, location: @location, comments: @comments }
|
|
25
|
+
end
|
|
26
|
+
def format(q)
|
|
27
|
+
Format.new(q).visit(self)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
class CommentGroup < Node
|
|
31
|
+
SEMANTIC_FIELDS = { list: :children }.freeze
|
|
32
|
+
attr_reader(:list, :location, :comments)
|
|
33
|
+
def initialize(
|
|
34
|
+
list: [],
|
|
35
|
+
location: SyntaxTree::Location.default,
|
|
36
|
+
comments: []
|
|
37
|
+
)
|
|
38
|
+
@list = list
|
|
39
|
+
@location = location
|
|
40
|
+
@comments = comments
|
|
41
|
+
end
|
|
42
|
+
def accept(visitor)
|
|
43
|
+
visitor.visit_comment_group(self)
|
|
44
|
+
end
|
|
45
|
+
def child_nodes
|
|
46
|
+
[@list].compact
|
|
47
|
+
end
|
|
48
|
+
alias deconstruct child_nodes
|
|
49
|
+
def deconstruct_keys(_keys)
|
|
50
|
+
{ list: @list, location: @location, comments: @comments }
|
|
51
|
+
end
|
|
52
|
+
def format(q)
|
|
53
|
+
Format.new(q).visit(self)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
class Field < Node
|
|
57
|
+
SEMANTIC_FIELDS = { names: :children, type: :child, tag: :child }.freeze
|
|
58
|
+
attr_reader(:doc, :names, :type, :tag, :comment, :location, :comments)
|
|
59
|
+
def initialize(
|
|
60
|
+
doc: nil,
|
|
61
|
+
names: [],
|
|
62
|
+
type: nil,
|
|
63
|
+
tag: nil,
|
|
64
|
+
comment: nil,
|
|
65
|
+
location: SyntaxTree::Location.default,
|
|
66
|
+
comments: []
|
|
67
|
+
)
|
|
68
|
+
@doc = doc
|
|
69
|
+
@names = names
|
|
70
|
+
@type = type
|
|
71
|
+
@tag = tag
|
|
72
|
+
@comment = comment
|
|
73
|
+
@location = location
|
|
74
|
+
@comments = comments
|
|
75
|
+
end
|
|
76
|
+
def accept(visitor)
|
|
77
|
+
visitor.visit_field(self)
|
|
78
|
+
end
|
|
79
|
+
def child_nodes
|
|
80
|
+
[@doc, @names, @type, @tag, @comment].compact
|
|
81
|
+
end
|
|
82
|
+
alias deconstruct child_nodes
|
|
83
|
+
def deconstruct_keys(_keys)
|
|
84
|
+
{
|
|
85
|
+
doc: @doc,
|
|
86
|
+
names: @names,
|
|
87
|
+
type: @type,
|
|
88
|
+
tag: @tag,
|
|
89
|
+
comment: @comment,
|
|
90
|
+
location: @location,
|
|
91
|
+
comments: @comments
|
|
92
|
+
}
|
|
93
|
+
end
|
|
94
|
+
def format(q)
|
|
95
|
+
Format.new(q).visit(self)
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
class FieldList < Node
|
|
99
|
+
SEMANTIC_FIELDS = { list: :children }.freeze
|
|
100
|
+
attr_reader(:opening, :list, :closing, :location, :comments)
|
|
101
|
+
def initialize(
|
|
102
|
+
opening: nil,
|
|
103
|
+
list: [],
|
|
104
|
+
closing: nil,
|
|
105
|
+
location: SyntaxTree::Location.default,
|
|
106
|
+
comments: []
|
|
107
|
+
)
|
|
108
|
+
@opening = opening
|
|
109
|
+
@list = list
|
|
110
|
+
@closing = closing
|
|
111
|
+
@location = location
|
|
112
|
+
@comments = comments
|
|
113
|
+
end
|
|
114
|
+
def accept(visitor)
|
|
115
|
+
visitor.visit_field_list(self)
|
|
116
|
+
end
|
|
117
|
+
def child_nodes
|
|
118
|
+
[@list].compact
|
|
119
|
+
end
|
|
120
|
+
alias deconstruct child_nodes
|
|
121
|
+
def deconstruct_keys(_keys)
|
|
122
|
+
{
|
|
123
|
+
opening: @opening,
|
|
124
|
+
list: @list,
|
|
125
|
+
closing: @closing,
|
|
126
|
+
location: @location,
|
|
127
|
+
comments: @comments
|
|
128
|
+
}
|
|
129
|
+
end
|
|
130
|
+
def format(q)
|
|
131
|
+
Format.new(q).visit(self)
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
class BadExpr < Node
|
|
135
|
+
SEMANTIC_FIELDS = {}.freeze
|
|
136
|
+
attr_reader(:from, :to, :location, :comments)
|
|
137
|
+
def initialize(
|
|
138
|
+
from: nil,
|
|
139
|
+
to: nil,
|
|
140
|
+
location: SyntaxTree::Location.default,
|
|
141
|
+
comments: []
|
|
142
|
+
)
|
|
143
|
+
@from = from
|
|
144
|
+
@to = to
|
|
145
|
+
@location = location
|
|
146
|
+
@comments = comments
|
|
147
|
+
end
|
|
148
|
+
def accept(visitor)
|
|
149
|
+
visitor.visit_bad_expr(self)
|
|
150
|
+
end
|
|
151
|
+
def child_nodes
|
|
152
|
+
[]
|
|
153
|
+
end
|
|
154
|
+
alias deconstruct child_nodes
|
|
155
|
+
def deconstruct_keys(_keys)
|
|
156
|
+
{ from: @from, to: @to, location: @location, comments: @comments }
|
|
157
|
+
end
|
|
158
|
+
def format(q)
|
|
159
|
+
Format.new(q).visit(self)
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
class Ident < Node
|
|
163
|
+
SEMANTIC_FIELDS = { name: :string }.freeze
|
|
164
|
+
attr_reader(:name_pos, :name, :obj, :location, :comments)
|
|
165
|
+
def initialize(
|
|
166
|
+
name_pos: nil,
|
|
167
|
+
name: nil,
|
|
168
|
+
obj: nil,
|
|
169
|
+
location: SyntaxTree::Location.default,
|
|
170
|
+
comments: []
|
|
171
|
+
)
|
|
172
|
+
@name_pos = name_pos
|
|
173
|
+
@name = name
|
|
174
|
+
@obj = obj
|
|
175
|
+
@location = location
|
|
176
|
+
@comments = comments
|
|
177
|
+
end
|
|
178
|
+
def accept(visitor)
|
|
179
|
+
visitor.visit_ident(self)
|
|
180
|
+
end
|
|
181
|
+
def child_nodes
|
|
182
|
+
[]
|
|
183
|
+
end
|
|
184
|
+
alias deconstruct child_nodes
|
|
185
|
+
def deconstruct_keys(_keys)
|
|
186
|
+
{
|
|
187
|
+
name_pos: @name_pos,
|
|
188
|
+
name: @name,
|
|
189
|
+
obj: @obj,
|
|
190
|
+
location: @location,
|
|
191
|
+
comments: @comments
|
|
192
|
+
}
|
|
193
|
+
end
|
|
194
|
+
def format(q)
|
|
195
|
+
Format.new(q).visit(self)
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
class Ellipsis < Node
|
|
199
|
+
SEMANTIC_FIELDS = { elt: :child }.freeze
|
|
200
|
+
attr_reader(:ellipsis, :elt, :location, :comments)
|
|
201
|
+
def initialize(
|
|
202
|
+
ellipsis: nil,
|
|
203
|
+
elt: nil,
|
|
204
|
+
location: SyntaxTree::Location.default,
|
|
205
|
+
comments: []
|
|
206
|
+
)
|
|
207
|
+
@ellipsis = ellipsis
|
|
208
|
+
@elt = elt
|
|
209
|
+
@location = location
|
|
210
|
+
@comments = comments
|
|
211
|
+
end
|
|
212
|
+
def accept(visitor)
|
|
213
|
+
visitor.visit_ellipsis(self)
|
|
214
|
+
end
|
|
215
|
+
def child_nodes
|
|
216
|
+
[@elt].compact
|
|
217
|
+
end
|
|
218
|
+
alias deconstruct child_nodes
|
|
219
|
+
def deconstruct_keys(_keys)
|
|
220
|
+
{
|
|
221
|
+
ellipsis: @ellipsis,
|
|
222
|
+
elt: @elt,
|
|
223
|
+
location: @location,
|
|
224
|
+
comments: @comments
|
|
225
|
+
}
|
|
226
|
+
end
|
|
227
|
+
def format(q)
|
|
228
|
+
Format.new(q).visit(self)
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
class BasicLit < Node
|
|
232
|
+
SEMANTIC_FIELDS = { kind: :token, value: :string }.freeze
|
|
233
|
+
attr_reader(:value_pos, :value_end, :kind, :value, :location, :comments)
|
|
234
|
+
def initialize(
|
|
235
|
+
value_pos: nil,
|
|
236
|
+
value_end: nil,
|
|
237
|
+
kind: nil,
|
|
238
|
+
value: nil,
|
|
239
|
+
location: SyntaxTree::Location.default,
|
|
240
|
+
comments: []
|
|
241
|
+
)
|
|
242
|
+
@value_pos = value_pos
|
|
243
|
+
@value_end = value_end
|
|
244
|
+
@kind = kind
|
|
245
|
+
@value = value
|
|
246
|
+
@location = location
|
|
247
|
+
@comments = comments
|
|
248
|
+
end
|
|
249
|
+
def accept(visitor)
|
|
250
|
+
visitor.visit_basic_lit(self)
|
|
251
|
+
end
|
|
252
|
+
def child_nodes
|
|
253
|
+
[]
|
|
254
|
+
end
|
|
255
|
+
alias deconstruct child_nodes
|
|
256
|
+
def deconstruct_keys(_keys)
|
|
257
|
+
{
|
|
258
|
+
value_pos: @value_pos,
|
|
259
|
+
value_end: @value_end,
|
|
260
|
+
kind: @kind,
|
|
261
|
+
value: @value,
|
|
262
|
+
location: @location,
|
|
263
|
+
comments: @comments
|
|
264
|
+
}
|
|
265
|
+
end
|
|
266
|
+
def format(q)
|
|
267
|
+
Format.new(q).visit(self)
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
class FuncLit < Node
|
|
271
|
+
SEMANTIC_FIELDS = { type: :child, body: :child }.freeze
|
|
272
|
+
attr_reader(:type, :body, :location, :comments)
|
|
273
|
+
def initialize(
|
|
274
|
+
type: nil,
|
|
275
|
+
body: nil,
|
|
276
|
+
location: SyntaxTree::Location.default,
|
|
277
|
+
comments: []
|
|
278
|
+
)
|
|
279
|
+
@type = type
|
|
280
|
+
@body = body
|
|
281
|
+
@location = location
|
|
282
|
+
@comments = comments
|
|
283
|
+
end
|
|
284
|
+
def accept(visitor)
|
|
285
|
+
visitor.visit_func_lit(self)
|
|
286
|
+
end
|
|
287
|
+
def child_nodes
|
|
288
|
+
[@type, @body].compact
|
|
289
|
+
end
|
|
290
|
+
alias deconstruct child_nodes
|
|
291
|
+
def deconstruct_keys(_keys)
|
|
292
|
+
{ type: @type, body: @body, location: @location, comments: @comments }
|
|
293
|
+
end
|
|
294
|
+
def format(q)
|
|
295
|
+
Format.new(q).visit(self)
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
class CompositeLit < Node
|
|
299
|
+
SEMANTIC_FIELDS = {
|
|
300
|
+
type: :child,
|
|
301
|
+
elts: :children,
|
|
302
|
+
incomplete: :bool
|
|
303
|
+
}.freeze
|
|
304
|
+
attr_reader(
|
|
305
|
+
:type,
|
|
306
|
+
:lbrace,
|
|
307
|
+
:elts,
|
|
308
|
+
:rbrace,
|
|
309
|
+
:incomplete,
|
|
310
|
+
:location,
|
|
311
|
+
:comments
|
|
312
|
+
)
|
|
313
|
+
def initialize(
|
|
314
|
+
type: nil,
|
|
315
|
+
lbrace: nil,
|
|
316
|
+
elts: [],
|
|
317
|
+
rbrace: nil,
|
|
318
|
+
incomplete: false,
|
|
319
|
+
location: SyntaxTree::Location.default,
|
|
320
|
+
comments: []
|
|
321
|
+
)
|
|
322
|
+
@type = type
|
|
323
|
+
@lbrace = lbrace
|
|
324
|
+
@elts = elts
|
|
325
|
+
@rbrace = rbrace
|
|
326
|
+
@incomplete = incomplete
|
|
327
|
+
@location = location
|
|
328
|
+
@comments = comments
|
|
329
|
+
end
|
|
330
|
+
def accept(visitor)
|
|
331
|
+
visitor.visit_composite_lit(self)
|
|
332
|
+
end
|
|
333
|
+
def child_nodes
|
|
334
|
+
[@type, @elts].compact
|
|
335
|
+
end
|
|
336
|
+
alias deconstruct child_nodes
|
|
337
|
+
def deconstruct_keys(_keys)
|
|
338
|
+
{
|
|
339
|
+
type: @type,
|
|
340
|
+
lbrace: @lbrace,
|
|
341
|
+
elts: @elts,
|
|
342
|
+
rbrace: @rbrace,
|
|
343
|
+
incomplete: @incomplete,
|
|
344
|
+
location: @location,
|
|
345
|
+
comments: @comments
|
|
346
|
+
}
|
|
347
|
+
end
|
|
348
|
+
def format(q)
|
|
349
|
+
Format.new(q).visit(self)
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
class ParenExpr < Node
|
|
353
|
+
SEMANTIC_FIELDS = { x: :child }.freeze
|
|
354
|
+
attr_reader(:lparen, :x, :rparen, :location, :comments)
|
|
355
|
+
def initialize(
|
|
356
|
+
lparen: nil,
|
|
357
|
+
x: nil,
|
|
358
|
+
rparen: nil,
|
|
359
|
+
location: SyntaxTree::Location.default,
|
|
360
|
+
comments: []
|
|
361
|
+
)
|
|
362
|
+
@lparen = lparen
|
|
363
|
+
@x = x
|
|
364
|
+
@rparen = rparen
|
|
365
|
+
@location = location
|
|
366
|
+
@comments = comments
|
|
367
|
+
end
|
|
368
|
+
def accept(visitor)
|
|
369
|
+
visitor.visit_paren_expr(self)
|
|
370
|
+
end
|
|
371
|
+
def child_nodes
|
|
372
|
+
[@x].compact
|
|
373
|
+
end
|
|
374
|
+
alias deconstruct child_nodes
|
|
375
|
+
def deconstruct_keys(_keys)
|
|
376
|
+
{
|
|
377
|
+
lparen: @lparen,
|
|
378
|
+
x: @x,
|
|
379
|
+
rparen: @rparen,
|
|
380
|
+
location: @location,
|
|
381
|
+
comments: @comments
|
|
382
|
+
}
|
|
383
|
+
end
|
|
384
|
+
def format(q)
|
|
385
|
+
Format.new(q).visit(self)
|
|
386
|
+
end
|
|
387
|
+
end
|
|
388
|
+
class SelectorExpr < Node
|
|
389
|
+
SEMANTIC_FIELDS = { x: :child, sel: :child }.freeze
|
|
390
|
+
attr_reader(:x, :sel, :location, :comments)
|
|
391
|
+
def initialize(
|
|
392
|
+
x: nil,
|
|
393
|
+
sel: nil,
|
|
394
|
+
location: SyntaxTree::Location.default,
|
|
395
|
+
comments: []
|
|
396
|
+
)
|
|
397
|
+
@x = x
|
|
398
|
+
@sel = sel
|
|
399
|
+
@location = location
|
|
400
|
+
@comments = comments
|
|
401
|
+
end
|
|
402
|
+
def accept(visitor)
|
|
403
|
+
visitor.visit_selector_expr(self)
|
|
404
|
+
end
|
|
405
|
+
def child_nodes
|
|
406
|
+
[@x, @sel].compact
|
|
407
|
+
end
|
|
408
|
+
alias deconstruct child_nodes
|
|
409
|
+
def deconstruct_keys(_keys)
|
|
410
|
+
{ x: @x, sel: @sel, location: @location, comments: @comments }
|
|
411
|
+
end
|
|
412
|
+
def format(q)
|
|
413
|
+
Format.new(q).visit(self)
|
|
414
|
+
end
|
|
415
|
+
end
|
|
416
|
+
class IndexExpr < Node
|
|
417
|
+
SEMANTIC_FIELDS = { x: :child, index: :child }.freeze
|
|
418
|
+
attr_reader(:x, :lbrack, :index, :rbrack, :location, :comments)
|
|
419
|
+
def initialize(
|
|
420
|
+
x: nil,
|
|
421
|
+
lbrack: nil,
|
|
422
|
+
index: nil,
|
|
423
|
+
rbrack: nil,
|
|
424
|
+
location: SyntaxTree::Location.default,
|
|
425
|
+
comments: []
|
|
426
|
+
)
|
|
427
|
+
@x = x
|
|
428
|
+
@lbrack = lbrack
|
|
429
|
+
@index = index
|
|
430
|
+
@rbrack = rbrack
|
|
431
|
+
@location = location
|
|
432
|
+
@comments = comments
|
|
433
|
+
end
|
|
434
|
+
def accept(visitor)
|
|
435
|
+
visitor.visit_index_expr(self)
|
|
436
|
+
end
|
|
437
|
+
def child_nodes
|
|
438
|
+
[@x, @index].compact
|
|
439
|
+
end
|
|
440
|
+
alias deconstruct child_nodes
|
|
441
|
+
def deconstruct_keys(_keys)
|
|
442
|
+
{
|
|
443
|
+
x: @x,
|
|
444
|
+
lbrack: @lbrack,
|
|
445
|
+
index: @index,
|
|
446
|
+
rbrack: @rbrack,
|
|
447
|
+
location: @location,
|
|
448
|
+
comments: @comments
|
|
449
|
+
}
|
|
450
|
+
end
|
|
451
|
+
def format(q)
|
|
452
|
+
Format.new(q).visit(self)
|
|
453
|
+
end
|
|
454
|
+
end
|
|
455
|
+
class IndexListExpr < Node
|
|
456
|
+
SEMANTIC_FIELDS = { x: :child, indices: :children }.freeze
|
|
457
|
+
attr_reader(:x, :lbrack, :indices, :rbrack, :location, :comments)
|
|
458
|
+
def initialize(
|
|
459
|
+
x: nil,
|
|
460
|
+
lbrack: nil,
|
|
461
|
+
indices: [],
|
|
462
|
+
rbrack: nil,
|
|
463
|
+
location: SyntaxTree::Location.default,
|
|
464
|
+
comments: []
|
|
465
|
+
)
|
|
466
|
+
@x = x
|
|
467
|
+
@lbrack = lbrack
|
|
468
|
+
@indices = indices
|
|
469
|
+
@rbrack = rbrack
|
|
470
|
+
@location = location
|
|
471
|
+
@comments = comments
|
|
472
|
+
end
|
|
473
|
+
def accept(visitor)
|
|
474
|
+
visitor.visit_index_list_expr(self)
|
|
475
|
+
end
|
|
476
|
+
def child_nodes
|
|
477
|
+
[@x, @indices].compact
|
|
478
|
+
end
|
|
479
|
+
alias deconstruct child_nodes
|
|
480
|
+
def deconstruct_keys(_keys)
|
|
481
|
+
{
|
|
482
|
+
x: @x,
|
|
483
|
+
lbrack: @lbrack,
|
|
484
|
+
indices: @indices,
|
|
485
|
+
rbrack: @rbrack,
|
|
486
|
+
location: @location,
|
|
487
|
+
comments: @comments
|
|
488
|
+
}
|
|
489
|
+
end
|
|
490
|
+
def format(q)
|
|
491
|
+
Format.new(q).visit(self)
|
|
492
|
+
end
|
|
493
|
+
end
|
|
494
|
+
class SliceExpr < Node
|
|
495
|
+
SEMANTIC_FIELDS = {
|
|
496
|
+
x: :child,
|
|
497
|
+
low: :child,
|
|
498
|
+
high: :child,
|
|
499
|
+
max: :child,
|
|
500
|
+
slice3: :bool
|
|
501
|
+
}.freeze
|
|
502
|
+
attr_reader(
|
|
503
|
+
:x,
|
|
504
|
+
:lbrack,
|
|
505
|
+
:low,
|
|
506
|
+
:high,
|
|
507
|
+
:max,
|
|
508
|
+
:slice3,
|
|
509
|
+
:rbrack,
|
|
510
|
+
:location,
|
|
511
|
+
:comments
|
|
512
|
+
)
|
|
513
|
+
def initialize(
|
|
514
|
+
x: nil,
|
|
515
|
+
lbrack: nil,
|
|
516
|
+
low: nil,
|
|
517
|
+
high: nil,
|
|
518
|
+
max: nil,
|
|
519
|
+
slice3: false,
|
|
520
|
+
rbrack: nil,
|
|
521
|
+
location: SyntaxTree::Location.default,
|
|
522
|
+
comments: []
|
|
523
|
+
)
|
|
524
|
+
@x = x
|
|
525
|
+
@lbrack = lbrack
|
|
526
|
+
@low = low
|
|
527
|
+
@high = high
|
|
528
|
+
@max = max
|
|
529
|
+
@slice3 = slice3
|
|
530
|
+
@rbrack = rbrack
|
|
531
|
+
@location = location
|
|
532
|
+
@comments = comments
|
|
533
|
+
end
|
|
534
|
+
def accept(visitor)
|
|
535
|
+
visitor.visit_slice_expr(self)
|
|
536
|
+
end
|
|
537
|
+
def child_nodes
|
|
538
|
+
[@x, @low, @high, @max].compact
|
|
539
|
+
end
|
|
540
|
+
alias deconstruct child_nodes
|
|
541
|
+
def deconstruct_keys(_keys)
|
|
542
|
+
{
|
|
543
|
+
x: @x,
|
|
544
|
+
lbrack: @lbrack,
|
|
545
|
+
low: @low,
|
|
546
|
+
high: @high,
|
|
547
|
+
max: @max,
|
|
548
|
+
slice3: @slice3,
|
|
549
|
+
rbrack: @rbrack,
|
|
550
|
+
location: @location,
|
|
551
|
+
comments: @comments
|
|
552
|
+
}
|
|
553
|
+
end
|
|
554
|
+
def format(q)
|
|
555
|
+
Format.new(q).visit(self)
|
|
556
|
+
end
|
|
557
|
+
end
|
|
558
|
+
class TypeAssertExpr < Node
|
|
559
|
+
SEMANTIC_FIELDS = { x: :child, type: :child }.freeze
|
|
560
|
+
attr_reader(:x, :lparen, :type, :rparen, :location, :comments)
|
|
561
|
+
def initialize(
|
|
562
|
+
x: nil,
|
|
563
|
+
lparen: nil,
|
|
564
|
+
type: nil,
|
|
565
|
+
rparen: nil,
|
|
566
|
+
location: SyntaxTree::Location.default,
|
|
567
|
+
comments: []
|
|
568
|
+
)
|
|
569
|
+
@x = x
|
|
570
|
+
@lparen = lparen
|
|
571
|
+
@type = type
|
|
572
|
+
@rparen = rparen
|
|
573
|
+
@location = location
|
|
574
|
+
@comments = comments
|
|
575
|
+
end
|
|
576
|
+
def accept(visitor)
|
|
577
|
+
visitor.visit_type_assert_expr(self)
|
|
578
|
+
end
|
|
579
|
+
def child_nodes
|
|
580
|
+
[@x, @type].compact
|
|
581
|
+
end
|
|
582
|
+
alias deconstruct child_nodes
|
|
583
|
+
def deconstruct_keys(_keys)
|
|
584
|
+
{
|
|
585
|
+
x: @x,
|
|
586
|
+
lparen: @lparen,
|
|
587
|
+
type: @type,
|
|
588
|
+
rparen: @rparen,
|
|
589
|
+
location: @location,
|
|
590
|
+
comments: @comments
|
|
591
|
+
}
|
|
592
|
+
end
|
|
593
|
+
def format(q)
|
|
594
|
+
Format.new(q).visit(self)
|
|
595
|
+
end
|
|
596
|
+
end
|
|
597
|
+
class CallExpr < Node
|
|
598
|
+
SEMANTIC_FIELDS = { fun: :child, args: :children }.freeze
|
|
599
|
+
attr_reader(:fun, :lparen, :args, :ellipsis, :rparen, :location, :comments)
|
|
600
|
+
def initialize(
|
|
601
|
+
fun: nil,
|
|
602
|
+
lparen: nil,
|
|
603
|
+
args: [],
|
|
604
|
+
ellipsis: nil,
|
|
605
|
+
rparen: nil,
|
|
606
|
+
location: SyntaxTree::Location.default,
|
|
607
|
+
comments: []
|
|
608
|
+
)
|
|
609
|
+
@fun = fun
|
|
610
|
+
@lparen = lparen
|
|
611
|
+
@args = args
|
|
612
|
+
@ellipsis = ellipsis
|
|
613
|
+
@rparen = rparen
|
|
614
|
+
@location = location
|
|
615
|
+
@comments = comments
|
|
616
|
+
end
|
|
617
|
+
def accept(visitor)
|
|
618
|
+
visitor.visit_call_expr(self)
|
|
619
|
+
end
|
|
620
|
+
def child_nodes
|
|
621
|
+
[@fun, @args].compact
|
|
622
|
+
end
|
|
623
|
+
alias deconstruct child_nodes
|
|
624
|
+
def deconstruct_keys(_keys)
|
|
625
|
+
{
|
|
626
|
+
fun: @fun,
|
|
627
|
+
lparen: @lparen,
|
|
628
|
+
args: @args,
|
|
629
|
+
ellipsis: @ellipsis,
|
|
630
|
+
rparen: @rparen,
|
|
631
|
+
location: @location,
|
|
632
|
+
comments: @comments
|
|
633
|
+
}
|
|
634
|
+
end
|
|
635
|
+
def format(q)
|
|
636
|
+
Format.new(q).visit(self)
|
|
637
|
+
end
|
|
638
|
+
end
|
|
639
|
+
class StarExpr < Node
|
|
640
|
+
SEMANTIC_FIELDS = { x: :child }.freeze
|
|
641
|
+
attr_reader(:star, :x, :location, :comments)
|
|
642
|
+
def initialize(
|
|
643
|
+
star: nil,
|
|
644
|
+
x: nil,
|
|
645
|
+
location: SyntaxTree::Location.default,
|
|
646
|
+
comments: []
|
|
647
|
+
)
|
|
648
|
+
@star = star
|
|
649
|
+
@x = x
|
|
650
|
+
@location = location
|
|
651
|
+
@comments = comments
|
|
652
|
+
end
|
|
653
|
+
def accept(visitor)
|
|
654
|
+
visitor.visit_star_expr(self)
|
|
655
|
+
end
|
|
656
|
+
def child_nodes
|
|
657
|
+
[@x].compact
|
|
658
|
+
end
|
|
659
|
+
alias deconstruct child_nodes
|
|
660
|
+
def deconstruct_keys(_keys)
|
|
661
|
+
{ star: @star, x: @x, location: @location, comments: @comments }
|
|
662
|
+
end
|
|
663
|
+
def format(q)
|
|
664
|
+
Format.new(q).visit(self)
|
|
665
|
+
end
|
|
666
|
+
end
|
|
667
|
+
class UnaryExpr < Node
|
|
668
|
+
SEMANTIC_FIELDS = { op: :token, x: :child }.freeze
|
|
669
|
+
attr_reader(:op_pos, :op, :x, :location, :comments)
|
|
670
|
+
def initialize(
|
|
671
|
+
op_pos: nil,
|
|
672
|
+
op: nil,
|
|
673
|
+
x: nil,
|
|
674
|
+
location: SyntaxTree::Location.default,
|
|
675
|
+
comments: []
|
|
676
|
+
)
|
|
677
|
+
@op_pos = op_pos
|
|
678
|
+
@op = op
|
|
679
|
+
@x = x
|
|
680
|
+
@location = location
|
|
681
|
+
@comments = comments
|
|
682
|
+
end
|
|
683
|
+
def accept(visitor)
|
|
684
|
+
visitor.visit_unary_expr(self)
|
|
685
|
+
end
|
|
686
|
+
def child_nodes
|
|
687
|
+
[@x].compact
|
|
688
|
+
end
|
|
689
|
+
alias deconstruct child_nodes
|
|
690
|
+
def deconstruct_keys(_keys)
|
|
691
|
+
{
|
|
692
|
+
op_pos: @op_pos,
|
|
693
|
+
op: @op,
|
|
694
|
+
x: @x,
|
|
695
|
+
location: @location,
|
|
696
|
+
comments: @comments
|
|
697
|
+
}
|
|
698
|
+
end
|
|
699
|
+
def format(q)
|
|
700
|
+
Format.new(q).visit(self)
|
|
701
|
+
end
|
|
702
|
+
end
|
|
703
|
+
class BinaryExpr < Node
|
|
704
|
+
SEMANTIC_FIELDS = { x: :child, op: :token, y: :child }.freeze
|
|
705
|
+
attr_reader(:x, :op_pos, :op, :y, :location, :comments)
|
|
706
|
+
def initialize(
|
|
707
|
+
x: nil,
|
|
708
|
+
op_pos: nil,
|
|
709
|
+
op: nil,
|
|
710
|
+
y: nil,
|
|
711
|
+
location: SyntaxTree::Location.default,
|
|
712
|
+
comments: []
|
|
713
|
+
)
|
|
714
|
+
@x = x
|
|
715
|
+
@op_pos = op_pos
|
|
716
|
+
@op = op
|
|
717
|
+
@y = y
|
|
718
|
+
@location = location
|
|
719
|
+
@comments = comments
|
|
720
|
+
end
|
|
721
|
+
def accept(visitor)
|
|
722
|
+
visitor.visit_binary_expr(self)
|
|
723
|
+
end
|
|
724
|
+
def child_nodes
|
|
725
|
+
[@x, @y].compact
|
|
726
|
+
end
|
|
727
|
+
alias deconstruct child_nodes
|
|
728
|
+
def deconstruct_keys(_keys)
|
|
729
|
+
{
|
|
730
|
+
x: @x,
|
|
731
|
+
op_pos: @op_pos,
|
|
732
|
+
op: @op,
|
|
733
|
+
y: @y,
|
|
734
|
+
location: @location,
|
|
735
|
+
comments: @comments
|
|
736
|
+
}
|
|
737
|
+
end
|
|
738
|
+
def format(q)
|
|
739
|
+
Format.new(q).visit(self)
|
|
740
|
+
end
|
|
741
|
+
end
|
|
742
|
+
class KeyValueExpr < Node
|
|
743
|
+
SEMANTIC_FIELDS = { key: :child, value: :child }.freeze
|
|
744
|
+
attr_reader(:key, :colon, :value, :location, :comments)
|
|
745
|
+
def initialize(
|
|
746
|
+
key: nil,
|
|
747
|
+
colon: nil,
|
|
748
|
+
value: nil,
|
|
749
|
+
location: SyntaxTree::Location.default,
|
|
750
|
+
comments: []
|
|
751
|
+
)
|
|
752
|
+
@key = key
|
|
753
|
+
@colon = colon
|
|
754
|
+
@value = value
|
|
755
|
+
@location = location
|
|
756
|
+
@comments = comments
|
|
757
|
+
end
|
|
758
|
+
def accept(visitor)
|
|
759
|
+
visitor.visit_key_value_expr(self)
|
|
760
|
+
end
|
|
761
|
+
def child_nodes
|
|
762
|
+
[@key, @value].compact
|
|
763
|
+
end
|
|
764
|
+
alias deconstruct child_nodes
|
|
765
|
+
def deconstruct_keys(_keys)
|
|
766
|
+
{
|
|
767
|
+
key: @key,
|
|
768
|
+
colon: @colon,
|
|
769
|
+
value: @value,
|
|
770
|
+
location: @location,
|
|
771
|
+
comments: @comments
|
|
772
|
+
}
|
|
773
|
+
end
|
|
774
|
+
def format(q)
|
|
775
|
+
Format.new(q).visit(self)
|
|
776
|
+
end
|
|
777
|
+
end
|
|
778
|
+
class ArrayType < Node
|
|
779
|
+
SEMANTIC_FIELDS = { len: :child, elt: :child }.freeze
|
|
780
|
+
attr_reader(:lbrack, :len, :elt, :location, :comments)
|
|
781
|
+
def initialize(
|
|
782
|
+
lbrack: nil,
|
|
783
|
+
len: nil,
|
|
784
|
+
elt: nil,
|
|
785
|
+
location: SyntaxTree::Location.default,
|
|
786
|
+
comments: []
|
|
787
|
+
)
|
|
788
|
+
@lbrack = lbrack
|
|
789
|
+
@len = len
|
|
790
|
+
@elt = elt
|
|
791
|
+
@location = location
|
|
792
|
+
@comments = comments
|
|
793
|
+
end
|
|
794
|
+
def accept(visitor)
|
|
795
|
+
visitor.visit_array_type(self)
|
|
796
|
+
end
|
|
797
|
+
def child_nodes
|
|
798
|
+
[@len, @elt].compact
|
|
799
|
+
end
|
|
800
|
+
alias deconstruct child_nodes
|
|
801
|
+
def deconstruct_keys(_keys)
|
|
802
|
+
{
|
|
803
|
+
lbrack: @lbrack,
|
|
804
|
+
len: @len,
|
|
805
|
+
elt: @elt,
|
|
806
|
+
location: @location,
|
|
807
|
+
comments: @comments
|
|
808
|
+
}
|
|
809
|
+
end
|
|
810
|
+
def format(q)
|
|
811
|
+
Format.new(q).visit(self)
|
|
812
|
+
end
|
|
813
|
+
end
|
|
814
|
+
class StructType < Node
|
|
815
|
+
SEMANTIC_FIELDS = { fields: :child, incomplete: :bool }.freeze
|
|
816
|
+
attr_reader(:struct, :fields, :incomplete, :location, :comments)
|
|
817
|
+
def initialize(
|
|
818
|
+
struct: nil,
|
|
819
|
+
fields: nil,
|
|
820
|
+
incomplete: false,
|
|
821
|
+
location: SyntaxTree::Location.default,
|
|
822
|
+
comments: []
|
|
823
|
+
)
|
|
824
|
+
@struct = struct
|
|
825
|
+
@fields = fields
|
|
826
|
+
@incomplete = incomplete
|
|
827
|
+
@location = location
|
|
828
|
+
@comments = comments
|
|
829
|
+
end
|
|
830
|
+
def accept(visitor)
|
|
831
|
+
visitor.visit_struct_type(self)
|
|
832
|
+
end
|
|
833
|
+
def child_nodes
|
|
834
|
+
[@fields].compact
|
|
835
|
+
end
|
|
836
|
+
alias deconstruct child_nodes
|
|
837
|
+
def deconstruct_keys(_keys)
|
|
838
|
+
{
|
|
839
|
+
struct: @struct,
|
|
840
|
+
fields: @fields,
|
|
841
|
+
incomplete: @incomplete,
|
|
842
|
+
location: @location,
|
|
843
|
+
comments: @comments
|
|
844
|
+
}
|
|
845
|
+
end
|
|
846
|
+
def format(q)
|
|
847
|
+
Format.new(q).visit(self)
|
|
848
|
+
end
|
|
849
|
+
end
|
|
850
|
+
class FuncType < Node
|
|
851
|
+
SEMANTIC_FIELDS = {
|
|
852
|
+
type_params: :child,
|
|
853
|
+
params: :child,
|
|
854
|
+
results: :child
|
|
855
|
+
}.freeze
|
|
856
|
+
attr_reader(:func, :type_params, :params, :results, :location, :comments)
|
|
857
|
+
def initialize(
|
|
858
|
+
func: nil,
|
|
859
|
+
type_params: nil,
|
|
860
|
+
params: nil,
|
|
861
|
+
results: nil,
|
|
862
|
+
location: SyntaxTree::Location.default,
|
|
863
|
+
comments: []
|
|
864
|
+
)
|
|
865
|
+
@func = func
|
|
866
|
+
@type_params = type_params
|
|
867
|
+
@params = params
|
|
868
|
+
@results = results
|
|
869
|
+
@location = location
|
|
870
|
+
@comments = comments
|
|
871
|
+
end
|
|
872
|
+
def accept(visitor)
|
|
873
|
+
visitor.visit_func_type(self)
|
|
874
|
+
end
|
|
875
|
+
def child_nodes
|
|
876
|
+
[@type_params, @params, @results].compact
|
|
877
|
+
end
|
|
878
|
+
alias deconstruct child_nodes
|
|
879
|
+
def deconstruct_keys(_keys)
|
|
880
|
+
{
|
|
881
|
+
func: @func,
|
|
882
|
+
type_params: @type_params,
|
|
883
|
+
params: @params,
|
|
884
|
+
results: @results,
|
|
885
|
+
location: @location,
|
|
886
|
+
comments: @comments
|
|
887
|
+
}
|
|
888
|
+
end
|
|
889
|
+
def format(q)
|
|
890
|
+
Format.new(q).visit(self)
|
|
891
|
+
end
|
|
892
|
+
end
|
|
893
|
+
class InterfaceType < Node
|
|
894
|
+
SEMANTIC_FIELDS = { methods: :child, incomplete: :bool }.freeze
|
|
895
|
+
attr_reader(:interface, :methods, :incomplete, :location, :comments)
|
|
896
|
+
def initialize(
|
|
897
|
+
interface: nil,
|
|
898
|
+
methods: nil,
|
|
899
|
+
incomplete: false,
|
|
900
|
+
location: SyntaxTree::Location.default,
|
|
901
|
+
comments: []
|
|
902
|
+
)
|
|
903
|
+
@interface = interface
|
|
904
|
+
@methods = methods
|
|
905
|
+
@incomplete = incomplete
|
|
906
|
+
@location = location
|
|
907
|
+
@comments = comments
|
|
908
|
+
end
|
|
909
|
+
def accept(visitor)
|
|
910
|
+
visitor.visit_interface_type(self)
|
|
911
|
+
end
|
|
912
|
+
def child_nodes
|
|
913
|
+
[@methods].compact
|
|
914
|
+
end
|
|
915
|
+
alias deconstruct child_nodes
|
|
916
|
+
def deconstruct_keys(_keys)
|
|
917
|
+
{
|
|
918
|
+
interface: @interface,
|
|
919
|
+
methods: @methods,
|
|
920
|
+
incomplete: @incomplete,
|
|
921
|
+
location: @location,
|
|
922
|
+
comments: @comments
|
|
923
|
+
}
|
|
924
|
+
end
|
|
925
|
+
def format(q)
|
|
926
|
+
Format.new(q).visit(self)
|
|
927
|
+
end
|
|
928
|
+
end
|
|
929
|
+
class MapType < Node
|
|
930
|
+
SEMANTIC_FIELDS = { key: :child, value: :child }.freeze
|
|
931
|
+
attr_reader(:map, :key, :value, :location, :comments)
|
|
932
|
+
def initialize(
|
|
933
|
+
map: nil,
|
|
934
|
+
key: nil,
|
|
935
|
+
value: nil,
|
|
936
|
+
location: SyntaxTree::Location.default,
|
|
937
|
+
comments: []
|
|
938
|
+
)
|
|
939
|
+
@map = map
|
|
940
|
+
@key = key
|
|
941
|
+
@value = value
|
|
942
|
+
@location = location
|
|
943
|
+
@comments = comments
|
|
944
|
+
end
|
|
945
|
+
def accept(visitor)
|
|
946
|
+
visitor.visit_map_type(self)
|
|
947
|
+
end
|
|
948
|
+
def child_nodes
|
|
949
|
+
[@key, @value].compact
|
|
950
|
+
end
|
|
951
|
+
alias deconstruct child_nodes
|
|
952
|
+
def deconstruct_keys(_keys)
|
|
953
|
+
{
|
|
954
|
+
map: @map,
|
|
955
|
+
key: @key,
|
|
956
|
+
value: @value,
|
|
957
|
+
location: @location,
|
|
958
|
+
comments: @comments
|
|
959
|
+
}
|
|
960
|
+
end
|
|
961
|
+
def format(q)
|
|
962
|
+
Format.new(q).visit(self)
|
|
963
|
+
end
|
|
964
|
+
end
|
|
965
|
+
class ChanType < Node
|
|
966
|
+
SEMANTIC_FIELDS = { dir: :scalar, value: :child }.freeze
|
|
967
|
+
attr_reader(:begin_, :arrow, :dir, :value, :location, :comments)
|
|
968
|
+
def initialize(
|
|
969
|
+
begin_: nil,
|
|
970
|
+
arrow: nil,
|
|
971
|
+
dir: nil,
|
|
972
|
+
value: nil,
|
|
973
|
+
location: SyntaxTree::Location.default,
|
|
974
|
+
comments: []
|
|
975
|
+
)
|
|
976
|
+
@begin_ = begin_
|
|
977
|
+
@arrow = arrow
|
|
978
|
+
@dir = dir
|
|
979
|
+
@value = value
|
|
980
|
+
@location = location
|
|
981
|
+
@comments = comments
|
|
982
|
+
end
|
|
983
|
+
def accept(visitor)
|
|
984
|
+
visitor.visit_chan_type(self)
|
|
985
|
+
end
|
|
986
|
+
def child_nodes
|
|
987
|
+
[@value].compact
|
|
988
|
+
end
|
|
989
|
+
alias deconstruct child_nodes
|
|
990
|
+
def deconstruct_keys(_keys)
|
|
991
|
+
{
|
|
992
|
+
begin_: @begin_,
|
|
993
|
+
arrow: @arrow,
|
|
994
|
+
dir: @dir,
|
|
995
|
+
value: @value,
|
|
996
|
+
location: @location,
|
|
997
|
+
comments: @comments
|
|
998
|
+
}
|
|
999
|
+
end
|
|
1000
|
+
def format(q)
|
|
1001
|
+
Format.new(q).visit(self)
|
|
1002
|
+
end
|
|
1003
|
+
end
|
|
1004
|
+
class BadStmt < Node
|
|
1005
|
+
SEMANTIC_FIELDS = {}.freeze
|
|
1006
|
+
attr_reader(:from, :to, :location, :comments)
|
|
1007
|
+
def initialize(
|
|
1008
|
+
from: nil,
|
|
1009
|
+
to: nil,
|
|
1010
|
+
location: SyntaxTree::Location.default,
|
|
1011
|
+
comments: []
|
|
1012
|
+
)
|
|
1013
|
+
@from = from
|
|
1014
|
+
@to = to
|
|
1015
|
+
@location = location
|
|
1016
|
+
@comments = comments
|
|
1017
|
+
end
|
|
1018
|
+
def accept(visitor)
|
|
1019
|
+
visitor.visit_bad_stmt(self)
|
|
1020
|
+
end
|
|
1021
|
+
def child_nodes
|
|
1022
|
+
[]
|
|
1023
|
+
end
|
|
1024
|
+
alias deconstruct child_nodes
|
|
1025
|
+
def deconstruct_keys(_keys)
|
|
1026
|
+
{ from: @from, to: @to, location: @location, comments: @comments }
|
|
1027
|
+
end
|
|
1028
|
+
def format(q)
|
|
1029
|
+
Format.new(q).visit(self)
|
|
1030
|
+
end
|
|
1031
|
+
end
|
|
1032
|
+
class DeclStmt < Node
|
|
1033
|
+
SEMANTIC_FIELDS = { decl: :child }.freeze
|
|
1034
|
+
attr_reader(:decl, :location, :comments)
|
|
1035
|
+
def initialize(
|
|
1036
|
+
decl: nil,
|
|
1037
|
+
location: SyntaxTree::Location.default,
|
|
1038
|
+
comments: []
|
|
1039
|
+
)
|
|
1040
|
+
@decl = decl
|
|
1041
|
+
@location = location
|
|
1042
|
+
@comments = comments
|
|
1043
|
+
end
|
|
1044
|
+
def accept(visitor)
|
|
1045
|
+
visitor.visit_decl_stmt(self)
|
|
1046
|
+
end
|
|
1047
|
+
def child_nodes
|
|
1048
|
+
[@decl].compact
|
|
1049
|
+
end
|
|
1050
|
+
alias deconstruct child_nodes
|
|
1051
|
+
def deconstruct_keys(_keys)
|
|
1052
|
+
{ decl: @decl, location: @location, comments: @comments }
|
|
1053
|
+
end
|
|
1054
|
+
def format(q)
|
|
1055
|
+
Format.new(q).visit(self)
|
|
1056
|
+
end
|
|
1057
|
+
end
|
|
1058
|
+
class EmptyStmt < Node
|
|
1059
|
+
SEMANTIC_FIELDS = { implicit: :bool }.freeze
|
|
1060
|
+
attr_reader(:semicolon, :implicit, :location, :comments)
|
|
1061
|
+
def initialize(
|
|
1062
|
+
semicolon: nil,
|
|
1063
|
+
implicit: false,
|
|
1064
|
+
location: SyntaxTree::Location.default,
|
|
1065
|
+
comments: []
|
|
1066
|
+
)
|
|
1067
|
+
@semicolon = semicolon
|
|
1068
|
+
@implicit = implicit
|
|
1069
|
+
@location = location
|
|
1070
|
+
@comments = comments
|
|
1071
|
+
end
|
|
1072
|
+
def accept(visitor)
|
|
1073
|
+
visitor.visit_empty_stmt(self)
|
|
1074
|
+
end
|
|
1075
|
+
def child_nodes
|
|
1076
|
+
[]
|
|
1077
|
+
end
|
|
1078
|
+
alias deconstruct child_nodes
|
|
1079
|
+
def deconstruct_keys(_keys)
|
|
1080
|
+
{
|
|
1081
|
+
semicolon: @semicolon,
|
|
1082
|
+
implicit: @implicit,
|
|
1083
|
+
location: @location,
|
|
1084
|
+
comments: @comments
|
|
1085
|
+
}
|
|
1086
|
+
end
|
|
1087
|
+
def format(q)
|
|
1088
|
+
Format.new(q).visit(self)
|
|
1089
|
+
end
|
|
1090
|
+
end
|
|
1091
|
+
class LabeledStmt < Node
|
|
1092
|
+
SEMANTIC_FIELDS = { label: :child, stmt: :child }.freeze
|
|
1093
|
+
attr_reader(:label, :colon, :stmt, :location, :comments)
|
|
1094
|
+
def initialize(
|
|
1095
|
+
label: nil,
|
|
1096
|
+
colon: nil,
|
|
1097
|
+
stmt: nil,
|
|
1098
|
+
location: SyntaxTree::Location.default,
|
|
1099
|
+
comments: []
|
|
1100
|
+
)
|
|
1101
|
+
@label = label
|
|
1102
|
+
@colon = colon
|
|
1103
|
+
@stmt = stmt
|
|
1104
|
+
@location = location
|
|
1105
|
+
@comments = comments
|
|
1106
|
+
end
|
|
1107
|
+
def accept(visitor)
|
|
1108
|
+
visitor.visit_labeled_stmt(self)
|
|
1109
|
+
end
|
|
1110
|
+
def child_nodes
|
|
1111
|
+
[@label, @stmt].compact
|
|
1112
|
+
end
|
|
1113
|
+
alias deconstruct child_nodes
|
|
1114
|
+
def deconstruct_keys(_keys)
|
|
1115
|
+
{
|
|
1116
|
+
label: @label,
|
|
1117
|
+
colon: @colon,
|
|
1118
|
+
stmt: @stmt,
|
|
1119
|
+
location: @location,
|
|
1120
|
+
comments: @comments
|
|
1121
|
+
}
|
|
1122
|
+
end
|
|
1123
|
+
def format(q)
|
|
1124
|
+
Format.new(q).visit(self)
|
|
1125
|
+
end
|
|
1126
|
+
end
|
|
1127
|
+
class ExprStmt < Node
|
|
1128
|
+
SEMANTIC_FIELDS = { x: :child }.freeze
|
|
1129
|
+
attr_reader(:x, :location, :comments)
|
|
1130
|
+
def initialize(x: nil, location: SyntaxTree::Location.default, comments: [])
|
|
1131
|
+
@x = x
|
|
1132
|
+
@location = location
|
|
1133
|
+
@comments = comments
|
|
1134
|
+
end
|
|
1135
|
+
def accept(visitor)
|
|
1136
|
+
visitor.visit_expr_stmt(self)
|
|
1137
|
+
end
|
|
1138
|
+
def child_nodes
|
|
1139
|
+
[@x].compact
|
|
1140
|
+
end
|
|
1141
|
+
alias deconstruct child_nodes
|
|
1142
|
+
def deconstruct_keys(_keys)
|
|
1143
|
+
{ x: @x, location: @location, comments: @comments }
|
|
1144
|
+
end
|
|
1145
|
+
def format(q)
|
|
1146
|
+
Format.new(q).visit(self)
|
|
1147
|
+
end
|
|
1148
|
+
end
|
|
1149
|
+
class SendStmt < Node
|
|
1150
|
+
SEMANTIC_FIELDS = { chan: :child, value: :child }.freeze
|
|
1151
|
+
attr_reader(:chan, :arrow, :value, :location, :comments)
|
|
1152
|
+
def initialize(
|
|
1153
|
+
chan: nil,
|
|
1154
|
+
arrow: nil,
|
|
1155
|
+
value: nil,
|
|
1156
|
+
location: SyntaxTree::Location.default,
|
|
1157
|
+
comments: []
|
|
1158
|
+
)
|
|
1159
|
+
@chan = chan
|
|
1160
|
+
@arrow = arrow
|
|
1161
|
+
@value = value
|
|
1162
|
+
@location = location
|
|
1163
|
+
@comments = comments
|
|
1164
|
+
end
|
|
1165
|
+
def accept(visitor)
|
|
1166
|
+
visitor.visit_send_stmt(self)
|
|
1167
|
+
end
|
|
1168
|
+
def child_nodes
|
|
1169
|
+
[@chan, @value].compact
|
|
1170
|
+
end
|
|
1171
|
+
alias deconstruct child_nodes
|
|
1172
|
+
def deconstruct_keys(_keys)
|
|
1173
|
+
{
|
|
1174
|
+
chan: @chan,
|
|
1175
|
+
arrow: @arrow,
|
|
1176
|
+
value: @value,
|
|
1177
|
+
location: @location,
|
|
1178
|
+
comments: @comments
|
|
1179
|
+
}
|
|
1180
|
+
end
|
|
1181
|
+
def format(q)
|
|
1182
|
+
Format.new(q).visit(self)
|
|
1183
|
+
end
|
|
1184
|
+
end
|
|
1185
|
+
class IncDecStmt < Node
|
|
1186
|
+
SEMANTIC_FIELDS = { x: :child, tok: :token }.freeze
|
|
1187
|
+
attr_reader(:x, :tok_pos, :tok, :location, :comments)
|
|
1188
|
+
def initialize(
|
|
1189
|
+
x: nil,
|
|
1190
|
+
tok_pos: nil,
|
|
1191
|
+
tok: nil,
|
|
1192
|
+
location: SyntaxTree::Location.default,
|
|
1193
|
+
comments: []
|
|
1194
|
+
)
|
|
1195
|
+
@x = x
|
|
1196
|
+
@tok_pos = tok_pos
|
|
1197
|
+
@tok = tok
|
|
1198
|
+
@location = location
|
|
1199
|
+
@comments = comments
|
|
1200
|
+
end
|
|
1201
|
+
def accept(visitor)
|
|
1202
|
+
visitor.visit_inc_dec_stmt(self)
|
|
1203
|
+
end
|
|
1204
|
+
def child_nodes
|
|
1205
|
+
[@x].compact
|
|
1206
|
+
end
|
|
1207
|
+
alias deconstruct child_nodes
|
|
1208
|
+
def deconstruct_keys(_keys)
|
|
1209
|
+
{
|
|
1210
|
+
x: @x,
|
|
1211
|
+
tok_pos: @tok_pos,
|
|
1212
|
+
tok: @tok,
|
|
1213
|
+
location: @location,
|
|
1214
|
+
comments: @comments
|
|
1215
|
+
}
|
|
1216
|
+
end
|
|
1217
|
+
def format(q)
|
|
1218
|
+
Format.new(q).visit(self)
|
|
1219
|
+
end
|
|
1220
|
+
end
|
|
1221
|
+
class AssignStmt < Node
|
|
1222
|
+
SEMANTIC_FIELDS = { lhs: :children, tok: :token, rhs: :children }.freeze
|
|
1223
|
+
attr_reader(:lhs, :tok_pos, :tok, :rhs, :location, :comments)
|
|
1224
|
+
def initialize(
|
|
1225
|
+
lhs: [],
|
|
1226
|
+
tok_pos: nil,
|
|
1227
|
+
tok: nil,
|
|
1228
|
+
rhs: [],
|
|
1229
|
+
location: SyntaxTree::Location.default,
|
|
1230
|
+
comments: []
|
|
1231
|
+
)
|
|
1232
|
+
@lhs = lhs
|
|
1233
|
+
@tok_pos = tok_pos
|
|
1234
|
+
@tok = tok
|
|
1235
|
+
@rhs = rhs
|
|
1236
|
+
@location = location
|
|
1237
|
+
@comments = comments
|
|
1238
|
+
end
|
|
1239
|
+
def accept(visitor)
|
|
1240
|
+
visitor.visit_assign_stmt(self)
|
|
1241
|
+
end
|
|
1242
|
+
def child_nodes
|
|
1243
|
+
[@lhs, @rhs].compact
|
|
1244
|
+
end
|
|
1245
|
+
alias deconstruct child_nodes
|
|
1246
|
+
def deconstruct_keys(_keys)
|
|
1247
|
+
{
|
|
1248
|
+
lhs: @lhs,
|
|
1249
|
+
tok_pos: @tok_pos,
|
|
1250
|
+
tok: @tok,
|
|
1251
|
+
rhs: @rhs,
|
|
1252
|
+
location: @location,
|
|
1253
|
+
comments: @comments
|
|
1254
|
+
}
|
|
1255
|
+
end
|
|
1256
|
+
def format(q)
|
|
1257
|
+
Format.new(q).visit(self)
|
|
1258
|
+
end
|
|
1259
|
+
end
|
|
1260
|
+
class GoStmt < Node
|
|
1261
|
+
SEMANTIC_FIELDS = { call: :child }.freeze
|
|
1262
|
+
attr_reader(:go, :call, :location, :comments)
|
|
1263
|
+
def initialize(
|
|
1264
|
+
go: nil,
|
|
1265
|
+
call: nil,
|
|
1266
|
+
location: SyntaxTree::Location.default,
|
|
1267
|
+
comments: []
|
|
1268
|
+
)
|
|
1269
|
+
@go = go
|
|
1270
|
+
@call = call
|
|
1271
|
+
@location = location
|
|
1272
|
+
@comments = comments
|
|
1273
|
+
end
|
|
1274
|
+
def accept(visitor)
|
|
1275
|
+
visitor.visit_go_stmt(self)
|
|
1276
|
+
end
|
|
1277
|
+
def child_nodes
|
|
1278
|
+
[@call].compact
|
|
1279
|
+
end
|
|
1280
|
+
alias deconstruct child_nodes
|
|
1281
|
+
def deconstruct_keys(_keys)
|
|
1282
|
+
{ go: @go, call: @call, location: @location, comments: @comments }
|
|
1283
|
+
end
|
|
1284
|
+
def format(q)
|
|
1285
|
+
Format.new(q).visit(self)
|
|
1286
|
+
end
|
|
1287
|
+
end
|
|
1288
|
+
class DeferStmt < Node
|
|
1289
|
+
SEMANTIC_FIELDS = { call: :child }.freeze
|
|
1290
|
+
attr_reader(:defer, :call, :location, :comments)
|
|
1291
|
+
def initialize(
|
|
1292
|
+
defer: nil,
|
|
1293
|
+
call: nil,
|
|
1294
|
+
location: SyntaxTree::Location.default,
|
|
1295
|
+
comments: []
|
|
1296
|
+
)
|
|
1297
|
+
@defer = defer
|
|
1298
|
+
@call = call
|
|
1299
|
+
@location = location
|
|
1300
|
+
@comments = comments
|
|
1301
|
+
end
|
|
1302
|
+
def accept(visitor)
|
|
1303
|
+
visitor.visit_defer_stmt(self)
|
|
1304
|
+
end
|
|
1305
|
+
def child_nodes
|
|
1306
|
+
[@call].compact
|
|
1307
|
+
end
|
|
1308
|
+
alias deconstruct child_nodes
|
|
1309
|
+
def deconstruct_keys(_keys)
|
|
1310
|
+
{ defer: @defer, call: @call, location: @location, comments: @comments }
|
|
1311
|
+
end
|
|
1312
|
+
def format(q)
|
|
1313
|
+
Format.new(q).visit(self)
|
|
1314
|
+
end
|
|
1315
|
+
end
|
|
1316
|
+
class ReturnStmt < Node
|
|
1317
|
+
SEMANTIC_FIELDS = { results: :children }.freeze
|
|
1318
|
+
attr_reader(:return_, :results, :location, :comments)
|
|
1319
|
+
def initialize(
|
|
1320
|
+
return_: nil,
|
|
1321
|
+
results: [],
|
|
1322
|
+
location: SyntaxTree::Location.default,
|
|
1323
|
+
comments: []
|
|
1324
|
+
)
|
|
1325
|
+
@return_ = return_
|
|
1326
|
+
@results = results
|
|
1327
|
+
@location = location
|
|
1328
|
+
@comments = comments
|
|
1329
|
+
end
|
|
1330
|
+
def accept(visitor)
|
|
1331
|
+
visitor.visit_return_stmt(self)
|
|
1332
|
+
end
|
|
1333
|
+
def child_nodes
|
|
1334
|
+
[@results].compact
|
|
1335
|
+
end
|
|
1336
|
+
alias deconstruct child_nodes
|
|
1337
|
+
def deconstruct_keys(_keys)
|
|
1338
|
+
{
|
|
1339
|
+
return_: @return_,
|
|
1340
|
+
results: @results,
|
|
1341
|
+
location: @location,
|
|
1342
|
+
comments: @comments
|
|
1343
|
+
}
|
|
1344
|
+
end
|
|
1345
|
+
def format(q)
|
|
1346
|
+
Format.new(q).visit(self)
|
|
1347
|
+
end
|
|
1348
|
+
end
|
|
1349
|
+
class BranchStmt < Node
|
|
1350
|
+
SEMANTIC_FIELDS = { tok: :token, label: :child }.freeze
|
|
1351
|
+
attr_reader(:tok_pos, :tok, :label, :location, :comments)
|
|
1352
|
+
def initialize(
|
|
1353
|
+
tok_pos: nil,
|
|
1354
|
+
tok: nil,
|
|
1355
|
+
label: nil,
|
|
1356
|
+
location: SyntaxTree::Location.default,
|
|
1357
|
+
comments: []
|
|
1358
|
+
)
|
|
1359
|
+
@tok_pos = tok_pos
|
|
1360
|
+
@tok = tok
|
|
1361
|
+
@label = label
|
|
1362
|
+
@location = location
|
|
1363
|
+
@comments = comments
|
|
1364
|
+
end
|
|
1365
|
+
def accept(visitor)
|
|
1366
|
+
visitor.visit_branch_stmt(self)
|
|
1367
|
+
end
|
|
1368
|
+
def child_nodes
|
|
1369
|
+
[@label].compact
|
|
1370
|
+
end
|
|
1371
|
+
alias deconstruct child_nodes
|
|
1372
|
+
def deconstruct_keys(_keys)
|
|
1373
|
+
{
|
|
1374
|
+
tok_pos: @tok_pos,
|
|
1375
|
+
tok: @tok,
|
|
1376
|
+
label: @label,
|
|
1377
|
+
location: @location,
|
|
1378
|
+
comments: @comments
|
|
1379
|
+
}
|
|
1380
|
+
end
|
|
1381
|
+
def format(q)
|
|
1382
|
+
Format.new(q).visit(self)
|
|
1383
|
+
end
|
|
1384
|
+
end
|
|
1385
|
+
class BlockStmt < Node
|
|
1386
|
+
SEMANTIC_FIELDS = { list: :children }.freeze
|
|
1387
|
+
attr_reader(:lbrace, :list, :rbrace, :location, :comments)
|
|
1388
|
+
def initialize(
|
|
1389
|
+
lbrace: nil,
|
|
1390
|
+
list: [],
|
|
1391
|
+
rbrace: nil,
|
|
1392
|
+
location: SyntaxTree::Location.default,
|
|
1393
|
+
comments: []
|
|
1394
|
+
)
|
|
1395
|
+
@lbrace = lbrace
|
|
1396
|
+
@list = list
|
|
1397
|
+
@rbrace = rbrace
|
|
1398
|
+
@location = location
|
|
1399
|
+
@comments = comments
|
|
1400
|
+
end
|
|
1401
|
+
def accept(visitor)
|
|
1402
|
+
visitor.visit_block_stmt(self)
|
|
1403
|
+
end
|
|
1404
|
+
def child_nodes
|
|
1405
|
+
[@list].compact
|
|
1406
|
+
end
|
|
1407
|
+
alias deconstruct child_nodes
|
|
1408
|
+
def deconstruct_keys(_keys)
|
|
1409
|
+
{
|
|
1410
|
+
lbrace: @lbrace,
|
|
1411
|
+
list: @list,
|
|
1412
|
+
rbrace: @rbrace,
|
|
1413
|
+
location: @location,
|
|
1414
|
+
comments: @comments
|
|
1415
|
+
}
|
|
1416
|
+
end
|
|
1417
|
+
def format(q)
|
|
1418
|
+
Format.new(q).visit(self)
|
|
1419
|
+
end
|
|
1420
|
+
end
|
|
1421
|
+
class IfStmt < Node
|
|
1422
|
+
SEMANTIC_FIELDS = {
|
|
1423
|
+
init: :child,
|
|
1424
|
+
cond: :child,
|
|
1425
|
+
body: :child,
|
|
1426
|
+
else_: :child
|
|
1427
|
+
}.freeze
|
|
1428
|
+
attr_reader(:if_, :init, :cond, :body, :else_, :location, :comments)
|
|
1429
|
+
def initialize(
|
|
1430
|
+
if_: nil,
|
|
1431
|
+
init: nil,
|
|
1432
|
+
cond: nil,
|
|
1433
|
+
body: nil,
|
|
1434
|
+
else_: nil,
|
|
1435
|
+
location: SyntaxTree::Location.default,
|
|
1436
|
+
comments: []
|
|
1437
|
+
)
|
|
1438
|
+
@if_ = if_
|
|
1439
|
+
@init = init
|
|
1440
|
+
@cond = cond
|
|
1441
|
+
@body = body
|
|
1442
|
+
@else_ = else_
|
|
1443
|
+
@location = location
|
|
1444
|
+
@comments = comments
|
|
1445
|
+
end
|
|
1446
|
+
def accept(visitor)
|
|
1447
|
+
visitor.visit_if_stmt(self)
|
|
1448
|
+
end
|
|
1449
|
+
def child_nodes
|
|
1450
|
+
[@init, @cond, @body, @else_].compact
|
|
1451
|
+
end
|
|
1452
|
+
alias deconstruct child_nodes
|
|
1453
|
+
def deconstruct_keys(_keys)
|
|
1454
|
+
{
|
|
1455
|
+
if_: @if_,
|
|
1456
|
+
init: @init,
|
|
1457
|
+
cond: @cond,
|
|
1458
|
+
body: @body,
|
|
1459
|
+
else_: @else_,
|
|
1460
|
+
location: @location,
|
|
1461
|
+
comments: @comments
|
|
1462
|
+
}
|
|
1463
|
+
end
|
|
1464
|
+
def format(q)
|
|
1465
|
+
Format.new(q).visit(self)
|
|
1466
|
+
end
|
|
1467
|
+
end
|
|
1468
|
+
class CaseClause < Node
|
|
1469
|
+
SEMANTIC_FIELDS = { list: :children, body: :children }.freeze
|
|
1470
|
+
attr_reader(:case_, :list, :colon, :body, :location, :comments)
|
|
1471
|
+
def initialize(
|
|
1472
|
+
case_: nil,
|
|
1473
|
+
list: [],
|
|
1474
|
+
colon: nil,
|
|
1475
|
+
body: [],
|
|
1476
|
+
location: SyntaxTree::Location.default,
|
|
1477
|
+
comments: []
|
|
1478
|
+
)
|
|
1479
|
+
@case_ = case_
|
|
1480
|
+
@list = list
|
|
1481
|
+
@colon = colon
|
|
1482
|
+
@body = body
|
|
1483
|
+
@location = location
|
|
1484
|
+
@comments = comments
|
|
1485
|
+
end
|
|
1486
|
+
def accept(visitor)
|
|
1487
|
+
visitor.visit_case_clause(self)
|
|
1488
|
+
end
|
|
1489
|
+
def child_nodes
|
|
1490
|
+
[@list, @body].compact
|
|
1491
|
+
end
|
|
1492
|
+
alias deconstruct child_nodes
|
|
1493
|
+
def deconstruct_keys(_keys)
|
|
1494
|
+
{
|
|
1495
|
+
case_: @case_,
|
|
1496
|
+
list: @list,
|
|
1497
|
+
colon: @colon,
|
|
1498
|
+
body: @body,
|
|
1499
|
+
location: @location,
|
|
1500
|
+
comments: @comments
|
|
1501
|
+
}
|
|
1502
|
+
end
|
|
1503
|
+
def format(q)
|
|
1504
|
+
Format.new(q).visit(self)
|
|
1505
|
+
end
|
|
1506
|
+
end
|
|
1507
|
+
class SwitchStmt < Node
|
|
1508
|
+
SEMANTIC_FIELDS = { init: :child, tag: :child, body: :child }.freeze
|
|
1509
|
+
attr_reader(:switch, :init, :tag, :body, :location, :comments)
|
|
1510
|
+
def initialize(
|
|
1511
|
+
switch: nil,
|
|
1512
|
+
init: nil,
|
|
1513
|
+
tag: nil,
|
|
1514
|
+
body: nil,
|
|
1515
|
+
location: SyntaxTree::Location.default,
|
|
1516
|
+
comments: []
|
|
1517
|
+
)
|
|
1518
|
+
@switch = switch
|
|
1519
|
+
@init = init
|
|
1520
|
+
@tag = tag
|
|
1521
|
+
@body = body
|
|
1522
|
+
@location = location
|
|
1523
|
+
@comments = comments
|
|
1524
|
+
end
|
|
1525
|
+
def accept(visitor)
|
|
1526
|
+
visitor.visit_switch_stmt(self)
|
|
1527
|
+
end
|
|
1528
|
+
def child_nodes
|
|
1529
|
+
[@init, @tag, @body].compact
|
|
1530
|
+
end
|
|
1531
|
+
alias deconstruct child_nodes
|
|
1532
|
+
def deconstruct_keys(_keys)
|
|
1533
|
+
{
|
|
1534
|
+
switch: @switch,
|
|
1535
|
+
init: @init,
|
|
1536
|
+
tag: @tag,
|
|
1537
|
+
body: @body,
|
|
1538
|
+
location: @location,
|
|
1539
|
+
comments: @comments
|
|
1540
|
+
}
|
|
1541
|
+
end
|
|
1542
|
+
def format(q)
|
|
1543
|
+
Format.new(q).visit(self)
|
|
1544
|
+
end
|
|
1545
|
+
end
|
|
1546
|
+
class TypeSwitchStmt < Node
|
|
1547
|
+
SEMANTIC_FIELDS = { init: :child, assign: :child, body: :child }.freeze
|
|
1548
|
+
attr_reader(:switch, :init, :assign, :body, :location, :comments)
|
|
1549
|
+
def initialize(
|
|
1550
|
+
switch: nil,
|
|
1551
|
+
init: nil,
|
|
1552
|
+
assign: nil,
|
|
1553
|
+
body: nil,
|
|
1554
|
+
location: SyntaxTree::Location.default,
|
|
1555
|
+
comments: []
|
|
1556
|
+
)
|
|
1557
|
+
@switch = switch
|
|
1558
|
+
@init = init
|
|
1559
|
+
@assign = assign
|
|
1560
|
+
@body = body
|
|
1561
|
+
@location = location
|
|
1562
|
+
@comments = comments
|
|
1563
|
+
end
|
|
1564
|
+
def accept(visitor)
|
|
1565
|
+
visitor.visit_type_switch_stmt(self)
|
|
1566
|
+
end
|
|
1567
|
+
def child_nodes
|
|
1568
|
+
[@init, @assign, @body].compact
|
|
1569
|
+
end
|
|
1570
|
+
alias deconstruct child_nodes
|
|
1571
|
+
def deconstruct_keys(_keys)
|
|
1572
|
+
{
|
|
1573
|
+
switch: @switch,
|
|
1574
|
+
init: @init,
|
|
1575
|
+
assign: @assign,
|
|
1576
|
+
body: @body,
|
|
1577
|
+
location: @location,
|
|
1578
|
+
comments: @comments
|
|
1579
|
+
}
|
|
1580
|
+
end
|
|
1581
|
+
def format(q)
|
|
1582
|
+
Format.new(q).visit(self)
|
|
1583
|
+
end
|
|
1584
|
+
end
|
|
1585
|
+
class CommClause < Node
|
|
1586
|
+
SEMANTIC_FIELDS = { comm: :child, body: :children }.freeze
|
|
1587
|
+
attr_reader(:case_, :comm, :colon, :body, :location, :comments)
|
|
1588
|
+
def initialize(
|
|
1589
|
+
case_: nil,
|
|
1590
|
+
comm: nil,
|
|
1591
|
+
colon: nil,
|
|
1592
|
+
body: [],
|
|
1593
|
+
location: SyntaxTree::Location.default,
|
|
1594
|
+
comments: []
|
|
1595
|
+
)
|
|
1596
|
+
@case_ = case_
|
|
1597
|
+
@comm = comm
|
|
1598
|
+
@colon = colon
|
|
1599
|
+
@body = body
|
|
1600
|
+
@location = location
|
|
1601
|
+
@comments = comments
|
|
1602
|
+
end
|
|
1603
|
+
def accept(visitor)
|
|
1604
|
+
visitor.visit_comm_clause(self)
|
|
1605
|
+
end
|
|
1606
|
+
def child_nodes
|
|
1607
|
+
[@comm, @body].compact
|
|
1608
|
+
end
|
|
1609
|
+
alias deconstruct child_nodes
|
|
1610
|
+
def deconstruct_keys(_keys)
|
|
1611
|
+
{
|
|
1612
|
+
case_: @case_,
|
|
1613
|
+
comm: @comm,
|
|
1614
|
+
colon: @colon,
|
|
1615
|
+
body: @body,
|
|
1616
|
+
location: @location,
|
|
1617
|
+
comments: @comments
|
|
1618
|
+
}
|
|
1619
|
+
end
|
|
1620
|
+
def format(q)
|
|
1621
|
+
Format.new(q).visit(self)
|
|
1622
|
+
end
|
|
1623
|
+
end
|
|
1624
|
+
class SelectStmt < Node
|
|
1625
|
+
SEMANTIC_FIELDS = { body: :child }.freeze
|
|
1626
|
+
attr_reader(:select, :body, :location, :comments)
|
|
1627
|
+
def initialize(
|
|
1628
|
+
select: nil,
|
|
1629
|
+
body: nil,
|
|
1630
|
+
location: SyntaxTree::Location.default,
|
|
1631
|
+
comments: []
|
|
1632
|
+
)
|
|
1633
|
+
@select = select
|
|
1634
|
+
@body = body
|
|
1635
|
+
@location = location
|
|
1636
|
+
@comments = comments
|
|
1637
|
+
end
|
|
1638
|
+
def accept(visitor)
|
|
1639
|
+
visitor.visit_select_stmt(self)
|
|
1640
|
+
end
|
|
1641
|
+
def child_nodes
|
|
1642
|
+
[@body].compact
|
|
1643
|
+
end
|
|
1644
|
+
alias deconstruct child_nodes
|
|
1645
|
+
def deconstruct_keys(_keys)
|
|
1646
|
+
{ select: @select, body: @body, location: @location, comments: @comments }
|
|
1647
|
+
end
|
|
1648
|
+
def format(q)
|
|
1649
|
+
Format.new(q).visit(self)
|
|
1650
|
+
end
|
|
1651
|
+
end
|
|
1652
|
+
class ForStmt < Node
|
|
1653
|
+
SEMANTIC_FIELDS = {
|
|
1654
|
+
init: :child,
|
|
1655
|
+
cond: :child,
|
|
1656
|
+
post: :child,
|
|
1657
|
+
body: :child
|
|
1658
|
+
}.freeze
|
|
1659
|
+
attr_reader(:for_, :init, :cond, :post, :body, :location, :comments)
|
|
1660
|
+
def initialize(
|
|
1661
|
+
for_: nil,
|
|
1662
|
+
init: nil,
|
|
1663
|
+
cond: nil,
|
|
1664
|
+
post: nil,
|
|
1665
|
+
body: nil,
|
|
1666
|
+
location: SyntaxTree::Location.default,
|
|
1667
|
+
comments: []
|
|
1668
|
+
)
|
|
1669
|
+
@for_ = for_
|
|
1670
|
+
@init = init
|
|
1671
|
+
@cond = cond
|
|
1672
|
+
@post = post
|
|
1673
|
+
@body = body
|
|
1674
|
+
@location = location
|
|
1675
|
+
@comments = comments
|
|
1676
|
+
end
|
|
1677
|
+
def accept(visitor)
|
|
1678
|
+
visitor.visit_for_stmt(self)
|
|
1679
|
+
end
|
|
1680
|
+
def child_nodes
|
|
1681
|
+
[@init, @cond, @post, @body].compact
|
|
1682
|
+
end
|
|
1683
|
+
alias deconstruct child_nodes
|
|
1684
|
+
def deconstruct_keys(_keys)
|
|
1685
|
+
{
|
|
1686
|
+
for_: @for_,
|
|
1687
|
+
init: @init,
|
|
1688
|
+
cond: @cond,
|
|
1689
|
+
post: @post,
|
|
1690
|
+
body: @body,
|
|
1691
|
+
location: @location,
|
|
1692
|
+
comments: @comments
|
|
1693
|
+
}
|
|
1694
|
+
end
|
|
1695
|
+
def format(q)
|
|
1696
|
+
Format.new(q).visit(self)
|
|
1697
|
+
end
|
|
1698
|
+
end
|
|
1699
|
+
class RangeStmt < Node
|
|
1700
|
+
SEMANTIC_FIELDS = {
|
|
1701
|
+
key: :child,
|
|
1702
|
+
value: :child,
|
|
1703
|
+
tok: :token,
|
|
1704
|
+
x: :child,
|
|
1705
|
+
body: :child
|
|
1706
|
+
}.freeze
|
|
1707
|
+
attr_reader(
|
|
1708
|
+
:for_,
|
|
1709
|
+
:key,
|
|
1710
|
+
:value,
|
|
1711
|
+
:tok_pos,
|
|
1712
|
+
:tok,
|
|
1713
|
+
:range,
|
|
1714
|
+
:x,
|
|
1715
|
+
:body,
|
|
1716
|
+
:location,
|
|
1717
|
+
:comments
|
|
1718
|
+
)
|
|
1719
|
+
def initialize(
|
|
1720
|
+
for_: nil,
|
|
1721
|
+
key: nil,
|
|
1722
|
+
value: nil,
|
|
1723
|
+
tok_pos: nil,
|
|
1724
|
+
tok: nil,
|
|
1725
|
+
range: nil,
|
|
1726
|
+
x: nil,
|
|
1727
|
+
body: nil,
|
|
1728
|
+
location: SyntaxTree::Location.default,
|
|
1729
|
+
comments: []
|
|
1730
|
+
)
|
|
1731
|
+
@for_ = for_
|
|
1732
|
+
@key = key
|
|
1733
|
+
@value = value
|
|
1734
|
+
@tok_pos = tok_pos
|
|
1735
|
+
@tok = tok
|
|
1736
|
+
@range = range
|
|
1737
|
+
@x = x
|
|
1738
|
+
@body = body
|
|
1739
|
+
@location = location
|
|
1740
|
+
@comments = comments
|
|
1741
|
+
end
|
|
1742
|
+
def accept(visitor)
|
|
1743
|
+
visitor.visit_range_stmt(self)
|
|
1744
|
+
end
|
|
1745
|
+
def child_nodes
|
|
1746
|
+
[@key, @value, @x, @body].compact
|
|
1747
|
+
end
|
|
1748
|
+
alias deconstruct child_nodes
|
|
1749
|
+
def deconstruct_keys(_keys)
|
|
1750
|
+
{
|
|
1751
|
+
for_: @for_,
|
|
1752
|
+
key: @key,
|
|
1753
|
+
value: @value,
|
|
1754
|
+
tok_pos: @tok_pos,
|
|
1755
|
+
tok: @tok,
|
|
1756
|
+
range: @range,
|
|
1757
|
+
x: @x,
|
|
1758
|
+
body: @body,
|
|
1759
|
+
location: @location,
|
|
1760
|
+
comments: @comments
|
|
1761
|
+
}
|
|
1762
|
+
end
|
|
1763
|
+
def format(q)
|
|
1764
|
+
Format.new(q).visit(self)
|
|
1765
|
+
end
|
|
1766
|
+
end
|
|
1767
|
+
class ImportSpec < Node
|
|
1768
|
+
SEMANTIC_FIELDS = { name: :child, path: :child }.freeze
|
|
1769
|
+
attr_reader(:doc, :name, :path, :comment, :end_pos, :location, :comments)
|
|
1770
|
+
def initialize(
|
|
1771
|
+
doc: nil,
|
|
1772
|
+
name: nil,
|
|
1773
|
+
path: nil,
|
|
1774
|
+
comment: nil,
|
|
1775
|
+
end_pos: nil,
|
|
1776
|
+
location: SyntaxTree::Location.default,
|
|
1777
|
+
comments: []
|
|
1778
|
+
)
|
|
1779
|
+
@doc = doc
|
|
1780
|
+
@name = name
|
|
1781
|
+
@path = path
|
|
1782
|
+
@comment = comment
|
|
1783
|
+
@end_pos = end_pos
|
|
1784
|
+
@location = location
|
|
1785
|
+
@comments = comments
|
|
1786
|
+
end
|
|
1787
|
+
def accept(visitor)
|
|
1788
|
+
visitor.visit_import_spec(self)
|
|
1789
|
+
end
|
|
1790
|
+
def child_nodes
|
|
1791
|
+
[@doc, @name, @path, @comment].compact
|
|
1792
|
+
end
|
|
1793
|
+
alias deconstruct child_nodes
|
|
1794
|
+
def deconstruct_keys(_keys)
|
|
1795
|
+
{
|
|
1796
|
+
doc: @doc,
|
|
1797
|
+
name: @name,
|
|
1798
|
+
path: @path,
|
|
1799
|
+
comment: @comment,
|
|
1800
|
+
end_pos: @end_pos,
|
|
1801
|
+
location: @location,
|
|
1802
|
+
comments: @comments
|
|
1803
|
+
}
|
|
1804
|
+
end
|
|
1805
|
+
def format(q)
|
|
1806
|
+
Format.new(q).visit(self)
|
|
1807
|
+
end
|
|
1808
|
+
end
|
|
1809
|
+
class ValueSpec < Node
|
|
1810
|
+
SEMANTIC_FIELDS = {
|
|
1811
|
+
names: :children,
|
|
1812
|
+
type: :child,
|
|
1813
|
+
values: :children
|
|
1814
|
+
}.freeze
|
|
1815
|
+
attr_reader(:doc, :names, :type, :values, :comment, :location, :comments)
|
|
1816
|
+
def initialize(
|
|
1817
|
+
doc: nil,
|
|
1818
|
+
names: [],
|
|
1819
|
+
type: nil,
|
|
1820
|
+
values: [],
|
|
1821
|
+
comment: nil,
|
|
1822
|
+
location: SyntaxTree::Location.default,
|
|
1823
|
+
comments: []
|
|
1824
|
+
)
|
|
1825
|
+
@doc = doc
|
|
1826
|
+
@names = names
|
|
1827
|
+
@type = type
|
|
1828
|
+
@values = values
|
|
1829
|
+
@comment = comment
|
|
1830
|
+
@location = location
|
|
1831
|
+
@comments = comments
|
|
1832
|
+
end
|
|
1833
|
+
def accept(visitor)
|
|
1834
|
+
visitor.visit_value_spec(self)
|
|
1835
|
+
end
|
|
1836
|
+
def child_nodes
|
|
1837
|
+
[@doc, @names, @type, @values, @comment].compact
|
|
1838
|
+
end
|
|
1839
|
+
alias deconstruct child_nodes
|
|
1840
|
+
def deconstruct_keys(_keys)
|
|
1841
|
+
{
|
|
1842
|
+
doc: @doc,
|
|
1843
|
+
names: @names,
|
|
1844
|
+
type: @type,
|
|
1845
|
+
values: @values,
|
|
1846
|
+
comment: @comment,
|
|
1847
|
+
location: @location,
|
|
1848
|
+
comments: @comments
|
|
1849
|
+
}
|
|
1850
|
+
end
|
|
1851
|
+
def format(q)
|
|
1852
|
+
Format.new(q).visit(self)
|
|
1853
|
+
end
|
|
1854
|
+
end
|
|
1855
|
+
class TypeSpec < Node
|
|
1856
|
+
SEMANTIC_FIELDS = { name: :child, type_params: :child, type: :child }.freeze
|
|
1857
|
+
attr_reader(
|
|
1858
|
+
:doc,
|
|
1859
|
+
:name,
|
|
1860
|
+
:type_params,
|
|
1861
|
+
:assign,
|
|
1862
|
+
:type,
|
|
1863
|
+
:comment,
|
|
1864
|
+
:location,
|
|
1865
|
+
:comments
|
|
1866
|
+
)
|
|
1867
|
+
def initialize(
|
|
1868
|
+
doc: nil,
|
|
1869
|
+
name: nil,
|
|
1870
|
+
type_params: nil,
|
|
1871
|
+
assign: nil,
|
|
1872
|
+
type: nil,
|
|
1873
|
+
comment: nil,
|
|
1874
|
+
location: SyntaxTree::Location.default,
|
|
1875
|
+
comments: []
|
|
1876
|
+
)
|
|
1877
|
+
@doc = doc
|
|
1878
|
+
@name = name
|
|
1879
|
+
@type_params = type_params
|
|
1880
|
+
@assign = assign
|
|
1881
|
+
@type = type
|
|
1882
|
+
@comment = comment
|
|
1883
|
+
@location = location
|
|
1884
|
+
@comments = comments
|
|
1885
|
+
end
|
|
1886
|
+
def accept(visitor)
|
|
1887
|
+
visitor.visit_type_spec(self)
|
|
1888
|
+
end
|
|
1889
|
+
def child_nodes
|
|
1890
|
+
[@doc, @name, @type_params, @type, @comment].compact
|
|
1891
|
+
end
|
|
1892
|
+
alias deconstruct child_nodes
|
|
1893
|
+
def deconstruct_keys(_keys)
|
|
1894
|
+
{
|
|
1895
|
+
doc: @doc,
|
|
1896
|
+
name: @name,
|
|
1897
|
+
type_params: @type_params,
|
|
1898
|
+
assign: @assign,
|
|
1899
|
+
type: @type,
|
|
1900
|
+
comment: @comment,
|
|
1901
|
+
location: @location,
|
|
1902
|
+
comments: @comments
|
|
1903
|
+
}
|
|
1904
|
+
end
|
|
1905
|
+
def format(q)
|
|
1906
|
+
Format.new(q).visit(self)
|
|
1907
|
+
end
|
|
1908
|
+
end
|
|
1909
|
+
class BadDecl < Node
|
|
1910
|
+
SEMANTIC_FIELDS = {}.freeze
|
|
1911
|
+
attr_reader(:from, :to, :location, :comments)
|
|
1912
|
+
def initialize(
|
|
1913
|
+
from: nil,
|
|
1914
|
+
to: nil,
|
|
1915
|
+
location: SyntaxTree::Location.default,
|
|
1916
|
+
comments: []
|
|
1917
|
+
)
|
|
1918
|
+
@from = from
|
|
1919
|
+
@to = to
|
|
1920
|
+
@location = location
|
|
1921
|
+
@comments = comments
|
|
1922
|
+
end
|
|
1923
|
+
def accept(visitor)
|
|
1924
|
+
visitor.visit_bad_decl(self)
|
|
1925
|
+
end
|
|
1926
|
+
def child_nodes
|
|
1927
|
+
[]
|
|
1928
|
+
end
|
|
1929
|
+
alias deconstruct child_nodes
|
|
1930
|
+
def deconstruct_keys(_keys)
|
|
1931
|
+
{ from: @from, to: @to, location: @location, comments: @comments }
|
|
1932
|
+
end
|
|
1933
|
+
def format(q)
|
|
1934
|
+
Format.new(q).visit(self)
|
|
1935
|
+
end
|
|
1936
|
+
end
|
|
1937
|
+
class GenDecl < Node
|
|
1938
|
+
SEMANTIC_FIELDS = { tok: :token, specs: :children }.freeze
|
|
1939
|
+
attr_reader(
|
|
1940
|
+
:doc,
|
|
1941
|
+
:tok_pos,
|
|
1942
|
+
:tok,
|
|
1943
|
+
:lparen,
|
|
1944
|
+
:specs,
|
|
1945
|
+
:rparen,
|
|
1946
|
+
:location,
|
|
1947
|
+
:comments
|
|
1948
|
+
)
|
|
1949
|
+
def initialize(
|
|
1950
|
+
doc: nil,
|
|
1951
|
+
tok_pos: nil,
|
|
1952
|
+
tok: nil,
|
|
1953
|
+
lparen: nil,
|
|
1954
|
+
specs: [],
|
|
1955
|
+
rparen: nil,
|
|
1956
|
+
location: SyntaxTree::Location.default,
|
|
1957
|
+
comments: []
|
|
1958
|
+
)
|
|
1959
|
+
@doc = doc
|
|
1960
|
+
@tok_pos = tok_pos
|
|
1961
|
+
@tok = tok
|
|
1962
|
+
@lparen = lparen
|
|
1963
|
+
@specs = specs
|
|
1964
|
+
@rparen = rparen
|
|
1965
|
+
@location = location
|
|
1966
|
+
@comments = comments
|
|
1967
|
+
end
|
|
1968
|
+
def accept(visitor)
|
|
1969
|
+
visitor.visit_gen_decl(self)
|
|
1970
|
+
end
|
|
1971
|
+
def child_nodes
|
|
1972
|
+
[@doc, @specs].compact
|
|
1973
|
+
end
|
|
1974
|
+
alias deconstruct child_nodes
|
|
1975
|
+
def deconstruct_keys(_keys)
|
|
1976
|
+
{
|
|
1977
|
+
doc: @doc,
|
|
1978
|
+
tok_pos: @tok_pos,
|
|
1979
|
+
tok: @tok,
|
|
1980
|
+
lparen: @lparen,
|
|
1981
|
+
specs: @specs,
|
|
1982
|
+
rparen: @rparen,
|
|
1983
|
+
location: @location,
|
|
1984
|
+
comments: @comments
|
|
1985
|
+
}
|
|
1986
|
+
end
|
|
1987
|
+
def format(q)
|
|
1988
|
+
Format.new(q).visit(self)
|
|
1989
|
+
end
|
|
1990
|
+
end
|
|
1991
|
+
class FuncDecl < Node
|
|
1992
|
+
SEMANTIC_FIELDS = {
|
|
1993
|
+
recv: :child,
|
|
1994
|
+
name: :child,
|
|
1995
|
+
type: :child,
|
|
1996
|
+
body: :child
|
|
1997
|
+
}.freeze
|
|
1998
|
+
attr_reader(:doc, :recv, :name, :type, :body, :location, :comments)
|
|
1999
|
+
def initialize(
|
|
2000
|
+
doc: nil,
|
|
2001
|
+
recv: nil,
|
|
2002
|
+
name: nil,
|
|
2003
|
+
type: nil,
|
|
2004
|
+
body: nil,
|
|
2005
|
+
location: SyntaxTree::Location.default,
|
|
2006
|
+
comments: []
|
|
2007
|
+
)
|
|
2008
|
+
@doc = doc
|
|
2009
|
+
@recv = recv
|
|
2010
|
+
@name = name
|
|
2011
|
+
@type = type
|
|
2012
|
+
@body = body
|
|
2013
|
+
@location = location
|
|
2014
|
+
@comments = comments
|
|
2015
|
+
end
|
|
2016
|
+
def accept(visitor)
|
|
2017
|
+
visitor.visit_func_decl(self)
|
|
2018
|
+
end
|
|
2019
|
+
def child_nodes
|
|
2020
|
+
[@doc, @recv, @name, @type, @body].compact
|
|
2021
|
+
end
|
|
2022
|
+
alias deconstruct child_nodes
|
|
2023
|
+
def deconstruct_keys(_keys)
|
|
2024
|
+
{
|
|
2025
|
+
doc: @doc,
|
|
2026
|
+
recv: @recv,
|
|
2027
|
+
name: @name,
|
|
2028
|
+
type: @type,
|
|
2029
|
+
body: @body,
|
|
2030
|
+
location: @location,
|
|
2031
|
+
comments: @comments
|
|
2032
|
+
}
|
|
2033
|
+
end
|
|
2034
|
+
def format(q)
|
|
2035
|
+
Format.new(q).visit(self)
|
|
2036
|
+
end
|
|
2037
|
+
end
|
|
2038
|
+
class File < Node
|
|
2039
|
+
SEMANTIC_FIELDS = { name: :child, decls: :children }.freeze
|
|
2040
|
+
attr_reader(
|
|
2041
|
+
:doc,
|
|
2042
|
+
:package,
|
|
2043
|
+
:name,
|
|
2044
|
+
:decls,
|
|
2045
|
+
:file_start,
|
|
2046
|
+
:file_end,
|
|
2047
|
+
:scope,
|
|
2048
|
+
:imports,
|
|
2049
|
+
:unresolved,
|
|
2050
|
+
:comments,
|
|
2051
|
+
:go_version,
|
|
2052
|
+
:location
|
|
2053
|
+
)
|
|
2054
|
+
def initialize(
|
|
2055
|
+
doc: nil,
|
|
2056
|
+
package: nil,
|
|
2057
|
+
name: nil,
|
|
2058
|
+
decls: [],
|
|
2059
|
+
file_start: nil,
|
|
2060
|
+
file_end: nil,
|
|
2061
|
+
scope: nil,
|
|
2062
|
+
imports: [],
|
|
2063
|
+
unresolved: [],
|
|
2064
|
+
comments: [],
|
|
2065
|
+
go_version: nil,
|
|
2066
|
+
location: SyntaxTree::Location.default
|
|
2067
|
+
)
|
|
2068
|
+
@doc = doc
|
|
2069
|
+
@package = package
|
|
2070
|
+
@name = name
|
|
2071
|
+
@decls = decls
|
|
2072
|
+
@file_start = file_start
|
|
2073
|
+
@file_end = file_end
|
|
2074
|
+
@scope = scope
|
|
2075
|
+
@imports = imports
|
|
2076
|
+
@unresolved = unresolved
|
|
2077
|
+
@comments = comments
|
|
2078
|
+
@go_version = go_version
|
|
2079
|
+
@location = location
|
|
2080
|
+
end
|
|
2081
|
+
def accept(visitor)
|
|
2082
|
+
visitor.visit_file(self)
|
|
2083
|
+
end
|
|
2084
|
+
def child_nodes
|
|
2085
|
+
[@doc, @name, @decls, @imports, @unresolved, @comments].compact
|
|
2086
|
+
end
|
|
2087
|
+
alias deconstruct child_nodes
|
|
2088
|
+
def deconstruct_keys(_keys)
|
|
2089
|
+
{
|
|
2090
|
+
doc: @doc,
|
|
2091
|
+
package: @package,
|
|
2092
|
+
name: @name,
|
|
2093
|
+
decls: @decls,
|
|
2094
|
+
file_start: @file_start,
|
|
2095
|
+
file_end: @file_end,
|
|
2096
|
+
scope: @scope,
|
|
2097
|
+
imports: @imports,
|
|
2098
|
+
unresolved: @unresolved,
|
|
2099
|
+
comments: @comments,
|
|
2100
|
+
go_version: @go_version,
|
|
2101
|
+
location: @location
|
|
2102
|
+
}
|
|
2103
|
+
end
|
|
2104
|
+
def format(q)
|
|
2105
|
+
Format.new(q).visit(self)
|
|
2106
|
+
end
|
|
2107
|
+
end
|
|
2108
|
+
class Package < Node
|
|
2109
|
+
SEMANTIC_FIELDS = { name: :string }.freeze
|
|
2110
|
+
attr_reader(:name, :scope, :imports, :files, :location, :comments)
|
|
2111
|
+
def initialize(
|
|
2112
|
+
name: nil,
|
|
2113
|
+
scope: nil,
|
|
2114
|
+
imports: nil,
|
|
2115
|
+
files: nil,
|
|
2116
|
+
location: SyntaxTree::Location.default,
|
|
2117
|
+
comments: []
|
|
2118
|
+
)
|
|
2119
|
+
@name = name
|
|
2120
|
+
@scope = scope
|
|
2121
|
+
@imports = imports
|
|
2122
|
+
@files = files
|
|
2123
|
+
@location = location
|
|
2124
|
+
@comments = comments
|
|
2125
|
+
end
|
|
2126
|
+
def accept(visitor)
|
|
2127
|
+
visitor.visit_package(self)
|
|
2128
|
+
end
|
|
2129
|
+
def child_nodes
|
|
2130
|
+
[]
|
|
2131
|
+
end
|
|
2132
|
+
alias deconstruct child_nodes
|
|
2133
|
+
def deconstruct_keys(_keys)
|
|
2134
|
+
{
|
|
2135
|
+
name: @name,
|
|
2136
|
+
scope: @scope,
|
|
2137
|
+
imports: @imports,
|
|
2138
|
+
files: @files,
|
|
2139
|
+
location: @location,
|
|
2140
|
+
comments: @comments
|
|
2141
|
+
}
|
|
2142
|
+
end
|
|
2143
|
+
def format(q)
|
|
2144
|
+
Format.new(q).visit(self)
|
|
2145
|
+
end
|
|
2146
|
+
end
|
|
2147
|
+
end
|