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/src/prettyprint.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/src/prettyprint.c.erb */
|
5
5
|
/* if you are looking to modify the */
|
6
6
|
/* template */
|
@@ -23,6 +23,10 @@ prettyprint_location(yp_buffer_t *buffer, yp_parser_t *parser, yp_location_t *lo
|
|
23
23
|
static void
|
24
24
|
prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
25
25
|
switch (YP_NODE_TYPE(node)) {
|
26
|
+
// We do not need to print a ScopeNode as it's not part
|
27
|
+
// of the AST
|
28
|
+
case YP_NODE_SCOPE_NODE:
|
29
|
+
return;
|
26
30
|
case YP_NODE_ALIAS_NODE: {
|
27
31
|
yp_buffer_append_str(buffer, "AliasNode(", 10);
|
28
32
|
prettyprint_node(buffer, parser, (yp_node_t *)((yp_alias_node_t *)node)->new_name);
|
@@ -47,14 +51,6 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
47
51
|
yp_buffer_append_str(buffer, ")", 1);
|
48
52
|
break;
|
49
53
|
}
|
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
|
-
}
|
58
54
|
case YP_NODE_ARGUMENTS_NODE: {
|
59
55
|
yp_buffer_append_str(buffer, "ArgumentsNode(", 14);
|
60
56
|
yp_buffer_append_str(buffer, "[", 1);
|
@@ -407,6 +403,36 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
407
403
|
prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_node_t *)node)->body);
|
408
404
|
}
|
409
405
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_class_node_t *)node)->end_keyword_loc);
|
406
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "\"", 1);
|
407
|
+
yp_buffer_append_str(buffer, yp_string_source(&((yp_class_node_t *)node)->name), yp_string_length(&((yp_class_node_t *)node)->name));
|
408
|
+
yp_buffer_append_str(buffer, "\"", 1);
|
409
|
+
yp_buffer_append_str(buffer, ")", 1);
|
410
|
+
break;
|
411
|
+
}
|
412
|
+
case YP_NODE_CLASS_VARIABLE_AND_WRITE_NODE: {
|
413
|
+
yp_buffer_append_str(buffer, "ClassVariableAndWriteNode(", 26);
|
414
|
+
prettyprint_location(buffer, parser, &((yp_class_variable_and_write_node_t *)node)->name_loc);
|
415
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_class_variable_and_write_node_t *)node)->operator_loc);
|
416
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_variable_and_write_node_t *)node)->value);
|
417
|
+
yp_buffer_append_str(buffer, ")", 1);
|
418
|
+
break;
|
419
|
+
}
|
420
|
+
case YP_NODE_CLASS_VARIABLE_OPERATOR_WRITE_NODE: {
|
421
|
+
yp_buffer_append_str(buffer, "ClassVariableOperatorWriteNode(", 31);
|
422
|
+
prettyprint_location(buffer, parser, &((yp_class_variable_operator_write_node_t *)node)->name_loc);
|
423
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_class_variable_operator_write_node_t *)node)->operator_loc);
|
424
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_variable_operator_write_node_t *)node)->value);
|
425
|
+
yp_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
|
426
|
+
snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((yp_class_variable_operator_write_node_t *)node)->operator);
|
427
|
+
yp_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
|
428
|
+
yp_buffer_append_str(buffer, ")", 1);
|
429
|
+
break;
|
430
|
+
}
|
431
|
+
case YP_NODE_CLASS_VARIABLE_OR_WRITE_NODE: {
|
432
|
+
yp_buffer_append_str(buffer, "ClassVariableOrWriteNode(", 25);
|
433
|
+
prettyprint_location(buffer, parser, &((yp_class_variable_or_write_node_t *)node)->name_loc);
|
434
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_class_variable_or_write_node_t *)node)->operator_loc);
|
435
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_class_variable_or_write_node_t *)node)->value);
|
410
436
|
yp_buffer_append_str(buffer, ")", 1);
|
411
437
|
break;
|
412
438
|
}
|
@@ -415,6 +441,11 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
415
441
|
yp_buffer_append_str(buffer, ")", 1);
|
416
442
|
break;
|
417
443
|
}
|
444
|
+
case YP_NODE_CLASS_VARIABLE_TARGET_NODE: {
|
445
|
+
yp_buffer_append_str(buffer, "ClassVariableTargetNode(", 24);
|
446
|
+
yp_buffer_append_str(buffer, ")", 1);
|
447
|
+
break;
|
448
|
+
}
|
418
449
|
case YP_NODE_CLASS_VARIABLE_WRITE_NODE: {
|
419
450
|
yp_buffer_append_str(buffer, "ClassVariableWriteNode(", 23);
|
420
451
|
prettyprint_location(buffer, parser, &((yp_class_variable_write_node_t *)node)->name_loc);
|
@@ -431,6 +462,41 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
431
462
|
yp_buffer_append_str(buffer, ")", 1);
|
432
463
|
break;
|
433
464
|
}
|
465
|
+
case YP_NODE_CONSTANT_AND_WRITE_NODE: {
|
466
|
+
yp_buffer_append_str(buffer, "ConstantAndWriteNode(", 21);
|
467
|
+
prettyprint_location(buffer, parser, &((yp_constant_and_write_node_t *)node)->name_loc);
|
468
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_and_write_node_t *)node)->operator_loc);
|
469
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_and_write_node_t *)node)->value);
|
470
|
+
yp_buffer_append_str(buffer, ")", 1);
|
471
|
+
break;
|
472
|
+
}
|
473
|
+
case YP_NODE_CONSTANT_OPERATOR_WRITE_NODE: {
|
474
|
+
yp_buffer_append_str(buffer, "ConstantOperatorWriteNode(", 26);
|
475
|
+
prettyprint_location(buffer, parser, &((yp_constant_operator_write_node_t *)node)->name_loc);
|
476
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_operator_write_node_t *)node)->operator_loc);
|
477
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_operator_write_node_t *)node)->value);
|
478
|
+
yp_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
|
479
|
+
snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((yp_constant_operator_write_node_t *)node)->operator);
|
480
|
+
yp_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
|
481
|
+
yp_buffer_append_str(buffer, ")", 1);
|
482
|
+
break;
|
483
|
+
}
|
484
|
+
case YP_NODE_CONSTANT_OR_WRITE_NODE: {
|
485
|
+
yp_buffer_append_str(buffer, "ConstantOrWriteNode(", 20);
|
486
|
+
prettyprint_location(buffer, parser, &((yp_constant_or_write_node_t *)node)->name_loc);
|
487
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_or_write_node_t *)node)->operator_loc);
|
488
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_or_write_node_t *)node)->value);
|
489
|
+
yp_buffer_append_str(buffer, ")", 1);
|
490
|
+
break;
|
491
|
+
}
|
492
|
+
case YP_NODE_CONSTANT_PATH_AND_WRITE_NODE: {
|
493
|
+
yp_buffer_append_str(buffer, "ConstantPathAndWriteNode(", 25);
|
494
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_and_write_node_t *)node)->target);
|
495
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_path_and_write_node_t *)node)->operator_loc);
|
496
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_and_write_node_t *)node)->value);
|
497
|
+
yp_buffer_append_str(buffer, ")", 1);
|
498
|
+
break;
|
499
|
+
}
|
434
500
|
case YP_NODE_CONSTANT_PATH_NODE: {
|
435
501
|
yp_buffer_append_str(buffer, "ConstantPathNode(", 17);
|
436
502
|
if (((yp_constant_path_node_t *)node)->parent == NULL) {
|
@@ -443,19 +509,42 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
443
509
|
yp_buffer_append_str(buffer, ")", 1);
|
444
510
|
break;
|
445
511
|
}
|
446
|
-
case
|
447
|
-
yp_buffer_append_str(buffer, "
|
448
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((
|
449
|
-
yp_buffer_append_str(buffer, ", ", 2);
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
yp_buffer_append_str(buffer, "
|
512
|
+
case YP_NODE_CONSTANT_PATH_OPERATOR_WRITE_NODE: {
|
513
|
+
yp_buffer_append_str(buffer, "ConstantPathOperatorWriteNode(", 30);
|
514
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_operator_write_node_t *)node)->target);
|
515
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_path_operator_write_node_t *)node)->operator_loc);
|
516
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_operator_write_node_t *)node)->value);
|
517
|
+
yp_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
|
518
|
+
snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((yp_constant_path_operator_write_node_t *)node)->operator);
|
519
|
+
yp_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
|
520
|
+
yp_buffer_append_str(buffer, ")", 1);
|
521
|
+
break;
|
522
|
+
}
|
523
|
+
case YP_NODE_CONSTANT_PATH_OR_WRITE_NODE: {
|
524
|
+
yp_buffer_append_str(buffer, "ConstantPathOrWriteNode(", 24);
|
525
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_or_write_node_t *)node)->target);
|
526
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_path_or_write_node_t *)node)->operator_loc);
|
527
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_or_write_node_t *)node)->value);
|
528
|
+
yp_buffer_append_str(buffer, ")", 1);
|
529
|
+
break;
|
530
|
+
}
|
531
|
+
case YP_NODE_CONSTANT_PATH_TARGET_NODE: {
|
532
|
+
yp_buffer_append_str(buffer, "ConstantPathTargetNode(", 23);
|
533
|
+
if (((yp_constant_path_target_node_t *)node)->parent == NULL) {
|
455
534
|
yp_buffer_append_str(buffer, "nil", 3);
|
456
535
|
} else {
|
457
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((
|
536
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_target_node_t *)node)->parent);
|
458
537
|
}
|
538
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_target_node_t *)node)->child);
|
539
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_path_target_node_t *)node)->delimiter_loc);
|
540
|
+
yp_buffer_append_str(buffer, ")", 1);
|
541
|
+
break;
|
542
|
+
}
|
543
|
+
case YP_NODE_CONSTANT_PATH_WRITE_NODE: {
|
544
|
+
yp_buffer_append_str(buffer, "ConstantPathWriteNode(", 22);
|
545
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_write_node_t *)node)->target);
|
546
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_path_write_node_t *)node)->operator_loc);
|
547
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_path_write_node_t *)node)->value);
|
459
548
|
yp_buffer_append_str(buffer, ")", 1);
|
460
549
|
break;
|
461
550
|
}
|
@@ -464,19 +553,16 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
464
553
|
yp_buffer_append_str(buffer, ")", 1);
|
465
554
|
break;
|
466
555
|
}
|
556
|
+
case YP_NODE_CONSTANT_TARGET_NODE: {
|
557
|
+
yp_buffer_append_str(buffer, "ConstantTargetNode(", 19);
|
558
|
+
yp_buffer_append_str(buffer, ")", 1);
|
559
|
+
break;
|
560
|
+
}
|
467
561
|
case YP_NODE_CONSTANT_WRITE_NODE: {
|
468
562
|
yp_buffer_append_str(buffer, "ConstantWriteNode(", 18);
|
469
563
|
prettyprint_location(buffer, parser, &((yp_constant_write_node_t *)node)->name_loc);
|
470
|
-
yp_buffer_append_str(buffer, ", ", 2);
|
471
|
-
|
472
|
-
} else {
|
473
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_write_node_t *)node)->value);
|
474
|
-
}
|
475
|
-
yp_buffer_append_str(buffer, ", ", 2); if (((yp_constant_write_node_t *)node)->operator_loc.start == NULL) {
|
476
|
-
yp_buffer_append_str(buffer, "nil", 3);
|
477
|
-
} else {
|
478
|
-
prettyprint_location(buffer, parser, &((yp_constant_write_node_t *)node)->operator_loc);
|
479
|
-
}
|
564
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_constant_write_node_t *)node)->value);
|
565
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_constant_write_node_t *)node)->operator_loc);
|
480
566
|
yp_buffer_append_str(buffer, ")", 1);
|
481
567
|
break;
|
482
568
|
}
|
@@ -696,24 +782,48 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
696
782
|
yp_buffer_append_str(buffer, ")", 1);
|
697
783
|
break;
|
698
784
|
}
|
785
|
+
case YP_NODE_GLOBAL_VARIABLE_AND_WRITE_NODE: {
|
786
|
+
yp_buffer_append_str(buffer, "GlobalVariableAndWriteNode(", 27);
|
787
|
+
prettyprint_location(buffer, parser, &((yp_global_variable_and_write_node_t *)node)->name_loc);
|
788
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_global_variable_and_write_node_t *)node)->operator_loc);
|
789
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_global_variable_and_write_node_t *)node)->value);
|
790
|
+
yp_buffer_append_str(buffer, ")", 1);
|
791
|
+
break;
|
792
|
+
}
|
793
|
+
case YP_NODE_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: {
|
794
|
+
yp_buffer_append_str(buffer, "GlobalVariableOperatorWriteNode(", 32);
|
795
|
+
prettyprint_location(buffer, parser, &((yp_global_variable_operator_write_node_t *)node)->name_loc);
|
796
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_global_variable_operator_write_node_t *)node)->operator_loc);
|
797
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_global_variable_operator_write_node_t *)node)->value);
|
798
|
+
yp_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
|
799
|
+
snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((yp_global_variable_operator_write_node_t *)node)->operator);
|
800
|
+
yp_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
|
801
|
+
yp_buffer_append_str(buffer, ")", 1);
|
802
|
+
break;
|
803
|
+
}
|
804
|
+
case YP_NODE_GLOBAL_VARIABLE_OR_WRITE_NODE: {
|
805
|
+
yp_buffer_append_str(buffer, "GlobalVariableOrWriteNode(", 26);
|
806
|
+
prettyprint_location(buffer, parser, &((yp_global_variable_or_write_node_t *)node)->name_loc);
|
807
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_global_variable_or_write_node_t *)node)->operator_loc);
|
808
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_global_variable_or_write_node_t *)node)->value);
|
809
|
+
yp_buffer_append_str(buffer, ")", 1);
|
810
|
+
break;
|
811
|
+
}
|
699
812
|
case YP_NODE_GLOBAL_VARIABLE_READ_NODE: {
|
700
813
|
yp_buffer_append_str(buffer, "GlobalVariableReadNode(", 23);
|
701
814
|
yp_buffer_append_str(buffer, ")", 1);
|
702
815
|
break;
|
703
816
|
}
|
817
|
+
case YP_NODE_GLOBAL_VARIABLE_TARGET_NODE: {
|
818
|
+
yp_buffer_append_str(buffer, "GlobalVariableTargetNode(", 25);
|
819
|
+
yp_buffer_append_str(buffer, ")", 1);
|
820
|
+
break;
|
821
|
+
}
|
704
822
|
case YP_NODE_GLOBAL_VARIABLE_WRITE_NODE: {
|
705
823
|
yp_buffer_append_str(buffer, "GlobalVariableWriteNode(", 24);
|
706
824
|
prettyprint_location(buffer, parser, &((yp_global_variable_write_node_t *)node)->name_loc);
|
707
|
-
yp_buffer_append_str(buffer, ", ", 2);
|
708
|
-
|
709
|
-
} else {
|
710
|
-
prettyprint_location(buffer, parser, &((yp_global_variable_write_node_t *)node)->operator_loc);
|
711
|
-
}
|
712
|
-
yp_buffer_append_str(buffer, ", ", 2); if (((yp_global_variable_write_node_t *)node)->value == NULL) {
|
713
|
-
yp_buffer_append_str(buffer, "nil", 3);
|
714
|
-
} else {
|
715
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((yp_global_variable_write_node_t *)node)->value);
|
716
|
-
}
|
825
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_global_variable_write_node_t *)node)->operator_loc);
|
826
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_global_variable_write_node_t *)node)->value);
|
717
827
|
yp_buffer_append_str(buffer, ")", 1);
|
718
828
|
break;
|
719
829
|
}
|
@@ -810,24 +920,48 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
810
920
|
yp_buffer_append_str(buffer, ")", 1);
|
811
921
|
break;
|
812
922
|
}
|
923
|
+
case YP_NODE_INSTANCE_VARIABLE_AND_WRITE_NODE: {
|
924
|
+
yp_buffer_append_str(buffer, "InstanceVariableAndWriteNode(", 29);
|
925
|
+
prettyprint_location(buffer, parser, &((yp_instance_variable_and_write_node_t *)node)->name_loc);
|
926
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_instance_variable_and_write_node_t *)node)->operator_loc);
|
927
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_instance_variable_and_write_node_t *)node)->value);
|
928
|
+
yp_buffer_append_str(buffer, ")", 1);
|
929
|
+
break;
|
930
|
+
}
|
931
|
+
case YP_NODE_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: {
|
932
|
+
yp_buffer_append_str(buffer, "InstanceVariableOperatorWriteNode(", 34);
|
933
|
+
prettyprint_location(buffer, parser, &((yp_instance_variable_operator_write_node_t *)node)->name_loc);
|
934
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_instance_variable_operator_write_node_t *)node)->operator_loc);
|
935
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_instance_variable_operator_write_node_t *)node)->value);
|
936
|
+
yp_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
|
937
|
+
snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((yp_instance_variable_operator_write_node_t *)node)->operator);
|
938
|
+
yp_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
|
939
|
+
yp_buffer_append_str(buffer, ")", 1);
|
940
|
+
break;
|
941
|
+
}
|
942
|
+
case YP_NODE_INSTANCE_VARIABLE_OR_WRITE_NODE: {
|
943
|
+
yp_buffer_append_str(buffer, "InstanceVariableOrWriteNode(", 28);
|
944
|
+
prettyprint_location(buffer, parser, &((yp_instance_variable_or_write_node_t *)node)->name_loc);
|
945
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_instance_variable_or_write_node_t *)node)->operator_loc);
|
946
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_instance_variable_or_write_node_t *)node)->value);
|
947
|
+
yp_buffer_append_str(buffer, ")", 1);
|
948
|
+
break;
|
949
|
+
}
|
813
950
|
case YP_NODE_INSTANCE_VARIABLE_READ_NODE: {
|
814
951
|
yp_buffer_append_str(buffer, "InstanceVariableReadNode(", 25);
|
815
952
|
yp_buffer_append_str(buffer, ")", 1);
|
816
953
|
break;
|
817
954
|
}
|
955
|
+
case YP_NODE_INSTANCE_VARIABLE_TARGET_NODE: {
|
956
|
+
yp_buffer_append_str(buffer, "InstanceVariableTargetNode(", 27);
|
957
|
+
yp_buffer_append_str(buffer, ")", 1);
|
958
|
+
break;
|
959
|
+
}
|
818
960
|
case YP_NODE_INSTANCE_VARIABLE_WRITE_NODE: {
|
819
961
|
yp_buffer_append_str(buffer, "InstanceVariableWriteNode(", 26);
|
820
962
|
prettyprint_location(buffer, parser, &((yp_instance_variable_write_node_t *)node)->name_loc);
|
821
|
-
yp_buffer_append_str(buffer, ", ", 2);
|
822
|
-
|
823
|
-
} else {
|
824
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((yp_instance_variable_write_node_t *)node)->value);
|
825
|
-
}
|
826
|
-
yp_buffer_append_str(buffer, ", ", 2); if (((yp_instance_variable_write_node_t *)node)->operator_loc.start == NULL) {
|
827
|
-
yp_buffer_append_str(buffer, "nil", 3);
|
828
|
-
} else {
|
829
|
-
prettyprint_location(buffer, parser, &((yp_instance_variable_write_node_t *)node)->operator_loc);
|
830
|
-
}
|
963
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_instance_variable_write_node_t *)node)->value);
|
964
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_instance_variable_write_node_t *)node)->operator_loc);
|
831
965
|
yp_buffer_append_str(buffer, ")", 1);
|
832
966
|
break;
|
833
967
|
}
|
@@ -950,7 +1084,9 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
950
1084
|
yp_buffer_append_str(buffer, locals_buffer, strlen(locals_buffer));
|
951
1085
|
}
|
952
1086
|
yp_buffer_append_str(buffer, "]", 1);
|
1087
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_lambda_node_t *)node)->operator_loc);
|
953
1088
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_lambda_node_t *)node)->opening_loc);
|
1089
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_lambda_node_t *)node)->closing_loc);
|
954
1090
|
yp_buffer_append_str(buffer, ", ", 2); if (((yp_lambda_node_t *)node)->parameters == NULL) {
|
955
1091
|
yp_buffer_append_str(buffer, "nil", 3);
|
956
1092
|
} else {
|
@@ -964,6 +1100,51 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
964
1100
|
yp_buffer_append_str(buffer, ")", 1);
|
965
1101
|
break;
|
966
1102
|
}
|
1103
|
+
case YP_NODE_LOCAL_VARIABLE_AND_WRITE_NODE: {
|
1104
|
+
yp_buffer_append_str(buffer, "LocalVariableAndWriteNode(", 26);
|
1105
|
+
prettyprint_location(buffer, parser, &((yp_local_variable_and_write_node_t *)node)->name_loc);
|
1106
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_local_variable_and_write_node_t *)node)->operator_loc);
|
1107
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_local_variable_and_write_node_t *)node)->value);
|
1108
|
+
yp_buffer_append_str(buffer, ", ", 2); char constant_id_buffer[12];
|
1109
|
+
snprintf(constant_id_buffer, sizeof(constant_id_buffer), "%u", ((yp_local_variable_and_write_node_t *)node)->constant_id);
|
1110
|
+
yp_buffer_append_str(buffer, constant_id_buffer, strlen(constant_id_buffer));
|
1111
|
+
yp_buffer_append_str(buffer, ", ", 2); char depth_buffer[12];
|
1112
|
+
snprintf(depth_buffer, sizeof(depth_buffer), "+%d", ((yp_local_variable_and_write_node_t *)node)->depth);
|
1113
|
+
yp_buffer_append_str(buffer, depth_buffer, strlen(depth_buffer));
|
1114
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1115
|
+
break;
|
1116
|
+
}
|
1117
|
+
case YP_NODE_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: {
|
1118
|
+
yp_buffer_append_str(buffer, "LocalVariableOperatorWriteNode(", 31);
|
1119
|
+
prettyprint_location(buffer, parser, &((yp_local_variable_operator_write_node_t *)node)->name_loc);
|
1120
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_local_variable_operator_write_node_t *)node)->operator_loc);
|
1121
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_local_variable_operator_write_node_t *)node)->value);
|
1122
|
+
yp_buffer_append_str(buffer, ", ", 2); char constant_id_buffer[12];
|
1123
|
+
snprintf(constant_id_buffer, sizeof(constant_id_buffer), "%u", ((yp_local_variable_operator_write_node_t *)node)->constant_id);
|
1124
|
+
yp_buffer_append_str(buffer, constant_id_buffer, strlen(constant_id_buffer));
|
1125
|
+
yp_buffer_append_str(buffer, ", ", 2); char operator_id_buffer[12];
|
1126
|
+
snprintf(operator_id_buffer, sizeof(operator_id_buffer), "%u", ((yp_local_variable_operator_write_node_t *)node)->operator_id);
|
1127
|
+
yp_buffer_append_str(buffer, operator_id_buffer, strlen(operator_id_buffer));
|
1128
|
+
yp_buffer_append_str(buffer, ", ", 2); char depth_buffer[12];
|
1129
|
+
snprintf(depth_buffer, sizeof(depth_buffer), "+%d", ((yp_local_variable_operator_write_node_t *)node)->depth);
|
1130
|
+
yp_buffer_append_str(buffer, depth_buffer, strlen(depth_buffer));
|
1131
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1132
|
+
break;
|
1133
|
+
}
|
1134
|
+
case YP_NODE_LOCAL_VARIABLE_OR_WRITE_NODE: {
|
1135
|
+
yp_buffer_append_str(buffer, "LocalVariableOrWriteNode(", 25);
|
1136
|
+
prettyprint_location(buffer, parser, &((yp_local_variable_or_write_node_t *)node)->name_loc);
|
1137
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_local_variable_or_write_node_t *)node)->operator_loc);
|
1138
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_local_variable_or_write_node_t *)node)->value);
|
1139
|
+
yp_buffer_append_str(buffer, ", ", 2); char constant_id_buffer[12];
|
1140
|
+
snprintf(constant_id_buffer, sizeof(constant_id_buffer), "%u", ((yp_local_variable_or_write_node_t *)node)->constant_id);
|
1141
|
+
yp_buffer_append_str(buffer, constant_id_buffer, strlen(constant_id_buffer));
|
1142
|
+
yp_buffer_append_str(buffer, ", ", 2); char depth_buffer[12];
|
1143
|
+
snprintf(depth_buffer, sizeof(depth_buffer), "+%d", ((yp_local_variable_or_write_node_t *)node)->depth);
|
1144
|
+
yp_buffer_append_str(buffer, depth_buffer, strlen(depth_buffer));
|
1145
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1146
|
+
break;
|
1147
|
+
}
|
967
1148
|
case YP_NODE_LOCAL_VARIABLE_READ_NODE: {
|
968
1149
|
yp_buffer_append_str(buffer, "LocalVariableReadNode(", 22);
|
969
1150
|
char constant_id_buffer[12];
|
@@ -975,6 +1156,17 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
975
1156
|
yp_buffer_append_str(buffer, ")", 1);
|
976
1157
|
break;
|
977
1158
|
}
|
1159
|
+
case YP_NODE_LOCAL_VARIABLE_TARGET_NODE: {
|
1160
|
+
yp_buffer_append_str(buffer, "LocalVariableTargetNode(", 24);
|
1161
|
+
char constant_id_buffer[12];
|
1162
|
+
snprintf(constant_id_buffer, sizeof(constant_id_buffer), "%u", ((yp_local_variable_target_node_t *)node)->constant_id);
|
1163
|
+
yp_buffer_append_str(buffer, constant_id_buffer, strlen(constant_id_buffer));
|
1164
|
+
yp_buffer_append_str(buffer, ", ", 2); char depth_buffer[12];
|
1165
|
+
snprintf(depth_buffer, sizeof(depth_buffer), "+%d", ((yp_local_variable_target_node_t *)node)->depth);
|
1166
|
+
yp_buffer_append_str(buffer, depth_buffer, strlen(depth_buffer));
|
1167
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1168
|
+
break;
|
1169
|
+
}
|
978
1170
|
case YP_NODE_LOCAL_VARIABLE_WRITE_NODE: {
|
979
1171
|
yp_buffer_append_str(buffer, "LocalVariableWriteNode(", 23);
|
980
1172
|
char constant_id_buffer[12];
|
@@ -983,17 +1175,9 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
983
1175
|
yp_buffer_append_str(buffer, ", ", 2); char depth_buffer[12];
|
984
1176
|
snprintf(depth_buffer, sizeof(depth_buffer), "+%d", ((yp_local_variable_write_node_t *)node)->depth);
|
985
1177
|
yp_buffer_append_str(buffer, depth_buffer, strlen(depth_buffer));
|
986
|
-
yp_buffer_append_str(buffer, ", ", 2);
|
987
|
-
yp_buffer_append_str(buffer, "nil", 3);
|
988
|
-
} else {
|
989
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((yp_local_variable_write_node_t *)node)->value);
|
990
|
-
}
|
1178
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_local_variable_write_node_t *)node)->value);
|
991
1179
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_local_variable_write_node_t *)node)->name_loc);
|
992
|
-
yp_buffer_append_str(buffer, ", ", 2);
|
993
|
-
yp_buffer_append_str(buffer, "nil", 3);
|
994
|
-
} else {
|
995
|
-
prettyprint_location(buffer, parser, &((yp_local_variable_write_node_t *)node)->operator_loc);
|
996
|
-
}
|
1180
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_local_variable_write_node_t *)node)->operator_loc);
|
997
1181
|
yp_buffer_append_str(buffer, ")", 1);
|
998
1182
|
break;
|
999
1183
|
}
|
@@ -1036,6 +1220,9 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1036
1220
|
prettyprint_node(buffer, parser, (yp_node_t *)((yp_module_node_t *)node)->body);
|
1037
1221
|
}
|
1038
1222
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_module_node_t *)node)->end_keyword_loc);
|
1223
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "\"", 1);
|
1224
|
+
yp_buffer_append_str(buffer, yp_string_source(&((yp_module_node_t *)node)->name), yp_string_length(&((yp_module_node_t *)node)->name));
|
1225
|
+
yp_buffer_append_str(buffer, "\"", 1);
|
1039
1226
|
yp_buffer_append_str(buffer, ")", 1);
|
1040
1227
|
break;
|
1041
1228
|
}
|
@@ -1098,17 +1285,6 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1098
1285
|
yp_buffer_append_str(buffer, ")", 1);
|
1099
1286
|
break;
|
1100
1287
|
}
|
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
|
-
}
|
1112
1288
|
case YP_NODE_OPTIONAL_PARAMETER_NODE: {
|
1113
1289
|
yp_buffer_append_str(buffer, "OptionalParameterNode(", 22);
|
1114
1290
|
char constant_id_buffer[12];
|
@@ -1128,14 +1304,6 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1128
1304
|
yp_buffer_append_str(buffer, ")", 1);
|
1129
1305
|
break;
|
1130
1306
|
}
|
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
|
-
}
|
1139
1307
|
case YP_NODE_PARAMETERS_NODE: {
|
1140
1308
|
yp_buffer_append_str(buffer, "ParametersNode(", 15);
|
1141
1309
|
yp_buffer_append_str(buffer, "[", 1);
|
@@ -1506,7 +1674,11 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1506
1674
|
} else {
|
1507
1675
|
prettyprint_location(buffer, parser, &((yp_symbol_node_t *)node)->opening_loc);
|
1508
1676
|
}
|
1509
|
-
yp_buffer_append_str(buffer, ", ", 2);
|
1677
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_symbol_node_t *)node)->value_loc.start == NULL) {
|
1678
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1679
|
+
} else {
|
1680
|
+
prettyprint_location(buffer, parser, &((yp_symbol_node_t *)node)->value_loc);
|
1681
|
+
}
|
1510
1682
|
yp_buffer_append_str(buffer, ", ", 2); if (((yp_symbol_node_t *)node)->closing_loc.start == NULL) {
|
1511
1683
|
yp_buffer_append_str(buffer, "nil", 3);
|
1512
1684
|
} else {
|
@@ -1560,6 +1732,11 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1560
1732
|
case YP_NODE_UNTIL_NODE: {
|
1561
1733
|
yp_buffer_append_str(buffer, "UntilNode(", 10);
|
1562
1734
|
prettyprint_location(buffer, parser, &((yp_until_node_t *)node)->keyword_loc);
|
1735
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_until_node_t *)node)->closing_loc.start == NULL) {
|
1736
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1737
|
+
} else {
|
1738
|
+
prettyprint_location(buffer, parser, &((yp_until_node_t *)node)->closing_loc);
|
1739
|
+
}
|
1563
1740
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_until_node_t *)node)->predicate);
|
1564
1741
|
yp_buffer_append_str(buffer, ", ", 2); if (((yp_until_node_t *)node)->statements == NULL) {
|
1565
1742
|
yp_buffer_append_str(buffer, "nil", 3);
|
@@ -1592,6 +1769,11 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1592
1769
|
case YP_NODE_WHILE_NODE: {
|
1593
1770
|
yp_buffer_append_str(buffer, "WhileNode(", 10);
|
1594
1771
|
prettyprint_location(buffer, parser, &((yp_while_node_t *)node)->keyword_loc);
|
1772
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_while_node_t *)node)->closing_loc.start == NULL) {
|
1773
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1774
|
+
} else {
|
1775
|
+
prettyprint_location(buffer, parser, &((yp_while_node_t *)node)->closing_loc);
|
1776
|
+
}
|
1595
1777
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_while_node_t *)node)->predicate);
|
1596
1778
|
yp_buffer_append_str(buffer, ", ", 2); if (((yp_while_node_t *)node)->statements == NULL) {
|
1597
1779
|
yp_buffer_append_str(buffer, "nil", 3);
|