yarp 0.7.0 → 0.8.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 +21 -2
- data/Makefile +2 -0
- data/README.md +5 -2
- data/config.yml +54 -267
- data/ext/yarp/api_node.c +135 -579
- data/ext/yarp/extension.c +2 -2
- data/ext/yarp/extension.h +1 -1
- data/include/yarp/ast.h +142 -285
- data/include/yarp/defines.h +5 -0
- data/include/yarp/unescape.h +1 -1
- data/include/yarp/util/yp_buffer.h +9 -1
- data/include/yarp/util/yp_constant_pool.h +3 -0
- data/include/yarp/util/yp_list.h +7 -7
- data/include/yarp/util/yp_newline_list.h +4 -0
- data/include/yarp/util/yp_state_stack.h +1 -1
- data/include/yarp/version.h +2 -2
- data/lib/yarp/ffi.rb +62 -47
- data/lib/yarp/node.rb +504 -1399
- data/lib/yarp/serialize.rb +111 -141
- data/lib/yarp.rb +6 -6
- data/src/node.c +70 -250
- data/src/prettyprint.c +41 -185
- data/src/serialize.c +35 -133
- data/src/unescape.c +29 -35
- data/src/util/yp_buffer.c +18 -0
- data/src/util/yp_list.c +7 -16
- data/src/util/yp_state_stack.c +0 -6
- data/src/yarp.c +265 -670
- data/yarp.gemspec +1 -1
- metadata +2 -2
data/src/prettyprint.c
CHANGED
@@ -47,6 +47,14 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
47
47
|
yp_buffer_append_str(buffer, ")", 1);
|
48
48
|
break;
|
49
49
|
}
|
50
|
+
case YP_NODE_AND_WRITE_NODE: {
|
51
|
+
yp_buffer_append_str(buffer, "AndWriteNode(", 13);
|
52
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_and_write_node_t *)node)->target);
|
53
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_and_write_node_t *)node)->value);
|
54
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_and_write_node_t *)node)->operator_loc);
|
55
|
+
yp_buffer_append_str(buffer, ")", 1);
|
56
|
+
break;
|
57
|
+
}
|
50
58
|
case YP_NODE_ARGUMENTS_NODE: {
|
51
59
|
yp_buffer_append_str(buffer, "ArgumentsNode(", 14);
|
52
60
|
yp_buffer_append_str(buffer, "[", 1);
|
@@ -209,10 +217,10 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
209
217
|
} else {
|
210
218
|
prettyprint_node(buffer, parser, (yp_node_t *)((yp_block_node_t *)node)->parameters);
|
211
219
|
}
|
212
|
-
yp_buffer_append_str(buffer, ", ", 2); if (((yp_block_node_t *)node)->
|
220
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_block_node_t *)node)->body == NULL) {
|
213
221
|
yp_buffer_append_str(buffer, "nil", 3);
|
214
222
|
} else {
|
215
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((yp_block_node_t *)node)->
|
223
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_block_node_t *)node)->body);
|
216
224
|
}
|
217
225
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_block_node_t *)node)->opening_loc);
|
218
226
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_block_node_t *)node)->closing_loc);
|
@@ -393,42 +401,15 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
393
401
|
} else {
|
394
402
|
prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_node_t *)node)->superclass);
|
395
403
|
}
|
396
|
-
yp_buffer_append_str(buffer, ", ", 2); if (((yp_class_node_t *)node)->
|
404
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_class_node_t *)node)->body == NULL) {
|
397
405
|
yp_buffer_append_str(buffer, "nil", 3);
|
398
406
|
} else {
|
399
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_node_t *)node)->
|
407
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_node_t *)node)->body);
|
400
408
|
}
|
401
409
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_class_node_t *)node)->end_keyword_loc);
|
402
410
|
yp_buffer_append_str(buffer, ")", 1);
|
403
411
|
break;
|
404
412
|
}
|
405
|
-
case YP_NODE_CLASS_VARIABLE_OPERATOR_AND_WRITE_NODE: {
|
406
|
-
yp_buffer_append_str(buffer, "ClassVariableOperatorAndWriteNode(", 34);
|
407
|
-
prettyprint_location(buffer, parser, &((yp_class_variable_operator_and_write_node_t *)node)->name_loc);
|
408
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_class_variable_operator_and_write_node_t *)node)->operator_loc);
|
409
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_variable_operator_and_write_node_t *)node)->value);
|
410
|
-
yp_buffer_append_str(buffer, ")", 1);
|
411
|
-
break;
|
412
|
-
}
|
413
|
-
case YP_NODE_CLASS_VARIABLE_OPERATOR_OR_WRITE_NODE: {
|
414
|
-
yp_buffer_append_str(buffer, "ClassVariableOperatorOrWriteNode(", 33);
|
415
|
-
prettyprint_location(buffer, parser, &((yp_class_variable_operator_or_write_node_t *)node)->name_loc);
|
416
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_class_variable_operator_or_write_node_t *)node)->operator_loc);
|
417
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_variable_operator_or_write_node_t *)node)->value);
|
418
|
-
yp_buffer_append_str(buffer, ")", 1);
|
419
|
-
break;
|
420
|
-
}
|
421
|
-
case YP_NODE_CLASS_VARIABLE_OPERATOR_WRITE_NODE: {
|
422
|
-
yp_buffer_append_str(buffer, "ClassVariableOperatorWriteNode(", 31);
|
423
|
-
prettyprint_location(buffer, parser, &((yp_class_variable_operator_write_node_t *)node)->name_loc);
|
424
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_class_variable_operator_write_node_t *)node)->operator_loc);
|
425
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_variable_operator_write_node_t *)node)->value);
|
426
|
-
yp_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
|
427
|
-
snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((yp_class_variable_operator_write_node_t *)node)->operator);
|
428
|
-
yp_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
|
429
|
-
yp_buffer_append_str(buffer, ")", 1);
|
430
|
-
break;
|
431
|
-
}
|
432
413
|
case YP_NODE_CLASS_VARIABLE_READ_NODE: {
|
433
414
|
yp_buffer_append_str(buffer, "ClassVariableReadNode(", 22);
|
434
415
|
yp_buffer_append_str(buffer, ")", 1);
|
@@ -450,33 +431,6 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
450
431
|
yp_buffer_append_str(buffer, ")", 1);
|
451
432
|
break;
|
452
433
|
}
|
453
|
-
case YP_NODE_CONSTANT_OPERATOR_AND_WRITE_NODE: {
|
454
|
-
yp_buffer_append_str(buffer, "ConstantOperatorAndWriteNode(", 29);
|
455
|
-
prettyprint_location(buffer, parser, &((yp_constant_operator_and_write_node_t *)node)->name_loc);
|
456
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_operator_and_write_node_t *)node)->operator_loc);
|
457
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_operator_and_write_node_t *)node)->value);
|
458
|
-
yp_buffer_append_str(buffer, ")", 1);
|
459
|
-
break;
|
460
|
-
}
|
461
|
-
case YP_NODE_CONSTANT_OPERATOR_OR_WRITE_NODE: {
|
462
|
-
yp_buffer_append_str(buffer, "ConstantOperatorOrWriteNode(", 28);
|
463
|
-
prettyprint_location(buffer, parser, &((yp_constant_operator_or_write_node_t *)node)->name_loc);
|
464
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_operator_or_write_node_t *)node)->operator_loc);
|
465
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_operator_or_write_node_t *)node)->value);
|
466
|
-
yp_buffer_append_str(buffer, ")", 1);
|
467
|
-
break;
|
468
|
-
}
|
469
|
-
case YP_NODE_CONSTANT_OPERATOR_WRITE_NODE: {
|
470
|
-
yp_buffer_append_str(buffer, "ConstantOperatorWriteNode(", 26);
|
471
|
-
prettyprint_location(buffer, parser, &((yp_constant_operator_write_node_t *)node)->name_loc);
|
472
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_operator_write_node_t *)node)->operator_loc);
|
473
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_operator_write_node_t *)node)->value);
|
474
|
-
yp_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
|
475
|
-
snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((yp_constant_operator_write_node_t *)node)->operator);
|
476
|
-
yp_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
|
477
|
-
yp_buffer_append_str(buffer, ")", 1);
|
478
|
-
break;
|
479
|
-
}
|
480
434
|
case YP_NODE_CONSTANT_PATH_NODE: {
|
481
435
|
yp_buffer_append_str(buffer, "ConstantPathNode(", 17);
|
482
436
|
if (((yp_constant_path_node_t *)node)->parent == NULL) {
|
@@ -489,33 +443,6 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
489
443
|
yp_buffer_append_str(buffer, ")", 1);
|
490
444
|
break;
|
491
445
|
}
|
492
|
-
case YP_NODE_CONSTANT_PATH_OPERATOR_AND_WRITE_NODE: {
|
493
|
-
yp_buffer_append_str(buffer, "ConstantPathOperatorAndWriteNode(", 33);
|
494
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_operator_and_write_node_t *)node)->target);
|
495
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_path_operator_and_write_node_t *)node)->operator_loc);
|
496
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_operator_and_write_node_t *)node)->value);
|
497
|
-
yp_buffer_append_str(buffer, ")", 1);
|
498
|
-
break;
|
499
|
-
}
|
500
|
-
case YP_NODE_CONSTANT_PATH_OPERATOR_OR_WRITE_NODE: {
|
501
|
-
yp_buffer_append_str(buffer, "ConstantPathOperatorOrWriteNode(", 32);
|
502
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_operator_or_write_node_t *)node)->target);
|
503
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_path_operator_or_write_node_t *)node)->operator_loc);
|
504
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_operator_or_write_node_t *)node)->value);
|
505
|
-
yp_buffer_append_str(buffer, ")", 1);
|
506
|
-
break;
|
507
|
-
}
|
508
|
-
case YP_NODE_CONSTANT_PATH_OPERATOR_WRITE_NODE: {
|
509
|
-
yp_buffer_append_str(buffer, "ConstantPathOperatorWriteNode(", 30);
|
510
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_operator_write_node_t *)node)->target);
|
511
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_path_operator_write_node_t *)node)->operator_loc);
|
512
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_operator_write_node_t *)node)->value);
|
513
|
-
yp_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
|
514
|
-
snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((yp_constant_path_operator_write_node_t *)node)->operator);
|
515
|
-
yp_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
|
516
|
-
yp_buffer_append_str(buffer, ")", 1);
|
517
|
-
break;
|
518
|
-
}
|
519
446
|
case YP_NODE_CONSTANT_PATH_WRITE_NODE: {
|
520
447
|
yp_buffer_append_str(buffer, "ConstantPathWriteNode(", 22);
|
521
448
|
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_write_node_t *)node)->target);
|
@@ -566,10 +493,10 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
566
493
|
} else {
|
567
494
|
prettyprint_node(buffer, parser, (yp_node_t *)((yp_def_node_t *)node)->parameters);
|
568
495
|
}
|
569
|
-
yp_buffer_append_str(buffer, ", ", 2); if (((yp_def_node_t *)node)->
|
496
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_def_node_t *)node)->body == NULL) {
|
570
497
|
yp_buffer_append_str(buffer, "nil", 3);
|
571
498
|
} else {
|
572
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((yp_def_node_t *)node)->
|
499
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_def_node_t *)node)->body);
|
573
500
|
}
|
574
501
|
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
575
502
|
for (uint32_t index = 0; index < ((yp_def_node_t *)node)->locals.size; index++) {
|
@@ -769,33 +696,6 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
769
696
|
yp_buffer_append_str(buffer, ")", 1);
|
770
697
|
break;
|
771
698
|
}
|
772
|
-
case YP_NODE_GLOBAL_VARIABLE_OPERATOR_AND_WRITE_NODE: {
|
773
|
-
yp_buffer_append_str(buffer, "GlobalVariableOperatorAndWriteNode(", 35);
|
774
|
-
prettyprint_location(buffer, parser, &((yp_global_variable_operator_and_write_node_t *)node)->name_loc);
|
775
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_global_variable_operator_and_write_node_t *)node)->operator_loc);
|
776
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_global_variable_operator_and_write_node_t *)node)->value);
|
777
|
-
yp_buffer_append_str(buffer, ")", 1);
|
778
|
-
break;
|
779
|
-
}
|
780
|
-
case YP_NODE_GLOBAL_VARIABLE_OPERATOR_OR_WRITE_NODE: {
|
781
|
-
yp_buffer_append_str(buffer, "GlobalVariableOperatorOrWriteNode(", 34);
|
782
|
-
prettyprint_location(buffer, parser, &((yp_global_variable_operator_or_write_node_t *)node)->name_loc);
|
783
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_global_variable_operator_or_write_node_t *)node)->operator_loc);
|
784
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_global_variable_operator_or_write_node_t *)node)->value);
|
785
|
-
yp_buffer_append_str(buffer, ")", 1);
|
786
|
-
break;
|
787
|
-
}
|
788
|
-
case YP_NODE_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: {
|
789
|
-
yp_buffer_append_str(buffer, "GlobalVariableOperatorWriteNode(", 32);
|
790
|
-
prettyprint_location(buffer, parser, &((yp_global_variable_operator_write_node_t *)node)->name_loc);
|
791
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_global_variable_operator_write_node_t *)node)->operator_loc);
|
792
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_global_variable_operator_write_node_t *)node)->value);
|
793
|
-
yp_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
|
794
|
-
snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((yp_global_variable_operator_write_node_t *)node)->operator);
|
795
|
-
yp_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
|
796
|
-
yp_buffer_append_str(buffer, ")", 1);
|
797
|
-
break;
|
798
|
-
}
|
799
699
|
case YP_NODE_GLOBAL_VARIABLE_READ_NODE: {
|
800
700
|
yp_buffer_append_str(buffer, "GlobalVariableReadNode(", 23);
|
801
701
|
yp_buffer_append_str(buffer, ")", 1);
|
@@ -910,33 +810,6 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
910
810
|
yp_buffer_append_str(buffer, ")", 1);
|
911
811
|
break;
|
912
812
|
}
|
913
|
-
case YP_NODE_INSTANCE_VARIABLE_OPERATOR_AND_WRITE_NODE: {
|
914
|
-
yp_buffer_append_str(buffer, "InstanceVariableOperatorAndWriteNode(", 37);
|
915
|
-
prettyprint_location(buffer, parser, &((yp_instance_variable_operator_and_write_node_t *)node)->name_loc);
|
916
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_instance_variable_operator_and_write_node_t *)node)->operator_loc);
|
917
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_instance_variable_operator_and_write_node_t *)node)->value);
|
918
|
-
yp_buffer_append_str(buffer, ")", 1);
|
919
|
-
break;
|
920
|
-
}
|
921
|
-
case YP_NODE_INSTANCE_VARIABLE_OPERATOR_OR_WRITE_NODE: {
|
922
|
-
yp_buffer_append_str(buffer, "InstanceVariableOperatorOrWriteNode(", 36);
|
923
|
-
prettyprint_location(buffer, parser, &((yp_instance_variable_operator_or_write_node_t *)node)->name_loc);
|
924
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_instance_variable_operator_or_write_node_t *)node)->operator_loc);
|
925
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_instance_variable_operator_or_write_node_t *)node)->value);
|
926
|
-
yp_buffer_append_str(buffer, ")", 1);
|
927
|
-
break;
|
928
|
-
}
|
929
|
-
case YP_NODE_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: {
|
930
|
-
yp_buffer_append_str(buffer, "InstanceVariableOperatorWriteNode(", 34);
|
931
|
-
prettyprint_location(buffer, parser, &((yp_instance_variable_operator_write_node_t *)node)->name_loc);
|
932
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_instance_variable_operator_write_node_t *)node)->operator_loc);
|
933
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_instance_variable_operator_write_node_t *)node)->value);
|
934
|
-
yp_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
|
935
|
-
snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((yp_instance_variable_operator_write_node_t *)node)->operator);
|
936
|
-
yp_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
|
937
|
-
yp_buffer_append_str(buffer, ")", 1);
|
938
|
-
break;
|
939
|
-
}
|
940
813
|
case YP_NODE_INSTANCE_VARIABLE_READ_NODE: {
|
941
814
|
yp_buffer_append_str(buffer, "InstanceVariableReadNode(", 25);
|
942
815
|
yp_buffer_append_str(buffer, ")", 1);
|
@@ -1083,50 +956,14 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1083
956
|
} else {
|
1084
957
|
prettyprint_node(buffer, parser, (yp_node_t *)((yp_lambda_node_t *)node)->parameters);
|
1085
958
|
}
|
1086
|
-
yp_buffer_append_str(buffer, ", ", 2); if (((yp_lambda_node_t *)node)->
|
959
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_lambda_node_t *)node)->body == NULL) {
|
1087
960
|
yp_buffer_append_str(buffer, "nil", 3);
|
1088
961
|
} else {
|
1089
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((yp_lambda_node_t *)node)->
|
962
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_lambda_node_t *)node)->body);
|
1090
963
|
}
|
1091
964
|
yp_buffer_append_str(buffer, ")", 1);
|
1092
965
|
break;
|
1093
966
|
}
|
1094
|
-
case YP_NODE_LOCAL_VARIABLE_OPERATOR_AND_WRITE_NODE: {
|
1095
|
-
yp_buffer_append_str(buffer, "LocalVariableOperatorAndWriteNode(", 34);
|
1096
|
-
prettyprint_location(buffer, parser, &((yp_local_variable_operator_and_write_node_t *)node)->name_loc);
|
1097
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_local_variable_operator_and_write_node_t *)node)->operator_loc);
|
1098
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_local_variable_operator_and_write_node_t *)node)->value);
|
1099
|
-
yp_buffer_append_str(buffer, ", ", 2); char constant_id_buffer[12];
|
1100
|
-
snprintf(constant_id_buffer, sizeof(constant_id_buffer), "%u", ((yp_local_variable_operator_and_write_node_t *)node)->constant_id);
|
1101
|
-
yp_buffer_append_str(buffer, constant_id_buffer, strlen(constant_id_buffer));
|
1102
|
-
yp_buffer_append_str(buffer, ")", 1);
|
1103
|
-
break;
|
1104
|
-
}
|
1105
|
-
case YP_NODE_LOCAL_VARIABLE_OPERATOR_OR_WRITE_NODE: {
|
1106
|
-
yp_buffer_append_str(buffer, "LocalVariableOperatorOrWriteNode(", 33);
|
1107
|
-
prettyprint_location(buffer, parser, &((yp_local_variable_operator_or_write_node_t *)node)->name_loc);
|
1108
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_local_variable_operator_or_write_node_t *)node)->operator_loc);
|
1109
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_local_variable_operator_or_write_node_t *)node)->value);
|
1110
|
-
yp_buffer_append_str(buffer, ", ", 2); char constant_id_buffer[12];
|
1111
|
-
snprintf(constant_id_buffer, sizeof(constant_id_buffer), "%u", ((yp_local_variable_operator_or_write_node_t *)node)->constant_id);
|
1112
|
-
yp_buffer_append_str(buffer, constant_id_buffer, strlen(constant_id_buffer));
|
1113
|
-
yp_buffer_append_str(buffer, ")", 1);
|
1114
|
-
break;
|
1115
|
-
}
|
1116
|
-
case YP_NODE_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: {
|
1117
|
-
yp_buffer_append_str(buffer, "LocalVariableOperatorWriteNode(", 31);
|
1118
|
-
prettyprint_location(buffer, parser, &((yp_local_variable_operator_write_node_t *)node)->name_loc);
|
1119
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_local_variable_operator_write_node_t *)node)->operator_loc);
|
1120
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_local_variable_operator_write_node_t *)node)->value);
|
1121
|
-
yp_buffer_append_str(buffer, ", ", 2); char constant_id_buffer[12];
|
1122
|
-
snprintf(constant_id_buffer, sizeof(constant_id_buffer), "%u", ((yp_local_variable_operator_write_node_t *)node)->constant_id);
|
1123
|
-
yp_buffer_append_str(buffer, constant_id_buffer, strlen(constant_id_buffer));
|
1124
|
-
yp_buffer_append_str(buffer, ", ", 2); char operator_id_buffer[12];
|
1125
|
-
snprintf(operator_id_buffer, sizeof(operator_id_buffer), "%u", ((yp_local_variable_operator_write_node_t *)node)->operator_id);
|
1126
|
-
yp_buffer_append_str(buffer, operator_id_buffer, strlen(operator_id_buffer));
|
1127
|
-
yp_buffer_append_str(buffer, ")", 1);
|
1128
|
-
break;
|
1129
|
-
}
|
1130
967
|
case YP_NODE_LOCAL_VARIABLE_READ_NODE: {
|
1131
968
|
yp_buffer_append_str(buffer, "LocalVariableReadNode(", 22);
|
1132
969
|
char constant_id_buffer[12];
|
@@ -1193,10 +1030,10 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1193
1030
|
yp_buffer_append_str(buffer, "]", 1);
|
1194
1031
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_module_node_t *)node)->module_keyword_loc);
|
1195
1032
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_module_node_t *)node)->constant_path);
|
1196
|
-
yp_buffer_append_str(buffer, ", ", 2); if (((yp_module_node_t *)node)->
|
1033
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_module_node_t *)node)->body == NULL) {
|
1197
1034
|
yp_buffer_append_str(buffer, "nil", 3);
|
1198
1035
|
} else {
|
1199
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((yp_module_node_t *)node)->
|
1036
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_module_node_t *)node)->body);
|
1200
1037
|
}
|
1201
1038
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_module_node_t *)node)->end_keyword_loc);
|
1202
1039
|
yp_buffer_append_str(buffer, ")", 1);
|
@@ -1261,6 +1098,17 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1261
1098
|
yp_buffer_append_str(buffer, ")", 1);
|
1262
1099
|
break;
|
1263
1100
|
}
|
1101
|
+
case YP_NODE_OPERATOR_WRITE_NODE: {
|
1102
|
+
yp_buffer_append_str(buffer, "OperatorWriteNode(", 18);
|
1103
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_operator_write_node_t *)node)->target);
|
1104
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_operator_write_node_t *)node)->operator_loc);
|
1105
|
+
yp_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
|
1106
|
+
snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((yp_operator_write_node_t *)node)->operator);
|
1107
|
+
yp_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
|
1108
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_operator_write_node_t *)node)->value);
|
1109
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1110
|
+
break;
|
1111
|
+
}
|
1264
1112
|
case YP_NODE_OPTIONAL_PARAMETER_NODE: {
|
1265
1113
|
yp_buffer_append_str(buffer, "OptionalParameterNode(", 22);
|
1266
1114
|
char constant_id_buffer[12];
|
@@ -1280,6 +1128,14 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1280
1128
|
yp_buffer_append_str(buffer, ")", 1);
|
1281
1129
|
break;
|
1282
1130
|
}
|
1131
|
+
case YP_NODE_OR_WRITE_NODE: {
|
1132
|
+
yp_buffer_append_str(buffer, "OrWriteNode(", 12);
|
1133
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_or_write_node_t *)node)->target);
|
1134
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_or_write_node_t *)node)->value);
|
1135
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_or_write_node_t *)node)->operator_loc);
|
1136
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1137
|
+
break;
|
1138
|
+
}
|
1283
1139
|
case YP_NODE_PARAMETERS_NODE: {
|
1284
1140
|
yp_buffer_append_str(buffer, "ParametersNode(", 15);
|
1285
1141
|
yp_buffer_append_str(buffer, "[", 1);
|
@@ -1326,10 +1182,10 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1326
1182
|
}
|
1327
1183
|
case YP_NODE_PARENTHESES_NODE: {
|
1328
1184
|
yp_buffer_append_str(buffer, "ParenthesesNode(", 16);
|
1329
|
-
if (((yp_parentheses_node_t *)node)->
|
1185
|
+
if (((yp_parentheses_node_t *)node)->body == NULL) {
|
1330
1186
|
yp_buffer_append_str(buffer, "nil", 3);
|
1331
1187
|
} else {
|
1332
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((yp_parentheses_node_t *)node)->
|
1188
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_parentheses_node_t *)node)->body);
|
1333
1189
|
}
|
1334
1190
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_parentheses_node_t *)node)->opening_loc);
|
1335
1191
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_parentheses_node_t *)node)->closing_loc);
|
@@ -1542,10 +1398,10 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1542
1398
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_singleton_class_node_t *)node)->class_keyword_loc);
|
1543
1399
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_singleton_class_node_t *)node)->operator_loc);
|
1544
1400
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_singleton_class_node_t *)node)->expression);
|
1545
|
-
yp_buffer_append_str(buffer, ", ", 2); if (((yp_singleton_class_node_t *)node)->
|
1401
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_singleton_class_node_t *)node)->body == NULL) {
|
1546
1402
|
yp_buffer_append_str(buffer, "nil", 3);
|
1547
1403
|
} else {
|
1548
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((yp_singleton_class_node_t *)node)->
|
1404
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_singleton_class_node_t *)node)->body);
|
1549
1405
|
}
|
1550
1406
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_singleton_class_node_t *)node)->end_keyword_loc);
|
1551
1407
|
yp_buffer_append_str(buffer, ")", 1);
|