prism 0.29.0 → 0.30.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 +22 -1
- data/CONTRIBUTING.md +0 -4
- data/README.md +1 -0
- data/config.yml +66 -9
- data/docs/fuzzing.md +1 -1
- data/docs/ripper_translation.md +22 -0
- data/ext/prism/api_node.c +30 -12
- data/ext/prism/extension.c +107 -372
- data/ext/prism/extension.h +1 -1
- data/include/prism/ast.h +138 -70
- data/include/prism/diagnostic.h +7 -2
- data/include/prism/node.h +0 -21
- data/include/prism/parser.h +23 -25
- data/include/prism/regexp.h +17 -8
- data/include/prism/static_literals.h +3 -2
- data/include/prism/util/pm_char.h +1 -2
- data/include/prism/util/pm_constant_pool.h +0 -8
- data/include/prism/util/pm_integer.h +16 -9
- data/include/prism/util/pm_string.h +0 -8
- data/include/prism/version.h +2 -2
- data/include/prism.h +0 -11
- data/lib/prism/compiler.rb +3 -0
- data/lib/prism/dispatcher.rb +14 -0
- data/lib/prism/dot_visitor.rb +22 -3
- data/lib/prism/dsl.rb +7 -2
- data/lib/prism/ffi.rb +24 -3
- data/lib/prism/inspect_visitor.rb +10 -8
- data/lib/prism/mutation_compiler.rb +6 -1
- data/lib/prism/node.rb +166 -241
- data/lib/prism/node_ext.rb +21 -5
- data/lib/prism/parse_result/comments.rb +0 -7
- data/lib/prism/parse_result/newlines.rb +101 -11
- data/lib/prism/parse_result.rb +17 -0
- data/lib/prism/reflection.rb +3 -1
- data/lib/prism/serialize.rb +80 -67
- data/lib/prism/translation/parser/compiler.rb +134 -114
- data/lib/prism/translation/parser.rb +6 -1
- data/lib/prism/translation/ripper.rb +8 -6
- data/lib/prism/translation/ruby_parser.rb +23 -5
- data/lib/prism/visitor.rb +3 -0
- data/lib/prism.rb +0 -4
- data/prism.gemspec +1 -4
- data/rbi/prism/node.rbi +63 -6
- data/rbi/prism/visitor.rbi +3 -0
- data/rbi/prism.rbi +6 -0
- data/sig/prism/dsl.rbs +4 -1
- data/sig/prism/mutation_compiler.rbs +1 -0
- data/sig/prism/node.rbs +28 -4
- data/sig/prism/visitor.rbs +1 -0
- data/sig/prism.rbs +21 -0
- data/src/diagnostic.c +27 -17
- data/src/node.c +408 -1666
- data/src/prettyprint.c +49 -6
- data/src/prism.c +958 -991
- data/src/regexp.c +133 -68
- data/src/serialize.c +6 -1
- data/src/static_literals.c +63 -84
- data/src/token_type.c +2 -2
- data/src/util/pm_constant_pool.c +0 -8
- data/src/util/pm_integer.c +39 -11
- data/src/util/pm_string.c +0 -12
- data/src/util/pm_strpbrk.c +32 -6
- metadata +2 -5
- data/include/prism/util/pm_string_list.h +0 -44
- data/lib/prism/debug.rb +0 -249
- data/src/util/pm_string_list.c +0 -28
data/src/prettyprint.c
CHANGED
@@ -5465,6 +5465,13 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
|
|
5465
5465
|
|
5466
5466
|
break;
|
5467
5467
|
}
|
5468
|
+
case PM_IT_LOCAL_VARIABLE_READ_NODE: {
|
5469
|
+
pm_buffer_append_string(output_buffer, "@ ItLocalVariableReadNode (location: ", 37);
|
5470
|
+
prettyprint_location(output_buffer, parser, &node->location);
|
5471
|
+
pm_buffer_append_string(output_buffer, ")\n", 2);
|
5472
|
+
|
5473
|
+
break;
|
5474
|
+
}
|
5468
5475
|
case PM_IT_PARAMETERS_NODE: {
|
5469
5476
|
pm_buffer_append_string(output_buffer, "@ ItParametersNode (location: ", 30);
|
5470
5477
|
prettyprint_location(output_buffer, parser, &node->location);
|
@@ -7290,17 +7297,53 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
|
|
7290
7297
|
prettyprint_location(output_buffer, parser, &node->location);
|
7291
7298
|
pm_buffer_append_string(output_buffer, ")\n", 2);
|
7292
7299
|
|
7293
|
-
//
|
7300
|
+
// flags
|
7294
7301
|
{
|
7295
7302
|
pm_buffer_concat(output_buffer, prefix_buffer);
|
7296
|
-
pm_buffer_append_string(output_buffer, "+--
|
7303
|
+
pm_buffer_append_string(output_buffer, "+-- flags:", 10);
|
7304
|
+
bool found = false;
|
7305
|
+
if (cast->base.flags & PM_INTEGER_BASE_FLAGS_BINARY) {
|
7306
|
+
if (found) pm_buffer_append_byte(output_buffer, ',');
|
7307
|
+
pm_buffer_append_string(output_buffer, " binary", 7);
|
7308
|
+
found = true;
|
7309
|
+
}
|
7310
|
+
if (cast->base.flags & PM_INTEGER_BASE_FLAGS_DECIMAL) {
|
7311
|
+
if (found) pm_buffer_append_byte(output_buffer, ',');
|
7312
|
+
pm_buffer_append_string(output_buffer, " decimal", 8);
|
7313
|
+
found = true;
|
7314
|
+
}
|
7315
|
+
if (cast->base.flags & PM_INTEGER_BASE_FLAGS_OCTAL) {
|
7316
|
+
if (found) pm_buffer_append_byte(output_buffer, ',');
|
7317
|
+
pm_buffer_append_string(output_buffer, " octal", 6);
|
7318
|
+
found = true;
|
7319
|
+
}
|
7320
|
+
if (cast->base.flags & PM_INTEGER_BASE_FLAGS_HEXADECIMAL) {
|
7321
|
+
if (found) pm_buffer_append_byte(output_buffer, ',');
|
7322
|
+
pm_buffer_append_string(output_buffer, " hexadecimal", 12);
|
7323
|
+
found = true;
|
7324
|
+
}
|
7325
|
+
if (!found) pm_buffer_append_string(output_buffer, " nil", 4);
|
7297
7326
|
pm_buffer_append_byte(output_buffer, '\n');
|
7327
|
+
}
|
7298
7328
|
|
7299
|
-
|
7300
|
-
|
7329
|
+
// numerator
|
7330
|
+
{
|
7301
7331
|
pm_buffer_concat(output_buffer, prefix_buffer);
|
7302
|
-
|
7303
|
-
|
7332
|
+
pm_buffer_append_string(output_buffer, "+-- numerator:", 14);
|
7333
|
+
const pm_integer_t *integer = &cast->numerator;
|
7334
|
+
pm_buffer_append_byte(output_buffer, ' ');
|
7335
|
+
pm_integer_string(output_buffer, integer);
|
7336
|
+
pm_buffer_append_byte(output_buffer, '\n');
|
7337
|
+
}
|
7338
|
+
|
7339
|
+
// denominator
|
7340
|
+
{
|
7341
|
+
pm_buffer_concat(output_buffer, prefix_buffer);
|
7342
|
+
pm_buffer_append_string(output_buffer, "+-- denominator:", 16);
|
7343
|
+
const pm_integer_t *integer = &cast->denominator;
|
7344
|
+
pm_buffer_append_byte(output_buffer, ' ');
|
7345
|
+
pm_integer_string(output_buffer, integer);
|
7346
|
+
pm_buffer_append_byte(output_buffer, '\n');
|
7304
7347
|
}
|
7305
7348
|
|
7306
7349
|
break;
|