yarp 0.10.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 +50 -1
- data/CONTRIBUTING.md +7 -0
- data/config.yml +259 -49
- data/docs/configuration.md +0 -1
- data/docs/mapping.md +91 -91
- data/docs/serialization.md +23 -20
- data/ext/yarp/api_node.c +1268 -419
- data/ext/yarp/extension.c +9 -2
- data/ext/yarp/extension.h +2 -2
- data/include/yarp/ast.h +471 -318
- data/include/yarp/diagnostic.h +203 -1
- data/include/yarp/enc/yp_encoding.h +1 -1
- data/include/yarp/node.h +0 -4
- data/include/yarp/parser.h +44 -16
- data/include/yarp/util/yp_char.h +22 -6
- data/include/yarp/util/yp_constant_pool.h +11 -4
- data/include/yarp/version.h +2 -2
- data/lib/yarp/desugar_visitor.rb +19 -19
- data/lib/yarp/mutation_visitor.rb +50 -15
- data/lib/yarp/node.rb +6455 -443
- data/lib/yarp/parse_result/comments.rb +172 -0
- data/lib/yarp/parse_result/newlines.rb +60 -0
- data/lib/yarp/pattern.rb +239 -0
- data/lib/yarp/serialize.rb +173 -140
- data/lib/yarp.rb +151 -76
- data/src/diagnostic.c +259 -2
- data/src/enc/yp_unicode.c +5 -5
- data/src/node.c +984 -872
- data/src/prettyprint.c +461 -203
- data/src/serialize.c +380 -185
- data/src/unescape.c +20 -20
- data/src/util/yp_char.c +59 -16
- data/src/util/yp_constant_pool.c +97 -13
- data/src/util/yp_newline_list.c +5 -1
- data/src/util/yp_string_list.c +4 -1
- data/src/yarp.c +2313 -1675
- data/yarp.gemspec +4 -1
- metadata +5 -2
data/ext/yarp/extension.c
CHANGED
@@ -347,7 +347,7 @@ parse_input(yp_string_t *input, const char *filepath) {
|
|
347
347
|
yp_node_t *node = yp_parse(&parser);
|
348
348
|
rb_encoding *encoding = rb_enc_find(parser.encoding.name);
|
349
349
|
|
350
|
-
VALUE source = yp_source_new(&parser);
|
350
|
+
VALUE source = yp_source_new(&parser, encoding);
|
351
351
|
VALUE result_argv[] = {
|
352
352
|
yp_ast_new(&parser, node, encoding),
|
353
353
|
parser_comments(&parser, source),
|
@@ -413,7 +413,11 @@ parse_lex(int argc, VALUE *argv, VALUE self) {
|
|
413
413
|
|
414
414
|
yp_string_t input;
|
415
415
|
input_load_string(&input, string);
|
416
|
-
|
416
|
+
|
417
|
+
VALUE value = parse_lex_input(&input, check_string(filepath), true);
|
418
|
+
yp_string_free(&input);
|
419
|
+
|
420
|
+
return value;
|
417
421
|
}
|
418
422
|
|
419
423
|
// Parse and lex the given file and return a ParseResult instance.
|
@@ -530,6 +534,8 @@ profile_file(VALUE self, VALUE filepath) {
|
|
530
534
|
yp_node_destroy(&parser, node);
|
531
535
|
yp_parser_free(&parser);
|
532
536
|
|
537
|
+
yp_string_free(&input);
|
538
|
+
|
533
539
|
return Qnil;
|
534
540
|
}
|
535
541
|
|
@@ -547,6 +553,7 @@ parse_serialize_file_metadata(VALUE self, VALUE filepath, VALUE metadata) {
|
|
547
553
|
yp_parse_serialize(yp_string_source(&input), yp_string_length(&input), &buffer, check_string(metadata));
|
548
554
|
VALUE result = rb_str_new(yp_buffer_value(&buffer), yp_buffer_length(&buffer));
|
549
555
|
|
556
|
+
yp_string_free(&input);
|
550
557
|
yp_buffer_free(&buffer);
|
551
558
|
return result;
|
552
559
|
}
|
data/ext/yarp/extension.h
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
#ifndef YARP_EXT_NODE_H
|
2
2
|
#define YARP_EXT_NODE_H
|
3
3
|
|
4
|
-
#define EXPECTED_YARP_VERSION "0.
|
4
|
+
#define EXPECTED_YARP_VERSION "0.12.0"
|
5
5
|
|
6
6
|
#include <ruby.h>
|
7
7
|
#include <ruby/encoding.h>
|
8
8
|
#include "yarp.h"
|
9
9
|
|
10
|
-
VALUE yp_source_new(yp_parser_t *parser);
|
10
|
+
VALUE yp_source_new(yp_parser_t *parser, rb_encoding *encoding);
|
11
11
|
VALUE yp_token_new(yp_parser_t *parser, yp_token_t *token, rb_encoding *encoding, VALUE source);
|
12
12
|
VALUE yp_ast_new(yp_parser_t *parser, yp_node_t *node, rb_encoding *encoding);
|
13
13
|
|