steep 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/bin/smoke_runner.rb +1 -1
- data/lib/steep.rb +6 -4
- data/lib/steep/ast/builtin.rb +96 -0
- data/lib/steep/ast/location.rb +9 -5
- data/lib/steep/ast/namespace.rb +80 -0
- data/lib/steep/ast/signature/env.rb +37 -31
- data/lib/steep/ast/types/boolean.rb +2 -2
- data/lib/steep/ast/types/hash.rb +50 -0
- data/lib/steep/ast/types/literal.rb +12 -10
- data/lib/steep/ast/types/name.rb +135 -94
- data/lib/steep/ast/types/nil.rb +3 -1
- data/lib/steep/ast/types/proc.rb +3 -1
- data/lib/steep/drivers/check.rb +4 -4
- data/lib/steep/drivers/utils/validator.rb +11 -16
- data/lib/steep/interface/builder.rb +201 -146
- data/lib/steep/interface/instantiated.rb +8 -0
- data/lib/steep/names.rb +86 -0
- data/lib/steep/parser.y +1093 -668
- data/lib/steep/source.rb +2 -2
- data/lib/steep/subtyping/check.rb +199 -63
- data/lib/steep/subtyping/constraints.rb +2 -5
- data/lib/steep/subtyping/variable_variance.rb +2 -2
- data/lib/steep/type_construction.rb +194 -175
- data/lib/steep/type_inference/block_params.rb +9 -21
- data/lib/steep/type_inference/constant_env.rb +26 -30
- data/lib/steep/type_inference/send_args.rb +4 -7
- data/lib/steep/type_inference/type_env.rb +3 -3
- data/lib/steep/version.rb +1 -1
- data/smoke/alias/a.rb +1 -1
- data/smoke/alias/b.rb +1 -1
- data/smoke/class/i.rbi +1 -1
- data/smoke/hash/a.rbi +8 -0
- data/smoke/hash/c.rb +18 -0
- data/smoke/hash/d.rb +6 -0
- data/smoke/hello/hello.rb +2 -2
- data/smoke/interface/a.rb +14 -0
- data/smoke/interface/a.rbi +12 -0
- data/smoke/module/a.rb +1 -1
- data/smoke/module/a.rbi +3 -3
- data/smoke/module/b.rb +1 -1
- data/smoke/stdout/a.rb +2 -2
- data/stdlib/builtin.rbi +6 -7
- data/steep.gemspec +1 -1
- metadata +14 -7
- data/lib/steep/module_name.rb +0 -116
- data/lib/steep/type_name.rb +0 -93
@@ -19,6 +19,14 @@ module Steep
|
|
19
19
|
other.is_a?(self.class) && other.type == type && other.params == params && other.methods == methods && other.ivars == ivars
|
20
20
|
end
|
21
21
|
|
22
|
+
def subst(s)
|
23
|
+
self.class.new(
|
24
|
+
type: type,
|
25
|
+
methods: methods.transform_values {|type| type.subst(s) },
|
26
|
+
ivar_chains: ivar_chains.transform_values {|chain| chain.subst(s) }
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
22
30
|
class InvalidMethodOverrideError < StandardError
|
23
31
|
attr_reader :type
|
24
32
|
attr_reader :current_method
|
data/lib/steep/names.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
module Steep
|
2
|
+
module Names
|
3
|
+
class Base
|
4
|
+
attr_reader :namespace
|
5
|
+
attr_reader :name
|
6
|
+
attr_reader :location
|
7
|
+
|
8
|
+
def initialize(namespace:, name:, location: nil)
|
9
|
+
@namespace = namespace
|
10
|
+
@name = name
|
11
|
+
@location = location
|
12
|
+
end
|
13
|
+
|
14
|
+
def absolute?
|
15
|
+
namespace.absolute?
|
16
|
+
end
|
17
|
+
|
18
|
+
def relative?
|
19
|
+
!absolute?
|
20
|
+
end
|
21
|
+
|
22
|
+
def ==(other)
|
23
|
+
other.is_a?(self.class) && other.name == name && other.namespace == namespace
|
24
|
+
end
|
25
|
+
|
26
|
+
def hash
|
27
|
+
self.class.hash ^ name.hash ^ @absolute.hash
|
28
|
+
end
|
29
|
+
|
30
|
+
alias eql? ==
|
31
|
+
|
32
|
+
def self.parse(string)
|
33
|
+
namespace = AST::Namespace.parse(string.to_s)
|
34
|
+
*_, name = namespace.path
|
35
|
+
new(namespace: namespace.parent, name: name)
|
36
|
+
end
|
37
|
+
|
38
|
+
def absolute!
|
39
|
+
self.class.new(namespace: namespace.absolute!,
|
40
|
+
name: name)
|
41
|
+
end
|
42
|
+
|
43
|
+
def in_namespace(namespace)
|
44
|
+
if absolute?
|
45
|
+
self
|
46
|
+
else
|
47
|
+
self.class.new(namespace: namespace + self.namespace, name: name)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def to_s
|
52
|
+
"#{namespace}#{name}"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class Module < Base
|
57
|
+
def self.from_node(node)
|
58
|
+
case node.type
|
59
|
+
when :const, :casgn
|
60
|
+
namespace = namespace_from_node(node.children[0]) or return
|
61
|
+
name = node.children[1]
|
62
|
+
new(namespace: namespace, name: name)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.namespace_from_node(node)
|
67
|
+
case node&.type
|
68
|
+
when nil
|
69
|
+
AST::Namespace.empty
|
70
|
+
when :cbase
|
71
|
+
AST::Namespace.root
|
72
|
+
when :const
|
73
|
+
namespace_from_node(node.children[0])&.yield_self do |parent|
|
74
|
+
parent.append(node.children[1])
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
class Interface < Base
|
81
|
+
end
|
82
|
+
|
83
|
+
class Alias < Base
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
data/lib/steep/parser.y
CHANGED
@@ -1,602 +1,1013 @@
|
|
1
1
|
class Steep::Parser
|
2
2
|
|
3
|
+
token kCLASS kMODULE kINTERFACE kDEF kEND kNIL kBOOL kANY kVOID kTYPE
|
4
|
+
kINCOMPATIBLE kAT_TYPE kAT_IMPLEMENTS kAT_DYNAMIC kCONST kVAR kRETURN
|
5
|
+
kBLOCK kBREAK kMETHOD kSELF kSELFQ kATTR_READER kATTR_ACCESSOR kINSTANCE
|
6
|
+
kINCLUDE kEXTEND kINSTANCE kIVAR kCONSTRUCTOR kNOCONSTRUCTOR kEXTENSION
|
7
|
+
tARROW tBANG tBAR tCOLON tCOMMA tDOT tEQ tGT tGVAR tHAT tINT
|
8
|
+
tINTERFACE_NAME tIVAR_NAME tLBRACE tLBRACKET tIDENT tLPAREN tLT tROCKET
|
9
|
+
tMINUS tOPERATOR tPERCENT tPLUS tQUESTION tRBRACE tRBRACKET
|
10
|
+
tRPAREN tSTAR tSTAR2 tSTRING tSYMBOL tUIDENT tUMINUS tVAR
|
11
|
+
type_METHOD type_SIGNATURE type_ANNOTATION type_TYPE
|
12
|
+
tQUALIFIED_MODULE_NAME tQUALIFIED_INTERFACE_NAME tQUALIFIED_ALIAS_NAME
|
13
|
+
|
3
14
|
expect 1
|
4
15
|
|
5
16
|
rule
|
6
17
|
|
7
|
-
target: type_METHOD method_type
|
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
|
-
val[
|
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
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
18
|
+
target: type_METHOD method_type
|
19
|
+
{
|
20
|
+
result = val[1]
|
21
|
+
}
|
22
|
+
| type_SIGNATURE signatures
|
23
|
+
{
|
24
|
+
result = val[1]
|
25
|
+
}
|
26
|
+
| type_ANNOTATION annotation
|
27
|
+
{
|
28
|
+
result = val[1]
|
29
|
+
}
|
30
|
+
| type_TYPE type
|
31
|
+
{
|
32
|
+
result = val[1]
|
33
|
+
}
|
34
|
+
|
35
|
+
method_type: type_params params block_opt tARROW return_type
|
36
|
+
{
|
37
|
+
result = AST::MethodType.new(location: AST::Location.concat(*val.compact.map(&:location)),
|
38
|
+
type_params: val[0],
|
39
|
+
params: val[1]&.value,
|
40
|
+
block: val[2],
|
41
|
+
return_type: val[4])
|
42
|
+
}
|
43
|
+
|
44
|
+
return_type: paren_type
|
45
|
+
|
46
|
+
params: # nothing
|
47
|
+
{
|
48
|
+
result = nil
|
49
|
+
}
|
50
|
+
| tLPAREN params0 tRPAREN
|
51
|
+
{
|
52
|
+
result = LocatedValue.new(location: val[0].location + val[2].location,
|
53
|
+
value: val[1])
|
54
|
+
}
|
55
|
+
| simple_type
|
56
|
+
{
|
57
|
+
result = LocatedValue.new(location: val[0].location,
|
58
|
+
value: AST::MethodType::Params::Required.new(location: val[0].location, type: val[0]))
|
59
|
+
}
|
60
|
+
|
61
|
+
params0: required_param
|
62
|
+
{
|
63
|
+
result = AST::MethodType::Params::Required.new(location: val[0].location, type: val[0])
|
64
|
+
}
|
65
|
+
| required_param tCOMMA params0
|
66
|
+
{
|
67
|
+
location = val[0].location
|
68
|
+
result = AST::MethodType::Params::Required.new(location: location,
|
69
|
+
type: val[0],
|
70
|
+
next_params: val[2])
|
71
|
+
}
|
72
|
+
| params1
|
73
|
+
{
|
74
|
+
result = val[0]
|
75
|
+
}
|
76
|
+
|
77
|
+
params1: optional_param
|
78
|
+
{
|
79
|
+
result = AST::MethodType::Params::Optional.new(location: val[0].first, type: val[0].last)
|
80
|
+
}
|
81
|
+
| optional_param tCOMMA params1
|
82
|
+
{
|
83
|
+
location = val[0].first
|
84
|
+
result = AST::MethodType::Params::Optional.new(type: val[0].last, location: location, next_params: val[2])
|
85
|
+
}
|
86
|
+
| params2
|
87
|
+
{
|
88
|
+
result = val[0]
|
89
|
+
}
|
90
|
+
|
91
|
+
params2: rest_param
|
92
|
+
{
|
93
|
+
result = AST::MethodType::Params::Rest.new(location: val[0].first, type: val[0].last)
|
94
|
+
}
|
95
|
+
| rest_param tCOMMA params3
|
96
|
+
{
|
97
|
+
loc = val[0].first
|
98
|
+
result = AST::MethodType::Params::Rest.new(location: loc, type: val[0].last, next_params: val[2])
|
99
|
+
}
|
100
|
+
| params3
|
101
|
+
{
|
102
|
+
result = val[0]
|
103
|
+
}
|
104
|
+
|
105
|
+
params3: required_keyword
|
106
|
+
{
|
107
|
+
location, name, type = val[0]
|
108
|
+
result = AST::MethodType::Params::RequiredKeyword.new(location: location, name: name, type: type)
|
109
|
+
}
|
110
|
+
| optional_keyword
|
111
|
+
{
|
112
|
+
location, name, type = val[0]
|
113
|
+
result = AST::MethodType::Params::OptionalKeyword.new(location: location, name: name, type: type)
|
114
|
+
}
|
115
|
+
| required_keyword tCOMMA params3
|
116
|
+
{
|
117
|
+
location, name, type = val[0]
|
118
|
+
result = AST::MethodType::Params::RequiredKeyword.new(location: location,
|
119
|
+
name: name,
|
120
|
+
type: type,
|
121
|
+
next_params: val[2])
|
122
|
+
}
|
123
|
+
| optional_keyword tCOMMA params3
|
124
|
+
{
|
125
|
+
location, name, type = val[0]
|
126
|
+
result = AST::MethodType::Params::OptionalKeyword.new(location: location,
|
127
|
+
name: name,
|
128
|
+
type: type,
|
129
|
+
next_params: val[2])
|
130
|
+
}
|
131
|
+
| params4
|
132
|
+
{
|
133
|
+
result = val[0]
|
134
|
+
}
|
135
|
+
|
136
|
+
params4: # nothing
|
137
|
+
{
|
138
|
+
result = nil
|
139
|
+
}
|
140
|
+
| tSTAR2 type
|
141
|
+
{
|
142
|
+
result = AST::MethodType::Params::RestKeyword.new(location: val[0].location + val[1].location,
|
143
|
+
type: val[1])
|
144
|
+
}
|
145
|
+
|
146
|
+
required_param: type
|
147
|
+
{
|
148
|
+
result = val[0]
|
149
|
+
}
|
150
|
+
|
151
|
+
optional_param: tQUESTION type
|
152
|
+
{
|
153
|
+
result = [
|
154
|
+
val[0].location + val[1].location,
|
155
|
+
val[1]
|
156
|
+
]
|
157
|
+
}
|
158
|
+
|
159
|
+
rest_param: tSTAR type
|
160
|
+
{
|
161
|
+
result = [
|
162
|
+
val[0].location + val[1].location,
|
163
|
+
val[1]
|
164
|
+
]
|
165
|
+
}
|
166
|
+
|
167
|
+
required_keyword: keyword tCOLON type
|
168
|
+
{
|
169
|
+
result = [
|
170
|
+
val[0].location + val[2].location,
|
171
|
+
val[0].value,
|
172
|
+
val[2]
|
173
|
+
]
|
174
|
+
}
|
175
|
+
|
176
|
+
optional_keyword: tQUESTION keyword tCOLON type
|
177
|
+
{
|
178
|
+
result = [
|
179
|
+
val[0].location + val[3].location,
|
180
|
+
val[1].value,
|
181
|
+
val[3]
|
182
|
+
]
|
183
|
+
}
|
184
|
+
|
185
|
+
block_opt: # nothing
|
186
|
+
{
|
187
|
+
result = nil
|
188
|
+
}
|
189
|
+
| block_optional tLBRACE tRBRACE
|
190
|
+
{
|
191
|
+
result = AST::MethodType::Block.new(params: nil,
|
192
|
+
return_type: nil,
|
193
|
+
location: (val[0] || val[1]).location + val[2].location,
|
194
|
+
optional: val[0]&.value || false)
|
195
|
+
}
|
196
|
+
| block_optional tLBRACE block_params tARROW type tRBRACE
|
197
|
+
{
|
198
|
+
result = AST::MethodType::Block.new(params: val[2],
|
199
|
+
return_type: val[4],
|
200
|
+
location: (val[0] || val[1]).location + val[5].location,
|
201
|
+
optional: val[0]&.value || false)
|
202
|
+
}
|
203
|
+
|
204
|
+
block_optional: # nothing
|
205
|
+
{
|
206
|
+
result = nil
|
207
|
+
}
|
208
|
+
| tQUESTION
|
209
|
+
{
|
210
|
+
result = LocatedValue.new(location: val[0].location, value: true)
|
211
|
+
}
|
212
|
+
|
213
|
+
block_params: # nothing
|
214
|
+
{
|
215
|
+
result = nil
|
216
|
+
}
|
217
|
+
| tLPAREN block_params0 tRPAREN
|
218
|
+
{
|
219
|
+
result = val[1]
|
220
|
+
}
|
221
|
+
|
222
|
+
block_params0: required_param
|
223
|
+
{
|
224
|
+
result = AST::MethodType::Params::Required.new(location: val[0].location,
|
225
|
+
type: val[0])
|
226
|
+
}
|
227
|
+
| required_param tCOMMA block_params0 {
|
228
|
+
result = AST::MethodType::Params::Required.new(location: val[0].location,
|
229
|
+
type: val[0],
|
230
|
+
next_params: val[2])
|
231
|
+
}
|
232
|
+
| block_params1
|
233
|
+
{
|
234
|
+
result = val[0]
|
235
|
+
}
|
236
|
+
|
237
|
+
block_params1: optional_param
|
238
|
+
{
|
239
|
+
result = AST::MethodType::Params::Optional.new(location: val[0].first,
|
240
|
+
type: val[0].last)
|
241
|
+
}
|
242
|
+
| optional_param tCOMMA block_params1
|
243
|
+
{
|
244
|
+
loc = val.first[0] + (val[2] || val[1]).location
|
245
|
+
type = val.first[1]
|
246
|
+
next_params = val[2]
|
247
|
+
result = AST::MethodType::Params::Optional.new(location: loc, type: type, next_params: next_params)
|
248
|
+
}
|
249
|
+
| block_params2
|
250
|
+
{
|
251
|
+
result = val[0]
|
252
|
+
}
|
253
|
+
|
254
|
+
block_params2: # nothing
|
255
|
+
{
|
256
|
+
result = nil
|
257
|
+
}
|
258
|
+
| rest_param
|
259
|
+
{
|
260
|
+
result = AST::MethodType::Params::Rest.new(location: val[0].first, type: val[0].last)
|
261
|
+
}
|
262
|
+
|
263
|
+
application_args: # nothing
|
264
|
+
{
|
265
|
+
result = nil
|
266
|
+
}
|
267
|
+
| tLT type_seq tGT
|
268
|
+
{
|
269
|
+
result = LocatedValue.new(location: val[0].location + val[2].location,
|
270
|
+
value: val[1])
|
271
|
+
}
|
272
|
+
|
273
|
+
simple_type: module_name tDOT kCLASS constructor
|
274
|
+
{
|
275
|
+
loc = val[0].location + (val[3] || val[2]).location
|
276
|
+
result = AST::Types::Name::Class.new(name: val[0].value,
|
277
|
+
constructor: val[3]&.value,
|
278
|
+
location: loc)
|
279
|
+
}
|
280
|
+
| module_name tDOT kMODULE
|
281
|
+
{
|
282
|
+
loc = val[0].location + val[2].location
|
283
|
+
result = AST::Types::Name::Module.new(name: val[0].value, location: loc)
|
284
|
+
}
|
285
|
+
| module_name application_args
|
286
|
+
{
|
287
|
+
loc = val[0].location + val[1]&.location
|
288
|
+
result = AST::Types::Name::Instance.new(name: val[0].value,
|
289
|
+
location: loc,
|
290
|
+
args: val[1]&.value || [])
|
291
|
+
}
|
292
|
+
| interface_name application_args
|
293
|
+
{
|
294
|
+
loc = val[0].location + val[1]&.location
|
295
|
+
result = AST::Types::Name::Interface.new(name: val[0].value,
|
296
|
+
location: loc,
|
297
|
+
args: val[1]&.value || [])
|
298
|
+
}
|
299
|
+
| alias_name application_args
|
300
|
+
{
|
301
|
+
loc = val[0].location + val[1]&.location
|
302
|
+
result = AST::Types::Name::Alias.new(name: val[0].value,
|
303
|
+
location: loc,
|
304
|
+
args: val[1]&.value || [])
|
305
|
+
}
|
306
|
+
| kANY
|
307
|
+
{
|
308
|
+
result = AST::Types::Any.new(location: val[0].location)
|
309
|
+
}
|
310
|
+
| tVAR
|
311
|
+
{
|
312
|
+
result = AST::Types::Var.new(location: val[0].location, name: val[0].value)
|
313
|
+
}
|
314
|
+
| kCLASS
|
315
|
+
{
|
316
|
+
result = AST::Types::Class.new(location: val[0].location)
|
317
|
+
}
|
318
|
+
| kMODULE
|
319
|
+
{
|
320
|
+
result = AST::Types::Class.new(location: val[0].location)
|
321
|
+
}
|
322
|
+
| kINSTANCE
|
323
|
+
{
|
324
|
+
result = AST::Types::Instance.new(location: val[0].location)
|
325
|
+
}
|
326
|
+
| kSELF
|
327
|
+
{
|
328
|
+
result = AST::Types::Self.new(location: val[0].location)
|
329
|
+
}
|
330
|
+
| kVOID
|
331
|
+
{
|
332
|
+
result = AST::Types::Void.new(location: val[0].location)
|
333
|
+
}
|
334
|
+
| kNIL
|
335
|
+
{
|
336
|
+
result = AST::Types::Nil.new(location: val[0].location)
|
337
|
+
}
|
338
|
+
| kBOOL
|
339
|
+
{
|
340
|
+
result = AST::Types::Boolean.new(location: val[0].location)
|
341
|
+
}
|
342
|
+
| simple_type tQUESTION
|
343
|
+
{
|
344
|
+
type = val[0]
|
345
|
+
nil_type = AST::Types::Nil.new(location: val[1].location)
|
346
|
+
result = AST::Types::Union.build(types: [type, nil_type], location: val[0].location + val[1].location)
|
347
|
+
}
|
348
|
+
| kSELFQ
|
349
|
+
{
|
350
|
+
type = AST::Types::Self.new(location: val[0].location)
|
351
|
+
nil_type = AST::Types::Nil.new(location: val[0].location)
|
352
|
+
result = AST::Types::Union.build(types: [type, nil_type], location: val[0].location)
|
353
|
+
}
|
354
|
+
| tINT
|
355
|
+
{
|
356
|
+
result = AST::Types::Literal.new(value: val[0].value, location: val[0].location)
|
357
|
+
}
|
358
|
+
| tSTRING
|
359
|
+
{
|
360
|
+
result = AST::Types::Literal.new(value: val[0].value, location: val[0].location)
|
361
|
+
}
|
362
|
+
| tSYMBOL
|
363
|
+
{
|
364
|
+
result = AST::Types::Literal.new(value: val[0].value, location: val[0].location)
|
365
|
+
}
|
366
|
+
| tLBRACKET type_seq tRBRACKET
|
367
|
+
{
|
368
|
+
loc = val[0].location + val[2].location
|
369
|
+
result = AST::Types::Tuple.new(types: val[1], location: loc)
|
370
|
+
}
|
371
|
+
|
372
|
+
hash_elements: # nothing
|
373
|
+
{
|
374
|
+
result = {}
|
375
|
+
}
|
376
|
+
| hash_element tCOMMA hash_elements
|
377
|
+
{
|
378
|
+
result = val[0].merge(val[2])
|
379
|
+
}
|
380
|
+
| hash_element
|
381
|
+
hash_element: tINT tROCKET type
|
382
|
+
{
|
383
|
+
result = { val[0].value => val[2] }
|
384
|
+
}
|
385
|
+
| tSTRING tROCKET type
|
386
|
+
{
|
387
|
+
result = { val[0].value => val[2] }
|
388
|
+
}
|
389
|
+
| tSYMBOL tROCKET type
|
390
|
+
{
|
391
|
+
result = { val[0].value => val[2] }
|
392
|
+
}
|
393
|
+
| keyword tCOLON type
|
394
|
+
{
|
395
|
+
result = { val[0].value => val[2] }
|
396
|
+
}
|
397
|
+
|
398
|
+
paren_type: tLPAREN type tRPAREN
|
399
|
+
{
|
400
|
+
result = val[1].with_location(val[0].location + val[2].location)
|
401
|
+
}
|
402
|
+
| tLBRACE hash_elements tRBRACE
|
403
|
+
{
|
404
|
+
location = val[0].location + val[2].location
|
405
|
+
result = AST::Types::Hash.new(elements: val[1], location: location)
|
406
|
+
}
|
407
|
+
| simple_type
|
408
|
+
|
409
|
+
constructor: # nothing
|
410
|
+
{
|
411
|
+
result = nil
|
412
|
+
}
|
413
|
+
| kCONSTRUCTOR
|
414
|
+
{
|
415
|
+
result = LocatedValue.new(location: val[0].location, value: true)
|
416
|
+
}
|
417
|
+
| kNOCONSTRUCTOR
|
418
|
+
{
|
419
|
+
result = LocatedValue.new(location: val[0].location, value: false)
|
420
|
+
}
|
421
|
+
|
422
|
+
type: paren_type
|
423
|
+
| union_seq
|
424
|
+
{
|
425
|
+
loc = val[0].first.location + val[0].last.location
|
426
|
+
result = AST::Types::Union.build(types: val[0], location: loc)
|
427
|
+
}
|
428
|
+
| tHAT tLPAREN lambda_params tRPAREN tARROW paren_type
|
429
|
+
{
|
430
|
+
loc = val[0].location + val[5].location
|
431
|
+
result = AST::Types::Proc.new(params: val[2], return_type: val[5], location: loc)
|
432
|
+
}
|
433
|
+
|
434
|
+
lambda_params: lambda_params1
|
435
|
+
| paren_type
|
436
|
+
{
|
437
|
+
result = Interface::Params.empty.update(required: [val[0]])
|
438
|
+
}
|
439
|
+
| paren_type tCOMMA lambda_params
|
440
|
+
{
|
441
|
+
result = val[2].update(required: [val[0]] + val[2].required)
|
442
|
+
}
|
443
|
+
|
444
|
+
lambda_params1: # nothing
|
445
|
+
{
|
446
|
+
result = Interface::Params.empty
|
447
|
+
}
|
448
|
+
| tSTAR paren_type
|
449
|
+
{
|
450
|
+
result = Interface::Params.empty.update(rest: val[1])
|
451
|
+
}
|
452
|
+
| tQUESTION paren_type
|
453
|
+
{
|
454
|
+
result = Interface::Params.empty.update(optional: [val[1]])
|
455
|
+
}
|
456
|
+
| tQUESTION paren_type tCOMMA lambda_params1
|
457
|
+
{
|
458
|
+
result = val[3].update(optional: [val[1]] + val[3].optional)
|
459
|
+
}
|
460
|
+
|
461
|
+
|
462
|
+
type_seq: type
|
463
|
+
{
|
464
|
+
result = [val[0]]
|
465
|
+
}
|
466
|
+
| type tCOMMA type_seq
|
467
|
+
{
|
468
|
+
result = [val[0]] + val[2]
|
469
|
+
}
|
470
|
+
|
471
|
+
union_seq: simple_type tBAR simple_type
|
472
|
+
{
|
473
|
+
result = [val[0], val[2]]
|
474
|
+
}
|
475
|
+
| simple_type tBAR union_seq
|
476
|
+
{
|
477
|
+
result = [val[0]] + val[2]
|
478
|
+
}
|
479
|
+
|
480
|
+
keyword: tIDENT
|
481
|
+
| tINTERFACE_NAME
|
482
|
+
| kANY
|
483
|
+
| kCLASS
|
484
|
+
| kMODULE
|
485
|
+
| kINSTANCE
|
486
|
+
| kBLOCK
|
487
|
+
| kINCLUDE
|
488
|
+
| kIVAR
|
489
|
+
| kSELF
|
490
|
+
| kTYPE
|
491
|
+
|
492
|
+
signatures: # nothing
|
493
|
+
{
|
494
|
+
result = []
|
495
|
+
}
|
496
|
+
| interface signatures
|
497
|
+
{
|
498
|
+
result = [val[0]] + val[1]
|
499
|
+
}
|
500
|
+
| class_decl signatures
|
501
|
+
{
|
502
|
+
result = [val[0]] + val[1]
|
503
|
+
}
|
504
|
+
| module_decl signatures
|
505
|
+
{
|
506
|
+
result = [val[0]] + val[1]
|
507
|
+
}
|
508
|
+
| extension_decl signatures
|
509
|
+
{
|
510
|
+
result = [val[0]] + val[1]
|
511
|
+
}
|
512
|
+
| const_decl signatures
|
513
|
+
{
|
514
|
+
result = [val[0]] + val[1]
|
515
|
+
}
|
516
|
+
| gvar_decl signatures
|
517
|
+
{
|
518
|
+
result = [val[0]] + val[1]
|
519
|
+
}
|
520
|
+
| alias_decl signatures
|
521
|
+
{
|
522
|
+
result = [val[0]] + val[1]
|
523
|
+
}
|
524
|
+
|
525
|
+
gvar_decl: tGVAR tCOLON type
|
526
|
+
{
|
527
|
+
loc = val.first.location + val.last.location
|
528
|
+
result = AST::Signature::Gvar.new(
|
529
|
+
location: loc,
|
530
|
+
name: val[0].value,
|
531
|
+
type: val[2]
|
532
|
+
)
|
533
|
+
}
|
534
|
+
|
535
|
+
const_decl: module_name tCOLON type
|
536
|
+
{
|
537
|
+
loc = val.first.location + val.last.location
|
538
|
+
result = AST::Signature::Const.new(
|
539
|
+
location: loc,
|
540
|
+
name: val[0].value.absolute!,
|
541
|
+
type: val[2]
|
542
|
+
)
|
543
|
+
}
|
544
|
+
|
545
|
+
interface: kINTERFACE interface_name type_params interface_members kEND
|
546
|
+
{
|
547
|
+
loc = val.first.location + val.last.location
|
548
|
+
result = AST::Signature::Interface.new(
|
549
|
+
location: loc,
|
550
|
+
name: val[1].value.absolute!,
|
551
|
+
params: val[2],
|
552
|
+
methods: val[3]
|
553
|
+
)
|
554
|
+
}
|
555
|
+
|
556
|
+
class_decl: kCLASS module_name class_params_super class_members kEND
|
557
|
+
{
|
558
|
+
loc = val.first.location + val.last.location
|
559
|
+
result = AST::Signature::Class.new(name: val[1].value.absolute!,
|
560
|
+
params: val[2][0],
|
561
|
+
super_class: val[2][1],
|
562
|
+
members: val[3],
|
563
|
+
location: loc)
|
564
|
+
}
|
565
|
+
|
566
|
+
class_params_super: # nothing
|
567
|
+
{
|
568
|
+
result = [nil, nil]
|
569
|
+
}
|
570
|
+
| tLT super_class
|
571
|
+
{
|
572
|
+
result = [nil, val[1]]
|
573
|
+
}
|
574
|
+
| tLT type_param_seq tGT
|
575
|
+
{
|
576
|
+
location = val[0].location + val[2].location
|
577
|
+
params = AST::TypeParams.new(location: location, variables: val[1])
|
578
|
+
result = [params, nil]
|
579
|
+
}
|
580
|
+
| tLT type_param_seq tGT tLT super_class
|
581
|
+
{
|
582
|
+
location = val[0].location + val[2].location
|
583
|
+
params = AST::TypeParams.new(location: location, variables: val[1])
|
584
|
+
result = [params, val[4]]
|
585
|
+
}
|
586
|
+
|
587
|
+
module_decl: kMODULE module_name type_params self_type_opt class_members kEND
|
588
|
+
{
|
589
|
+
loc = val.first.location + val.last.location
|
590
|
+
result = AST::Signature::Module.new(name: val[1].value.absolute!,
|
591
|
+
location: loc,
|
592
|
+
params: val[2],
|
593
|
+
self_type: val[3],
|
594
|
+
members: val[4])
|
595
|
+
}
|
596
|
+
|
597
|
+
extension_decl: kEXTENSION module_name type_params tLPAREN tUIDENT tRPAREN class_members kEND
|
598
|
+
{
|
599
|
+
loc = val.first.location + val.last.location
|
600
|
+
result = AST::Signature::Extension.new(module_name: val[1].value.absolute!,
|
601
|
+
name: val[4].value,
|
602
|
+
location: loc,
|
603
|
+
params: val[2],
|
604
|
+
members: val[6])
|
605
|
+
}
|
606
|
+
|
607
|
+
alias_decl: kTYPE alias_name type_params tEQ type
|
608
|
+
{
|
609
|
+
loc = val[0].location + val[4].location
|
610
|
+
result = AST::Signature::Alias.new(location: loc,
|
611
|
+
name: val[1].value.absolute!,
|
612
|
+
params: val[2],
|
613
|
+
type: val[4])
|
614
|
+
}
|
615
|
+
|
616
|
+
self_type_opt: # nothing
|
617
|
+
{
|
618
|
+
result = nil
|
619
|
+
}
|
620
|
+
| tCOLON type
|
621
|
+
{
|
622
|
+
result = val[1]
|
623
|
+
}
|
624
|
+
|
625
|
+
interface_name: tQUALIFIED_INTERFACE_NAME
|
626
|
+
| tINTERFACE_NAME {
|
627
|
+
name = Names::Interface.new(name: val[0].value, namespace: AST::Namespace.empty)
|
628
|
+
result = LocatedValue.new(location: val[0].location, value: name)
|
629
|
+
}
|
630
|
+
|
631
|
+
module_name: tQUALIFIED_MODULE_NAME
|
632
|
+
| tUIDENT {
|
633
|
+
name = Names::Module.new(name: val[0].value, namespace: AST::Namespace.empty)
|
634
|
+
result = LocatedValue.new(location: val[0].location, value: name)
|
635
|
+
}
|
636
|
+
|
637
|
+
alias_name: tQUALIFIED_ALIAS_NAME
|
638
|
+
| tIDENT {
|
639
|
+
name = Names::Alias.new(name: val[0].value, namespace: AST::Namespace.empty)
|
640
|
+
result = LocatedValue.new(location: val[0].location, value: name)
|
641
|
+
}
|
642
|
+
|
643
|
+
class_members: # nothing
|
644
|
+
{
|
645
|
+
result = []
|
646
|
+
}
|
647
|
+
| class_member class_members
|
648
|
+
{
|
649
|
+
result = [val[0]] + val[1]
|
650
|
+
}
|
651
|
+
|
652
|
+
class_member: instance_method_member
|
653
|
+
| module_method_member
|
654
|
+
| module_instance_method_member
|
655
|
+
| include_member
|
656
|
+
| extend_member
|
657
|
+
| ivar_member
|
658
|
+
| attr_reader_member
|
659
|
+
| attr_accessor_member
|
660
|
+
|
661
|
+
ivar_member: tIVAR_NAME tCOLON type
|
662
|
+
{
|
663
|
+
loc = val.first.location + val.last.location
|
664
|
+
result = AST::Signature::Members::Ivar.new(
|
665
|
+
location: loc,
|
666
|
+
name: val[0].value,
|
667
|
+
type: val[2]
|
668
|
+
)
|
669
|
+
}
|
670
|
+
|
671
|
+
instance_method_member: kDEF method_annotations method_name tCOLON method_type_union
|
672
|
+
{
|
673
|
+
loc = val.first.location + val.last.last.location
|
674
|
+
result = AST::Signature::Members::Method.new(
|
675
|
+
name: val[2].value,
|
676
|
+
types: val[4],
|
677
|
+
kind: :instance,
|
678
|
+
location: loc,
|
679
|
+
attributes: val[1] || []
|
680
|
+
)
|
681
|
+
}
|
682
|
+
|
683
|
+
module_method_member: kDEF method_annotations kSELF tDOT method_name tCOLON method_type_union
|
684
|
+
{
|
685
|
+
loc = val.first.location + val.last.last.location
|
686
|
+
result = AST::Signature::Members::Method.new(
|
687
|
+
name: val[4].value,
|
688
|
+
types: val[6],
|
689
|
+
kind: :module,
|
690
|
+
location: loc,
|
691
|
+
attributes: val[1] || []
|
692
|
+
)
|
693
|
+
}
|
694
|
+
|
695
|
+
module_instance_method_member: kDEF method_annotations kSELFQ tDOT method_name tCOLON method_type_union
|
696
|
+
{
|
697
|
+
loc = val.first.location + val.last.last.location
|
698
|
+
result = AST::Signature::Members::Method.new(
|
699
|
+
name: val[4].value,
|
700
|
+
types: val[6],
|
701
|
+
kind: :module_instance,
|
702
|
+
location: loc,
|
703
|
+
attributes: val[1] || []
|
704
|
+
)
|
705
|
+
}
|
706
|
+
|
707
|
+
include_member: kINCLUDE module_name
|
708
|
+
{
|
709
|
+
loc = val[0].location + val[1].location
|
710
|
+
name = val[1].value
|
711
|
+
result = AST::Signature::Members::Include.new(name: name, location: loc, args: [])
|
712
|
+
}
|
713
|
+
| kINCLUDE module_name tLT type_seq tGT
|
714
|
+
{
|
715
|
+
loc = val[0].location + val[4].location
|
716
|
+
name = val[1].value
|
717
|
+
result = AST::Signature::Members::Include.new(name: name, location: loc, args: val[3])
|
718
|
+
}
|
719
|
+
|
720
|
+
extend_member: kEXTEND module_name
|
721
|
+
{
|
722
|
+
loc = val[0].location + val[1].location
|
723
|
+
name = val[1].value
|
724
|
+
result = AST::Signature::Members::Extend.new(name: name, location: loc, args: [])
|
725
|
+
}
|
726
|
+
| kEXTEND module_name tLT type_seq tGT
|
727
|
+
{
|
728
|
+
loc = val[0].location + val[4].location
|
729
|
+
name = val[1].value
|
730
|
+
result = AST::Signature::Members::Extend.new(name: name, location: loc, args: val[3])
|
731
|
+
}
|
732
|
+
|
733
|
+
attr_reader_member: kATTR_READER method_name attr_ivar_opt tCOLON type
|
734
|
+
{
|
735
|
+
loc = val.first.location + val.last.location
|
736
|
+
result = AST::Signature::Members::Attr.new(location: loc, name: val[1].value, kind: :reader, ivar: val[2], type: val[4])
|
737
|
+
}
|
738
|
+
|
739
|
+
attr_accessor_member: kATTR_ACCESSOR method_name attr_ivar_opt tCOLON type
|
740
|
+
{
|
741
|
+
loc = val.first.location + val.last.location
|
742
|
+
result = AST::Signature::Members::Attr.new(location: loc, name: val[1].value, kind: :accessor, ivar: val[2], type: val[4])
|
743
|
+
}
|
744
|
+
|
745
|
+
attr_ivar_opt: # nothing
|
746
|
+
{
|
747
|
+
result = nil
|
748
|
+
}
|
749
|
+
| tLPAREN tRPAREN
|
750
|
+
{
|
751
|
+
result = false
|
752
|
+
}
|
753
|
+
| tLPAREN tIVAR_NAME tRPAREN
|
754
|
+
{
|
755
|
+
result = val[1].value
|
756
|
+
}
|
757
|
+
|
758
|
+
method_annotations: # nothing
|
759
|
+
{
|
760
|
+
result = nil
|
761
|
+
}
|
762
|
+
| tLPAREN method_annotation_seq tRPAREN
|
763
|
+
{
|
764
|
+
result = val[1]
|
765
|
+
}
|
766
|
+
|
767
|
+
method_annotation_seq: method_annotation_keyword
|
768
|
+
{
|
769
|
+
result = [val[0]]
|
770
|
+
}
|
771
|
+
| method_annotation_keyword tCOMMA method_annotation_seq
|
772
|
+
{
|
773
|
+
result = [val[0]] + val[2]
|
774
|
+
}
|
775
|
+
|
776
|
+
method_annotation_keyword: kCONSTRUCTOR
|
777
|
+
{
|
778
|
+
result = val[0].value
|
779
|
+
}
|
780
|
+
| kINCOMPATIBLE
|
781
|
+
{
|
782
|
+
result = val[0].value
|
783
|
+
}
|
784
|
+
|
785
|
+
super_class: module_name
|
786
|
+
{
|
787
|
+
result = AST::Signature::SuperClass.new(location: val[0].location, name: val[0].value, args: [])
|
788
|
+
}
|
789
|
+
| module_name tLT type_seq tGT
|
790
|
+
{
|
791
|
+
loc = val[0].location + val[3].location
|
792
|
+
name = val[0].value
|
793
|
+
result = AST::Signature::SuperClass.new(location: loc, name: name, args: val[2])
|
794
|
+
}
|
795
|
+
|
796
|
+
type_params: # nothing
|
797
|
+
{
|
798
|
+
result = nil
|
799
|
+
}
|
800
|
+
| tLT type_param_seq tGT
|
801
|
+
{
|
802
|
+
location = val[0].location + val[2].location
|
803
|
+
result = AST::TypeParams.new(location: location, variables: val[1])
|
804
|
+
}
|
805
|
+
|
806
|
+
type_param_seq: tVAR
|
807
|
+
{
|
808
|
+
result = [val[0].value]
|
809
|
+
}
|
810
|
+
| tVAR tCOMMA type_param_seq
|
811
|
+
{
|
812
|
+
result = [val[0].value] + val[2]
|
813
|
+
}
|
814
|
+
|
815
|
+
interface_members: # nothing
|
816
|
+
{
|
817
|
+
result = []
|
818
|
+
}
|
819
|
+
| interface_method interface_members
|
820
|
+
{
|
821
|
+
result = val[1].unshift(val[0])
|
822
|
+
}
|
823
|
+
|
824
|
+
interface_method: kDEF method_name tCOLON method_type_union
|
825
|
+
{
|
826
|
+
loc = val[0].location + val[3].last.location
|
827
|
+
result = AST::Signature::Interface::Method.new(location: loc, name: val[1].value, types: val[3])
|
828
|
+
}
|
829
|
+
|
830
|
+
method_type_union: method_type
|
831
|
+
{
|
832
|
+
result = [val[0]]
|
833
|
+
}
|
834
|
+
| method_type tBAR method_type_union
|
835
|
+
{
|
836
|
+
result = [val[0]] + val[2]
|
837
|
+
}
|
838
|
+
|
839
|
+
method_name: method_name0
|
840
|
+
| tSTAR
|
841
|
+
| tSTAR2
|
842
|
+
| tPERCENT
|
843
|
+
| tMINUS
|
844
|
+
| tLT
|
845
|
+
| tGT
|
846
|
+
| tUMINUS
|
847
|
+
| tBAR
|
848
|
+
{
|
849
|
+
result = LocatedValue.new(location: val[0].location, value: :|)
|
850
|
+
}
|
851
|
+
| method_name0 tEQ
|
852
|
+
{
|
853
|
+
raise ParseError, "\nunexpected method name #{val[0].to_s} =" unless val[0].location.pred?(val[1].location)
|
854
|
+
result = LocatedValue.new(location: val[0].location + val[1].location,
|
855
|
+
value: :"#{val[0].value}=")
|
856
|
+
}
|
857
|
+
| method_name0 tQUESTION
|
858
|
+
{
|
859
|
+
raise ParseError, "\nunexpected method name #{val[0].to_s} ?" unless val[0].location.pred?(val[1].location)
|
860
|
+
result = LocatedValue.new(location: val[0].location + val[1].location,
|
861
|
+
value: :"#{val[0].value}?")
|
862
|
+
}
|
863
|
+
| method_name0 tBANG
|
864
|
+
{
|
865
|
+
raise ParseError, "\nunexpected method name #{val[0].to_s} !" unless val[0].location.pred?(val[1].location)
|
866
|
+
result = LocatedValue.new(location: val[0].location + val[1].location,
|
867
|
+
value: :"#{val[0].value}!")
|
868
|
+
}
|
869
|
+
| tGT tGT
|
870
|
+
{
|
871
|
+
raise ParseError, "\nunexpected method name > >" unless val[0].location.pred?(val[1].location)
|
872
|
+
result = LocatedValue.new(location: val[0].location + val[1].location, value: :>>)
|
873
|
+
}
|
874
|
+
| kNIL tQUESTION
|
875
|
+
{
|
876
|
+
raise ParseError, "\nunexpected method name #{val[0].to_s} ?" unless val[0].location.pred?(val[1].location)
|
877
|
+
result = LocatedValue.new(location: val[0].location + val[1].location,
|
878
|
+
value: :"nil?")
|
879
|
+
}
|
880
|
+
|
881
|
+
method_name0: tIDENT
|
882
|
+
| tUIDENT
|
883
|
+
| tINTERFACE_NAME
|
884
|
+
| kANY
|
885
|
+
| kVOID
|
886
|
+
| kINTERFACE
|
887
|
+
| kEND
|
888
|
+
| tPLUS
|
889
|
+
| kCLASS
|
890
|
+
| kMODULE
|
891
|
+
| kINSTANCE
|
892
|
+
| kEXTEND
|
893
|
+
| kINCLUDE
|
894
|
+
| tOPERATOR
|
895
|
+
| tHAT
|
896
|
+
| tBANG
|
897
|
+
| kBLOCK
|
898
|
+
| kBREAK
|
899
|
+
| kMETHOD
|
900
|
+
| kBOOL
|
901
|
+
| kTYPE
|
902
|
+
| kCONSTRUCTOR
|
903
|
+
{
|
904
|
+
result = LocatedValue.new(location: val[0].location, value: :constructor)
|
905
|
+
}
|
906
|
+
| kNOCONSTRUCTOR
|
907
|
+
{
|
908
|
+
result = LocatedValue.new(location: val[0].location, value: :noconstructor)
|
909
|
+
}
|
910
|
+
| kATTR_READER
|
911
|
+
| kATTR_ACCESSOR
|
912
|
+
| kINCOMPATIBLE
|
913
|
+
|
914
|
+
annotation: kAT_TYPE kVAR subject tCOLON type
|
915
|
+
{
|
916
|
+
loc = val.first.location + val.last.location
|
917
|
+
result = AST::Annotation::VarType.new(location: loc,
|
918
|
+
name: val[2].value,
|
919
|
+
type: val[4])
|
920
|
+
}
|
921
|
+
| kAT_TYPE kMETHOD subject tCOLON method_type
|
922
|
+
{
|
923
|
+
loc = val.first.location + val.last.location
|
924
|
+
result = AST::Annotation::MethodType.new(location: loc,
|
925
|
+
name: val[2].value,
|
926
|
+
type: val[4])
|
927
|
+
}
|
928
|
+
| kAT_TYPE kRETURN tCOLON type
|
929
|
+
{
|
930
|
+
loc = val.first.location + val.last.location
|
931
|
+
result = AST::Annotation::ReturnType.new(type: val[3], location: loc)
|
932
|
+
}
|
933
|
+
| kAT_TYPE kBLOCK tCOLON type
|
934
|
+
{
|
935
|
+
loc = val.first.location + val.last.location
|
936
|
+
result = AST::Annotation::BlockType.new(type: val[3], location: loc)
|
937
|
+
}
|
938
|
+
| kAT_TYPE kSELF tCOLON type
|
939
|
+
{
|
940
|
+
loc = val.first.location + val.last.location
|
941
|
+
result = AST::Annotation::SelfType.new(type: val[3], location: loc)
|
942
|
+
}
|
943
|
+
| kAT_TYPE kCONST module_name tCOLON type
|
944
|
+
{
|
945
|
+
loc = val[0].location + val[4].location
|
946
|
+
result = AST::Annotation::ConstType.new(name: val[2].value,
|
947
|
+
type: val[4],
|
948
|
+
location: loc)
|
949
|
+
}
|
950
|
+
| kAT_TYPE kINSTANCE tCOLON type
|
951
|
+
{
|
952
|
+
loc = val.first.location + val.last.location
|
953
|
+
result = AST::Annotation::InstanceType.new(type: val[3], location: loc)
|
954
|
+
}
|
955
|
+
| kAT_TYPE kMODULE tCOLON type
|
956
|
+
{
|
957
|
+
loc = val.first.location + val.last.location
|
958
|
+
result = AST::Annotation::ModuleType.new(type: val[3], location: loc)
|
959
|
+
}
|
960
|
+
| kAT_TYPE kIVAR tIVAR_NAME tCOLON type
|
961
|
+
{
|
962
|
+
loc = val.first.location + val.last.location
|
963
|
+
result = AST::Annotation::IvarType.new(name: val[2].value, type: val[4], location: loc)
|
964
|
+
}
|
965
|
+
| kAT_IMPLEMENTS module_name type_params
|
966
|
+
{
|
967
|
+
loc = val[0].location + (val[2]&.location || val[1].location)
|
968
|
+
args = val[2]&.variables || []
|
969
|
+
name = AST::Annotation::Implements::Module.new(name: val[1].value, args: args)
|
970
|
+
result = AST::Annotation::Implements.new(name: name, location: loc)
|
971
|
+
}
|
972
|
+
| kAT_DYNAMIC dynamic_names
|
973
|
+
{
|
974
|
+
loc = val[0].location + val[1].last.location
|
975
|
+
result = AST::Annotation::Dynamic.new(names: val[1], location: loc)
|
976
|
+
}
|
977
|
+
| kAT_TYPE kBREAK tCOLON type
|
978
|
+
{
|
979
|
+
loc = val.first.location + val.last.location
|
980
|
+
result = AST::Annotation::BreakType.new(type: val[3], location: loc)
|
981
|
+
}
|
982
|
+
|
983
|
+
dynamic_names: dynamic_name tCOMMA dynamic_names
|
984
|
+
{
|
985
|
+
result = [val[0]] + val[2]
|
986
|
+
}
|
987
|
+
| dynamic_name
|
988
|
+
{
|
989
|
+
result = val
|
990
|
+
}
|
991
|
+
|
992
|
+
dynamic_name: method_name
|
993
|
+
{
|
994
|
+
result = AST::Annotation::Dynamic::Name.new(name: val[0].value, location: val[0].location, kind: :instance)
|
995
|
+
}
|
996
|
+
| kSELF tDOT method_name
|
997
|
+
{
|
998
|
+
loc = val.first.location + val.last.location
|
999
|
+
result = AST::Annotation::Dynamic::Name.new(name: val[2].value, location: loc, kind: :module)
|
1000
|
+
}
|
1001
|
+
| kSELFQ tDOT method_name
|
1002
|
+
{
|
1003
|
+
loc = val.first.location + val.last.location
|
1004
|
+
result = AST::Annotation::Dynamic::Name.new(name: val[2].value, location: loc, kind: :module_instance)
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
subject: tIDENT
|
1008
|
+
{
|
1009
|
+
result = val[0]
|
1010
|
+
}
|
600
1011
|
end
|
601
1012
|
|
602
1013
|
---- inner
|
@@ -670,148 +1081,162 @@ def next_token
|
|
670
1081
|
when input.eos?
|
671
1082
|
[false, false]
|
672
1083
|
when input.scan(/->/)
|
673
|
-
new_token(:
|
1084
|
+
new_token(:tARROW)
|
674
1085
|
when input.scan(/\?/)
|
675
|
-
new_token(:
|
1086
|
+
new_token(:tQUESTION)
|
676
1087
|
when input.scan(/!/)
|
677
|
-
new_token(:
|
1088
|
+
new_token(:tBANG, :!)
|
678
1089
|
when input.scan(/\(/)
|
679
|
-
new_token(:
|
1090
|
+
new_token(:tLPAREN, nil)
|
680
1091
|
when input.scan(/\)/)
|
681
|
-
new_token(:
|
1092
|
+
new_token(:tRPAREN, nil)
|
682
1093
|
when input.scan(/{/)
|
683
|
-
new_token(:
|
1094
|
+
new_token(:tLBRACE, nil)
|
684
1095
|
when input.scan(/}/)
|
685
|
-
new_token(:
|
1096
|
+
new_token(:tRBRACE, nil)
|
686
1097
|
when input.scan(/,/)
|
687
|
-
new_token(:
|
1098
|
+
new_token(:tCOMMA, nil)
|
688
1099
|
when input.scan(/:\w+/)
|
689
|
-
new_token(:
|
690
|
-
when input.scan(/::/)
|
691
|
-
new_token(:COLON2)
|
692
|
-
when input.scan(/:/)
|
693
|
-
new_token(:COLON)
|
1100
|
+
new_token(:tSYMBOL, input.matched[1..-1].to_sym)
|
694
1101
|
when input.scan(/\*\*/)
|
695
|
-
new_token(:
|
1102
|
+
new_token(:tSTAR2, :**)
|
696
1103
|
when input.scan(/\*/)
|
697
|
-
new_token(:
|
1104
|
+
new_token(:tSTAR, :*)
|
698
1105
|
when input.scan(/\+/)
|
699
|
-
new_token(:
|
1106
|
+
new_token(:tPLUS, :+)
|
700
1107
|
when input.scan(/\./)
|
701
|
-
new_token(:
|
702
|
-
when input.scan(
|
703
|
-
new_token(
|
1108
|
+
new_token(:tDOT)
|
1109
|
+
when input.scan(/<:(?!:)/)
|
1110
|
+
loc = new_token("<:")[1].location
|
1111
|
+
Steep.logger.warn("`<:` syntax for super class is deprecated. Use `<` instead. (#{loc.buffer.name}:#{loc})")
|
1112
|
+
new_token(:tLT)
|
704
1113
|
when input.scan(/\^/)
|
705
|
-
new_token(:
|
1114
|
+
new_token(:tHAT, :"^")
|
1115
|
+
when input.scan(/=>/)
|
1116
|
+
new_token(:tROCKET, :"=>")
|
706
1117
|
when input.scan(/(\[\]=)|(\[\])|===|==|!=|<<|=~/)
|
707
|
-
new_token(:
|
1118
|
+
new_token(:tOPERATOR, input.matched.to_sym)
|
708
1119
|
when input.scan(/\[/)
|
709
|
-
new_token(:
|
1120
|
+
new_token(:tLBRACKET, nil)
|
710
1121
|
when input.scan(/\]/)
|
711
|
-
new_token(:
|
1122
|
+
new_token(:tRBRACKET, nil)
|
712
1123
|
when input.scan(/<=/)
|
713
|
-
new_token(:
|
1124
|
+
new_token(:tOPERATOR, :<=)
|
714
1125
|
when input.scan(/>=/)
|
715
|
-
new_token(:
|
1126
|
+
new_token(:tOPERATOR, :>=)
|
716
1127
|
when input.scan(/=/)
|
717
|
-
new_token(:
|
1128
|
+
new_token(:tEQ, :"=")
|
718
1129
|
when input.scan(/</)
|
719
|
-
new_token(:
|
1130
|
+
new_token(:tLT, :<)
|
720
1131
|
when input.scan(/>/)
|
721
|
-
new_token(:
|
1132
|
+
new_token(:tGT, :>)
|
722
1133
|
when input.scan(/nil\b/)
|
723
|
-
new_token(:
|
1134
|
+
new_token(:kNIL, :nil)
|
724
1135
|
when input.scan(/bool\b/)
|
725
|
-
new_token(:
|
1136
|
+
new_token(:kBOOL, :bool)
|
726
1137
|
when input.scan(/any\b/)
|
727
|
-
new_token(:
|
1138
|
+
new_token(:kANY, :any)
|
728
1139
|
when input.scan(/void\b/)
|
729
|
-
new_token(:
|
1140
|
+
new_token(:kVOID, :void)
|
730
1141
|
when input.scan(/type\b/)
|
731
|
-
new_token(:
|
1142
|
+
new_token(:kTYPE, :type)
|
732
1143
|
when input.scan(/interface\b/)
|
733
|
-
new_token(:
|
1144
|
+
new_token(:kINTERFACE, :interface)
|
734
1145
|
when input.scan(/incompatible\b/)
|
735
|
-
new_token(:
|
1146
|
+
new_token(:kINCOMPATIBLE, :incompatible)
|
736
1147
|
when input.scan(/end\b/)
|
737
|
-
new_token(:
|
1148
|
+
new_token(:kEND, :end)
|
738
1149
|
when input.scan(/\|/)
|
739
|
-
new_token(:
|
1150
|
+
new_token(:tBAR, :bar)
|
740
1151
|
when input.scan(/-@/)
|
741
|
-
new_token(:
|
1152
|
+
new_token(:tUMINUS, :"-@")
|
742
1153
|
when input.scan(/def\b/)
|
743
|
-
new_token(:
|
1154
|
+
new_token(:kDEF)
|
744
1155
|
when input.scan(/@type\b/)
|
745
|
-
new_token(:
|
1156
|
+
new_token(:kAT_TYPE)
|
746
1157
|
when input.scan(/@implements\b/)
|
747
|
-
new_token(:
|
1158
|
+
new_token(:kAT_IMPLEMENTS)
|
748
1159
|
when input.scan(/@dynamic\b/)
|
749
|
-
new_token(:
|
1160
|
+
new_token(:kAT_DYNAMIC)
|
750
1161
|
when input.scan(/const\b/)
|
751
|
-
new_token(:
|
1162
|
+
new_token(:kCONST, :const)
|
752
1163
|
when input.scan(/var\b/)
|
753
|
-
new_token(:
|
1164
|
+
new_token(:kVAR, :var)
|
754
1165
|
when input.scan(/return\b/)
|
755
|
-
new_token(:
|
1166
|
+
new_token(:kRETURN)
|
756
1167
|
when input.scan(/block\b/)
|
757
|
-
new_token(:
|
1168
|
+
new_token(:kBLOCK, :block)
|
758
1169
|
when input.scan(/break\b/)
|
759
|
-
new_token(:
|
1170
|
+
new_token(:kBREAK, :break)
|
760
1171
|
when input.scan(/method\b/)
|
761
|
-
new_token(:
|
1172
|
+
new_token(:kMETHOD, :method)
|
762
1173
|
when input.scan(/self\?/)
|
763
|
-
new_token(:
|
1174
|
+
new_token(:kSELFQ)
|
764
1175
|
when input.scan(/self\b/)
|
765
|
-
new_token(:
|
1176
|
+
new_token(:kSELF, :self)
|
766
1177
|
when input.scan(/'\w+/)
|
767
|
-
new_token(:
|
1178
|
+
new_token(:tVAR, input.matched.gsub(/\A'/, '').to_sym)
|
768
1179
|
when input.scan(/attr_reader\b/)
|
769
|
-
new_token(:
|
1180
|
+
new_token(:kATTR_READER, :attr_reader)
|
770
1181
|
when input.scan(/attr_accessor\b/)
|
771
|
-
new_token(:
|
1182
|
+
new_token(:kATTR_ACCESSOR, :attr_accessor)
|
772
1183
|
when input.scan(/instance\b/)
|
773
|
-
new_token(:
|
1184
|
+
new_token(:kINSTANCE, :instance)
|
774
1185
|
when input.scan(/class\b/)
|
775
|
-
new_token(:
|
1186
|
+
new_token(:kCLASS, :class)
|
776
1187
|
when input.scan(/module\b/)
|
777
|
-
new_token(:
|
1188
|
+
new_token(:kMODULE, :module)
|
778
1189
|
when input.scan(/include\b/)
|
779
|
-
new_token(:
|
1190
|
+
new_token(:kINCLUDE, :include)
|
780
1191
|
when input.scan(/extend\b/)
|
781
|
-
new_token(:
|
1192
|
+
new_token(:kEXTEND, :extend)
|
782
1193
|
when input.scan(/instance\b/)
|
783
|
-
new_token(:
|
1194
|
+
new_token(:kINSTANCE, :instance)
|
784
1195
|
when input.scan(/ivar\b/)
|
785
|
-
new_token(:
|
1196
|
+
new_token(:kIVAR, :ivar)
|
786
1197
|
when input.scan(/%/)
|
787
|
-
new_token(:
|
1198
|
+
new_token(:tPERCENT, :%)
|
788
1199
|
when input.scan(/-/)
|
789
|
-
new_token(:
|
1200
|
+
new_token(:tMINUS, :-)
|
790
1201
|
when input.scan(/&/)
|
791
|
-
new_token(:
|
1202
|
+
new_token(:tOPERATOR, :&)
|
792
1203
|
when input.scan(/~/)
|
793
|
-
new_token(:
|
1204
|
+
new_token(:tOPERATOR, :~)
|
794
1205
|
when input.scan(/\//)
|
795
|
-
new_token(:
|
1206
|
+
new_token(:tOPERATOR, :/)
|
796
1207
|
when input.scan(/extension\b/)
|
797
|
-
new_token(:
|
1208
|
+
new_token(:kEXTENSION, :extension)
|
798
1209
|
when input.scan(/constructor\b/)
|
799
|
-
new_token(:
|
1210
|
+
new_token(:kCONSTRUCTOR, :constructor)
|
800
1211
|
when input.scan(/noconstructor\b/)
|
801
|
-
new_token(:
|
1212
|
+
new_token(:kNOCONSTRUCTOR, :noconstructor)
|
802
1213
|
when input.scan(/\$\w+\b/)
|
803
|
-
new_token(:
|
1214
|
+
new_token(:tGVAR, input.matched.to_sym)
|
1215
|
+
when input.scan(/::([A-Z]\w*::)*[A-Z]\w*/)
|
1216
|
+
new_token(:tQUALIFIED_MODULE_NAME, Names::Module.parse(input.matched))
|
1217
|
+
when input.scan(/([A-Z]\w*::)+[A-Z]\w*/)
|
1218
|
+
new_token(:tQUALIFIED_MODULE_NAME, Names::Module.parse(input.matched))
|
1219
|
+
when input.scan(/::([A-Z]\w*::)*_\w+/)
|
1220
|
+
new_token(:tQUALIFIED_INTERFACE_NAME, Names::Interface.parse(input.matched))
|
1221
|
+
when input.scan(/([A-Z]\w*::)+_\w+/)
|
1222
|
+
new_token(:tQUALIFIED_INTERFACE_NAME, Names::Interface.parse(input.matched))
|
1223
|
+
when input.scan(/::([A-Z]\w*::)*[a-z]\w*/)
|
1224
|
+
new_token(:tQUALIFIED_ALIAS_NAME, Names::Alias.parse(input.matched))
|
1225
|
+
when input.scan(/([A-Z]\w*::)+[a-z]\w*/)
|
1226
|
+
new_token(:tQUALIFIED_ALIAS_NAME, Names::Alias.parse(input.matched))
|
804
1227
|
when input.scan(/[A-Z]\w*/)
|
805
|
-
new_token(:
|
1228
|
+
new_token(:tUIDENT, input.matched.to_sym)
|
806
1229
|
when input.scan(/_\w+/)
|
807
|
-
new_token(:
|
1230
|
+
new_token(:tINTERFACE_NAME, input.matched.to_sym)
|
808
1231
|
when input.scan(/@\w+/)
|
809
|
-
new_token(:
|
1232
|
+
new_token(:tIVAR_NAME, input.matched.to_sym)
|
810
1233
|
when input.scan(/\d+/)
|
811
|
-
new_token(:
|
1234
|
+
new_token(:tINT, input.matched.to_i)
|
812
1235
|
when input.scan(/\"[^\"]*\"/)
|
813
|
-
new_token(:
|
1236
|
+
new_token(:tSTRING, input.matched[1...-1])
|
814
1237
|
when input.scan(/[a-z]\w*/)
|
815
|
-
new_token(:
|
1238
|
+
new_token(:tIDENT, input.matched.to_sym)
|
1239
|
+
when input.scan(/:/)
|
1240
|
+
new_token(:tCOLON)
|
816
1241
|
end
|
817
1242
|
end
|