prism 0.19.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -1
  3. data/Makefile +5 -0
  4. data/README.md +8 -6
  5. data/config.yml +236 -38
  6. data/docs/build_system.md +19 -2
  7. data/docs/cruby_compilation.md +27 -0
  8. data/docs/parser_translation.md +34 -0
  9. data/docs/parsing_rules.md +19 -0
  10. data/docs/releasing.md +3 -3
  11. data/docs/ruby_api.md +1 -1
  12. data/docs/serialization.md +17 -5
  13. data/ext/prism/api_node.c +101 -81
  14. data/ext/prism/extension.c +74 -11
  15. data/ext/prism/extension.h +1 -1
  16. data/include/prism/ast.h +1699 -504
  17. data/include/prism/defines.h +8 -0
  18. data/include/prism/diagnostic.h +39 -2
  19. data/include/prism/encoding.h +10 -0
  20. data/include/prism/options.h +40 -14
  21. data/include/prism/parser.h +33 -17
  22. data/include/prism/util/pm_buffer.h +9 -0
  23. data/include/prism/util/pm_constant_pool.h +7 -0
  24. data/include/prism/util/pm_newline_list.h +0 -11
  25. data/include/prism/version.h +2 -2
  26. data/include/prism.h +19 -2
  27. data/lib/prism/debug.rb +11 -5
  28. data/lib/prism/dot_visitor.rb +36 -14
  29. data/lib/prism/dsl.rb +22 -22
  30. data/lib/prism/ffi.rb +2 -2
  31. data/lib/prism/node.rb +1020 -737
  32. data/lib/prism/node_ext.rb +2 -2
  33. data/lib/prism/parse_result.rb +17 -9
  34. data/lib/prism/serialize.rb +53 -29
  35. data/lib/prism/translation/parser/compiler.rb +1831 -0
  36. data/lib/prism/translation/parser/lexer.rb +335 -0
  37. data/lib/prism/translation/parser/rubocop.rb +37 -0
  38. data/lib/prism/translation/parser.rb +163 -0
  39. data/lib/prism/translation.rb +11 -0
  40. data/lib/prism.rb +1 -0
  41. data/prism.gemspec +12 -5
  42. data/rbi/prism.rbi +150 -88
  43. data/rbi/prism_static.rbi +15 -3
  44. data/sig/prism.rbs +996 -961
  45. data/sig/prism_static.rbs +123 -46
  46. data/src/diagnostic.c +259 -219
  47. data/src/encoding.c +4 -8
  48. data/src/node.c +2 -6
  49. data/src/options.c +24 -5
  50. data/src/prettyprint.c +174 -42
  51. data/src/prism.c +1136 -328
  52. data/src/serialize.c +12 -9
  53. data/src/token_type.c +353 -4
  54. data/src/util/pm_buffer.c +11 -0
  55. data/src/util/pm_constant_pool.c +12 -11
  56. data/src/util/pm_newline_list.c +2 -14
  57. metadata +10 -3
  58. data/docs/building.md +0 -29
data/src/encoding.c CHANGED
@@ -2277,7 +2277,10 @@ pm_utf_8_codepoint(const uint8_t *b, ptrdiff_t n, size_t *width) {
2277
2277
  return 0;
2278
2278
  }
2279
2279
 
