jruby-prism-parser 0.24.0-java → 1.4.0-java
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/BSDmakefile +58 -0
- data/CHANGELOG.md +269 -1
- data/CONTRIBUTING.md +0 -4
- data/Makefile +25 -18
- data/README.md +57 -6
- data/config.yml +1724 -140
- data/docs/build_system.md +39 -11
- data/docs/configuration.md +4 -0
- data/docs/cruby_compilation.md +1 -1
- data/docs/fuzzing.md +1 -1
- data/docs/parser_translation.md +14 -9
- data/docs/parsing_rules.md +4 -1
- data/docs/releasing.md +8 -10
- data/docs/relocation.md +34 -0
- data/docs/ripper_translation.md +72 -0
- data/docs/ruby_api.md +2 -1
- data/docs/serialization.md +29 -5
- data/ext/prism/api_node.c +3395 -1999
- data/ext/prism/api_pack.c +9 -0
- data/ext/prism/extconf.rb +55 -34
- data/ext/prism/extension.c +597 -346
- data/ext/prism/extension.h +6 -5
- data/include/prism/ast.h +2612 -455
- data/include/prism/defines.h +160 -2
- data/include/prism/diagnostic.h +188 -76
- data/include/prism/encoding.h +22 -4
- data/include/prism/node.h +89 -17
- data/include/prism/options.h +224 -12
- data/include/prism/pack.h +11 -0
- data/include/prism/parser.h +267 -66
- data/include/prism/prettyprint.h +8 -0
- data/include/prism/regexp.h +18 -8
- data/include/prism/static_literals.h +121 -0
- data/include/prism/util/pm_buffer.h +75 -2
- data/include/prism/util/pm_char.h +1 -2
- data/include/prism/util/pm_constant_pool.h +18 -9
- data/include/prism/util/pm_integer.h +126 -0
- data/include/prism/util/pm_list.h +1 -1
- data/include/prism/util/pm_newline_list.h +19 -0
- data/include/prism/util/pm_string.h +48 -8
- data/include/prism/version.h +3 -3
- data/include/prism.h +99 -5
- data/jruby-prism.jar +0 -0
- data/lib/prism/compiler.rb +11 -1
- data/lib/prism/desugar_compiler.rb +113 -74
- data/lib/prism/dispatcher.rb +45 -1
- data/lib/prism/dot_visitor.rb +201 -77
- data/lib/prism/dsl.rb +673 -461
- data/lib/prism/ffi.rb +233 -45
- data/lib/prism/inspect_visitor.rb +2389 -0
- data/lib/prism/lex_compat.rb +35 -16
- data/lib/prism/mutation_compiler.rb +24 -8
- data/lib/prism/node.rb +7731 -8460
- data/lib/prism/node_ext.rb +328 -32
- data/lib/prism/pack.rb +4 -0
- data/lib/prism/parse_result/comments.rb +34 -24
- data/lib/prism/parse_result/errors.rb +65 -0
- data/lib/prism/parse_result/newlines.rb +102 -12
- data/lib/prism/parse_result.rb +448 -44
- data/lib/prism/pattern.rb +28 -10
- data/lib/prism/polyfill/append_as_bytes.rb +15 -0
- data/lib/prism/polyfill/byteindex.rb +13 -0
- data/lib/prism/polyfill/unpack1.rb +14 -0
- data/lib/prism/reflection.rb +413 -0
- data/lib/prism/relocation.rb +504 -0
- data/lib/prism/serialize.rb +1940 -1198
- data/lib/prism/string_query.rb +30 -0
- data/lib/prism/translation/parser/builder.rb +61 -0
- data/lib/prism/translation/parser/compiler.rb +569 -195
- data/lib/prism/translation/parser/lexer.rb +516 -39
- data/lib/prism/translation/parser.rb +177 -12
- data/lib/prism/translation/parser33.rb +1 -1
- data/lib/prism/translation/parser34.rb +1 -1
- data/lib/prism/translation/parser35.rb +12 -0
- data/lib/prism/translation/ripper/sexp.rb +125 -0
- data/lib/prism/translation/ripper/shim.rb +5 -0
- data/lib/prism/translation/ripper.rb +3224 -462
- data/lib/prism/translation/ruby_parser.rb +194 -69
- data/lib/prism/translation.rb +4 -1
- data/lib/prism/version.rb +1 -1
- data/lib/prism/visitor.rb +13 -0
- data/lib/prism.rb +17 -27
- data/prism.gemspec +57 -17
- data/rbi/prism/compiler.rbi +12 -0
- data/rbi/prism/dsl.rbi +524 -0
- data/rbi/prism/inspect_visitor.rbi +12 -0
- data/rbi/prism/node.rbi +8722 -0
- data/rbi/prism/node_ext.rbi +107 -0
- data/rbi/prism/parse_result.rbi +404 -0
- data/rbi/prism/reflection.rbi +58 -0
- data/rbi/prism/string_query.rbi +12 -0
- data/rbi/prism/translation/parser.rbi +11 -0
- data/rbi/prism/translation/parser33.rbi +6 -0
- data/rbi/prism/translation/parser34.rbi +6 -0
- data/rbi/prism/translation/parser35.rbi +6 -0
- data/rbi/prism/translation/ripper.rbi +15 -0
- data/rbi/prism/visitor.rbi +473 -0
- data/rbi/prism.rbi +44 -7745
- data/sig/prism/compiler.rbs +9 -0
- data/sig/prism/dispatcher.rbs +16 -0
- data/sig/prism/dot_visitor.rbs +6 -0
- data/sig/prism/dsl.rbs +351 -0
- data/sig/prism/inspect_visitor.rbs +22 -0
- data/sig/prism/lex_compat.rbs +10 -0
- data/sig/prism/mutation_compiler.rbs +159 -0
- data/sig/prism/node.rbs +3614 -0
- data/sig/prism/node_ext.rbs +82 -0
- data/sig/prism/pack.rbs +43 -0
- data/sig/prism/parse_result.rbs +192 -0
- data/sig/prism/pattern.rbs +13 -0
- data/sig/prism/reflection.rbs +50 -0
- data/sig/prism/relocation.rbs +185 -0
- data/sig/prism/serialize.rbs +8 -0
- data/sig/prism/string_query.rbs +11 -0
- data/sig/prism/visitor.rbs +169 -0
- data/sig/prism.rbs +248 -4767
- data/src/diagnostic.c +672 -230
- data/src/encoding.c +211 -108
- data/src/node.c +7541 -1653
- data/src/options.c +135 -20
- data/src/pack.c +33 -17
- data/src/prettyprint.c +1543 -1485
- data/src/prism.c +7813 -3050
- data/src/regexp.c +225 -73
- data/src/serialize.c +101 -77
- data/src/static_literals.c +617 -0
- data/src/token_type.c +14 -13
- data/src/util/pm_buffer.c +187 -20
- data/src/util/pm_char.c +5 -5
- data/src/util/pm_constant_pool.c +39 -19
- data/src/util/pm_integer.c +670 -0
- data/src/util/pm_list.c +1 -1
- data/src/util/pm_newline_list.c +43 -5
- data/src/util/pm_string.c +213 -33
- data/src/util/pm_strncasecmp.c +13 -1
- data/src/util/pm_strpbrk.c +32 -6
- metadata +55 -19
- data/docs/ripper.md +0 -36
- data/include/prism/util/pm_state_stack.h +0 -42
- data/include/prism/util/pm_string_list.h +0 -44
- data/lib/prism/debug.rb +0 -206
- data/lib/prism/node_inspector.rb +0 -68
- data/lib/prism/translation/parser/rubocop.rb +0 -45
- data/rbi/prism_static.rbi +0 -207
- data/sig/prism_static.rbs +0 -201
- data/src/util/pm_state_stack.c +0 -25
- data/src/util/pm_string_list.c +0 -28
data/src/serialize.c
CHANGED
@@ -1,12 +1,18 @@
|
|
1
|
-
|
1
|
+
/*----------------------------------------------------------------------------*/
|
2
2
|
/* This file is generated by the templates/template.rb script and should not */
|
3
3
|
/* be modified manually. See */
|
4
4
|
/* templates/src/serialize.c.erb */
|
5
5
|
/* if you are looking to modify the */
|
6
6
|
/* template */
|
7
|
-
|
7
|
+
/*----------------------------------------------------------------------------*/
|
8
|
+
|
8
9
|
#include "prism.h"
|
9
10
|
|
11
|
+
// We optionally support serializing to a binary string. For systems that don't
|
12
|
+
// want or need this functionality, it can be turned off with the
|
13
|
+
// PRISM_EXCLUDE_SERIALIZATION define.
|
14
|
+
#ifndef PRISM_EXCLUDE_SERIALIZATION
|
15
|
+
|
10
16
|
#include <stdio.h>
|
11
17
|
|
12
18
|
static inline uint32_t
|
@@ -32,7 +38,7 @@ pm_serialize_location(const pm_parser_t *parser, const pm_location_t *location,
|
|
32
38
|
}
|
33
39
|
|
34
40
|
static void
|
35
|
-
pm_serialize_string(pm_parser_t *parser, pm_string_t *string, pm_buffer_t *buffer) {
|
41
|
+
pm_serialize_string(const pm_parser_t *parser, const pm_string_t *string, pm_buffer_t *buffer) {
|
36
42
|
switch (string->type) {
|
37
43
|
case PM_STRING_SHARED: {
|
38
44
|
pm_buffer_append_byte(buffer, 1);
|
@@ -48,9 +54,25 @@ pm_serialize_string(pm_parser_t *parser, pm_string_t *string, pm_buffer_t *buffe
|
|
48
54
|
pm_buffer_append_bytes(buffer, pm_string_source(string), length);
|
49
55
|
break;
|
50
56
|
}
|
57
|
+
#ifdef PRISM_HAS_MMAP
|
51
58
|
case PM_STRING_MAPPED:
|
52
59
|
assert(false && "Cannot serialize mapped strings.");
|
53
60
|
break;
|
61
|
+
#endif
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
static void
|
66
|
+
pm_serialize_integer(const pm_integer_t *integer, pm_buffer_t *buffer) {
|
67
|
+
pm_buffer_append_byte(buffer, integer->negative ? 1 : 0);
|
68
|
+
if (integer->values == NULL) {
|
69
|
+
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(1));
|
70
|
+
pm_buffer_append_varuint(buffer, integer->value);
|
71
|
+
} else {
|
72
|
+
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(integer->length));
|
73
|
+
for (size_t i = 0; i < integer->length; i++) {
|
74
|
+
pm_buffer_append_varuint(buffer, integer->values[i]);
|
75
|
+
}
|
54
76
|
}
|
55
77
|
}
|
56
78
|
|
@@ -88,7 +110,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
88
110
|
break;
|
89
111
|
}
|
90
112
|
case PM_ARGUMENTS_NODE: {
|
91
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
113
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
92
114
|
uint32_t arguments_size = pm_sizet_to_u32(((pm_arguments_node_t *)node)->arguments.size);
|
93
115
|
pm_buffer_append_varuint(buffer, arguments_size);
|
94
116
|
for (uint32_t index = 0; index < arguments_size; index++) {
|
@@ -97,7 +119,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
97
119
|
break;
|
98
120
|
}
|
99
121
|
case PM_ARRAY_NODE: {
|
100
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
122
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
101
123
|
uint32_t elements_size = pm_sizet_to_u32(((pm_array_node_t *)node)->elements.size);
|
102
124
|
pm_buffer_append_varuint(buffer, elements_size);
|
103
125
|
for (uint32_t index = 0; index < elements_size; index++) {
|
@@ -177,7 +199,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
177
199
|
break;
|
178
200
|
}
|
179
201
|
case PM_BLOCK_LOCAL_VARIABLE_NODE: {
|
180
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
202
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
181
203
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_block_local_variable_node_t *)node)->name));
|
182
204
|
break;
|
183
205
|
}
|
@@ -200,7 +222,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
200
222
|
break;
|
201
223
|
}
|
202
224
|
case PM_BLOCK_PARAMETER_NODE: {
|
203
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
225
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
204
226
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_block_parameter_node_t *)node)->name));
|
205
227
|
break;
|
206
228
|
}
|
@@ -226,7 +248,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
226
248
|
break;
|
227
249
|
}
|
228
250
|
case PM_CALL_AND_WRITE_NODE: {
|
229
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
251
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
230
252
|
if (((pm_call_and_write_node_t *)node)->receiver == NULL) {
|
231
253
|
pm_buffer_append_byte(buffer, 0);
|
232
254
|
} else {
|
@@ -238,7 +260,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
238
260
|
break;
|
239
261
|
}
|
240
262
|
case PM_CALL_NODE: {
|
241
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
263
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
242
264
|
if (((pm_call_node_t *)node)->receiver == NULL) {
|
243
265
|
pm_buffer_append_byte(buffer, 0);
|
244
266
|
} else {
|
@@ -258,7 +280,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
258
280
|
break;
|
259
281
|
}
|
260
282
|
case PM_CALL_OPERATOR_WRITE_NODE: {
|
261
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
283
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
262
284
|
if (((pm_call_operator_write_node_t *)node)->receiver == NULL) {
|
263
285
|
pm_buffer_append_byte(buffer, 0);
|
264
286
|
} else {
|
@@ -266,12 +288,12 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
266
288
|
}
|
267
289
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_call_operator_write_node_t *)node)->read_name));
|
268
290
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_call_operator_write_node_t *)node)->write_name));
|
269
|
-
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_call_operator_write_node_t *)node)->
|
291
|
+
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_call_operator_write_node_t *)node)->binary_operator));
|
270
292
|
pm_serialize_node(parser, (pm_node_t *)((pm_call_operator_write_node_t *)node)->value, buffer);
|
271
293
|
break;
|
272
294
|
}
|
273
295
|
case PM_CALL_OR_WRITE_NODE: {
|
274
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
296
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
275
297
|
if (((pm_call_or_write_node_t *)node)->receiver == NULL) {
|
276
298
|
pm_buffer_append_byte(buffer, 0);
|
277
299
|
} else {
|
@@ -283,7 +305,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
283
305
|
break;
|
284
306
|
}
|
285
307
|
case PM_CALL_TARGET_NODE: {
|
286
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
308
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
287
309
|
pm_serialize_node(parser, (pm_node_t *)((pm_call_target_node_t *)node)->receiver, buffer);
|
288
310
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_call_target_node_t *)node)->name));
|
289
311
|
break;
|
@@ -304,10 +326,10 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
304
326
|
for (uint32_t index = 0; index < conditions_size; index++) {
|
305
327
|
pm_serialize_node(parser, (pm_node_t *) ((pm_case_match_node_t *)node)->conditions.nodes[index], buffer);
|
306
328
|
}
|
307
|
-
if (((pm_case_match_node_t *)node)->
|
329
|
+
if (((pm_case_match_node_t *)node)->else_clause == NULL) {
|
308
330
|
pm_buffer_append_byte(buffer, 0);
|
309
331
|
} else {
|
310
|
-
pm_serialize_node(parser, (pm_node_t *)((pm_case_match_node_t *)node)->
|
332
|
+
pm_serialize_node(parser, (pm_node_t *)((pm_case_match_node_t *)node)->else_clause, buffer);
|
311
333
|
}
|
312
334
|
break;
|
313
335
|
}
|
@@ -322,10 +344,10 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
322
344
|
for (uint32_t index = 0; index < conditions_size; index++) {
|
323
345
|
pm_serialize_node(parser, (pm_node_t *) ((pm_case_node_t *)node)->conditions.nodes[index], buffer);
|
324
346
|
}
|
325
|
-
if (((pm_case_node_t *)node)->
|
347
|
+
if (((pm_case_node_t *)node)->else_clause == NULL) {
|
326
348
|
pm_buffer_append_byte(buffer, 0);
|
327
349
|
} else {
|
328
|
-
pm_serialize_node(parser, (pm_node_t *)((pm_case_node_t *)node)->
|
350
|
+
pm_serialize_node(parser, (pm_node_t *)((pm_case_node_t *)node)->else_clause, buffer);
|
329
351
|
}
|
330
352
|
break;
|
331
353
|
}
|
@@ -357,7 +379,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
357
379
|
case PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE: {
|
358
380
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_class_variable_operator_write_node_t *)node)->name));
|
359
381
|
pm_serialize_node(parser, (pm_node_t *)((pm_class_variable_operator_write_node_t *)node)->value, buffer);
|
360
|
-
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_class_variable_operator_write_node_t *)node)->
|
382
|
+
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_class_variable_operator_write_node_t *)node)->binary_operator));
|
361
383
|
break;
|
362
384
|
}
|
363
385
|
case PM_CLASS_VARIABLE_OR_WRITE_NODE: {
|
@@ -386,7 +408,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
386
408
|
case PM_CONSTANT_OPERATOR_WRITE_NODE: {
|
387
409
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_constant_operator_write_node_t *)node)->name));
|
388
410
|
pm_serialize_node(parser, (pm_node_t *)((pm_constant_operator_write_node_t *)node)->value, buffer);
|
389
|
-
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_constant_operator_write_node_t *)node)->
|
411
|
+
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_constant_operator_write_node_t *)node)->binary_operator));
|
390
412
|
break;
|
391
413
|
}
|
392
414
|
case PM_CONSTANT_OR_WRITE_NODE: {
|
@@ -405,13 +427,13 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
405
427
|
} else {
|
406
428
|
pm_serialize_node(parser, (pm_node_t *)((pm_constant_path_node_t *)node)->parent, buffer);
|
407
429
|
}
|
408
|
-
|
430
|
+
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_constant_path_node_t *)node)->name));
|
409
431
|
break;
|
410
432
|
}
|
411
433
|
case PM_CONSTANT_PATH_OPERATOR_WRITE_NODE: {
|
412
434
|
pm_serialize_node(parser, (pm_node_t *)((pm_constant_path_operator_write_node_t *)node)->target, buffer);
|
413
435
|
pm_serialize_node(parser, (pm_node_t *)((pm_constant_path_operator_write_node_t *)node)->value, buffer);
|
414
|
-
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_constant_path_operator_write_node_t *)node)->
|
436
|
+
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_constant_path_operator_write_node_t *)node)->binary_operator));
|
415
437
|
break;
|
416
438
|
}
|
417
439
|
case PM_CONSTANT_PATH_OR_WRITE_NODE: {
|
@@ -425,7 +447,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
425
447
|
} else {
|
426
448
|
pm_serialize_node(parser, (pm_node_t *)((pm_constant_path_target_node_t *)node)->parent, buffer);
|
427
449
|
}
|
428
|
-
|
450
|
+
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_constant_path_target_node_t *)node)->name));
|
429
451
|
break;
|
430
452
|
}
|
431
453
|
case PM_CONSTANT_PATH_WRITE_NODE: {
|
@@ -528,7 +550,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
528
550
|
break;
|
529
551
|
}
|
530
552
|
case PM_FLIP_FLOP_NODE: {
|
531
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
553
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
532
554
|
if (((pm_flip_flop_node_t *)node)->left == NULL) {
|
533
555
|
pm_buffer_append_byte(buffer, 0);
|
534
556
|
} else {
|
@@ -542,6 +564,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
542
564
|
break;
|
543
565
|
}
|
544
566
|
case PM_FLOAT_NODE: {
|
567
|
+
pm_buffer_append_double(buffer, ((pm_float_node_t *)node)->value);
|
545
568
|
break;
|
546
569
|
}
|
547
570
|
case PM_FOR_NODE: {
|
@@ -576,7 +599,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
576
599
|
case PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE: {
|
577
600
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_global_variable_operator_write_node_t *)node)->name));
|
578
601
|
pm_serialize_node(parser, (pm_node_t *)((pm_global_variable_operator_write_node_t *)node)->value, buffer);
|
579
|
-
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_global_variable_operator_write_node_t *)node)->
|
602
|
+
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_global_variable_operator_write_node_t *)node)->binary_operator));
|
580
603
|
break;
|
581
604
|
}
|
582
605
|
case PM_GLOBAL_VARIABLE_OR_WRITE_NODE: {
|
@@ -630,10 +653,10 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
630
653
|
} else {
|
631
654
|
pm_serialize_node(parser, (pm_node_t *)((pm_if_node_t *)node)->statements, buffer);
|
632
655
|
}
|
633
|
-
if (((pm_if_node_t *)node)->
|
656
|
+
if (((pm_if_node_t *)node)->subsequent == NULL) {
|
634
657
|
pm_buffer_append_byte(buffer, 0);
|
635
658
|
} else {
|
636
|
-
pm_serialize_node(parser, (pm_node_t *)((pm_if_node_t *)node)->
|
659
|
+
pm_serialize_node(parser, (pm_node_t *)((pm_if_node_t *)node)->subsequent, buffer);
|
637
660
|
}
|
638
661
|
break;
|
639
662
|
}
|
@@ -658,7 +681,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
658
681
|
break;
|
659
682
|
}
|
660
683
|
case PM_INDEX_AND_WRITE_NODE: {
|
661
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
684
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
662
685
|
if (((pm_index_and_write_node_t *)node)->receiver == NULL) {
|
663
686
|
pm_buffer_append_byte(buffer, 0);
|
664
687
|
} else {
|
@@ -678,7 +701,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
678
701
|
break;
|
679
702
|
}
|
680
703
|
case PM_INDEX_OPERATOR_WRITE_NODE: {
|
681
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
704
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
682
705
|
if (((pm_index_operator_write_node_t *)node)->receiver == NULL) {
|
683
706
|
pm_buffer_append_byte(buffer, 0);
|
684
707
|
} else {
|
@@ -694,12 +717,12 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
694
717
|
} else {
|
695
718
|
pm_serialize_node(parser, (pm_node_t *)((pm_index_operator_write_node_t *)node)->block, buffer);
|
696
719
|
}
|
697
|
-
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_index_operator_write_node_t *)node)->
|
720
|
+
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_index_operator_write_node_t *)node)->binary_operator));
|
698
721
|
pm_serialize_node(parser, (pm_node_t *)((pm_index_operator_write_node_t *)node)->value, buffer);
|
699
722
|
break;
|
700
723
|
}
|
701
724
|
case PM_INDEX_OR_WRITE_NODE: {
|
702
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
725
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
703
726
|
if (((pm_index_or_write_node_t *)node)->receiver == NULL) {
|
704
727
|
pm_buffer_append_byte(buffer, 0);
|
705
728
|
} else {
|
@@ -719,7 +742,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
719
742
|
break;
|
720
743
|
}
|
721
744
|
case PM_INDEX_TARGET_NODE: {
|
722
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
745
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
723
746
|
pm_serialize_node(parser, (pm_node_t *)((pm_index_target_node_t *)node)->receiver, buffer);
|
724
747
|
if (((pm_index_target_node_t *)node)->arguments == NULL) {
|
725
748
|
pm_buffer_append_byte(buffer, 0);
|
@@ -741,7 +764,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
741
764
|
case PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE: {
|
742
765
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_instance_variable_operator_write_node_t *)node)->name));
|
743
766
|
pm_serialize_node(parser, (pm_node_t *)((pm_instance_variable_operator_write_node_t *)node)->value, buffer);
|
744
|
-
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_instance_variable_operator_write_node_t *)node)->
|
767
|
+
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_instance_variable_operator_write_node_t *)node)->binary_operator));
|
745
768
|
break;
|
746
769
|
}
|
747
770
|
case PM_INSTANCE_VARIABLE_OR_WRITE_NODE: {
|
@@ -763,11 +786,12 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
763
786
|
break;
|
764
787
|
}
|
765
788
|
case PM_INTEGER_NODE: {
|
766
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
789
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
790
|
+
pm_serialize_integer(&((pm_integer_node_t *)node)->value, buffer);
|
767
791
|
break;
|
768
792
|
}
|
769
793
|
case PM_INTERPOLATED_MATCH_LAST_LINE_NODE: {
|
770
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
794
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
771
795
|
uint32_t parts_size = pm_sizet_to_u32(((pm_interpolated_match_last_line_node_t *)node)->parts.size);
|
772
796
|
pm_buffer_append_varuint(buffer, parts_size);
|
773
797
|
for (uint32_t index = 0; index < parts_size; index++) {
|
@@ -776,7 +800,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
776
800
|
break;
|
777
801
|
}
|
778
802
|
case PM_INTERPOLATED_REGULAR_EXPRESSION_NODE: {
|
779
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
803
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
780
804
|
uint32_t parts_size = pm_sizet_to_u32(((pm_interpolated_regular_expression_node_t *)node)->parts.size);
|
781
805
|
pm_buffer_append_varuint(buffer, parts_size);
|
782
806
|
for (uint32_t index = 0; index < parts_size; index++) {
|
@@ -785,6 +809,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
785
809
|
break;
|
786
810
|
}
|
787
811
|
case PM_INTERPOLATED_STRING_NODE: {
|
812
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
788
813
|
uint32_t parts_size = pm_sizet_to_u32(((pm_interpolated_string_node_t *)node)->parts.size);
|
789
814
|
pm_buffer_append_varuint(buffer, parts_size);
|
790
815
|
for (uint32_t index = 0; index < parts_size; index++) {
|
@@ -808,8 +833,14 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
808
833
|
}
|
809
834
|
break;
|
810
835
|
}
|
836
|
+
case PM_IT_LOCAL_VARIABLE_READ_NODE: {
|
837
|
+
break;
|
838
|
+
}
|
839
|
+
case PM_IT_PARAMETERS_NODE: {
|
840
|
+
break;
|
841
|
+
}
|
811
842
|
case PM_KEYWORD_HASH_NODE: {
|
812
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
843
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
813
844
|
uint32_t elements_size = pm_sizet_to_u32(((pm_keyword_hash_node_t *)node)->elements.size);
|
814
845
|
pm_buffer_append_varuint(buffer, elements_size);
|
815
846
|
for (uint32_t index = 0; index < elements_size; index++) {
|
@@ -818,7 +849,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
818
849
|
break;
|
819
850
|
}
|
820
851
|
case PM_KEYWORD_REST_PARAMETER_NODE: {
|
821
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
852
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
822
853
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_keyword_rest_parameter_node_t *)node)->name));
|
823
854
|
break;
|
824
855
|
}
|
@@ -849,7 +880,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
849
880
|
case PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE: {
|
850
881
|
pm_serialize_node(parser, (pm_node_t *)((pm_local_variable_operator_write_node_t *)node)->value, buffer);
|
851
882
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_local_variable_operator_write_node_t *)node)->name));
|
852
|
-
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_local_variable_operator_write_node_t *)node)->
|
883
|
+
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_local_variable_operator_write_node_t *)node)->binary_operator));
|
853
884
|
pm_buffer_append_varuint(buffer, ((pm_local_variable_operator_write_node_t *)node)->depth);
|
854
885
|
break;
|
855
886
|
}
|
@@ -876,7 +907,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
876
907
|
break;
|
877
908
|
}
|
878
909
|
case PM_MATCH_LAST_LINE_NODE: {
|
879
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
910
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
880
911
|
pm_serialize_string(parser, &((pm_match_last_line_node_t *)node)->unescaped, buffer);
|
881
912
|
break;
|
882
913
|
}
|
@@ -977,13 +1008,13 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
977
1008
|
break;
|
978
1009
|
}
|
979
1010
|
case PM_OPTIONAL_KEYWORD_PARAMETER_NODE: {
|
980
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
1011
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
981
1012
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_optional_keyword_parameter_node_t *)node)->name));
|
982
1013
|
pm_serialize_node(parser, (pm_node_t *)((pm_optional_keyword_parameter_node_t *)node)->value, buffer);
|
983
1014
|
break;
|
984
1015
|
}
|
985
1016
|
case PM_OPTIONAL_PARAMETER_NODE: {
|
986
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
1017
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
987
1018
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_optional_parameter_node_t *)node)->name));
|
988
1019
|
pm_serialize_node(parser, (pm_node_t *)((pm_optional_parameter_node_t *)node)->value, buffer);
|
989
1020
|
break;
|
@@ -1032,6 +1063,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
1032
1063
|
break;
|
1033
1064
|
}
|
1034
1065
|
case PM_PARENTHESES_NODE: {
|
1066
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
1035
1067
|
if (((pm_parentheses_node_t *)node)->body == NULL) {
|
1036
1068
|
pm_buffer_append_byte(buffer, 0);
|
1037
1069
|
} else {
|
@@ -1073,7 +1105,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
1073
1105
|
break;
|
1074
1106
|
}
|
1075
1107
|
case PM_RANGE_NODE: {
|
1076
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
1108
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
1077
1109
|
if (((pm_range_node_t *)node)->left == NULL) {
|
1078
1110
|
pm_buffer_append_byte(buffer, 0);
|
1079
1111
|
} else {
|
@@ -1087,24 +1119,26 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
1087
1119
|
break;
|
1088
1120
|
}
|
1089
1121
|
case PM_RATIONAL_NODE: {
|
1090
|
-
|
1122
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
1123
|
+
pm_serialize_integer(&((pm_rational_node_t *)node)->numerator, buffer);
|
1124
|
+
pm_serialize_integer(&((pm_rational_node_t *)node)->denominator, buffer);
|
1091
1125
|
break;
|
1092
1126
|
}
|
1093
1127
|
case PM_REDO_NODE: {
|
1094
1128
|
break;
|
1095
1129
|
}
|
1096
1130
|
case PM_REGULAR_EXPRESSION_NODE: {
|
1097
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
1131
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
1098
1132
|
pm_serialize_string(parser, &((pm_regular_expression_node_t *)node)->unescaped, buffer);
|
1099
1133
|
break;
|
1100
1134
|
}
|
1101
1135
|
case PM_REQUIRED_KEYWORD_PARAMETER_NODE: {
|
1102
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
1136
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
1103
1137
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_required_keyword_parameter_node_t *)node)->name));
|
1104
1138
|
break;
|
1105
1139
|
}
|
1106
1140
|
case PM_REQUIRED_PARAMETER_NODE: {
|
1107
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
1141
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
1108
1142
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_required_parameter_node_t *)node)->name));
|
1109
1143
|
break;
|
1110
1144
|
}
|
@@ -1129,15 +1163,15 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
1129
1163
|
} else {
|
1130
1164
|
pm_serialize_node(parser, (pm_node_t *)((pm_rescue_node_t *)node)->statements, buffer);
|
1131
1165
|
}
|
1132
|
-
if (((pm_rescue_node_t *)node)->
|
1166
|
+
if (((pm_rescue_node_t *)node)->subsequent == NULL) {
|
1133
1167
|
pm_buffer_append_byte(buffer, 0);
|
1134
1168
|
} else {
|
1135
|
-
pm_serialize_node(parser, (pm_node_t *)((pm_rescue_node_t *)node)->
|
1169
|
+
pm_serialize_node(parser, (pm_node_t *)((pm_rescue_node_t *)node)->subsequent, buffer);
|
1136
1170
|
}
|
1137
1171
|
break;
|
1138
1172
|
}
|
1139
1173
|
case PM_REST_PARAMETER_NODE: {
|
1140
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
1174
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
1141
1175
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(((pm_rest_parameter_node_t *)node)->name));
|
1142
1176
|
break;
|
1143
1177
|
}
|
@@ -1155,6 +1189,11 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
1155
1189
|
case PM_SELF_NODE: {
|
1156
1190
|
break;
|
1157
1191
|
}
|
1192
|
+
case PM_SHAREABLE_CONSTANT_NODE: {
|
1193
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
1194
|
+
pm_serialize_node(parser, (pm_node_t *)((pm_shareable_constant_node_t *)node)->write, buffer);
|
1195
|
+
break;
|
1196
|
+
}
|
1158
1197
|
case PM_SINGLETON_CLASS_NODE: {
|
1159
1198
|
uint32_t locals_size = pm_sizet_to_u32(((pm_singleton_class_node_t *)node)->locals.size);
|
1160
1199
|
pm_buffer_append_varuint(buffer, locals_size);
|
@@ -1173,6 +1212,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
1173
1212
|
break;
|
1174
1213
|
}
|
1175
1214
|
case PM_SOURCE_FILE_NODE: {
|
1215
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
1176
1216
|
pm_serialize_string(parser, &((pm_source_file_node_t *)node)->filepath, buffer);
|
1177
1217
|
break;
|
1178
1218
|
}
|
@@ -1196,7 +1236,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
1196
1236
|
break;
|
1197
1237
|
}
|
1198
1238
|
case PM_STRING_NODE: {
|
1199
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
1239
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
1200
1240
|
pm_serialize_string(parser, &((pm_string_node_t *)node)->unescaped, buffer);
|
1201
1241
|
break;
|
1202
1242
|
}
|
@@ -1214,7 +1254,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
1214
1254
|
break;
|
1215
1255
|
}
|
1216
1256
|
case PM_SYMBOL_NODE: {
|
1217
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
1257
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
1218
1258
|
pm_serialize_string(parser, &((pm_symbol_node_t *)node)->unescaped, buffer);
|
1219
1259
|
break;
|
1220
1260
|
}
|
@@ -1236,15 +1276,15 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
1236
1276
|
} else {
|
1237
1277
|
pm_serialize_node(parser, (pm_node_t *)((pm_unless_node_t *)node)->statements, buffer);
|
1238
1278
|
}
|
1239
|
-
if (((pm_unless_node_t *)node)->
|
1279
|
+
if (((pm_unless_node_t *)node)->else_clause == NULL) {
|
1240
1280
|
pm_buffer_append_byte(buffer, 0);
|
1241
1281
|
} else {
|
1242
|
-
pm_serialize_node(parser, (pm_node_t *)((pm_unless_node_t *)node)->
|
1282
|
+
pm_serialize_node(parser, (pm_node_t *)((pm_unless_node_t *)node)->else_clause, buffer);
|
1243
1283
|
}
|
1244
1284
|
break;
|
1245
1285
|
}
|
1246
1286
|
case PM_UNTIL_NODE: {
|
1247
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
1287
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
1248
1288
|
pm_serialize_node(parser, (pm_node_t *)((pm_until_node_t *)node)->predicate, buffer);
|
1249
1289
|
if (((pm_until_node_t *)node)->statements == NULL) {
|
1250
1290
|
pm_buffer_append_byte(buffer, 0);
|
@@ -1267,7 +1307,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
1267
1307
|
break;
|
1268
1308
|
}
|
1269
1309
|
case PM_WHILE_NODE: {
|
1270
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
1310
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
1271
1311
|
pm_serialize_node(parser, (pm_node_t *)((pm_while_node_t *)node)->predicate, buffer);
|
1272
1312
|
if (((pm_while_node_t *)node)->statements == NULL) {
|
1273
1313
|
pm_buffer_append_byte(buffer, 0);
|
@@ -1277,7 +1317,7 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
|
|
1277
1317
|
break;
|
1278
1318
|
}
|
1279
1319
|
case PM_X_STRING_NODE: {
|
1280
|
-
pm_buffer_append_varuint(buffer, (uint32_t)
|
1320
|
+
pm_buffer_append_varuint(buffer, (uint32_t) node->flags);
|
1281
1321
|
pm_serialize_string(parser, &((pm_x_string_node_t *)node)->unescaped, buffer);
|
1282
1322
|
break;
|
1283
1323
|
}
|
@@ -1358,6 +1398,9 @@ pm_serialize_data_loc(const pm_parser_t *parser, pm_buffer_t *buffer) {
|
|
1358
1398
|
|
1359
1399
|
static void
|
1360
1400
|
pm_serialize_diagnostic(pm_parser_t *parser, pm_diagnostic_t *diagnostic, pm_buffer_t *buffer) {
|
1401
|
+
// serialize the type
|
1402
|
+
pm_buffer_append_varuint(buffer, (uint32_t) diagnostic->diag_id);
|
1403
|
+
|
1361
1404
|
// serialize message
|
1362
1405
|
size_t message_length = strlen(diagnostic->message);
|
1363
1406
|
pm_buffer_append_varuint(buffer, pm_sizet_to_u32(message_length));
|
@@ -1400,7 +1443,7 @@ pm_serialize_metadata(pm_parser_t *parser, pm_buffer_t *buffer) {
|
|
1400
1443
|
pm_serialize_diagnostic_list(parser, &parser->warning_list, buffer);
|
1401
1444
|
}
|
1402
1445
|
|
1403
|
-
#line
|
1446
|
+
#line 275 "prism/templates/src/serialize.c.erb"
|
1404
1447
|
/**
|
1405
1448
|
* Serialize the metadata, nodes, and constant pool.
|
1406
1449
|
*/
|
@@ -1532,23 +1575,4 @@ pm_serialize_parse_lex(pm_buffer_t *buffer, const uint8_t *source, size_t size,
|
|
1532
1575
|
pm_options_free(&options);
|
1533
1576
|
}
|
1534
1577
|
|
1535
|
-
|
1536
|
-
* Parse the source and return true if it parses without errors or warnings.
|
1537
|
-
*/
|
1538
|
-
PRISM_EXPORTED_FUNCTION bool
|
1539
|
-
pm_parse_success_p(const uint8_t *source, size_t size, const char *data) {
|
1540
|
-
pm_options_t options = { 0 };
|
1541
|
-
pm_options_read(&options, data);
|
1542
|
-
|
1543
|
-
pm_parser_t parser;
|
1544
|
-
pm_parser_init(&parser, source, size, &options);
|
1545
|
-
|
1546
|
-
pm_node_t *node = pm_parse(&parser);
|
1547
|
-
pm_node_destroy(&parser, node);
|
1548
|
-
|
1549
|
-
bool result = parser.error_list.size == 0 && parser.warning_list.size == 0;
|
1550
|
-
pm_parser_free(&parser);
|
1551
|
-
pm_options_free(&options);
|
1552
|
-
|
1553
|
-
return result;
|
1554
|
-
}
|
1578
|
+
#endif
|