yarp 0.11.0 → 0.12.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 +26 -1
- data/config.yml +105 -6
- data/ext/yarp/api_node.c +200 -34
- data/ext/yarp/extension.c +8 -1
- data/ext/yarp/extension.h +1 -1
- data/include/yarp/ast.h +246 -293
- data/include/yarp/diagnostic.h +7 -2
- data/include/yarp/enc/yp_encoding.h +1 -1
- data/include/yarp/parser.h +44 -16
- data/include/yarp/util/yp_char.h +21 -5
- data/include/yarp/version.h +2 -2
- data/lib/yarp/mutation_visitor.rb +28 -3
- data/lib/yarp/node.rb +3507 -85
- data/lib/yarp/serialize.rb +146 -136
- data/lib/yarp.rb +57 -42
- data/src/diagnostic.c +6 -1
- data/src/enc/yp_unicode.c +5 -5
- data/src/node.c +87 -8
- data/src/prettyprint.c +85 -21
- data/src/serialize.c +59 -19
- data/src/util/yp_char.c +57 -9
- data/src/util/yp_constant_pool.c +69 -18
- data/src/yarp.c +1528 -1018
- data/yarp.gemspec +1 -1
- metadata +3 -3
data/src/enc/yp_unicode.c
CHANGED
@@ -10,7 +10,7 @@ typedef uint32_t yp_unicode_codepoint_t;
|
|
10
10
|
// this table is different from other encodings where we used a lookup table
|
11
11
|
// because the indices of those tables are the byte representations, not the
|
12
12
|
// codepoints themselves.
|
13
|
-
uint8_t yp_encoding_unicode_table[256] = {
|
13
|
+
const uint8_t yp_encoding_unicode_table[256] = {
|
14
14
|
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
15
15
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
16
16
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
@@ -31,7 +31,7 @@ uint8_t yp_encoding_unicode_table[256] = {
|
|
31
31
|
};
|
32
32
|
|
33
33
|
#define UNICODE_ALPHA_CODEPOINTS_LENGTH 1450
|
34
|
-
static yp_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEPOINTS_LENGTH] = {
|
34
|
+
static const yp_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEPOINTS_LENGTH] = {
|
35
35
|
0x100, 0x2C1,
|
36
36
|
0x2C6, 0x2D1,
|
37
37
|
0x2E0, 0x2E4,
|
@@ -760,7 +760,7 @@ static yp_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEPOINTS_
|
|
760
760
|
};
|
761
761
|
|
762
762
|
#define UNICODE_ALNUM_CODEPOINTS_LENGTH 1528
|
763
|
-
static yp_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEPOINTS_LENGTH] = {
|
763
|
+
static const yp_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEPOINTS_LENGTH] = {
|
764
764
|
0x100, 0x2C1,
|
765
765
|
0x2C6, 0x2D1,
|
766
766
|
0x2E0, 0x2E4,
|
@@ -1528,7 +1528,7 @@ static yp_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEPOINTS_
|
|
1528
1528
|
};
|
1529
1529
|
|
1530
1530
|
#define UNICODE_ISUPPER_CODEPOINTS_LENGTH 1296
|
1531
|
-
static yp_unicode_codepoint_t unicode_isupper_codepoints[UNICODE_ISUPPER_CODEPOINTS_LENGTH] = {
|
1531
|
+
static const yp_unicode_codepoint_t unicode_isupper_codepoints[UNICODE_ISUPPER_CODEPOINTS_LENGTH] = {
|
1532
1532
|
0x100, 0x100,
|
1533
1533
|
0x102, 0x102,
|
1534
1534
|
0x104, 0x104,
|
@@ -2180,7 +2180,7 @@ static yp_unicode_codepoint_t unicode_isupper_codepoints[UNICODE_ISUPPER_CODEPOI
|
|
2180
2180
|
};
|
2181
2181
|
|
2182
2182
|
static bool
|
2183
|
-
yp_unicode_codepoint_match(yp_unicode_codepoint_t codepoint, yp_unicode_codepoint_t *codepoints, size_t size) {
|
2183
|
+
yp_unicode_codepoint_match(yp_unicode_codepoint_t codepoint, const yp_unicode_codepoint_t *codepoints, size_t size) {
|
2184
2184
|
size_t start = 0;
|
2185
2185
|
size_t end = size;
|
2186
2186
|
|
data/src/node.c
CHANGED
@@ -60,8 +60,15 @@ YP_EXPORTED_FUNCTION void
|
|
60
60
|
yp_node_destroy(yp_parser_t *parser, yp_node_t *node) {
|
61
61
|
switch (YP_NODE_TYPE(node)) {
|
62
62
|
#line 57 "node.c.erb"
|
63
|
-
case
|
64
|
-
|
63
|
+
case YP_ALIAS_GLOBAL_VARIABLE_NODE: {
|
64
|
+
yp_alias_global_variable_node_t *cast = (yp_alias_global_variable_node_t *) node;
|
65
|
+
yp_node_destroy(parser, (yp_node_t *)cast->new_name);
|
66
|
+
yp_node_destroy(parser, (yp_node_t *)cast->old_name);
|
67
|
+
break;
|
68
|
+
}
|
69
|
+
#line 57 "node.c.erb"
|
70
|
+
case YP_ALIAS_METHOD_NODE: {
|
71
|
+
yp_alias_method_node_t *cast = (yp_alias_method_node_t *) node;
|
65
72
|
yp_node_destroy(parser, (yp_node_t *)cast->new_name);
|
66
73
|
yp_node_destroy(parser, (yp_node_t *)cast->old_name);
|
67
74
|
break;
|
@@ -562,6 +569,12 @@ yp_node_destroy(yp_parser_t *parser, yp_node_t *node) {
|
|
562
569
|
yp_node_destroy(parser, (yp_node_t *)cast->numeric);
|
563
570
|
break;
|
564
571
|
}
|
572
|
+
#line 57 "node.c.erb"
|
573
|
+
case YP_IMPLICIT_NODE: {
|
574
|
+
yp_implicit_node_t *cast = (yp_implicit_node_t *) node;
|
575
|
+
yp_node_destroy(parser, (yp_node_t *)cast->value);
|
576
|
+
break;
|
577
|
+
}
|
565
578
|
#line 57 "node.c.erb"
|
566
579
|
case YP_IN_NODE: {
|
567
580
|
yp_in_node_t *cast = (yp_in_node_t *) node;
|
@@ -607,6 +620,12 @@ yp_node_destroy(yp_parser_t *parser, yp_node_t *node) {
|
|
607
620
|
case YP_INTEGER_NODE: {
|
608
621
|
break;
|
609
622
|
}
|
623
|
+
#line 57 "node.c.erb"
|
624
|
+
case YP_INTERPOLATED_MATCH_LAST_LINE_NODE: {
|
625
|
+
yp_interpolated_match_last_line_node_t *cast = (yp_interpolated_match_last_line_node_t *) node;
|
626
|
+
yp_node_list_free(parser, &cast->parts);
|
627
|
+
break;
|
628
|
+
}
|
610
629
|
#line 57 "node.c.erb"
|
611
630
|
case YP_INTERPOLATED_REGULAR_EXPRESSION_NODE: {
|
612
631
|
yp_interpolated_regular_expression_node_t *cast = (yp_interpolated_regular_expression_node_t *) node;
|
@@ -693,6 +712,12 @@ yp_node_destroy(yp_parser_t *parser, yp_node_t *node) {
|
|
693
712
|
yp_node_destroy(parser, (yp_node_t *)cast->value);
|
694
713
|
break;
|
695
714
|
}
|
715
|
+
#line 57 "node.c.erb"
|
716
|
+
case YP_MATCH_LAST_LINE_NODE: {
|
717
|
+
yp_match_last_line_node_t *cast = (yp_match_last_line_node_t *) node;
|
718
|
+
yp_string_free(&cast->unescaped);
|
719
|
+
break;
|
720
|
+
}
|
696
721
|
#line 57 "node.c.erb"
|
697
722
|
case YP_MATCH_PREDICATE_NODE: {
|
698
723
|
yp_match_predicate_node_t *cast = (yp_match_predicate_node_t *) node;
|
@@ -707,6 +732,13 @@ yp_node_destroy(yp_parser_t *parser, yp_node_t *node) {
|
|
707
732
|
yp_node_destroy(parser, (yp_node_t *)cast->pattern);
|
708
733
|
break;
|
709
734
|
}
|
735
|
+
#line 57 "node.c.erb"
|
736
|
+
case YP_MATCH_WRITE_NODE: {
|
737
|
+
yp_match_write_node_t *cast = (yp_match_write_node_t *) node;
|
738
|
+
yp_node_destroy(parser, (yp_node_t *)cast->call);
|
739
|
+
yp_constant_id_list_free(&cast->locals);
|
740
|
+
break;
|
741
|
+
}
|
710
742
|
#line 57 "node.c.erb"
|
711
743
|
case YP_MISSING_NODE: {
|
712
744
|
break;
|
@@ -772,10 +804,10 @@ yp_node_destroy(yp_parser_t *parser, yp_node_t *node) {
|
|
772
804
|
yp_parameters_node_t *cast = (yp_parameters_node_t *) node;
|
773
805
|
yp_node_list_free(parser, &cast->requireds);
|
774
806
|
yp_node_list_free(parser, &cast->optionals);
|
775
|
-
yp_node_list_free(parser, &cast->posts);
|
776
807
|
if (cast->rest != NULL) {
|
777
808
|
yp_node_destroy(parser, (yp_node_t *)cast->rest);
|
778
809
|
}
|
810
|
+
yp_node_list_free(parser, &cast->posts);
|
779
811
|
yp_node_list_free(parser, &cast->keywords);
|
780
812
|
if (cast->keyword_rest != NULL) {
|
781
813
|
yp_node_destroy(parser, (yp_node_t *)cast->keyword_rest);
|
@@ -1056,8 +1088,16 @@ yp_node_memsize_node(yp_node_t *node, yp_memsize_t *memsize) {
|
|
1056
1088
|
case YP_SCOPE_NODE:
|
1057
1089
|
return;
|
1058
1090
|
#line 102 "node.c.erb"
|
1059
|
-
case
|
1060
|
-
|
1091
|
+
case YP_ALIAS_GLOBAL_VARIABLE_NODE: {
|
1092
|
+
yp_alias_global_variable_node_t *cast = (yp_alias_global_variable_node_t *) node;
|
1093
|
+
memsize->memsize += sizeof(*cast);
|
1094
|
+
yp_node_memsize_node((yp_node_t *)cast->new_name, memsize);
|
1095
|
+
yp_node_memsize_node((yp_node_t *)cast->old_name, memsize);
|
1096
|
+
break;
|
1097
|
+
}
|
1098
|
+
#line 102 "node.c.erb"
|
1099
|
+
case YP_ALIAS_METHOD_NODE: {
|
1100
|
+
yp_alias_method_node_t *cast = (yp_alias_method_node_t *) node;
|
1061
1101
|
memsize->memsize += sizeof(*cast);
|
1062
1102
|
yp_node_memsize_node((yp_node_t *)cast->new_name, memsize);
|
1063
1103
|
yp_node_memsize_node((yp_node_t *)cast->old_name, memsize);
|
@@ -1636,6 +1676,13 @@ yp_node_memsize_node(yp_node_t *node, yp_memsize_t *memsize) {
|
|
1636
1676
|
yp_node_memsize_node((yp_node_t *)cast->numeric, memsize);
|
1637
1677
|
break;
|
1638
1678
|
}
|
1679
|
+
#line 102 "node.c.erb"
|
1680
|
+
case YP_IMPLICIT_NODE: {
|
1681
|
+
yp_implicit_node_t *cast = (yp_implicit_node_t *) node;
|
1682
|
+
memsize->memsize += sizeof(*cast);
|
1683
|
+
yp_node_memsize_node((yp_node_t *)cast->value, memsize);
|
1684
|
+
break;
|
1685
|
+
}
|
1639
1686
|
#line 102 "node.c.erb"
|
1640
1687
|
case YP_IN_NODE: {
|
1641
1688
|
yp_in_node_t *cast = (yp_in_node_t *) node;
|
@@ -1692,6 +1739,13 @@ yp_node_memsize_node(yp_node_t *node, yp_memsize_t *memsize) {
|
|
1692
1739
|
memsize->memsize += sizeof(*cast);
|
1693
1740
|
break;
|
1694
1741
|
}
|
1742
|
+
#line 102 "node.c.erb"
|
1743
|
+
case YP_INTERPOLATED_MATCH_LAST_LINE_NODE: {
|
1744
|
+
yp_interpolated_match_last_line_node_t *cast = (yp_interpolated_match_last_line_node_t *) node;
|
1745
|
+
memsize->memsize += sizeof(*cast);
|
1746
|
+
yp_node_list_memsize(&cast->parts, memsize);
|
1747
|
+
break;
|
1748
|
+
}
|
1695
1749
|
#line 102 "node.c.erb"
|
1696
1750
|
case YP_INTERPOLATED_REGULAR_EXPRESSION_NODE: {
|
1697
1751
|
yp_interpolated_regular_expression_node_t *cast = (yp_interpolated_regular_expression_node_t *) node;
|
@@ -1795,6 +1849,13 @@ yp_node_memsize_node(yp_node_t *node, yp_memsize_t *memsize) {
|
|
1795
1849
|
yp_node_memsize_node((yp_node_t *)cast->value, memsize);
|
1796
1850
|
break;
|
1797
1851
|
}
|
1852
|
+
#line 102 "node.c.erb"
|
1853
|
+
case YP_MATCH_LAST_LINE_NODE: {
|
1854
|
+
yp_match_last_line_node_t *cast = (yp_match_last_line_node_t *) node;
|
1855
|
+
memsize->memsize += sizeof(*cast);
|
1856
|
+
memsize->memsize += yp_string_memsize(&cast->unescaped);
|
1857
|
+
break;
|
1858
|
+
}
|
1798
1859
|
#line 102 "node.c.erb"
|
1799
1860
|
case YP_MATCH_PREDICATE_NODE: {
|
1800
1861
|
yp_match_predicate_node_t *cast = (yp_match_predicate_node_t *) node;
|
@@ -1811,6 +1872,14 @@ yp_node_memsize_node(yp_node_t *node, yp_memsize_t *memsize) {
|
|
1811
1872
|
yp_node_memsize_node((yp_node_t *)cast->pattern, memsize);
|
1812
1873
|
break;
|
1813
1874
|
}
|
1875
|
+
#line 102 "node.c.erb"
|
1876
|
+
case YP_MATCH_WRITE_NODE: {
|
1877
|
+
yp_match_write_node_t *cast = (yp_match_write_node_t *) node;
|
1878
|
+
memsize->memsize += sizeof(*cast);
|
1879
|
+
yp_node_memsize_node((yp_node_t *)cast->call, memsize);
|
1880
|
+
memsize->memsize += yp_constant_id_list_memsize(&cast->locals);
|
1881
|
+
break;
|
1882
|
+
}
|
1814
1883
|
#line 102 "node.c.erb"
|
1815
1884
|
case YP_MISSING_NODE: {
|
1816
1885
|
yp_missing_node_t *cast = (yp_missing_node_t *) node;
|
@@ -1891,10 +1960,10 @@ yp_node_memsize_node(yp_node_t *node, yp_memsize_t *memsize) {
|
|
1891
1960
|
memsize->memsize += sizeof(*cast);
|
1892
1961
|
yp_node_list_memsize(&cast->requireds, memsize);
|
1893
1962
|
yp_node_list_memsize(&cast->optionals, memsize);
|
1894
|
-
yp_node_list_memsize(&cast->posts, memsize);
|
1895
1963
|
if (cast->rest != NULL) {
|
1896
1964
|
yp_node_memsize_node((yp_node_t *)cast->rest, memsize);
|
1897
1965
|
}
|
1966
|
+
yp_node_list_memsize(&cast->posts, memsize);
|
1898
1967
|
yp_node_list_memsize(&cast->keywords, memsize);
|
1899
1968
|
if (cast->keyword_rest != NULL) {
|
1900
1969
|
yp_node_memsize_node((yp_node_t *)cast->keyword_rest, memsize);
|
@@ -2217,8 +2286,10 @@ YP_EXPORTED_FUNCTION const char *
|
|
2217
2286
|
yp_node_type_to_str(yp_node_type_t node_type)
|
2218
2287
|
{
|
2219
2288
|
switch (node_type) {
|
2220
|
-
case
|
2221
|
-
return "
|
2289
|
+
case YP_ALIAS_GLOBAL_VARIABLE_NODE:
|
2290
|
+
return "YP_ALIAS_GLOBAL_VARIABLE_NODE";
|
2291
|
+
case YP_ALIAS_METHOD_NODE:
|
2292
|
+
return "YP_ALIAS_METHOD_NODE";
|
2222
2293
|
case YP_ALTERNATION_PATTERN_NODE:
|
2223
2294
|
return "YP_ALTERNATION_PATTERN_NODE";
|
2224
2295
|
case YP_AND_NODE:
|
@@ -2347,6 +2418,8 @@ yp_node_type_to_str(yp_node_type_t node_type)
|
|
2347
2418
|
return "YP_IF_NODE";
|
2348
2419
|
case YP_IMAGINARY_NODE:
|
2349
2420
|
return "YP_IMAGINARY_NODE";
|
2421
|
+
case YP_IMPLICIT_NODE:
|
2422
|
+
return "YP_IMPLICIT_NODE";
|
2350
2423
|
case YP_IN_NODE:
|
2351
2424
|
return "YP_IN_NODE";
|
2352
2425
|
case YP_INSTANCE_VARIABLE_AND_WRITE_NODE:
|
@@ -2363,6 +2436,8 @@ yp_node_type_to_str(yp_node_type_t node_type)
|
|
2363
2436
|
return "YP_INSTANCE_VARIABLE_WRITE_NODE";
|
2364
2437
|
case YP_INTEGER_NODE:
|
2365
2438
|
return "YP_INTEGER_NODE";
|
2439
|
+
case YP_INTERPOLATED_MATCH_LAST_LINE_NODE:
|
2440
|
+
return "YP_INTERPOLATED_MATCH_LAST_LINE_NODE";
|
2366
2441
|
case YP_INTERPOLATED_REGULAR_EXPRESSION_NODE:
|
2367
2442
|
return "YP_INTERPOLATED_REGULAR_EXPRESSION_NODE";
|
2368
2443
|
case YP_INTERPOLATED_STRING_NODE:
|
@@ -2391,10 +2466,14 @@ yp_node_type_to_str(yp_node_type_t node_type)
|
|
2391
2466
|
return "YP_LOCAL_VARIABLE_TARGET_NODE";
|
2392
2467
|
case YP_LOCAL_VARIABLE_WRITE_NODE:
|
2393
2468
|
return "YP_LOCAL_VARIABLE_WRITE_NODE";
|
2469
|
+
case YP_MATCH_LAST_LINE_NODE:
|
2470
|
+
return "YP_MATCH_LAST_LINE_NODE";
|
2394
2471
|
case YP_MATCH_PREDICATE_NODE:
|
2395
2472
|
return "YP_MATCH_PREDICATE_NODE";
|
2396
2473
|
case YP_MATCH_REQUIRED_NODE:
|
2397
2474
|
return "YP_MATCH_REQUIRED_NODE";
|
2475
|
+
case YP_MATCH_WRITE_NODE:
|
2476
|
+
return "YP_MATCH_WRITE_NODE";
|
2398
2477
|
case YP_MISSING_NODE:
|
2399
2478
|
return "YP_MISSING_NODE";
|
2400
2479
|
case YP_MODULE_NODE:
|
data/src/prettyprint.c
CHANGED
@@ -27,11 +27,19 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
27
27
|
// of the AST
|
28
28
|
case YP_SCOPE_NODE:
|
29
29
|
return;
|
30
|
-
case
|
31
|
-
yp_buffer_append_str(buffer, "
|
32
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((
|
33
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((
|
34
|
-
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((
|
30
|
+
case YP_ALIAS_GLOBAL_VARIABLE_NODE: {
|
31
|
+
yp_buffer_append_str(buffer, "AliasGlobalVariableNode(", 24);
|
32
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_alias_global_variable_node_t *)node)->new_name);
|
33
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_alias_global_variable_node_t *)node)->old_name);
|
34
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_alias_global_variable_node_t *)node)->keyword_loc);
|
35
|
+
yp_buffer_append_str(buffer, ")", 1);
|
36
|
+
break;
|
37
|
+
}
|
38
|
+
case YP_ALIAS_METHOD_NODE: {
|
39
|
+
yp_buffer_append_str(buffer, "AliasMethodNode(", 16);
|
40
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_alias_method_node_t *)node)->new_name);
|
41
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (yp_node_t *)((yp_alias_method_node_t *)node)->old_name);
|
42
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_alias_method_node_t *)node)->keyword_loc);
|
35
43
|
yp_buffer_append_str(buffer, ")", 1);
|
36
44
|
break;
|
37
45
|
}
|
@@ -319,7 +327,7 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
319
327
|
prettyprint_location(buffer, parser, &((yp_call_and_write_node_t *)node)->closing_loc);
|
320
328
|
}
|
321
329
|
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
322
|
-
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >>
|
330
|
+
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >> 2);
|
323
331
|
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
324
332
|
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "\"", 1);
|
325
333
|
yp_buffer_append_bytes(buffer, yp_string_source(&((yp_call_and_write_node_t *)node)->read_name), yp_string_length(&((yp_call_and_write_node_t *)node)->read_name));
|
@@ -370,7 +378,7 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
370
378
|
prettyprint_node(buffer, parser, (yp_node_t *)((yp_call_node_t *)node)->block);
|
371
379
|
}
|
372
380
|
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
373
|
-
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >>
|
381
|
+
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >> 2);
|
374
382
|
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
375
383
|
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "\"", 1);
|
376
384
|
yp_buffer_append_bytes(buffer, yp_string_source(&((yp_call_node_t *)node)->name), yp_string_length(&((yp_call_node_t *)node)->name));
|
@@ -411,7 +419,7 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
411
419
|
prettyprint_location(buffer, parser, &((yp_call_operator_write_node_t *)node)->closing_loc);
|
412
420
|
}
|
413
421
|
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
414
|
-
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >>
|
422
|
+
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >> 2);
|
415
423
|
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
416
424
|
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "\"", 1);
|
417
425
|
yp_buffer_append_bytes(buffer, yp_string_source(&((yp_call_operator_write_node_t *)node)->read_name), yp_string_length(&((yp_call_operator_write_node_t *)node)->read_name));
|
@@ -460,7 +468,7 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
460
468
|
prettyprint_location(buffer, parser, &((yp_call_or_write_node_t *)node)->closing_loc);
|
461
469
|
}
|
462
470
|
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
463
|
-
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >>
|
471
|
+
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >> 2);
|
464
472
|
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
465
473
|
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "\"", 1);
|
466
474
|
yp_buffer_append_bytes(buffer, yp_string_source(&((yp_call_or_write_node_t *)node)->read_name), yp_string_length(&((yp_call_or_write_node_t *)node)->read_name));
|
@@ -896,7 +904,7 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
896
904
|
}
|
897
905
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_flip_flop_node_t *)node)->operator_loc);
|
898
906
|
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
899
|
-
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >>
|
907
|
+
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >> 2);
|
900
908
|
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
901
909
|
yp_buffer_append_str(buffer, ")", 1);
|
902
910
|
break;
|
@@ -1085,6 +1093,12 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1085
1093
|
yp_buffer_append_str(buffer, ")", 1);
|
1086
1094
|
break;
|
1087
1095
|
}
|
1096
|
+
case YP_IMPLICIT_NODE: {
|
1097
|
+
yp_buffer_append_str(buffer, "ImplicitNode(", 13);
|
1098
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_implicit_node_t *)node)->value);
|
1099
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1100
|
+
break;
|
1101
|
+
}
|
1088
1102
|
case YP_IN_NODE: {
|
1089
1103
|
yp_buffer_append_str(buffer, "InNode(", 7);
|
1090
1104
|
prettyprint_node(buffer, parser, (yp_node_t *)((yp_in_node_t *)node)->pattern);
|
@@ -1167,6 +1181,25 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1167
1181
|
}
|
1168
1182
|
case YP_INTEGER_NODE: {
|
1169
1183
|
yp_buffer_append_str(buffer, "IntegerNode(", 12);
|
1184
|
+
char flags_buffer[12];
|
1185
|
+
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >> 2);
|
1186
|
+
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
1187
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1188
|
+
break;
|
1189
|
+
}
|
1190
|
+
case YP_INTERPOLATED_MATCH_LAST_LINE_NODE: {
|
1191
|
+
yp_buffer_append_str(buffer, "InterpolatedMatchLastLineNode(", 30);
|
1192
|
+
prettyprint_location(buffer, parser, &((yp_interpolated_match_last_line_node_t *)node)->opening_loc);
|
1193
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
1194
|
+
for (uint32_t index = 0; index < ((yp_interpolated_match_last_line_node_t *)node)->parts.size; index++) {
|
1195
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1196
|
+
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_interpolated_match_last_line_node_t *) node)->parts.nodes[index]);
|
1197
|
+
}
|
1198
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1199
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_interpolated_match_last_line_node_t *)node)->closing_loc);
|
1200
|
+
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
1201
|
+
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >> 2);
|
1202
|
+
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
1170
1203
|
yp_buffer_append_str(buffer, ")", 1);
|
1171
1204
|
break;
|
1172
1205
|
}
|
@@ -1181,7 +1214,7 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1181
1214
|
yp_buffer_append_str(buffer, "]", 1);
|
1182
1215
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_interpolated_regular_expression_node_t *)node)->closing_loc);
|
1183
1216
|
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
1184
|
-
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >>
|
1217
|
+
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >> 2);
|
1185
1218
|
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
1186
1219
|
yp_buffer_append_str(buffer, ")", 1);
|
1187
1220
|
break;
|
@@ -1391,6 +1424,20 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1391
1424
|
yp_buffer_append_str(buffer, ")", 1);
|
1392
1425
|
break;
|
1393
1426
|
}
|
1427
|
+
case YP_MATCH_LAST_LINE_NODE: {
|
1428
|
+
yp_buffer_append_str(buffer, "MatchLastLineNode(", 18);
|
1429
|
+
prettyprint_location(buffer, parser, &((yp_match_last_line_node_t *)node)->opening_loc);
|
1430
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_match_last_line_node_t *)node)->content_loc);
|
1431
|
+
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_match_last_line_node_t *)node)->closing_loc);
|
1432
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "\"", 1);
|
1433
|
+
yp_buffer_append_bytes(buffer, yp_string_source(&((yp_match_last_line_node_t *)node)->unescaped), yp_string_length(&((yp_match_last_line_node_t *)node)->unescaped));
|
1434
|
+
yp_buffer_append_str(buffer, "\"", 1);
|
1435
|
+
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
1436
|
+
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >> 2);
|
1437
|
+
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
1438
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1439
|
+
break;
|
1440
|
+
}
|
1394
1441
|
case YP_MATCH_PREDICATE_NODE: {
|
1395
1442
|
yp_buffer_append_str(buffer, "MatchPredicateNode(", 19);
|
1396
1443
|
prettyprint_node(buffer, parser, (yp_node_t *)((yp_match_predicate_node_t *)node)->value);
|
@@ -1407,6 +1454,20 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1407
1454
|
yp_buffer_append_str(buffer, ")", 1);
|
1408
1455
|
break;
|
1409
1456
|
}
|
1457
|
+
case YP_MATCH_WRITE_NODE: {
|
1458
|
+
yp_buffer_append_str(buffer, "MatchWriteNode(", 15);
|
1459
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_match_write_node_t *)node)->call);
|
1460
|
+
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
1461
|
+
for (uint32_t index = 0; index < ((yp_match_write_node_t *)node)->locals.size; index++) {
|
1462
|
+
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1463
|
+
char locals_buffer[12];
|
1464
|
+
snprintf(locals_buffer, sizeof(locals_buffer), "%u", ((yp_match_write_node_t *)node)->locals.ids[index]);
|
1465
|
+
yp_buffer_append_str(buffer, locals_buffer, strlen(locals_buffer));
|
1466
|
+
}
|
1467
|
+
yp_buffer_append_str(buffer, "]", 1);
|
1468
|
+
yp_buffer_append_str(buffer, ")", 1);
|
1469
|
+
break;
|
1470
|
+
}
|
1410
1471
|
case YP_MISSING_NODE: {
|
1411
1472
|
yp_buffer_append_str(buffer, "MissingNode(", 12);
|
1412
1473
|
yp_buffer_append_str(buffer, ")", 1);
|
@@ -1544,17 +1605,17 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1544
1605
|
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_parameters_node_t *) node)->optionals.nodes[index]);
|
1545
1606
|
}
|
1546
1607
|
yp_buffer_append_str(buffer, "]", 1);
|
1608
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_parameters_node_t *)node)->rest == NULL) {
|
1609
|
+
yp_buffer_append_str(buffer, "nil", 3);
|
1610
|
+
} else {
|
1611
|
+
prettyprint_node(buffer, parser, (yp_node_t *)((yp_parameters_node_t *)node)->rest);
|
1612
|
+
}
|
1547
1613
|
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
1548
1614
|
for (uint32_t index = 0; index < ((yp_parameters_node_t *)node)->posts.size; index++) {
|
1549
1615
|
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
1550
1616
|
prettyprint_node(buffer, parser, (yp_node_t *) ((yp_parameters_node_t *) node)->posts.nodes[index]);
|
1551
1617
|
}
|
1552
1618
|
yp_buffer_append_str(buffer, "]", 1);
|
1553
|
-
yp_buffer_append_str(buffer, ", ", 2); if (((yp_parameters_node_t *)node)->rest == NULL) {
|
1554
|
-
yp_buffer_append_str(buffer, "nil", 3);
|
1555
|
-
} else {
|
1556
|
-
prettyprint_node(buffer, parser, (yp_node_t *)((yp_parameters_node_t *)node)->rest);
|
1557
|
-
}
|
1558
1619
|
yp_buffer_append_str(buffer, ", ", 2); yp_buffer_append_str(buffer, "[", 1);
|
1559
1620
|
for (uint32_t index = 0; index < ((yp_parameters_node_t *)node)->keywords.size; index++) {
|
1560
1621
|
if (index != 0) yp_buffer_append_str(buffer, ", ", 2);
|
@@ -1656,7 +1717,7 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1656
1717
|
}
|
1657
1718
|
yp_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((yp_range_node_t *)node)->operator_loc);
|
1658
1719
|
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
1659
|
-
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >>
|
1720
|
+
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >> 2);
|
1660
1721
|
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
1661
1722
|
yp_buffer_append_str(buffer, ")", 1);
|
1662
1723
|
break;
|
@@ -1681,7 +1742,7 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1681
1742
|
yp_buffer_append_bytes(buffer, yp_string_source(&((yp_regular_expression_node_t *)node)->unescaped), yp_string_length(&((yp_regular_expression_node_t *)node)->unescaped));
|
1682
1743
|
yp_buffer_append_str(buffer, "\"", 1);
|
1683
1744
|
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
1684
|
-
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >>
|
1745
|
+
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >> 2);
|
1685
1746
|
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
1686
1747
|
yp_buffer_append_str(buffer, ")", 1);
|
1687
1748
|
break;
|
@@ -1857,7 +1918,10 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1857
1918
|
}
|
1858
1919
|
case YP_STRING_NODE: {
|
1859
1920
|
yp_buffer_append_str(buffer, "StringNode(", 11);
|
1860
|
-
|
1921
|
+
char flags_buffer[12];
|
1922
|
+
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >> 2);
|
1923
|
+
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
1924
|
+
yp_buffer_append_str(buffer, ", ", 2); if (((yp_string_node_t *)node)->opening_loc.start == NULL) {
|
1861
1925
|
yp_buffer_append_str(buffer, "nil", 3);
|
1862
1926
|
} else {
|
1863
1927
|
prettyprint_location(buffer, parser, &((yp_string_node_t *)node)->opening_loc);
|
@@ -1977,7 +2041,7 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
1977
2041
|
prettyprint_node(buffer, parser, (yp_node_t *)((yp_until_node_t *)node)->statements);
|
1978
2042
|
}
|
1979
2043
|
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
1980
|
-
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >>
|
2044
|
+
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >> 2);
|
1981
2045
|
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
1982
2046
|
yp_buffer_append_str(buffer, ")", 1);
|
1983
2047
|
break;
|
@@ -2014,7 +2078,7 @@ prettyprint_node(yp_buffer_t *buffer, yp_parser_t *parser, yp_node_t *node) {
|
|
2014
2078
|
prettyprint_node(buffer, parser, (yp_node_t *)((yp_while_node_t *)node)->statements);
|
2015
2079
|
}
|
2016
2080
|
yp_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
|
2017
|
-
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >>
|
2081
|
+
snprintf(flags_buffer, sizeof(flags_buffer), "+%d", node->flags >> 2);
|
2018
2082
|
yp_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
|
2019
2083
|
yp_buffer_append_str(buffer, ")", 1);
|
2020
2084
|
break;
|