yarp 0.8.0 → 0.9.0
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 +4 -4
- data/CHANGELOG.md +34 -1
- data/README.md +4 -3
- data/config.yml +332 -52
- data/docs/configuration.md +1 -0
- data/docs/ruby_api.md +2 -0
- data/docs/serialization.md +1 -1
- data/docs/testing.md +2 -2
- data/ext/yarp/api_node.c +703 -136
- data/ext/yarp/extension.c +73 -24
- data/ext/yarp/extension.h +2 -2
- data/include/yarp/ast.h +331 -137
- data/include/yarp/node.h +10 -0
- data/include/yarp/unescape.h +4 -2
- data/include/yarp/util/yp_newline_list.h +3 -0
- data/include/yarp/version.h +2 -2
- data/include/yarp.h +10 -0
- data/lib/yarp/desugar_visitor.rb +267 -0
- data/lib/yarp/ffi.rb +27 -1
- data/lib/yarp/lex_compat.rb +93 -25
- data/lib/yarp/mutation_visitor.rb +683 -0
- data/lib/yarp/node.rb +3042 -508
- data/lib/yarp/serialize.rb +198 -126
- data/lib/yarp.rb +48 -2
- data/src/node.c +421 -185
- data/src/prettyprint.c +262 -80
- data/src/serialize.c +410 -270
- data/src/token_type.c +2 -2
- data/src/unescape.c +69 -51
- data/src/util/yp_newline_list.c +10 -0
- data/src/yarp.c +1208 -458
- data/yarp.gemspec +3 -1
- metadata +4 -2
data/ext/yarp/api_node.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/******************************************************************************/
|
2
|
-
/* This file is generated by the
|
3
|
-
/* modified manually. See
|
2
|
+
/* This file is generated by the templates/template.rb script and should not */
|
3
|
+
/* be modified manually. See */
|
4
4
|
/* templates/ext/yarp/api_node.c.erb */
|
5
5
|
/* if you are looking to modify the */
|
6
6
|
/* template */
|
@@ -17,7 +17,6 @@ extern VALUE rb_cYARPLocation;
|
|
17
17
|
static VALUE rb_cYARPAliasNode;
|
18
18
|
static VALUE rb_cYARPAlternationPatternNode;
|
19
19
|
static VALUE rb_cYARPAndNode;
|
20
|
-
static VALUE rb_cYARPAndWriteNode;
|
21
20
|
static VALUE rb_cYARPArgumentsNode;
|
22
21
|
static VALUE rb_cYARPArrayNode;
|
23
22
|
static VALUE rb_cYARPArrayPatternNode;
|
@@ -37,11 +36,23 @@ static VALUE rb_cYARPCallOperatorWriteNode;
|
|
37
36
|
static VALUE rb_cYARPCapturePatternNode;
|
38
37
|
static VALUE rb_cYARPCaseNode;
|
39
38
|
static VALUE rb_cYARPClassNode;
|
39
|
+
static VALUE rb_cYARPClassVariableAndWriteNode;
|
40
|
+
static VALUE rb_cYARPClassVariableOperatorWriteNode;
|
41
|
+
static VALUE rb_cYARPClassVariableOrWriteNode;
|
40
42
|
static VALUE rb_cYARPClassVariableReadNode;
|
43
|
+
static VALUE rb_cYARPClassVariableTargetNode;
|
41
44
|
static VALUE rb_cYARPClassVariableWriteNode;
|
45
|
+
static VALUE rb_cYARPConstantAndWriteNode;
|
46
|
+
static VALUE rb_cYARPConstantOperatorWriteNode;
|
47
|
+
static VALUE rb_cYARPConstantOrWriteNode;
|
48
|
+
static VALUE rb_cYARPConstantPathAndWriteNode;
|
42
49
|
static VALUE rb_cYARPConstantPathNode;
|
50
|
+
static VALUE rb_cYARPConstantPathOperatorWriteNode;
|
51
|
+
static VALUE rb_cYARPConstantPathOrWriteNode;
|
52
|
+
static VALUE rb_cYARPConstantPathTargetNode;
|
43
53
|
static VALUE rb_cYARPConstantPathWriteNode;
|
44
54
|
static VALUE rb_cYARPConstantReadNode;
|
55
|
+
static VALUE rb_cYARPConstantTargetNode;
|
45
56
|
static VALUE rb_cYARPConstantWriteNode;
|
46
57
|
static VALUE rb_cYARPDefNode;
|
47
58
|
static VALUE rb_cYARPDefinedNode;
|
@@ -57,14 +68,22 @@ static VALUE rb_cYARPForNode;
|
|
57
68
|
static VALUE rb_cYARPForwardingArgumentsNode;
|
58
69
|
static VALUE rb_cYARPForwardingParameterNode;
|
59
70
|
static VALUE rb_cYARPForwardingSuperNode;
|
71
|
+
static VALUE rb_cYARPGlobalVariableAndWriteNode;
|
72
|
+
static VALUE rb_cYARPGlobalVariableOperatorWriteNode;
|
73
|
+
static VALUE rb_cYARPGlobalVariableOrWriteNode;
|
60
74
|
static VALUE rb_cYARPGlobalVariableReadNode;
|
75
|
+
static VALUE rb_cYARPGlobalVariableTargetNode;
|
61
76
|
static VALUE rb_cYARPGlobalVariableWriteNode;
|
62
77
|
static VALUE rb_cYARPHashNode;
|
63
78
|
static VALUE rb_cYARPHashPatternNode;
|
64
79
|
static VALUE rb_cYARPIfNode;
|
65
80
|
static VALUE rb_cYARPImaginaryNode;
|
66
81
|
static VALUE rb_cYARPInNode;
|
82
|
+
static VALUE rb_cYARPInstanceVariableAndWriteNode;
|
83
|
+
static VALUE rb_cYARPInstanceVariableOperatorWriteNode;
|
84
|
+
static VALUE rb_cYARPInstanceVariableOrWriteNode;
|
67
85
|
static VALUE rb_cYARPInstanceVariableReadNode;
|
86
|
+
static VALUE rb_cYARPInstanceVariableTargetNode;
|
68
87
|
static VALUE rb_cYARPInstanceVariableWriteNode;
|
69
88
|
static VALUE rb_cYARPIntegerNode;
|
70
89
|
static VALUE rb_cYARPInterpolatedRegularExpressionNode;
|
@@ -75,7 +94,11 @@ static VALUE rb_cYARPKeywordHashNode;
|
|
75
94
|
static VALUE rb_cYARPKeywordParameterNode;
|
76
95
|
static VALUE rb_cYARPKeywordRestParameterNode;
|
77
96
|
static VALUE rb_cYARPLambdaNode;
|
97
|
+
static VALUE rb_cYARPLocalVariableAndWriteNode;
|
98
|
+
static VALUE rb_cYARPLocalVariableOperatorWriteNode;
|
99
|
+
static VALUE rb_cYARPLocalVariableOrWriteNode;
|
78
100
|
static VALUE rb_cYARPLocalVariableReadNode;
|
101
|
+
static VALUE rb_cYARPLocalVariableTargetNode;
|
79
102
|
static VALUE rb_cYARPLocalVariableWriteNode;
|
80
103
|
static VALUE rb_cYARPMatchPredicateNode;
|
81
104
|
static VALUE rb_cYARPMatchRequiredNode;
|
@@ -86,10 +109,8 @@ static VALUE rb_cYARPNextNode;
|
|
86
109
|
static VALUE rb_cYARPNilNode;
|
87
110
|
static VALUE rb_cYARPNoKeywordsParameterNode;
|
88
111
|
static VALUE rb_cYARPNumberedReferenceReadNode;
|
89
|
-
static VALUE rb_cYARPOperatorWriteNode;
|
90
112
|
static VALUE rb_cYARPOptionalParameterNode;
|
91
113
|
static VALUE rb_cYARPOrNode;
|
92
|
-
static VALUE rb_cYARPOrWriteNode;
|
93
114
|
static VALUE rb_cYARPParametersNode;
|
94
115
|
static VALUE rb_cYARPParenthesesNode;
|
95
116
|
static VALUE rb_cYARPPinnedExpressionNode;
|
@@ -243,13 +264,6 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
243
264
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->right);
|
244
265
|
break;
|
245
266
|
}
|
246
|
-
#line 111 "api_node.c.erb"
|
247
|
-
case YP_NODE_AND_WRITE_NODE: {
|
248
|
-
yp_and_write_node_t *cast = (yp_and_write_node_t *) node;
|
249
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
|
250
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
251
|
-
break;
|
252
|
-
}
|
253
267
|
#line 111 "api_node.c.erb"
|
254
268
|
case YP_NODE_ARGUMENTS_NODE: {
|
255
269
|
yp_arguments_node_t *cast = (yp_arguments_node_t *) node;
|
@@ -380,12 +394,55 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
380
394
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->body);
|
381
395
|
break;
|
382
396
|
}
|
397
|
+
#line 111 "api_node.c.erb"
|
398
|
+
case YP_NODE_CLASS_VARIABLE_AND_WRITE_NODE: {
|
399
|
+
yp_class_variable_and_write_node_t *cast = (yp_class_variable_and_write_node_t *) node;
|
400
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
401
|
+
break;
|
402
|
+
}
|
403
|
+
#line 111 "api_node.c.erb"
|
404
|
+
case YP_NODE_CLASS_VARIABLE_OPERATOR_WRITE_NODE: {
|
405
|
+
yp_class_variable_operator_write_node_t *cast = (yp_class_variable_operator_write_node_t *) node;
|
406
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
407
|
+
break;
|
408
|
+
}
|
409
|
+
#line 111 "api_node.c.erb"
|
410
|
+
case YP_NODE_CLASS_VARIABLE_OR_WRITE_NODE: {
|
411
|
+
yp_class_variable_or_write_node_t *cast = (yp_class_variable_or_write_node_t *) node;
|
412
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
413
|
+
break;
|
414
|
+
}
|
383
415
|
#line 111 "api_node.c.erb"
|
384
416
|
case YP_NODE_CLASS_VARIABLE_WRITE_NODE: {
|
385
417
|
yp_class_variable_write_node_t *cast = (yp_class_variable_write_node_t *) node;
|
386
418
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
387
419
|
break;
|
388
420
|
}
|
421
|
+
#line 111 "api_node.c.erb"
|
422
|
+
case YP_NODE_CONSTANT_AND_WRITE_NODE: {
|
423
|
+
yp_constant_and_write_node_t *cast = (yp_constant_and_write_node_t *) node;
|
424
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
425
|
+
break;
|
426
|
+
}
|
427
|
+
#line 111 "api_node.c.erb"
|
428
|
+
case YP_NODE_CONSTANT_OPERATOR_WRITE_NODE: {
|
429
|
+
yp_constant_operator_write_node_t *cast = (yp_constant_operator_write_node_t *) node;
|
430
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
431
|
+
break;
|
432
|
+
}
|
433
|
+
#line 111 "api_node.c.erb"
|
434
|
+
case YP_NODE_CONSTANT_OR_WRITE_NODE: {
|
435
|
+
yp_constant_or_write_node_t *cast = (yp_constant_or_write_node_t *) node;
|
436
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
437
|
+
break;
|
438
|
+
}
|
439
|
+
#line 111 "api_node.c.erb"
|
440
|
+
case YP_NODE_CONSTANT_PATH_AND_WRITE_NODE: {
|
441
|
+
yp_constant_path_and_write_node_t *cast = (yp_constant_path_and_write_node_t *) node;
|
442
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
|
443
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
444
|
+
break;
|
445
|
+
}
|
389
446
|
#line 111 "api_node.c.erb"
|
390
447
|
case YP_NODE_CONSTANT_PATH_NODE: {
|
391
448
|
yp_constant_path_node_t *cast = (yp_constant_path_node_t *) node;
|
@@ -393,6 +450,27 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
393
450
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->child);
|
394
451
|
break;
|
395
452
|
}
|
453
|
+
#line 111 "api_node.c.erb"
|
454
|
+
case YP_NODE_CONSTANT_PATH_OPERATOR_WRITE_NODE: {
|
455
|
+
yp_constant_path_operator_write_node_t *cast = (yp_constant_path_operator_write_node_t *) node;
|
456
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
|
457
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
458
|
+
break;
|
459
|
+
}
|
460
|
+
#line 111 "api_node.c.erb"
|
461
|
+
case YP_NODE_CONSTANT_PATH_OR_WRITE_NODE: {
|
462
|
+
yp_constant_path_or_write_node_t *cast = (yp_constant_path_or_write_node_t *) node;
|
463
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
|
464
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
465
|
+
break;
|
466
|
+
}
|
467
|
+
#line 111 "api_node.c.erb"
|
468
|
+
case YP_NODE_CONSTANT_PATH_TARGET_NODE: {
|
469
|
+
yp_constant_path_target_node_t *cast = (yp_constant_path_target_node_t *) node;
|
470
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->parent);
|
471
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->child);
|
472
|
+
break;
|
473
|
+
}
|
396
474
|
#line 111 "api_node.c.erb"
|
397
475
|
case YP_NODE_CONSTANT_PATH_WRITE_NODE: {
|
398
476
|
yp_constant_path_write_node_t *cast = (yp_constant_path_write_node_t *) node;
|
@@ -476,6 +554,24 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
476
554
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->block);
|
477
555
|
break;
|
478
556
|
}
|
557
|
+
#line 111 "api_node.c.erb"
|
558
|
+
case YP_NODE_GLOBAL_VARIABLE_AND_WRITE_NODE: {
|
559
|
+
yp_global_variable_and_write_node_t *cast = (yp_global_variable_and_write_node_t *) node;
|
560
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
561
|
+
break;
|
562
|
+
}
|
563
|
+
#line 111 "api_node.c.erb"
|
564
|
+
case YP_NODE_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: {
|
565
|
+
yp_global_variable_operator_write_node_t *cast = (yp_global_variable_operator_write_node_t *) node;
|
566
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
567
|
+
break;
|
568
|
+
}
|
569
|
+
#line 111 "api_node.c.erb"
|
570
|
+
case YP_NODE_GLOBAL_VARIABLE_OR_WRITE_NODE: {
|
571
|
+
yp_global_variable_or_write_node_t *cast = (yp_global_variable_or_write_node_t *) node;
|
572
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
573
|
+
break;
|
574
|
+
}
|
479
575
|
#line 111 "api_node.c.erb"
|
480
576
|
case YP_NODE_GLOBAL_VARIABLE_WRITE_NODE: {
|
481
577
|
yp_global_variable_write_node_t *cast = (yp_global_variable_write_node_t *) node;
|
@@ -521,6 +617,24 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
521
617
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->statements);
|
522
618
|
break;
|
523
619
|
}
|
620
|
+
#line 111 "api_node.c.erb"
|
621
|
+
case YP_NODE_INSTANCE_VARIABLE_AND_WRITE_NODE: {
|
622
|
+
yp_instance_variable_and_write_node_t *cast = (yp_instance_variable_and_write_node_t *) node;
|
623
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
624
|
+
break;
|
625
|
+
}
|
626
|
+
#line 111 "api_node.c.erb"
|
627
|
+
case YP_NODE_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: {
|
628
|
+
yp_instance_variable_operator_write_node_t *cast = (yp_instance_variable_operator_write_node_t *) node;
|
629
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
630
|
+
break;
|
631
|
+
}
|
632
|
+
#line 111 "api_node.c.erb"
|
633
|
+
case YP_NODE_INSTANCE_VARIABLE_OR_WRITE_NODE: {
|
634
|
+
yp_instance_variable_or_write_node_t *cast = (yp_instance_variable_or_write_node_t *) node;
|
635
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
636
|
+
break;
|
637
|
+
}
|
524
638
|
#line 111 "api_node.c.erb"
|
525
639
|
case YP_NODE_INSTANCE_VARIABLE_WRITE_NODE: {
|
526
640
|
yp_instance_variable_write_node_t *cast = (yp_instance_variable_write_node_t *) node;
|
@@ -580,6 +694,24 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
580
694
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->body);
|
581
695
|
break;
|
582
696
|
}
|
697
|
+
#line 111 "api_node.c.erb"
|
698
|
+
case YP_NODE_LOCAL_VARIABLE_AND_WRITE_NODE: {
|
699
|
+
yp_local_variable_and_write_node_t *cast = (yp_local_variable_and_write_node_t *) node;
|
700
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
701
|
+
break;
|
702
|
+
}
|
703
|
+
#line 111 "api_node.c.erb"
|
704
|
+
case YP_NODE_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: {
|
705
|
+
yp_local_variable_operator_write_node_t *cast = (yp_local_variable_operator_write_node_t *) node;
|
706
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
707
|
+
break;
|
708
|
+
}
|
709
|
+
#line 111 "api_node.c.erb"
|
710
|
+
case YP_NODE_LOCAL_VARIABLE_OR_WRITE_NODE: {
|
711
|
+
yp_local_variable_or_write_node_t *cast = (yp_local_variable_or_write_node_t *) node;
|
712
|
+
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
713
|
+
break;
|
714
|
+
}
|
583
715
|
#line 111 "api_node.c.erb"
|
584
716
|
case YP_NODE_LOCAL_VARIABLE_WRITE_NODE: {
|
585
717
|
yp_local_variable_write_node_t *cast = (yp_local_variable_write_node_t *) node;
|
@@ -622,13 +754,6 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
622
754
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->arguments);
|
623
755
|
break;
|
624
756
|
}
|
625
|
-
#line 111 "api_node.c.erb"
|
626
|
-
case YP_NODE_OPERATOR_WRITE_NODE: {
|
627
|
-
yp_operator_write_node_t *cast = (yp_operator_write_node_t *) node;
|
628
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
|
629
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
630
|
-
break;
|
631
|
-
}
|
632
757
|
#line 111 "api_node.c.erb"
|
633
758
|
case YP_NODE_OPTIONAL_PARAMETER_NODE: {
|
634
759
|
yp_optional_parameter_node_t *cast = (yp_optional_parameter_node_t *) node;
|
@@ -642,13 +767,6 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
642
767
|
yp_node_stack_push(&node_stack, (yp_node_t *) cast->right);
|
643
768
|
break;
|
644
769
|
}
|
645
|
-
#line 111 "api_node.c.erb"
|
646
|
-
case YP_NODE_OR_WRITE_NODE: {
|
647
|
-
yp_or_write_node_t *cast = (yp_or_write_node_t *) node;
|
648
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->target);
|
649
|
-
yp_node_stack_push(&node_stack, (yp_node_t *) cast->value);
|
650
|
-
break;
|
651
|
-
}
|
652
770
|
#line 111 "api_node.c.erb"
|
653
771
|
case YP_NODE_PARAMETERS_NODE: {
|
654
772
|
yp_parameters_node_t *cast = (yp_parameters_node_t *) node;
|
@@ -898,26 +1016,6 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
898
1016
|
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPAndNode));
|
899
1017
|
break;
|
900
1018
|
}
|
901
|
-
#line 137 "api_node.c.erb"
|
902
|
-
case YP_NODE_AND_WRITE_NODE: {
|
903
|
-
yp_and_write_node_t *cast = (yp_and_write_node_t *) node;
|
904
|
-
VALUE argv[4];
|
905
|
-
|
906
|
-
// target
|
907
|
-
argv[0] = rb_ary_pop(value_stack);
|
908
|
-
|
909
|
-
// value
|
910
|
-
argv[1] = rb_ary_pop(value_stack);
|
911
|
-
|
912
|
-
// operator_loc
|
913
|
-
argv[2] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
914
|
-
|
915
|
-
// location
|
916
|
-
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
917
|
-
|
918
|
-
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPAndWriteNode));
|
919
|
-
break;
|
920
|
-
}
|
921
1019
|
#line 137 "api_node.c.erb"
|
922
1020
|
case YP_NODE_ARGUMENTS_NODE: {
|
923
1021
|
yp_arguments_node_t *cast = (yp_arguments_node_t *) node;
|
@@ -1329,7 +1427,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1329
1427
|
#line 137 "api_node.c.erb"
|
1330
1428
|
case YP_NODE_CLASS_NODE: {
|
1331
1429
|
yp_class_node_t *cast = (yp_class_node_t *) node;
|
1332
|
-
VALUE argv[
|
1430
|
+
VALUE argv[9];
|
1333
1431
|
|
1334
1432
|
// locals
|
1335
1433
|
argv[0] = rb_ary_new_capa(cast->locals.size);
|
@@ -1355,10 +1453,76 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1355
1453
|
// end_keyword_loc
|
1356
1454
|
argv[6] = yp_location_new(parser, cast->end_keyword_loc.start, cast->end_keyword_loc.end, source);
|
1357
1455
|
|
1456
|
+
// name
|
1457
|
+
argv[7] = yp_string_new(&cast->name, encoding);
|
1458
|
+
|
1358
1459
|
// location
|
1359
|
-
argv[
|
1460
|
+
argv[8] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1360
1461
|
|
1361
|
-
rb_ary_push(value_stack, rb_class_new_instance(
|
1462
|
+
rb_ary_push(value_stack, rb_class_new_instance(9, argv, rb_cYARPClassNode));
|
1463
|
+
break;
|
1464
|
+
}
|
1465
|
+
#line 137 "api_node.c.erb"
|
1466
|
+
case YP_NODE_CLASS_VARIABLE_AND_WRITE_NODE: {
|
1467
|
+
yp_class_variable_and_write_node_t *cast = (yp_class_variable_and_write_node_t *) node;
|
1468
|
+
VALUE argv[4];
|
1469
|
+
|
1470
|
+
// name_loc
|
1471
|
+
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
1472
|
+
|
1473
|
+
// operator_loc
|
1474
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1475
|
+
|
1476
|
+
// value
|
1477
|
+
argv[2] = rb_ary_pop(value_stack);
|
1478
|
+
|
1479
|
+
// location
|
1480
|
+
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1481
|
+
|
1482
|
+
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPClassVariableAndWriteNode));
|
1483
|
+
break;
|
1484
|
+
}
|
1485
|
+
#line 137 "api_node.c.erb"
|
1486
|
+
case YP_NODE_CLASS_VARIABLE_OPERATOR_WRITE_NODE: {
|
1487
|
+
yp_class_variable_operator_write_node_t *cast = (yp_class_variable_operator_write_node_t *) node;
|
1488
|
+
VALUE argv[5];
|
1489
|
+
|
1490
|
+
// name_loc
|
1491
|
+
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
1492
|
+
|
1493
|
+
// operator_loc
|
1494
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1495
|
+
|
1496
|
+
// value
|
1497
|
+
argv[2] = rb_ary_pop(value_stack);
|
1498
|
+
|
1499
|
+
// operator
|
1500
|
+
argv[3] = rb_id2sym(constants[cast->operator - 1]);
|
1501
|
+
|
1502
|
+
// location
|
1503
|
+
argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1504
|
+
|
1505
|
+
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPClassVariableOperatorWriteNode));
|
1506
|
+
break;
|
1507
|
+
}
|
1508
|
+
#line 137 "api_node.c.erb"
|
1509
|
+
case YP_NODE_CLASS_VARIABLE_OR_WRITE_NODE: {
|
1510
|
+
yp_class_variable_or_write_node_t *cast = (yp_class_variable_or_write_node_t *) node;
|
1511
|
+
VALUE argv[4];
|
1512
|
+
|
1513
|
+
// name_loc
|
1514
|
+
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
1515
|
+
|
1516
|
+
// operator_loc
|
1517
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1518
|
+
|
1519
|
+
// value
|
1520
|
+
argv[2] = rb_ary_pop(value_stack);
|
1521
|
+
|
1522
|
+
// location
|
1523
|
+
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1524
|
+
|
1525
|
+
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPClassVariableOrWriteNode));
|
1362
1526
|
break;
|
1363
1527
|
}
|
1364
1528
|
#line 137 "api_node.c.erb"
|
@@ -1371,6 +1535,16 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1371
1535
|
rb_ary_push(value_stack, rb_class_new_instance(1, argv, rb_cYARPClassVariableReadNode));
|
1372
1536
|
break;
|
1373
1537
|
}
|
1538
|
+
#line 137 "api_node.c.erb"
|
1539
|
+
case YP_NODE_CLASS_VARIABLE_TARGET_NODE: {
|
1540
|
+
VALUE argv[1];
|
1541
|
+
|
1542
|
+
// location
|
1543
|
+
argv[0] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1544
|
+
|
1545
|
+
rb_ary_push(value_stack, rb_class_new_instance(1, argv, rb_cYARPClassVariableTargetNode));
|
1546
|
+
break;
|
1547
|
+
}
|
1374
1548
|
#line 137 "api_node.c.erb"
|
1375
1549
|
case YP_NODE_CLASS_VARIABLE_WRITE_NODE: {
|
1376
1550
|
yp_class_variable_write_node_t *cast = (yp_class_variable_write_node_t *) node;
|
@@ -1391,6 +1565,89 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1391
1565
|
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPClassVariableWriteNode));
|
1392
1566
|
break;
|
1393
1567
|
}
|
1568
|
+
#line 137 "api_node.c.erb"
|
1569
|
+
case YP_NODE_CONSTANT_AND_WRITE_NODE: {
|
1570
|
+
yp_constant_and_write_node_t *cast = (yp_constant_and_write_node_t *) node;
|
1571
|
+
VALUE argv[4];
|
1572
|
+
|
1573
|
+
// name_loc
|
1574
|
+
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
1575
|
+
|
1576
|
+
// operator_loc
|
1577
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1578
|
+
|
1579
|
+
// value
|
1580
|
+
argv[2] = rb_ary_pop(value_stack);
|
1581
|
+
|
1582
|
+
// location
|
1583
|
+
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1584
|
+
|
1585
|
+
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPConstantAndWriteNode));
|
1586
|
+
break;
|
1587
|
+
}
|
1588
|
+
#line 137 "api_node.c.erb"
|
1589
|
+
case YP_NODE_CONSTANT_OPERATOR_WRITE_NODE: {
|
1590
|
+
yp_constant_operator_write_node_t *cast = (yp_constant_operator_write_node_t *) node;
|
1591
|
+
VALUE argv[5];
|
1592
|
+
|
1593
|
+
// name_loc
|
1594
|
+
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
1595
|
+
|
1596
|
+
// operator_loc
|
1597
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1598
|
+
|
1599
|
+
// value
|
1600
|
+
argv[2] = rb_ary_pop(value_stack);
|
1601
|
+
|
1602
|
+
// operator
|
1603
|
+
argv[3] = rb_id2sym(constants[cast->operator - 1]);
|
1604
|
+
|
1605
|
+
// location
|
1606
|
+
argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1607
|
+
|
1608
|
+
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPConstantOperatorWriteNode));
|
1609
|
+
break;
|
1610
|
+
}
|
1611
|
+
#line 137 "api_node.c.erb"
|
1612
|
+
case YP_NODE_CONSTANT_OR_WRITE_NODE: {
|
1613
|
+
yp_constant_or_write_node_t *cast = (yp_constant_or_write_node_t *) node;
|
1614
|
+
VALUE argv[4];
|
1615
|
+
|
1616
|
+
// name_loc
|
1617
|
+
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
1618
|
+
|
1619
|
+
// operator_loc
|
1620
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1621
|
+
|
1622
|
+
// value
|
1623
|
+
argv[2] = rb_ary_pop(value_stack);
|
1624
|
+
|
1625
|
+
// location
|
1626
|
+
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1627
|
+
|
1628
|
+
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPConstantOrWriteNode));
|
1629
|
+
break;
|
1630
|
+
}
|
1631
|
+
#line 137 "api_node.c.erb"
|
1632
|
+
case YP_NODE_CONSTANT_PATH_AND_WRITE_NODE: {
|
1633
|
+
yp_constant_path_and_write_node_t *cast = (yp_constant_path_and_write_node_t *) node;
|
1634
|
+
VALUE argv[4];
|
1635
|
+
|
1636
|
+
// target
|
1637
|
+
argv[0] = rb_ary_pop(value_stack);
|
1638
|
+
|
1639
|
+
// operator_loc
|
1640
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1641
|
+
|
1642
|
+
// value
|
1643
|
+
argv[2] = rb_ary_pop(value_stack);
|
1644
|
+
|
1645
|
+
// location
|
1646
|
+
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1647
|
+
|
1648
|
+
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPConstantPathAndWriteNode));
|
1649
|
+
break;
|
1650
|
+
}
|
1394
1651
|
#line 137 "api_node.c.erb"
|
1395
1652
|
case YP_NODE_CONSTANT_PATH_NODE: {
|
1396
1653
|
yp_constant_path_node_t *cast = (yp_constant_path_node_t *) node;
|
@@ -1411,6 +1668,69 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1411
1668
|
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPConstantPathNode));
|
1412
1669
|
break;
|
1413
1670
|
}
|
1671
|
+
#line 137 "api_node.c.erb"
|
1672
|
+
case YP_NODE_CONSTANT_PATH_OPERATOR_WRITE_NODE: {
|
1673
|
+
yp_constant_path_operator_write_node_t *cast = (yp_constant_path_operator_write_node_t *) node;
|
1674
|
+
VALUE argv[5];
|
1675
|
+
|
1676
|
+
// target
|
1677
|
+
argv[0] = rb_ary_pop(value_stack);
|
1678
|
+
|
1679
|
+
// operator_loc
|
1680
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1681
|
+
|
1682
|
+
// value
|
1683
|
+
argv[2] = rb_ary_pop(value_stack);
|
1684
|
+
|
1685
|
+
// operator
|
1686
|
+
argv[3] = rb_id2sym(constants[cast->operator - 1]);
|
1687
|
+
|
1688
|
+
// location
|
1689
|
+
argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1690
|
+
|
1691
|
+
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPConstantPathOperatorWriteNode));
|
1692
|
+
break;
|
1693
|
+
}
|
1694
|
+
#line 137 "api_node.c.erb"
|
1695
|
+
case YP_NODE_CONSTANT_PATH_OR_WRITE_NODE: {
|
1696
|
+
yp_constant_path_or_write_node_t *cast = (yp_constant_path_or_write_node_t *) node;
|
1697
|
+
VALUE argv[4];
|
1698
|
+
|
1699
|
+
// target
|
1700
|
+
argv[0] = rb_ary_pop(value_stack);
|
1701
|
+
|
1702
|
+
// operator_loc
|
1703
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1704
|
+
|
1705
|
+
// value
|
1706
|
+
argv[2] = rb_ary_pop(value_stack);
|
1707
|
+
|
1708
|
+
// location
|
1709
|
+
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1710
|
+
|
1711
|
+
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPConstantPathOrWriteNode));
|
1712
|
+
break;
|
1713
|
+
}
|
1714
|
+
#line 137 "api_node.c.erb"
|
1715
|
+
case YP_NODE_CONSTANT_PATH_TARGET_NODE: {
|
1716
|
+
yp_constant_path_target_node_t *cast = (yp_constant_path_target_node_t *) node;
|
1717
|
+
VALUE argv[4];
|
1718
|
+
|
1719
|
+
// parent
|
1720
|
+
argv[0] = rb_ary_pop(value_stack);
|
1721
|
+
|
1722
|
+
// child
|
1723
|
+
argv[1] = rb_ary_pop(value_stack);
|
1724
|
+
|
1725
|
+
// delimiter_loc
|
1726
|
+
argv[2] = yp_location_new(parser, cast->delimiter_loc.start, cast->delimiter_loc.end, source);
|
1727
|
+
|
1728
|
+
// location
|
1729
|
+
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1730
|
+
|
1731
|
+
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPConstantPathTargetNode));
|
1732
|
+
break;
|
1733
|
+
}
|
1414
1734
|
#line 137 "api_node.c.erb"
|
1415
1735
|
case YP_NODE_CONSTANT_PATH_WRITE_NODE: {
|
1416
1736
|
yp_constant_path_write_node_t *cast = (yp_constant_path_write_node_t *) node;
|
@@ -1420,7 +1740,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1420
1740
|
argv[0] = rb_ary_pop(value_stack);
|
1421
1741
|
|
1422
1742
|
// operator_loc
|
1423
|
-
argv[1] =
|
1743
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1424
1744
|
|
1425
1745
|
// value
|
1426
1746
|
argv[2] = rb_ary_pop(value_stack);
|
@@ -1441,6 +1761,16 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1441
1761
|
rb_ary_push(value_stack, rb_class_new_instance(1, argv, rb_cYARPConstantReadNode));
|
1442
1762
|
break;
|
1443
1763
|
}
|
1764
|
+
#line 137 "api_node.c.erb"
|
1765
|
+
case YP_NODE_CONSTANT_TARGET_NODE: {
|
1766
|
+
VALUE argv[1];
|
1767
|
+
|
1768
|
+
// location
|
1769
|
+
argv[0] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1770
|
+
|
1771
|
+
rb_ary_push(value_stack, rb_class_new_instance(1, argv, rb_cYARPConstantTargetNode));
|
1772
|
+
break;
|
1773
|
+
}
|
1444
1774
|
#line 137 "api_node.c.erb"
|
1445
1775
|
case YP_NODE_CONSTANT_WRITE_NODE: {
|
1446
1776
|
yp_constant_write_node_t *cast = (yp_constant_write_node_t *) node;
|
@@ -1453,7 +1783,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1453
1783
|
argv[1] = rb_ary_pop(value_stack);
|
1454
1784
|
|
1455
1785
|
// operator_loc
|
1456
|
-
argv[2] =
|
1786
|
+
argv[2] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1457
1787
|
|
1458
1788
|
// location
|
1459
1789
|
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
@@ -1722,40 +2052,113 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1722
2052
|
// location
|
1723
2053
|
argv[0] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1724
2054
|
|
1725
|
-
rb_ary_push(value_stack, rb_class_new_instance(1, argv, rb_cYARPForwardingArgumentsNode));
|
2055
|
+
rb_ary_push(value_stack, rb_class_new_instance(1, argv, rb_cYARPForwardingArgumentsNode));
|
2056
|
+
break;
|
2057
|
+
}
|
2058
|
+
#line 137 "api_node.c.erb"
|
2059
|
+
case YP_NODE_FORWARDING_PARAMETER_NODE: {
|
2060
|
+
VALUE argv[1];
|
2061
|
+
|
2062
|
+
// location
|
2063
|
+
argv[0] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2064
|
+
|
2065
|
+
rb_ary_push(value_stack, rb_class_new_instance(1, argv, rb_cYARPForwardingParameterNode));
|
2066
|
+
break;
|
2067
|
+
}
|
2068
|
+
#line 137 "api_node.c.erb"
|
2069
|
+
case YP_NODE_FORWARDING_SUPER_NODE: {
|
2070
|
+
VALUE argv[2];
|
2071
|
+
|
2072
|
+
// block
|
2073
|
+
argv[0] = rb_ary_pop(value_stack);
|
2074
|
+
|
2075
|
+
// location
|
2076
|
+
argv[1] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2077
|
+
|
2078
|
+
rb_ary_push(value_stack, rb_class_new_instance(2, argv, rb_cYARPForwardingSuperNode));
|
2079
|
+
break;
|
2080
|
+
}
|
2081
|
+
#line 137 "api_node.c.erb"
|
2082
|
+
case YP_NODE_GLOBAL_VARIABLE_AND_WRITE_NODE: {
|
2083
|
+
yp_global_variable_and_write_node_t *cast = (yp_global_variable_and_write_node_t *) node;
|
2084
|
+
VALUE argv[4];
|
2085
|
+
|
2086
|
+
// name_loc
|
2087
|
+
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2088
|
+
|
2089
|
+
// operator_loc
|
2090
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2091
|
+
|
2092
|
+
// value
|
2093
|
+
argv[2] = rb_ary_pop(value_stack);
|
2094
|
+
|
2095
|
+
// location
|
2096
|
+
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2097
|
+
|
2098
|
+
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPGlobalVariableAndWriteNode));
|
2099
|
+
break;
|
2100
|
+
}
|
2101
|
+
#line 137 "api_node.c.erb"
|
2102
|
+
case YP_NODE_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: {
|
2103
|
+
yp_global_variable_operator_write_node_t *cast = (yp_global_variable_operator_write_node_t *) node;
|
2104
|
+
VALUE argv[5];
|
2105
|
+
|
2106
|
+
// name_loc
|
2107
|
+
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2108
|
+
|
2109
|
+
// operator_loc
|
2110
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2111
|
+
|
2112
|
+
// value
|
2113
|
+
argv[2] = rb_ary_pop(value_stack);
|
2114
|
+
|
2115
|
+
// operator
|
2116
|
+
argv[3] = rb_id2sym(constants[cast->operator - 1]);
|
2117
|
+
|
2118
|
+
// location
|
2119
|
+
argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2120
|
+
|
2121
|
+
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPGlobalVariableOperatorWriteNode));
|
1726
2122
|
break;
|
1727
2123
|
}
|
1728
2124
|
#line 137 "api_node.c.erb"
|
1729
|
-
case
|
1730
|
-
|
2125
|
+
case YP_NODE_GLOBAL_VARIABLE_OR_WRITE_NODE: {
|
2126
|
+
yp_global_variable_or_write_node_t *cast = (yp_global_variable_or_write_node_t *) node;
|
2127
|
+
VALUE argv[4];
|
2128
|
+
|
2129
|
+
// name_loc
|
2130
|
+
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2131
|
+
|
2132
|
+
// operator_loc
|
2133
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2134
|
+
|
2135
|
+
// value
|
2136
|
+
argv[2] = rb_ary_pop(value_stack);
|
1731
2137
|
|
1732
2138
|
// location
|
1733
|
-
argv[
|
2139
|
+
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1734
2140
|
|
1735
|
-
rb_ary_push(value_stack, rb_class_new_instance(
|
2141
|
+
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPGlobalVariableOrWriteNode));
|
1736
2142
|
break;
|
1737
2143
|
}
|
1738
2144
|
#line 137 "api_node.c.erb"
|
1739
|
-
case
|
1740
|
-
VALUE argv[
|
1741
|
-
|
1742
|
-
// block
|
1743
|
-
argv[0] = rb_ary_pop(value_stack);
|
2145
|
+
case YP_NODE_GLOBAL_VARIABLE_READ_NODE: {
|
2146
|
+
VALUE argv[1];
|
1744
2147
|
|
1745
2148
|
// location
|
1746
|
-
argv[
|
2149
|
+
argv[0] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1747
2150
|
|
1748
|
-
rb_ary_push(value_stack, rb_class_new_instance(
|
2151
|
+
rb_ary_push(value_stack, rb_class_new_instance(1, argv, rb_cYARPGlobalVariableReadNode));
|
1749
2152
|
break;
|
1750
2153
|
}
|
1751
2154
|
#line 137 "api_node.c.erb"
|
1752
|
-
case
|
2155
|
+
case YP_NODE_GLOBAL_VARIABLE_TARGET_NODE: {
|
1753
2156
|
VALUE argv[1];
|
1754
2157
|
|
1755
2158
|
// location
|
1756
2159
|
argv[0] = yp_location_new(parser, node->location.start, node->location.end, source);
|
1757
2160
|
|
1758
|
-
rb_ary_push(value_stack, rb_class_new_instance(1, argv,
|
2161
|
+
rb_ary_push(value_stack, rb_class_new_instance(1, argv, rb_cYARPGlobalVariableTargetNode));
|
1759
2162
|
break;
|
1760
2163
|
}
|
1761
2164
|
#line 137 "api_node.c.erb"
|
@@ -1767,7 +2170,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1767
2170
|
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
1768
2171
|
|
1769
2172
|
// operator_loc
|
1770
|
-
argv[1] =
|
2173
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1771
2174
|
|
1772
2175
|
// value
|
1773
2176
|
argv[2] = rb_ary_pop(value_stack);
|
@@ -1892,6 +2295,69 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1892
2295
|
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPInNode));
|
1893
2296
|
break;
|
1894
2297
|
}
|
2298
|
+
#line 137 "api_node.c.erb"
|
2299
|
+
case YP_NODE_INSTANCE_VARIABLE_AND_WRITE_NODE: {
|
2300
|
+
yp_instance_variable_and_write_node_t *cast = (yp_instance_variable_and_write_node_t *) node;
|
2301
|
+
VALUE argv[4];
|
2302
|
+
|
2303
|
+
// name_loc
|
2304
|
+
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2305
|
+
|
2306
|
+
// operator_loc
|
2307
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2308
|
+
|
2309
|
+
// value
|
2310
|
+
argv[2] = rb_ary_pop(value_stack);
|
2311
|
+
|
2312
|
+
// location
|
2313
|
+
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2314
|
+
|
2315
|
+
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPInstanceVariableAndWriteNode));
|
2316
|
+
break;
|
2317
|
+
}
|
2318
|
+
#line 137 "api_node.c.erb"
|
2319
|
+
case YP_NODE_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: {
|
2320
|
+
yp_instance_variable_operator_write_node_t *cast = (yp_instance_variable_operator_write_node_t *) node;
|
2321
|
+
VALUE argv[5];
|
2322
|
+
|
2323
|
+
// name_loc
|
2324
|
+
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2325
|
+
|
2326
|
+
// operator_loc
|
2327
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2328
|
+
|
2329
|
+
// value
|
2330
|
+
argv[2] = rb_ary_pop(value_stack);
|
2331
|
+
|
2332
|
+
// operator
|
2333
|
+
argv[3] = rb_id2sym(constants[cast->operator - 1]);
|
2334
|
+
|
2335
|
+
// location
|
2336
|
+
argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2337
|
+
|
2338
|
+
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPInstanceVariableOperatorWriteNode));
|
2339
|
+
break;
|
2340
|
+
}
|
2341
|
+
#line 137 "api_node.c.erb"
|
2342
|
+
case YP_NODE_INSTANCE_VARIABLE_OR_WRITE_NODE: {
|
2343
|
+
yp_instance_variable_or_write_node_t *cast = (yp_instance_variable_or_write_node_t *) node;
|
2344
|
+
VALUE argv[4];
|
2345
|
+
|
2346
|
+
// name_loc
|
2347
|
+
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2348
|
+
|
2349
|
+
// operator_loc
|
2350
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2351
|
+
|
2352
|
+
// value
|
2353
|
+
argv[2] = rb_ary_pop(value_stack);
|
2354
|
+
|
2355
|
+
// location
|
2356
|
+
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2357
|
+
|
2358
|
+
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPInstanceVariableOrWriteNode));
|
2359
|
+
break;
|
2360
|
+
}
|
1895
2361
|
#line 137 "api_node.c.erb"
|
1896
2362
|
case YP_NODE_INSTANCE_VARIABLE_READ_NODE: {
|
1897
2363
|
VALUE argv[1];
|
@@ -1902,6 +2368,16 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1902
2368
|
rb_ary_push(value_stack, rb_class_new_instance(1, argv, rb_cYARPInstanceVariableReadNode));
|
1903
2369
|
break;
|
1904
2370
|
}
|
2371
|
+
#line 137 "api_node.c.erb"
|
2372
|
+
case YP_NODE_INSTANCE_VARIABLE_TARGET_NODE: {
|
2373
|
+
VALUE argv[1];
|
2374
|
+
|
2375
|
+
// location
|
2376
|
+
argv[0] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2377
|
+
|
2378
|
+
rb_ary_push(value_stack, rb_class_new_instance(1, argv, rb_cYARPInstanceVariableTargetNode));
|
2379
|
+
break;
|
2380
|
+
}
|
1905
2381
|
#line 137 "api_node.c.erb"
|
1906
2382
|
case YP_NODE_INSTANCE_VARIABLE_WRITE_NODE: {
|
1907
2383
|
yp_instance_variable_write_node_t *cast = (yp_instance_variable_write_node_t *) node;
|
@@ -1914,7 +2390,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
1914
2390
|
argv[1] = rb_ary_pop(value_stack);
|
1915
2391
|
|
1916
2392
|
// operator_loc
|
1917
|
-
argv[2] =
|
2393
|
+
argv[2] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
1918
2394
|
|
1919
2395
|
// location
|
1920
2396
|
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
@@ -2081,7 +2557,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2081
2557
|
#line 137 "api_node.c.erb"
|
2082
2558
|
case YP_NODE_LAMBDA_NODE: {
|
2083
2559
|
yp_lambda_node_t *cast = (yp_lambda_node_t *) node;
|
2084
|
-
VALUE argv[
|
2560
|
+
VALUE argv[7];
|
2085
2561
|
|
2086
2562
|
// locals
|
2087
2563
|
argv[0] = rb_ary_new_capa(cast->locals.size);
|
@@ -2089,19 +2565,106 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2089
2565
|
rb_ary_push(argv[0], rb_id2sym(constants[cast->locals.ids[index] - 1]));
|
2090
2566
|
}
|
2091
2567
|
|
2568
|
+
// operator_loc
|
2569
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2570
|
+
|
2092
2571
|
// opening_loc
|
2093
|
-
argv[
|
2572
|
+
argv[2] = yp_location_new(parser, cast->opening_loc.start, cast->opening_loc.end, source);
|
2573
|
+
|
2574
|
+
// closing_loc
|
2575
|
+
argv[3] = yp_location_new(parser, cast->closing_loc.start, cast->closing_loc.end, source);
|
2094
2576
|
|
2095
2577
|
// parameters
|
2096
|
-
argv[
|
2578
|
+
argv[4] = rb_ary_pop(value_stack);
|
2097
2579
|
|
2098
2580
|
// body
|
2099
|
-
argv[
|
2581
|
+
argv[5] = rb_ary_pop(value_stack);
|
2100
2582
|
|
2101
2583
|
// location
|
2102
|
-
argv[
|
2584
|
+
argv[6] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2585
|
+
|
2586
|
+
rb_ary_push(value_stack, rb_class_new_instance(7, argv, rb_cYARPLambdaNode));
|
2587
|
+
break;
|
2588
|
+
}
|
2589
|
+
#line 137 "api_node.c.erb"
|
2590
|
+
case YP_NODE_LOCAL_VARIABLE_AND_WRITE_NODE: {
|
2591
|
+
yp_local_variable_and_write_node_t *cast = (yp_local_variable_and_write_node_t *) node;
|
2592
|
+
VALUE argv[6];
|
2593
|
+
|
2594
|
+
// name_loc
|
2595
|
+
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2596
|
+
|
2597
|
+
// operator_loc
|
2598
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2599
|
+
|
2600
|
+
// value
|
2601
|
+
argv[2] = rb_ary_pop(value_stack);
|
2602
|
+
|
2603
|
+
// constant_id
|
2604
|
+
argv[3] = rb_id2sym(constants[cast->constant_id - 1]);
|
2605
|
+
|
2606
|
+
// depth
|
2607
|
+
argv[4] = ULONG2NUM(cast->depth);
|
2608
|
+
|
2609
|
+
// location
|
2610
|
+
argv[5] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2611
|
+
|
2612
|
+
rb_ary_push(value_stack, rb_class_new_instance(6, argv, rb_cYARPLocalVariableAndWriteNode));
|
2613
|
+
break;
|
2614
|
+
}
|
2615
|
+
#line 137 "api_node.c.erb"
|
2616
|
+
case YP_NODE_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: {
|
2617
|
+
yp_local_variable_operator_write_node_t *cast = (yp_local_variable_operator_write_node_t *) node;
|
2618
|
+
VALUE argv[7];
|
2619
|
+
|
2620
|
+
// name_loc
|
2621
|
+
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2622
|
+
|
2623
|
+
// operator_loc
|
2624
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2625
|
+
|
2626
|
+
// value
|
2627
|
+
argv[2] = rb_ary_pop(value_stack);
|
2628
|
+
|
2629
|
+
// constant_id
|
2630
|
+
argv[3] = rb_id2sym(constants[cast->constant_id - 1]);
|
2631
|
+
|
2632
|
+
// operator_id
|
2633
|
+
argv[4] = rb_id2sym(constants[cast->operator_id - 1]);
|
2634
|
+
|
2635
|
+
// depth
|
2636
|
+
argv[5] = ULONG2NUM(cast->depth);
|
2637
|
+
|
2638
|
+
// location
|
2639
|
+
argv[6] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2640
|
+
|
2641
|
+
rb_ary_push(value_stack, rb_class_new_instance(7, argv, rb_cYARPLocalVariableOperatorWriteNode));
|
2642
|
+
break;
|
2643
|
+
}
|
2644
|
+
#line 137 "api_node.c.erb"
|
2645
|
+
case YP_NODE_LOCAL_VARIABLE_OR_WRITE_NODE: {
|
2646
|
+
yp_local_variable_or_write_node_t *cast = (yp_local_variable_or_write_node_t *) node;
|
2647
|
+
VALUE argv[6];
|
2103
2648
|
|
2104
|
-
|
2649
|
+
// name_loc
|
2650
|
+
argv[0] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2651
|
+
|
2652
|
+
// operator_loc
|
2653
|
+
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2654
|
+
|
2655
|
+
// value
|
2656
|
+
argv[2] = rb_ary_pop(value_stack);
|
2657
|
+
|
2658
|
+
// constant_id
|
2659
|
+
argv[3] = rb_id2sym(constants[cast->constant_id - 1]);
|
2660
|
+
|
2661
|
+
// depth
|
2662
|
+
argv[4] = ULONG2NUM(cast->depth);
|
2663
|
+
|
2664
|
+
// location
|
2665
|
+
argv[5] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2666
|
+
|
2667
|
+
rb_ary_push(value_stack, rb_class_new_instance(6, argv, rb_cYARPLocalVariableOrWriteNode));
|
2105
2668
|
break;
|
2106
2669
|
}
|
2107
2670
|
#line 137 "api_node.c.erb"
|
@@ -2121,6 +2684,23 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2121
2684
|
rb_ary_push(value_stack, rb_class_new_instance(3, argv, rb_cYARPLocalVariableReadNode));
|
2122
2685
|
break;
|
2123
2686
|
}
|
2687
|
+
#line 137 "api_node.c.erb"
|
2688
|
+
case YP_NODE_LOCAL_VARIABLE_TARGET_NODE: {
|
2689
|
+
yp_local_variable_target_node_t *cast = (yp_local_variable_target_node_t *) node;
|
2690
|
+
VALUE argv[3];
|
2691
|
+
|
2692
|
+
// constant_id
|
2693
|
+
argv[0] = rb_id2sym(constants[cast->constant_id - 1]);
|
2694
|
+
|
2695
|
+
// depth
|
2696
|
+
argv[1] = ULONG2NUM(cast->depth);
|
2697
|
+
|
2698
|
+
// location
|
2699
|
+
argv[2] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2700
|
+
|
2701
|
+
rb_ary_push(value_stack, rb_class_new_instance(3, argv, rb_cYARPLocalVariableTargetNode));
|
2702
|
+
break;
|
2703
|
+
}
|
2124
2704
|
#line 137 "api_node.c.erb"
|
2125
2705
|
case YP_NODE_LOCAL_VARIABLE_WRITE_NODE: {
|
2126
2706
|
yp_local_variable_write_node_t *cast = (yp_local_variable_write_node_t *) node;
|
@@ -2139,7 +2719,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2139
2719
|
argv[3] = yp_location_new(parser, cast->name_loc.start, cast->name_loc.end, source);
|
2140
2720
|
|
2141
2721
|
// operator_loc
|
2142
|
-
argv[4] =
|
2722
|
+
argv[4] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2143
2723
|
|
2144
2724
|
// location
|
2145
2725
|
argv[5] = yp_location_new(parser, node->location.start, node->location.end, source);
|
@@ -2200,7 +2780,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2200
2780
|
#line 137 "api_node.c.erb"
|
2201
2781
|
case YP_NODE_MODULE_NODE: {
|
2202
2782
|
yp_module_node_t *cast = (yp_module_node_t *) node;
|
2203
|
-
VALUE argv[
|
2783
|
+
VALUE argv[7];
|
2204
2784
|
|
2205
2785
|
// locals
|
2206
2786
|
argv[0] = rb_ary_new_capa(cast->locals.size);
|
@@ -2220,10 +2800,13 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2220
2800
|
// end_keyword_loc
|
2221
2801
|
argv[4] = yp_location_new(parser, cast->end_keyword_loc.start, cast->end_keyword_loc.end, source);
|
2222
2802
|
|
2803
|
+
// name
|
2804
|
+
argv[5] = yp_string_new(&cast->name, encoding);
|
2805
|
+
|
2223
2806
|
// location
|
2224
|
-
argv[
|
2807
|
+
argv[6] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2225
2808
|
|
2226
|
-
rb_ary_push(value_stack, rb_class_new_instance(
|
2809
|
+
rb_ary_push(value_stack, rb_class_new_instance(7, argv, rb_cYARPModuleNode));
|
2227
2810
|
break;
|
2228
2811
|
}
|
2229
2812
|
#line 137 "api_node.c.erb"
|
@@ -2309,29 +2892,6 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2309
2892
|
rb_ary_push(value_stack, rb_class_new_instance(1, argv, rb_cYARPNumberedReferenceReadNode));
|
2310
2893
|
break;
|
2311
2894
|
}
|
2312
|
-
#line 137 "api_node.c.erb"
|
2313
|
-
case YP_NODE_OPERATOR_WRITE_NODE: {
|
2314
|
-
yp_operator_write_node_t *cast = (yp_operator_write_node_t *) node;
|
2315
|
-
VALUE argv[5];
|
2316
|
-
|
2317
|
-
// target
|
2318
|
-
argv[0] = rb_ary_pop(value_stack);
|
2319
|
-
|
2320
|
-
// operator_loc
|
2321
|
-
argv[1] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2322
|
-
|
2323
|
-
// operator
|
2324
|
-
argv[2] = rb_id2sym(constants[cast->operator - 1]);
|
2325
|
-
|
2326
|
-
// value
|
2327
|
-
argv[3] = rb_ary_pop(value_stack);
|
2328
|
-
|
2329
|
-
// location
|
2330
|
-
argv[4] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2331
|
-
|
2332
|
-
rb_ary_push(value_stack, rb_class_new_instance(5, argv, rb_cYARPOperatorWriteNode));
|
2333
|
-
break;
|
2334
|
-
}
|
2335
2895
|
#line 137 "api_node.c.erb"
|
2336
2896
|
case YP_NODE_OPTIONAL_PARAMETER_NODE: {
|
2337
2897
|
yp_optional_parameter_node_t *cast = (yp_optional_parameter_node_t *) node;
|
@@ -2375,26 +2935,6 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2375
2935
|
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPOrNode));
|
2376
2936
|
break;
|
2377
2937
|
}
|
2378
|
-
#line 137 "api_node.c.erb"
|
2379
|
-
case YP_NODE_OR_WRITE_NODE: {
|
2380
|
-
yp_or_write_node_t *cast = (yp_or_write_node_t *) node;
|
2381
|
-
VALUE argv[4];
|
2382
|
-
|
2383
|
-
// target
|
2384
|
-
argv[0] = rb_ary_pop(value_stack);
|
2385
|
-
|
2386
|
-
// value
|
2387
|
-
argv[1] = rb_ary_pop(value_stack);
|
2388
|
-
|
2389
|
-
// operator_loc
|
2390
|
-
argv[2] = yp_location_new(parser, cast->operator_loc.start, cast->operator_loc.end, source);
|
2391
|
-
|
2392
|
-
// location
|
2393
|
-
argv[3] = yp_location_new(parser, node->location.start, node->location.end, source);
|
2394
|
-
|
2395
|
-
rb_ary_push(value_stack, rb_class_new_instance(4, argv, rb_cYARPOrWriteNode));
|
2396
|
-
break;
|
2397
|
-
}
|
2398
2938
|
#line 137 "api_node.c.erb"
|
2399
2939
|
case YP_NODE_PARAMETERS_NODE: {
|
2400
2940
|
yp_parameters_node_t *cast = (yp_parameters_node_t *) node;
|
@@ -2954,7 +3494,7 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
2954
3494
|
argv[0] = cast->opening_loc.start == NULL ? Qnil : yp_location_new(parser, cast->opening_loc.start, cast->opening_loc.end, source);
|
2955
3495
|
|
2956
3496
|
// value_loc
|
2957
|
-
argv[1] = yp_location_new(parser, cast->value_loc.start, cast->value_loc.end, source);
|
3497
|
+
argv[1] = cast->value_loc.start == NULL ? Qnil : yp_location_new(parser, cast->value_loc.start, cast->value_loc.end, source);
|
2958
3498
|
|
2959
3499
|
// closing_loc
|
2960
3500
|
argv[2] = cast->closing_loc.start == NULL ? Qnil : yp_location_new(parser, cast->closing_loc.start, cast->closing_loc.end, source);
|
@@ -3027,24 +3567,27 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
3027
3567
|
#line 137 "api_node.c.erb"
|
3028
3568
|
case YP_NODE_UNTIL_NODE: {
|
3029
3569
|
yp_until_node_t *cast = (yp_until_node_t *) node;
|
3030
|
-
VALUE argv[
|
3570
|
+
VALUE argv[6];
|
3031
3571
|
|
3032
3572
|
// keyword_loc
|
3033
3573
|
argv[0] = yp_location_new(parser, cast->keyword_loc.start, cast->keyword_loc.end, source);
|
3034
3574
|
|
3575
|
+
// closing_loc
|
3576
|
+
argv[1] = cast->closing_loc.start == NULL ? Qnil : yp_location_new(parser, cast->closing_loc.start, cast->closing_loc.end, source);
|
3577
|
+
|
3035
3578
|
// predicate
|
3036
|
-
argv[
|
3579
|
+
argv[2] = rb_ary_pop(value_stack);
|
3037
3580
|
|
3038
3581
|
// statements
|
3039
|
-
argv[
|
3582
|
+
argv[3] = rb_ary_pop(value_stack);
|
3040
3583
|
|
3041
3584
|
// flags
|
3042
|
-
argv[
|
3585
|
+
argv[4] = ULONG2NUM(node->flags >> 1);
|
3043
3586
|
|
3044
3587
|
// location
|
3045
|
-
argv[
|
3588
|
+
argv[5] = yp_location_new(parser, node->location.start, node->location.end, source);
|
3046
3589
|
|
3047
|
-
rb_ary_push(value_stack, rb_class_new_instance(
|
3590
|
+
rb_ary_push(value_stack, rb_class_new_instance(6, argv, rb_cYARPUntilNode));
|
3048
3591
|
break;
|
3049
3592
|
}
|
3050
3593
|
#line 137 "api_node.c.erb"
|
@@ -3073,24 +3616,27 @@ yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding) {
|
|
3073
3616
|
#line 137 "api_node.c.erb"
|
3074
3617
|
case YP_NODE_WHILE_NODE: {
|
3075
3618
|
yp_while_node_t *cast = (yp_while_node_t *) node;
|
3076
|
-
VALUE argv[
|
3619
|
+
VALUE argv[6];
|
3077
3620
|
|
3078
3621
|
// keyword_loc
|
3079
3622
|
argv[0] = yp_location_new(parser, cast->keyword_loc.start, cast->keyword_loc.end, source);
|
3080
3623
|
|
3624
|
+
// closing_loc
|
3625
|
+
argv[1] = cast->closing_loc.start == NULL ? Qnil : yp_location_new(parser, cast->closing_loc.start, cast->closing_loc.end, source);
|
3626
|
+
|
3081
3627
|
// predicate
|
3082
|
-
argv[
|
3628
|
+
argv[2] = rb_ary_pop(value_stack);
|
3083
3629
|
|
3084
3630
|
// statements
|
3085
|
-
argv[
|
3631
|
+
argv[3] = rb_ary_pop(value_stack);
|
3086
3632
|
|
3087
3633
|
// flags
|
3088
|
-
argv[
|
3634
|
+
argv[4] = ULONG2NUM(node->flags >> 1);
|
3089
3635
|
|
3090
3636
|
// location
|
3091
|
-
argv[
|
3637
|
+
argv[5] = yp_location_new(parser, node->location.start, node->location.end, source);
|
3092
3638
|
|
3093
|
-
rb_ary_push(value_stack, rb_class_new_instance(
|
3639
|
+
rb_ary_push(value_stack, rb_class_new_instance(6, argv, rb_cYARPWhileNode));
|
3094
3640
|
break;
|
3095
3641
|
}
|
3096
3642
|
#line 137 "api_node.c.erb"
|
@@ -3155,7 +3701,6 @@ Init_yarp_api_node(void) {
|
|
3155
3701
|
rb_cYARPAliasNode = rb_define_class_under(rb_cYARP, "AliasNode", rb_cYARPNode);
|
3156
3702
|
rb_cYARPAlternationPatternNode = rb_define_class_under(rb_cYARP, "AlternationPatternNode", rb_cYARPNode);
|
3157
3703
|
rb_cYARPAndNode = rb_define_class_under(rb_cYARP, "AndNode", rb_cYARPNode);
|
3158
|
-
rb_cYARPAndWriteNode = rb_define_class_under(rb_cYARP, "AndWriteNode", rb_cYARPNode);
|
3159
3704
|
rb_cYARPArgumentsNode = rb_define_class_under(rb_cYARP, "ArgumentsNode", rb_cYARPNode);
|
3160
3705
|
rb_cYARPArrayNode = rb_define_class_under(rb_cYARP, "ArrayNode", rb_cYARPNode);
|
3161
3706
|
rb_cYARPArrayPatternNode = rb_define_class_under(rb_cYARP, "ArrayPatternNode", rb_cYARPNode);
|
@@ -3175,11 +3720,23 @@ Init_yarp_api_node(void) {
|
|
3175
3720
|
rb_cYARPCapturePatternNode = rb_define_class_under(rb_cYARP, "CapturePatternNode", rb_cYARPNode);
|
3176
3721
|
rb_cYARPCaseNode = rb_define_class_under(rb_cYARP, "CaseNode", rb_cYARPNode);
|
3177
3722
|
rb_cYARPClassNode = rb_define_class_under(rb_cYARP, "ClassNode", rb_cYARPNode);
|
3723
|
+
rb_cYARPClassVariableAndWriteNode = rb_define_class_under(rb_cYARP, "ClassVariableAndWriteNode", rb_cYARPNode);
|
3724
|
+
rb_cYARPClassVariableOperatorWriteNode = rb_define_class_under(rb_cYARP, "ClassVariableOperatorWriteNode", rb_cYARPNode);
|
3725
|
+
rb_cYARPClassVariableOrWriteNode = rb_define_class_under(rb_cYARP, "ClassVariableOrWriteNode", rb_cYARPNode);
|
3178
3726
|
rb_cYARPClassVariableReadNode = rb_define_class_under(rb_cYARP, "ClassVariableReadNode", rb_cYARPNode);
|
3727
|
+
rb_cYARPClassVariableTargetNode = rb_define_class_under(rb_cYARP, "ClassVariableTargetNode", rb_cYARPNode);
|
3179
3728
|
rb_cYARPClassVariableWriteNode = rb_define_class_under(rb_cYARP, "ClassVariableWriteNode", rb_cYARPNode);
|
3729
|
+
rb_cYARPConstantAndWriteNode = rb_define_class_under(rb_cYARP, "ConstantAndWriteNode", rb_cYARPNode);
|
3730
|
+
rb_cYARPConstantOperatorWriteNode = rb_define_class_under(rb_cYARP, "ConstantOperatorWriteNode", rb_cYARPNode);
|
3731
|
+
rb_cYARPConstantOrWriteNode = rb_define_class_under(rb_cYARP, "ConstantOrWriteNode", rb_cYARPNode);
|
3732
|
+
rb_cYARPConstantPathAndWriteNode = rb_define_class_under(rb_cYARP, "ConstantPathAndWriteNode", rb_cYARPNode);
|
3180
3733
|
rb_cYARPConstantPathNode = rb_define_class_under(rb_cYARP, "ConstantPathNode", rb_cYARPNode);
|
3734
|
+
rb_cYARPConstantPathOperatorWriteNode = rb_define_class_under(rb_cYARP, "ConstantPathOperatorWriteNode", rb_cYARPNode);
|
3735
|
+
rb_cYARPConstantPathOrWriteNode = rb_define_class_under(rb_cYARP, "ConstantPathOrWriteNode", rb_cYARPNode);
|
3736
|
+
rb_cYARPConstantPathTargetNode = rb_define_class_under(rb_cYARP, "ConstantPathTargetNode", rb_cYARPNode);
|
3181
3737
|
rb_cYARPConstantPathWriteNode = rb_define_class_under(rb_cYARP, "ConstantPathWriteNode", rb_cYARPNode);
|
3182
3738
|
rb_cYARPConstantReadNode = rb_define_class_under(rb_cYARP, "ConstantReadNode", rb_cYARPNode);
|
3739
|
+
rb_cYARPConstantTargetNode = rb_define_class_under(rb_cYARP, "ConstantTargetNode", rb_cYARPNode);
|
3183
3740
|
rb_cYARPConstantWriteNode = rb_define_class_under(rb_cYARP, "ConstantWriteNode", rb_cYARPNode);
|
3184
3741
|
rb_cYARPDefNode = rb_define_class_under(rb_cYARP, "DefNode", rb_cYARPNode);
|
3185
3742
|
rb_cYARPDefinedNode = rb_define_class_under(rb_cYARP, "DefinedNode", rb_cYARPNode);
|
@@ -3195,14 +3752,22 @@ Init_yarp_api_node(void) {
|
|
3195
3752
|
rb_cYARPForwardingArgumentsNode = rb_define_class_under(rb_cYARP, "ForwardingArgumentsNode", rb_cYARPNode);
|
3196
3753
|
rb_cYARPForwardingParameterNode = rb_define_class_under(rb_cYARP, "ForwardingParameterNode", rb_cYARPNode);
|
3197
3754
|
rb_cYARPForwardingSuperNode = rb_define_class_under(rb_cYARP, "ForwardingSuperNode", rb_cYARPNode);
|
3755
|
+
rb_cYARPGlobalVariableAndWriteNode = rb_define_class_under(rb_cYARP, "GlobalVariableAndWriteNode", rb_cYARPNode);
|
3756
|
+
rb_cYARPGlobalVariableOperatorWriteNode = rb_define_class_under(rb_cYARP, "GlobalVariableOperatorWriteNode", rb_cYARPNode);
|
3757
|
+
rb_cYARPGlobalVariableOrWriteNode = rb_define_class_under(rb_cYARP, "GlobalVariableOrWriteNode", rb_cYARPNode);
|
3198
3758
|
rb_cYARPGlobalVariableReadNode = rb_define_class_under(rb_cYARP, "GlobalVariableReadNode", rb_cYARPNode);
|
3759
|
+
rb_cYARPGlobalVariableTargetNode = rb_define_class_under(rb_cYARP, "GlobalVariableTargetNode", rb_cYARPNode);
|
3199
3760
|
rb_cYARPGlobalVariableWriteNode = rb_define_class_under(rb_cYARP, "GlobalVariableWriteNode", rb_cYARPNode);
|
3200
3761
|
rb_cYARPHashNode = rb_define_class_under(rb_cYARP, "HashNode", rb_cYARPNode);
|
3201
3762
|
rb_cYARPHashPatternNode = rb_define_class_under(rb_cYARP, "HashPatternNode", rb_cYARPNode);
|
3202
3763
|
rb_cYARPIfNode = rb_define_class_under(rb_cYARP, "IfNode", rb_cYARPNode);
|
3203
3764
|
rb_cYARPImaginaryNode = rb_define_class_under(rb_cYARP, "ImaginaryNode", rb_cYARPNode);
|
3204
3765
|
rb_cYARPInNode = rb_define_class_under(rb_cYARP, "InNode", rb_cYARPNode);
|
3766
|
+
rb_cYARPInstanceVariableAndWriteNode = rb_define_class_under(rb_cYARP, "InstanceVariableAndWriteNode", rb_cYARPNode);
|
3767
|
+
rb_cYARPInstanceVariableOperatorWriteNode = rb_define_class_under(rb_cYARP, "InstanceVariableOperatorWriteNode", rb_cYARPNode);
|
3768
|
+
rb_cYARPInstanceVariableOrWriteNode = rb_define_class_under(rb_cYARP, "InstanceVariableOrWriteNode", rb_cYARPNode);
|
3205
3769
|
rb_cYARPInstanceVariableReadNode = rb_define_class_under(rb_cYARP, "InstanceVariableReadNode", rb_cYARPNode);
|
3770
|
+
rb_cYARPInstanceVariableTargetNode = rb_define_class_under(rb_cYARP, "InstanceVariableTargetNode", rb_cYARPNode);
|
3206
3771
|
rb_cYARPInstanceVariableWriteNode = rb_define_class_under(rb_cYARP, "InstanceVariableWriteNode", rb_cYARPNode);
|
3207
3772
|
rb_cYARPIntegerNode = rb_define_class_under(rb_cYARP, "IntegerNode", rb_cYARPNode);
|
3208
3773
|
rb_cYARPInterpolatedRegularExpressionNode = rb_define_class_under(rb_cYARP, "InterpolatedRegularExpressionNode", rb_cYARPNode);
|
@@ -3213,7 +3778,11 @@ Init_yarp_api_node(void) {
|
|
3213
3778
|
rb_cYARPKeywordParameterNode = rb_define_class_under(rb_cYARP, "KeywordParameterNode", rb_cYARPNode);
|
3214
3779
|
rb_cYARPKeywordRestParameterNode = rb_define_class_under(rb_cYARP, "KeywordRestParameterNode", rb_cYARPNode);
|
3215
3780
|
rb_cYARPLambdaNode = rb_define_class_under(rb_cYARP, "LambdaNode", rb_cYARPNode);
|
3781
|
+
rb_cYARPLocalVariableAndWriteNode = rb_define_class_under(rb_cYARP, "LocalVariableAndWriteNode", rb_cYARPNode);
|
3782
|
+
rb_cYARPLocalVariableOperatorWriteNode = rb_define_class_under(rb_cYARP, "LocalVariableOperatorWriteNode", rb_cYARPNode);
|
3783
|
+
rb_cYARPLocalVariableOrWriteNode = rb_define_class_under(rb_cYARP, "LocalVariableOrWriteNode", rb_cYARPNode);
|
3216
3784
|
rb_cYARPLocalVariableReadNode = rb_define_class_under(rb_cYARP, "LocalVariableReadNode", rb_cYARPNode);
|
3785
|
+
rb_cYARPLocalVariableTargetNode = rb_define_class_under(rb_cYARP, "LocalVariableTargetNode", rb_cYARPNode);
|
3217
3786
|
rb_cYARPLocalVariableWriteNode = rb_define_class_under(rb_cYARP, "LocalVariableWriteNode", rb_cYARPNode);
|
3218
3787
|
rb_cYARPMatchPredicateNode = rb_define_class_under(rb_cYARP, "MatchPredicateNode", rb_cYARPNode);
|
3219
3788
|
rb_cYARPMatchRequiredNode = rb_define_class_under(rb_cYARP, "MatchRequiredNode", rb_cYARPNode);
|
@@ -3224,10 +3793,8 @@ Init_yarp_api_node(void) {
|
|
3224
3793
|
rb_cYARPNilNode = rb_define_class_under(rb_cYARP, "NilNode", rb_cYARPNode);
|
3225
3794
|
rb_cYARPNoKeywordsParameterNode = rb_define_class_under(rb_cYARP, "NoKeywordsParameterNode", rb_cYARPNode);
|
3226
3795
|
rb_cYARPNumberedReferenceReadNode = rb_define_class_under(rb_cYARP, "NumberedReferenceReadNode", rb_cYARPNode);
|
3227
|
-
rb_cYARPOperatorWriteNode = rb_define_class_under(rb_cYARP, "OperatorWriteNode", rb_cYARPNode);
|
3228
3796
|
rb_cYARPOptionalParameterNode = rb_define_class_under(rb_cYARP, "OptionalParameterNode", rb_cYARPNode);
|
3229
3797
|
rb_cYARPOrNode = rb_define_class_under(rb_cYARP, "OrNode", rb_cYARPNode);
|
3230
|
-
rb_cYARPOrWriteNode = rb_define_class_under(rb_cYARP, "OrWriteNode", rb_cYARPNode);
|
3231
3798
|
rb_cYARPParametersNode = rb_define_class_under(rb_cYARP, "ParametersNode", rb_cYARPNode);
|
3232
3799
|
rb_cYARPParenthesesNode = rb_define_class_under(rb_cYARP, "ParenthesesNode", rb_cYARPNode);
|
3233
3800
|
rb_cYARPPinnedExpressionNode = rb_define_class_under(rb_cYARP, "PinnedExpressionNode", rb_cYARPNode);
|