2280
- static size_t
2280
+ /**
2281
+ * Return the size of the next character in the UTF-8 encoding.
2282
+ */
2283
+ size_t
2281
2284
  pm_encoding_utf_8_char_width(const uint8_t *b, ptrdiff_t n) {
2282
2285
  size_t width;
2283
2286
  pm_utf_8_codepoint(b, n, &width);
@@ -5022,10 +5025,6 @@ pm_encoding_find(const uint8_t *start, const uint8_t *end) {
5022
5025
  ENCODING2("EUC-CN", "eucCN", PM_ENCODING_GB2312);
5023
5026
  ENCODING2("EUC-TW", "eucTW", PM_ENCODING_EUC_TW);
5024
5027
  ENCODING1("Emacs-Mule", PM_ENCODING_EMACS_MULE);
5025
- ENCODING1("external", PM_ENCODING_UTF_8);
5026
- break;
5027
- case 'F': case 'f':
5028
- ENCODING1("filesystem", PM_ENCODING_UTF_8);
5029
5028
  break;
5030
5029
  case 'G': case 'g':
5031
5030
  ENCODING1("GBK", PM_ENCODING_GBK);
@@ -5071,9 +5070,6 @@ pm_encoding_find(const uint8_t *start, const uint8_t *end) {
5071
5070
  ENCODING1("KOI8-R", PM_ENCODING_KOI8_R);
5072
5071
  ENCODING1("KOI8-U", PM_ENCODING_KOI8_U);
5073
5072
  break;
5074
- case 'L': case 'l':
5075
- ENCODING1("locale", PM_ENCODING_UTF_8);
5076
- break;
5077
5073
  case 'M': case 'm':
5078
5074
  ENCODING1("macCentEuro", PM_ENCODING_MAC_CENT_EURO);
5079
5075
  ENCODING1("macCroatian", PM_ENCODING_MAC_CROATIAN);
data/src/node.c CHANGED
@@ -117,9 +117,7 @@ pm_node_destroy(pm_parser_t *parser, pm_node_t *node) {
117
117
  case PM_ASSOC_NODE: {
118
118
  pm_assoc_node_t *cast = (pm_assoc_node_t *) node;
119
119
  pm_node_destroy(parser, (pm_node_t *)cast->key);
120
- if (cast->value != NULL) {
121
- pm_node_destroy(parser, (pm_node_t *)cast->value);
122
- }
120
+ pm_node_destroy(parser, (pm_node_t *)cast->value);
123
121
  break;
124
122
  }
125
123
  #line 58 "node.c.erb"
@@ -1223,9 +1221,7 @@ pm_node_memsize_node(pm_node_t *node, pm_memsize_t *memsize) {
1223
1221
  pm_assoc_node_t *cast = (pm_assoc_node_t *) node;
1224
1222
  memsize->memsize += sizeof(*cast);
1225
1223
  pm_node_memsize_node((pm_node_t *)cast->key, memsize);
1226
- if (cast->value != NULL) {
1227
- pm_node_memsize_node((pm_node_t *)cast->value, memsize);
1228
- }
1224
+ pm_node_memsize_node((pm_node_t *)cast->value, memsize);
1229
1225
  break;
1230
1226
  }
1231
1227
  #line 103 "node.c.erb"
data/src/options.c CHANGED
@@ -33,11 +33,30 @@ pm_options_frozen_string_literal_set(pm_options_t *options, bool frozen_string_l
33
33
  }
34
34
 
35
35
  /**
36
- * Set the suppress warnings option on the given options struct.
36
+ * Set the version option on the given options struct by parsing the given
37
+ * string. If the string contains an invalid option, this returns false.
38
+ * Otherwise, it returns true.
37
39
  */
38
- PRISM_EXPORTED_FUNCTION void
39
- pm_options_suppress_warnings_set(pm_options_t *options, bool suppress_warnings) {
40
- options->suppress_warnings = suppress_warnings;
40
+ PRISM_EXPORTED_FUNCTION bool
41
+ pm_options_version_set(pm_options_t *options, const char *version, size_t length) {
42
+ if (version == NULL && length == 0) {
43
+ options->version = PM_OPTIONS_VERSION_LATEST;
44
+ return true;
45
+ }
46
+
47
+ if (length == 5) {
48
+ if (strncmp(version, "3.3.0", 5) == 0) {
49
+ options->version = PM_OPTIONS_VERSION_CRUBY_3_3_0;
50
+ return true;
51
+ }
52
+
53
+ if (strncmp(version, "latest", 6) == 0) {
54
+ options->version = PM_OPTIONS_VERSION_LATEST;
55
+ return true;
56
+ }
57
+ }
58
+
59
+ return false;
41
60
  }
42
61
 
43
62
  /**
@@ -162,7 +181,7 @@ pm_options_read(pm_options_t *options, const char *data) {
162
181
  }
163
182
 
164
183
  options->frozen_string_literal = *data++;
165
- options->suppress_warnings = *data++;
184
+ options->version = (pm_options_version_t) *data++;
166
185
 
167
186
  uint32_t scopes_count = pm_options_read_u32(data);
168
187
  data += 4;
data/src/prettyprint.c CHANGED
@@ -46,7 +46,7 @@ static inline void
46
46
  prettyprint_location(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm_location_t *location) {
47
47
  pm_line_column_t start = pm_newline_list_line_column(&parser->newline_list, location->start);
48
48
  pm_line_column_t end = pm_newline_list_line_column(&parser->newline_list, location->end);
49
- pm_buffer_append_format(output_buffer, "(%lu,%lu)-(%lu,%lu)", (unsigned long) (start.line + 1), (unsigned long) start.column, (unsigned long) (end.line + 1), (unsigned long) end.column);
49
+ pm_buffer_append_format(output_buffer, "(%lu,%lu)-(%lu,%lu)", (unsigned long) start.line, (unsigned long) start.column, (unsigned long) end.line, (unsigned long) end.column);
50
50
  }
51
51
 
52
52
  static inline void
@@ -518,17 +518,13 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
518
518
  {
519
519
  pm_buffer_concat(output_buffer, prefix_buffer);
520
520
  pm_buffer_append_string(output_buffer, "\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 value:", 16);
521
- if (cast->value == NULL) {
522
- pm_buffer_append_string(output_buffer, " \xe2\x88\x85\n", 5);
523
- } else {
524
- pm_buffer_append_byte(output_buffer, '\n');
521
+ pm_buffer_append_byte(output_buffer, '\n');
525
522
 
526
- size_t prefix_length = prefix_buffer->length;
527
- pm_buffer_append_string(prefix_buffer, "\xe2\x94\x82 ", 6);
528
- pm_buffer_concat(output_buffer, prefix_buffer);
529
- prettyprint_node(output_buffer, parser, (pm_node_t *) cast->value, prefix_buffer);
530
- prefix_buffer->length = prefix_length;
531
- }
523
+ size_t prefix_length = prefix_buffer->length;
524
+ pm_buffer_append_string(prefix_buffer, "\xe2\x94\x82 ", 6);
525
+ pm_buffer_concat(output_buffer, prefix_buffer);
526
+ prettyprint_node(output_buffer, parser, (pm_node_t *) cast->value, prefix_buffer);
527
+ prefix_buffer->length = prefix_length;
532
528
  }
533
529
 
534
530
  // operator_loc
@@ -754,6 +750,20 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
754
750
  prettyprint_location(output_buffer, parser, &node->location);
755
751
  pm_buffer_append_string(output_buffer, ")\n", 2);
756
752
 
753
+ // flags
754
+ {
755
+ pm_buffer_concat(output_buffer, prefix_buffer);
756
+ pm_buffer_append_string(output_buffer, "\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 flags:", 16);
757
+ bool found = false;
758
+ if (cast->base.flags & PM_PARAMETER_FLAGS_REPEATED_PARAMETER) {
759
+ if (found) pm_buffer_append_byte(output_buffer, ',');
760
+ pm_buffer_append_string(output_buffer, " repeated_parameter", 19);
761
+ found = true;
762
+ }
763
+ if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
764
+ pm_buffer_append_byte(output_buffer, '\n');
765
+ }
766
+
757
767
  // name
758
768
  {
759
769
  pm_buffer_concat(output_buffer, prefix_buffer);
@@ -783,13 +793,6 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
783
793
  pm_buffer_append_string(output_buffer, "]\n", 2);
784
794
  }
785
795
 
786
- // locals_body_index
787
- {
788
- pm_buffer_concat(output_buffer, prefix_buffer);
789
- pm_buffer_append_string(output_buffer, "\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 locals_body_index:", 28);
790
- pm_buffer_append_format(output_buffer, " %d\n", cast->locals_body_index);
791
- }
792
-
793
796
  // parameters
794
797
  {
795
798
  pm_buffer_concat(output_buffer, prefix_buffer);
@@ -856,6 +859,20 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
856
859
  prettyprint_location(output_buffer, parser, &node->location);
857
860
  pm_buffer_append_string(output_buffer, ")\n", 2);
858
861
 
862
+ // flags
863
+ {
864
+ pm_buffer_concat(output_buffer, prefix_buffer);
865
+ pm_buffer_append_string(output_buffer, "\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 flags:", 16);
866
+ bool found = false;
867
+ if (cast->base.flags & PM_PARAMETER_FLAGS_REPEATED_PARAMETER) {
868
+ if (found) pm_buffer_append_byte(output_buffer, ',');
869
+ pm_buffer_append_string(output_buffer, " repeated_parameter", 19);
870
+ found = true;
871
+ }
872
+ if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
873
+ pm_buffer_append_byte(output_buffer, '\n');
874
+ }
875
+
859
876
  // name
860
877
  {
861
878
  pm_buffer_concat(output_buffer, prefix_buffer);
@@ -1044,6 +1061,11 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
1044
1061
  pm_buffer_append_string(output_buffer, " attribute_write", 16);
1045
1062
  found = true;
1046
1063
  }
1064
+ if (cast->base.flags & PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY) {
1065
+ if (found) pm_buffer_append_byte(output_buffer, ',');
1066
+ pm_buffer_append_string(output_buffer, " ignore_visibility", 18);
1067
+ found = true;
1068
+ }
1047
1069
  if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
1048
1070
  pm_buffer_append_byte(output_buffer, '\n');
1049
1071
  }
@@ -1168,6 +1190,11 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
1168
1190
  pm_buffer_append_string(output_buffer, " attribute_write", 16);
1169
1191
  found = true;
1170
1192
  }
1193
+ if (cast->base.flags & PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY) {
1194
+ if (found) pm_buffer_append_byte(output_buffer, ',');
1195
+ pm_buffer_append_string(output_buffer, " ignore_visibility", 18);
1196
+ found = true;
1197
+ }
1171
1198
  if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
1172
1199
  pm_buffer_append_byte(output_buffer, '\n');
1173
1200
  }
@@ -1324,6 +1351,11 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
1324
1351
  pm_buffer_append_string(output_buffer, " attribute_write", 16);
1325
1352
  found = true;
1326
1353
  }
1354
+ if (cast->base.flags & PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY) {
1355
+ if (found) pm_buffer_append_byte(output_buffer, ',');
1356
+ pm_buffer_append_string(output_buffer, " ignore_visibility", 18);
1357
+ found = true;
1358
+ }
1327
1359
  if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
1328
1360
  pm_buffer_append_byte(output_buffer, '\n');
1329
1361
  }
@@ -1457,6 +1489,11 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
1457
1489
  pm_buffer_append_string(output_buffer, " attribute_write", 16);
1458
1490
  found = true;
1459
1491
  }
1492
+ if (cast->base.flags & PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY) {
1493
+ if (found) pm_buffer_append_byte(output_buffer, ',');
1494
+ pm_buffer_append_string(output_buffer, " ignore_visibility", 18);
1495
+ found = true;
1496
+ }
1460
1497
  if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
1461
1498
  pm_buffer_append_byte(output_buffer, '\n');
1462
1499
  }
@@ -1581,6 +1618,11 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
1581
1618
  pm_buffer_append_string(output_buffer, " attribute_write", 16);
1582
1619
  found = true;
1583
1620
  }
1621
+ if (cast->base.flags & PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY) {
1622
+ if (found) pm_buffer_append_byte(output_buffer, ',');
1623
+ pm_buffer_append_string(output_buffer, " ignore_visibility", 18);
1624
+ found = true;
1625
+ }
1584
1626
  if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
1585
1627
  pm_buffer_append_byte(output_buffer, '\n');
1586
1628
  }
@@ -2882,13 +2924,6 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
2882
2924
  pm_buffer_append_string(output_buffer, "]\n", 2);
2883
2925
  }
2884
2926
 
2885
- // locals_body_index
2886
- {
2887
- pm_buffer_concat(output_buffer, prefix_buffer);
2888
- pm_buffer_append_string(output_buffer, "\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 locals_body_index:", 28);
2889
- pm_buffer_append_format(output_buffer, " %d\n", cast->locals_body_index);
2890
- }
2891
-
2892
2927
  // def_keyword_loc
2893
2928
  {
2894
2929
  pm_buffer_concat(output_buffer, prefix_buffer);
@@ -4223,6 +4258,11 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
4223
4258
  pm_buffer_append_string(output_buffer, " attribute_write", 16);
4224
4259
  found = true;
4225
4260
  }
4261
+ if (cast->base.flags & PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY) {
4262
+ if (found) pm_buffer_append_byte(output_buffer, ',');
4263
+ pm_buffer_append_string(output_buffer, " ignore_visibility", 18);
4264
+ found = true;
4265
+ }
4226
4266
  if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
4227
4267
  pm_buffer_append_byte(output_buffer, '\n');
4228
4268
  }
@@ -4371,6 +4411,11 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
4371
4411
  pm_buffer_append_string(output_buffer, " attribute_write", 16);
4372
4412
  found = true;
4373
4413
  }
4414
+ if (cast->base.flags & PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY) {
4415
+ if (found) pm_buffer_append_byte(output_buffer, ',');
4416
+ pm_buffer_append_string(output_buffer, " ignore_visibility", 18);
4417
+ found = true;
4418
+ }
4374
4419
  if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
4375
4420
  pm_buffer_append_byte(output_buffer, '\n');
4376
4421
  }
@@ -4528,6 +4573,11 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
4528
4573
  pm_buffer_append_string(output_buffer, " attribute_write", 16);
4529
4574
  found = true;
4530
4575
  }
4576
+ if (cast->base.flags & PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY) {
4577
+ if (found) pm_buffer_append_byte(output_buffer, ',');
4578
+ pm_buffer_append_string(output_buffer, " ignore_visibility", 18);
4579
+ found = true;
4580
+ }
4531
4581
  if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
4532
4582
  pm_buffer_append_byte(output_buffer, '\n');
4533
4583
  }
@@ -4676,6 +4726,11 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
4676
4726
  pm_buffer_append_string(output_buffer, " attribute_write", 16);
4677
4727
  found = true;
4678
4728
  }
4729
+ if (cast->base.flags & PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY) {
4730
+ if (found) pm_buffer_append_byte(output_buffer, ',');
4731
+ pm_buffer_append_string(output_buffer, " ignore_visibility", 18);
4732
+ found = true;
4733
+ }
4679
4734
  if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
4680
4735
  pm_buffer_append_byte(output_buffer, '\n');
4681
4736
  }
@@ -5489,9 +5544,9 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
5489
5544
  pm_buffer_concat(output_buffer, prefix_buffer);
5490
5545
  pm_buffer_append_string(output_buffer, "\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 flags:", 16);
5491
5546
  bool found = false;
5492
- if (cast->base.flags & PM_KEYWORD_HASH_NODE_FLAGS_STATIC_KEYS) {
5547
+ if (cast->base.flags & PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS) {
5493
5548
  if (found) pm_buffer_append_byte(output_buffer, ',');
5494
- pm_buffer_append_string(output_buffer, " static_keys", 12);
5549
+ pm_buffer_append_string(output_buffer, " symbol_keys", 12);
5495
5550
  found = true;
5496
5551
  }
5497
5552
  if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
@@ -5531,6 +5586,20 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
5531
5586
  prettyprint_location(output_buffer, parser, &node->location);
5532
5587
  pm_buffer_append_string(output_buffer, ")\n", 2);
5533
5588
 
5589
+ // flags
5590
+ {
5591
+ pm_buffer_concat(output_buffer, prefix_buffer);
5592
+ pm_buffer_append_string(output_buffer, "\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 flags:", 16);
5593
+ bool found = false;
5594
+ if (cast->base.flags & PM_PARAMETER_FLAGS_REPEATED_PARAMETER) {
5595
+ if (found) pm_buffer_append_byte(output_buffer, ',');
5596
+ pm_buffer_append_string(output_buffer, " repeated_parameter", 19);
5597
+ found = true;
5598
+ }
5599
+ if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
5600
+ pm_buffer_append_byte(output_buffer, '\n');
5601
+ }
5602
+
5534
5603
  // name
5535
5604
  {
5536
5605
  pm_buffer_concat(output_buffer, prefix_buffer);
@@ -5592,13 +5661,6 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
5592
5661
  pm_buffer_append_string(output_buffer, "]\n", 2);
5593
5662
  }
5594
5663
 
5595
- // locals_body_index
5596
- {
5597
- pm_buffer_concat(output_buffer, prefix_buffer);
5598
- pm_buffer_append_string(output_buffer, "\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 locals_body_index:", 28);
5599
- pm_buffer_append_format(output_buffer, " %d\n", cast->locals_body_index);
5600
- }
5601
-
5602
5664
  // operator_loc
5603
5665
  {
5604
5666
  pm_buffer_concat(output_buffer, prefix_buffer);
@@ -5727,7 +5789,7 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
5727
5789
  {
5728
5790
  pm_buffer_concat(output_buffer, prefix_buffer);
5729
5791
  pm_buffer_append_string(output_buffer, "\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 depth:", 16);
5730
- pm_buffer_append_format(output_buffer, " %d\n", cast->depth);
5792
+ pm_buffer_append_format(output_buffer, " %" PRIu32 "\n", cast->depth);
5731
5793
  }
5732
5794
 
5733
5795
  break;
@@ -5797,7 +5859,7 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
5797
5859
  {
5798
5860
  pm_buffer_concat(output_buffer, prefix_buffer);
5799
5861
  pm_buffer_append_string(output_buffer, "\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 depth:", 16);
5800
- pm_buffer_append_format(output_buffer, " %d\n", cast->depth);
5862
+ pm_buffer_append_format(output_buffer, " %" PRIu32 "\n", cast->depth);
5801
5863
  }
5802
5864
 
5803
5865
  break;
@@ -5858,7 +5920,7 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
5858
5920
  {
5859
5921
  pm_buffer_concat(output_buffer, prefix_buffer);
5860
5922
  pm_buffer_append_string(output_buffer, "\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 depth:", 16);
5861
- pm_buffer_append_format(output_buffer, " %d\n", cast->depth);
5923
+ pm_buffer_append_format(output_buffer, " %" PRIu32 "\n", cast->depth);
5862
5924
  }
5863
5925
 
5864
5926
  break;
@@ -5882,7 +5944,7 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
5882
5944
  {
5883
5945
  pm_buffer_concat(output_buffer, prefix_buffer);
5884
5946
  pm_buffer_append_string(output_buffer, "\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 depth:", 16);
5885
- pm_buffer_append_format(output_buffer, " %d\n", cast->depth);
5947
+ pm_buffer_append_format(output_buffer, " %" PRIu32 "\n", cast->depth);
5886
5948
  }
5887
5949
 
5888
5950
  break;
@@ -5906,7 +5968,7 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
5906
5968
  {
5907
5969
  pm_buffer_concat(output_buffer, prefix_buffer);
5908
5970
  pm_buffer_append_string(output_buffer, "\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 depth:", 16);
5909
- pm_buffer_append_format(output_buffer, " %d\n", cast->depth);
5971
+ pm_buffer_append_format(output_buffer, " %" PRIu32 "\n", cast->depth);
5910
5972
  }
5911
5973
 
5912
5974
  break;
@@ -5930,7 +5992,7 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
5930
5992
  {
5931
5993
  pm_buffer_concat(output_buffer, prefix_buffer);
5932
5994
  pm_buffer_append_string(output_buffer, "\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 depth:", 16);
5933
- pm_buffer_append_format(output_buffer, " %d\n", cast->depth);
5995
+ pm_buffer_append_format(output_buffer, " %" PRIu32 "\n", cast->depth);
5934
5996
  }
5935
5997
 
5936
5998
  // name_loc
@@ -6642,7 +6704,7 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
6642
6704
  {
6643
6705
  pm_buffer_concat(output_buffer, prefix_buffer);
6644
6706
  pm_buffer_append_string(output_buffer, "\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 maximum:", 18);
6645
- pm_buffer_append_format(output_buffer, " %d\n", cast->maximum);
6707
+ pm_buffer_append_format(output_buffer, " %" PRIu8 "\n", cast->maximum);
6646
6708
  }
6647
6709
 
6648
6710
  break;
@@ -6657,7 +6719,7 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
6657
6719
  {
6658
6720
  pm_buffer_concat(output_buffer, prefix_buffer);
6659
6721
  pm_buffer_append_string(output_buffer, "\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 number:", 17);
6660
- pm_buffer_append_format(output_buffer, " %d\n", cast->number);
6722
+ pm_buffer_append_format(output_buffer, " %" PRIu32 "\n", cast->number);
6661
6723
  }
6662
6724
 
6663
6725
  break;
@@ -6668,6 +6730,20 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
6668
6730
  prettyprint_location(output_buffer, parser, &node->location);
6669
6731
  pm_buffer_append_string(output_buffer, ")\n", 2);
6670
6732
 
6733
+ // flags
6734
+ {
6735
+ pm_buffer_concat(output_buffer, prefix_buffer);
6736
+ pm_buffer_append_string(output_buffer, "\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 flags:", 16);
6737
+ bool found = false;
6738
+ if (cast->base.flags & PM_PARAMETER_FLAGS_REPEATED_PARAMETER) {
6739
+ if (found) pm_buffer_append_byte(output_buffer, ',');
6740
+ pm_buffer_append_string(output_buffer, " repeated_parameter", 19);
6741
+ found = true;
6742
+ }
6743
+ if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
6744
+ pm_buffer_append_byte(output_buffer, '\n');
6745
+ }
6746
+
6671
6747
  // name
6672
6748
  {
6673
6749
  pm_buffer_concat(output_buffer, prefix_buffer);
@@ -6710,6 +6786,20 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
6710
6786
  prettyprint_location(output_buffer, parser, &node->location);
6711
6787
  pm_buffer_append_string(output_buffer, ")\n", 2);
6712
6788
 
6789
+ // flags
6790
+ {
6791
+ pm_buffer_concat(output_buffer, prefix_buffer);
6792
+ pm_buffer_append_string(output_buffer, "\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 flags:", 16);
6793
+ bool found = false;
6794
+ if (cast->base.flags & PM_PARAMETER_FLAGS_REPEATED_PARAMETER) {
6795
+ if (found) pm_buffer_append_byte(output_buffer, ',');
6796
+ pm_buffer_append_string(output_buffer, " repeated_parameter", 19);
6797
+ found = true;
6798
+ }
6799
+ if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
6800
+ pm_buffer_append_byte(output_buffer, '\n');
6801
+ }
6802
+
6713
6803
  // name
6714
6804
  {
6715
6805
  pm_buffer_concat(output_buffer, prefix_buffer);
@@ -7476,6 +7566,20 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
7476
7566
  prettyprint_location(output_buffer, parser, &node->location);
7477
7567
  pm_buffer_append_string(output_buffer, ")\n", 2);
7478
7568
 
7569
+ // flags
7570
+ {
7571
+ pm_buffer_concat(output_buffer, prefix_buffer);
7572
+ pm_buffer_append_string(output_buffer, "\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 flags:", 16);
7573
+ bool found = false;
7574
+ if (cast->base.flags & PM_PARAMETER_FLAGS_REPEATED_PARAMETER) {
7575
+ if (found) pm_buffer_append_byte(output_buffer, ',');
7576
+ pm_buffer_append_string(output_buffer, " repeated_parameter", 19);
7577
+ found = true;
7578
+ }
7579
+ if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
7580
+ pm_buffer_append_byte(output_buffer, '\n');
7581
+ }
7582
+
7479
7583
  // name
7480
7584
  {
7481
7585
  pm_buffer_concat(output_buffer, prefix_buffer);
@@ -7505,6 +7609,20 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
7505
7609
  prettyprint_location(output_buffer, parser, &node->location);
7506
7610
  pm_buffer_append_string(output_buffer, ")\n", 2);
7507
7611
 
7612
+ // flags
7613
+ {
7614
+ pm_buffer_concat(output_buffer, prefix_buffer);
7615
+ pm_buffer_append_string(output_buffer, "\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 flags:", 16);
7616
+ bool found = false;
7617
+ if (cast->base.flags & PM_PARAMETER_FLAGS_REPEATED_PARAMETER) {
7618
+ if (found) pm_buffer_append_byte(output_buffer, ',');
7619
+ pm_buffer_append_string(output_buffer, " repeated_parameter", 19);
7620
+ found = true;
7621
+ }
7622
+ if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
7623
+ pm_buffer_append_byte(output_buffer, '\n');
7624
+ }
7625
+
7508
7626
  // name
7509
7627
  {
7510
7628
  pm_buffer_concat(output_buffer, prefix_buffer);
@@ -7680,6 +7798,20 @@ prettyprint_node(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm
7680
7798
  prettyprint_location(output_buffer, parser, &node->location);
7681
7799
  pm_buffer_append_string(output_buffer, ")\n", 2);
7682
7800
 
7801
+ // flags
7802
+ {
7803
+ pm_buffer_concat(output_buffer, prefix_buffer);
7804
+ pm_buffer_append_string(output_buffer, "\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 flags:", 16);
7805
+ bool found = false;
7806
+ if (cast->base.flags & PM_PARAMETER_FLAGS_REPEATED_PARAMETER) {
7807
+ if (found) pm_buffer_append_byte(output_buffer, ',');
7808
+ pm_buffer_append_string(output_buffer, " repeated_parameter", 19);
7809
+ found = true;
7810
+ }
7811
+ if (!found) pm_buffer_append_string(output_buffer, " \xe2\x88\x85", 4);
7812
+ pm_buffer_append_byte(output_buffer, '\n');
7813
+ }
7814
+
7683
7815
  // name
7684
7816
  {
7685
7817
  pm_buffer_concat(output_buffer, prefix_buffer);