prism 0.30.0 → 1.0.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 +31 -1
- data/README.md +3 -1
- data/config.yml +185 -126
- data/docs/serialization.md +3 -0
- data/ext/prism/api_node.c +2843 -2085
- data/ext/prism/extconf.rb +1 -1
- data/ext/prism/extension.c +35 -25
- data/ext/prism/extension.h +2 -2
- data/include/prism/ast.h +1048 -69
- data/include/prism/defines.h +9 -0
- data/include/prism/diagnostic.h +11 -3
- data/include/prism/options.h +55 -1
- data/include/prism/parser.h +27 -3
- data/include/prism/regexp.h +2 -1
- data/include/prism/util/pm_integer.h +6 -6
- data/include/prism/util/pm_newline_list.h +11 -0
- data/include/prism/util/pm_string.h +1 -0
- data/include/prism/version.h +3 -3
- data/lib/prism/desugar_compiler.rb +111 -74
- data/lib/prism/dispatcher.rb +2 -1
- data/lib/prism/dot_visitor.rb +21 -31
- data/lib/prism/dsl.rb +656 -471
- data/lib/prism/ffi.rb +3 -0
- data/lib/prism/inspect_visitor.rb +285 -57
- data/lib/prism/mutation_compiler.rb +5 -5
- data/lib/prism/node.rb +2282 -4754
- data/lib/prism/node_ext.rb +72 -11
- data/lib/prism/parse_result/errors.rb +65 -0
- data/lib/prism/parse_result/newlines.rb +28 -28
- data/lib/prism/parse_result.rb +25 -2
- data/lib/prism/reflection.rb +7 -7
- data/lib/prism/serialize.rb +468 -610
- data/lib/prism/translation/parser/compiler.rb +18 -18
- data/lib/prism/translation/parser/lexer.rb +1 -1
- data/lib/prism/translation/parser.rb +3 -3
- data/lib/prism/translation/ripper.rb +14 -14
- data/lib/prism/translation/ruby_parser.rb +43 -7
- data/prism.gemspec +3 -1
- data/rbi/prism/dsl.rbi +521 -0
- data/rbi/prism/node.rbi +1456 -5616
- data/rbi/prism.rbi +16 -16
- data/sig/prism/dsl.rbs +189 -305
- data/sig/prism/node.rbs +702 -603
- data/sig/prism/parse_result.rbs +2 -0
- data/src/diagnostic.c +22 -6
- data/src/node.c +277 -284
- data/src/options.c +18 -0
- data/src/prettyprint.c +99 -108
- data/src/prism.c +1282 -760
- data/src/regexp.c +72 -4
- data/src/serialize.c +165 -50
- data/src/token_type.c +2 -2
- data/src/util/pm_integer.c +14 -14
- data/src/util/pm_newline_list.c +29 -0
- data/src/util/pm_string.c +9 -5
- metadata +4 -2
data/src/options.c
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
#include "prism/options.h"
|
2
2
|
|
3
|
+
/**
|
4
|
+
* Set the shebang callback option on the given options struct.
|
5
|
+
*/
|
6
|
+
PRISM_EXPORTED_FUNCTION void
|
7
|
+
pm_options_shebang_callback_set(pm_options_t *options, pm_options_shebang_callback_t shebang_callback, void *shebang_callback_data) {
|
8
|
+
options->shebang_callback = shebang_callback;
|
9
|
+
options->shebang_callback_data = shebang_callback_data;
|
10
|
+
}
|
11
|
+
|
3
12
|
/**
|
4
13
|
* Set the filepath option on the given options struct.
|
5
14
|
*/
|
@@ -16,6 +25,14 @@ pm_options_encoding_set(pm_options_t *options, const char *encoding) {
|
|
16
25
|
pm_string_constant_init(&options->encoding, encoding, strlen(encoding));
|
17
26
|
}
|
18
27
|
|
28
|
+
/**
|
29
|
+
* Set the encoding_locked option on the given options struct.
|
30
|
+
*/
|
31
|
+
PRISM_EXPORTED_FUNCTION void
|
32
|
+
pm_options_encoding_locked_set(pm_options_t *options, bool encoding_locked) {
|
33
|
+
options->encoding_locked = encoding_locked;
|
34
|
+
}
|
35
|
+
|
19
36
|
/**
|
20
37
|
* Set the line option on the given options struct.
|
21
38
|
*/
|
@@ -215,6 +232,7 @@ pm_options_read(pm_options_t *options, const char *data) {
|
|
215
232
|
options->frozen_string_literal = (int8_t) *data++;
|
216
233
|
options->command_line = (uint8_t) *data++;
|
217
234
|
options->version = (pm_options_version_t) *data++;
|
235
|
+
options->encoding_locked = ((uint8_t) *data++) > 0;
|
218
236
|
|
219
237
|
uint32_t scopes_count = pm_options_read_u32(data);
|
220
238
|
data += 4;
|