prism 1.2.0 → 1.3.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 +23 -1
- data/Makefile +1 -1
- data/config.yml +420 -2
- data/docs/build_system.md +8 -11
- data/docs/relocation.md +34 -0
- data/ext/prism/api_node.c +18 -10
- data/ext/prism/extconf.rb +13 -36
- data/ext/prism/extension.c +68 -0
- data/ext/prism/extension.h +1 -1
- data/include/prism/ast.h +426 -2
- data/include/prism/defines.h +22 -7
- data/include/prism/version.h +2 -2
- data/include/prism.h +47 -0
- data/lib/prism/dot_visitor.rb +10 -0
- data/lib/prism/dsl.rb +4 -4
- data/lib/prism/ffi.rb +49 -2
- data/lib/prism/inspect_visitor.rb +2 -0
- data/lib/prism/node.rb +1838 -95
- data/lib/prism/parse_result/errors.rb +1 -1
- data/lib/prism/parse_result.rb +2 -2
- data/lib/prism/reflection.rb +2 -2
- data/lib/prism/relocation.rb +504 -0
- data/lib/prism/serialize.rb +5 -5
- data/lib/prism/string_query.rb +30 -0
- data/lib/prism/translation/parser/compiler.rb +36 -26
- data/lib/prism/translation/ruby_parser.rb +12 -3
- data/lib/prism.rb +6 -4
- data/prism.gemspec +7 -1
- data/rbi/prism/dsl.rbi +4 -4
- data/rbi/prism/node.rbi +22 -10
- data/rbi/prism/string_query.rbi +12 -0
- data/sig/prism/dsl.rbs +2 -2
- data/sig/prism/node.rbs +12 -8
- data/sig/prism/relocation.rbs +185 -0
- data/sig/prism/string_query.rbs +11 -0
- data/src/node.c +18 -0
- data/src/prettyprint.c +32 -0
- data/src/prism.c +364 -81
- data/src/regexp.c +7 -3
- data/src/serialize.c +12 -0
- data/src/static_literals.c +1 -1
- data/src/util/pm_char.c +1 -1
- data/src/util/pm_string.c +1 -0
- metadata +9 -3
data/src/node.c
CHANGED
@@ -8418,6 +8418,15 @@ pm_dump_json(pm_buffer_t *buffer, const pm_parser_t *parser, const pm_node_t *no
|
|
8418
8418
|
pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
|
8419
8419
|
pm_dump_json_location(buffer, parser, &cast->keyword_loc);
|
8420
8420
|
|
8421
|
+
// Dump the do_keyword_loc field
|
8422
|
+
pm_buffer_append_byte(buffer, ',');
|
8423
|
+
pm_buffer_append_string(buffer, "\"do_keyword_loc\":", 17);
|
8424
|
+
if (cast->do_keyword_loc.start != NULL) {
|
8425
|
+
pm_dump_json_location(buffer, parser, &cast->do_keyword_loc);
|
8426
|
+
} else {
|
8427
|
+
pm_buffer_append_string(buffer, "null", 4);
|
8428
|
+
}
|
8429
|
+
|
8421
8430
|
// Dump the closing_loc field
|
8422
8431
|
pm_buffer_append_byte(buffer, ',');
|
8423
8432
|
pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
|
@@ -8511,6 +8520,15 @@ pm_dump_json(pm_buffer_t *buffer, const pm_parser_t *parser, const pm_node_t *no
|
|
8511
8520
|
pm_buffer_append_string(buffer, "\"keyword_loc\":", 14);
|
8512
8521
|
pm_dump_json_location(buffer, parser, &cast->keyword_loc);
|
8513
8522
|
|
8523
|
+
// Dump the do_keyword_loc field
|
8524
|
+
pm_buffer_append_byte(buffer, ',');
|
8525
|
+
pm_buffer_append_string(buffer, "\"do_keyword_loc\":", 17);
|
8526
|
+
if (cast->do_keyword_loc.start != NULL) {
|
8527
|
+
pm_dump_json_location(buffer, parser, &cast->do_keyword_loc);
|
8528
|
+
} else {
|
8529
|
+
pm_buffer_append_string(buffer, "null", 4);
|
8530
|
+
}
|
8531
|
+
|
8514
8532
|
// Dump the closing_loc field
|
8515
8533
|
pm_buffer_append_byte(buffer, ',');
|
8516
8534
|
pm_buffer_append_string(buffer, "\"closing_loc\":", 14);
|
data/src/prettyprint.c
CHANGED
@@ -8521,6 +8521,22 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
|
|
8521
8521
|
pm_buffer_append_string(output_buffer, "\"\n", 2);
|
8522
8522
|
}
|
8523
8523
|
|
8524
|
+
// do_keyword_loc
|
8525
|
+
{
|
8526
|
+
pm_buffer_concat(output_buffer, prefix_buffer);
|
8527
|
+
pm_buffer_append_string(output_buffer, "+-- do_keyword_loc:", 19);
|
8528
|
+
pm_location_t *location = &cast->do_keyword_loc;
|
8529
|
+
if (location->start == NULL) {
|
8530
|
+
pm_buffer_append_string(output_buffer, " nil\n", 5);
|
8531
|
+
} else {
|
8532
|
+
pm_buffer_append_byte(output_buffer, ' ');
|
8533
|
+
prettyprint_location(output_buffer, parser, location);
|
8534
|
+
pm_buffer_append_string(output_buffer, " = \"", 4);
|
8535
|
+
pm_buffer_append_source(output_buffer, location->start, (size_t) (location->end - location->start), PM_BUFFER_ESCAPING_RUBY);
|
8536
|
+
pm_buffer_append_string(output_buffer, "\"\n", 2);
|
8537
|
+
}
|
8538
|
+
}
|
8539
|
+
|
8524
8540
|
// closing_loc
|
8525
8541
|
{
|
8526
8542
|
pm_buffer_concat(output_buffer, prefix_buffer);
|
@@ -8672,6 +8688,22 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
|
|
8672
8688
|
pm_buffer_append_string(output_buffer, "\"\n", 2);
|
8673
8689
|
}
|
8674
8690
|
|
8691
|
+
// do_keyword_loc
|
8692
|
+
{
|
8693
|
+
pm_buffer_concat(output_buffer, prefix_buffer);
|
8694
|
+
pm_buffer_append_string(output_buffer, "+-- do_keyword_loc:", 19);
|
8695
|
+
pm_location_t *location = &cast->do_keyword_loc;
|
8696
|
+
if (location->start == NULL) {
|
8697
|
+
pm_buffer_append_string(output_buffer, " nil\n", 5);
|
8698
|
+
} else {
|
8699
|
+
pm_buffer_append_byte(output_buffer, ' ');
|
8700
|
+
prettyprint_location(output_buffer, parser, location);
|
8701
|
+
pm_buffer_append_string(output_buffer, " = \"", 4);
|
8702
|
+
pm_buffer_append_source(output_buffer, location->start, (size_t) (location->end - location->start), PM_BUFFER_ESCAPING_RUBY);
|
8703
|
+
pm_buffer_append_string(output_buffer, "\"\n", 2);
|
8704
|
+
}
|
8705
|
+
}
|
8706
|
+
|
8675
8707
|
// closing_loc
|
8676
8708
|
{
|
8677
8709
|
pm_buffer_concat(output_buffer, prefix_buffer);
|