prism 1.6.0 → 1.7.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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -1
  3. data/Makefile +3 -3
  4. data/README.md +1 -1
  5. data/config.yml +28 -3
  6. data/docs/build_system.md +2 -2
  7. data/docs/cruby_compilation.md +1 -1
  8. data/docs/releasing.md +2 -2
  9. data/ext/prism/api_node.c +7 -3
  10. data/ext/prism/extconf.rb +1 -1
  11. data/ext/prism/extension.c +2 -3
  12. data/ext/prism/extension.h +1 -1
  13. data/include/prism/ast.h +54 -20
  14. data/include/prism/diagnostic.h +2 -0
  15. data/include/prism/options.h +8 -2
  16. data/include/prism/parser.h +3 -0
  17. data/include/prism/version.h +2 -2
  18. data/include/prism.h +1 -1
  19. data/lib/prism/dot_visitor.rb +5 -0
  20. data/lib/prism/dsl.rb +2 -2
  21. data/lib/prism/ffi.rb +3 -1
  22. data/lib/prism/inspect_visitor.rb +1 -0
  23. data/lib/prism/node.rb +52 -13
  24. data/lib/prism/parse_result.rb +2 -15
  25. data/lib/prism/polyfill/scan_byte.rb +1 -1
  26. data/lib/prism/reflection.rb +1 -1
  27. data/lib/prism/serialize.rb +6 -4
  28. data/lib/prism/translation/parser/compiler.rb +16 -16
  29. data/lib/prism/translation/parser.rb +5 -3
  30. data/lib/prism/translation/parser35.rb +1 -6
  31. data/lib/prism/translation/parser40.rb +13 -0
  32. data/lib/prism/translation/parser41.rb +13 -0
  33. data/lib/prism/translation/parser_current.rb +4 -2
  34. data/lib/prism/translation/ripper.rb +2 -2
  35. data/lib/prism/translation/ruby_parser.rb +53 -18
  36. data/lib/prism/translation.rb +2 -0
  37. data/lib/prism.rb +4 -5
  38. data/prism.gemspec +5 -1
  39. data/rbi/prism/dsl.rbi +3 -3
  40. data/rbi/prism/node.rbi +21 -8
  41. data/rbi/prism/translation/parser35.rbi +0 -2
  42. data/rbi/prism/translation/parser40.rbi +6 -0
  43. data/rbi/prism/translation/parser41.rbi +6 -0
  44. data/sig/prism/dsl.rbs +2 -2
  45. data/sig/prism/node.rbs +18 -8
  46. data/src/diagnostic.c +5 -1
  47. data/src/encoding.c +172 -67
  48. data/src/node.c +9 -0
  49. data/src/options.c +17 -7
  50. data/src/prettyprint.c +16 -0
  51. data/src/prism.c +1192 -1895
  52. data/src/serialize.c +7 -1
  53. data/src/token_type.c +2 -2
  54. data/src/util/pm_constant_pool.c +1 -1
  55. metadata +5 -1
data/src/serialize.c CHANGED
@@ -395,6 +395,12 @@ pm_serialize_node(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer) {
395
395
  pm_buffer_append_byte(buffer, 1);
396
396
  pm_serialize_location(parser, &((pm_call_node_t *)node)->closing_loc, buffer);
397
397
  }
398
+ if (((pm_call_node_t *)node)->equal_loc.start == NULL) {
399
+ pm_buffer_append_byte(buffer, 0);
400
+ } else {
401
+ pm_buffer_append_byte(buffer, 1);
402
+ pm_serialize_location(parser, &((pm_call_node_t *)node)->equal_loc, buffer);
403
+ }
398
404
  if (((pm_call_node_t *)node)->block == NULL) {
399
405
  pm_buffer_append_byte(buffer, 0);
400
406
  } else {
@@ -2177,7 +2183,7 @@ pm_serialize_content(pm_parser_t *parser, pm_node_t *node, pm_buffer_t *buffer)
2177
2183
  // buffer offset. We will add a leading 1 to indicate that this
2178
2184
  // is a buffer offset.
2179
2185
  uint32_t content_offset = pm_sizet_to_u32(buffer->length);
2180
- uint32_t owned_mask = (uint32_t) (1 << 31);
2186
+ uint32_t owned_mask = 1U << 31;
2181
2187
 
2182
2188
  assert(content_offset < owned_mask);
2183
2189
  content_offset |= owned_mask;
data/src/token_type.c CHANGED
@@ -48,6 +48,8 @@ pm_token_type_name(pm_token_type_t token_type) {
48
48
  return "NEWLINE";
49
49
  case PM_TOKEN_PARENTHESIS_RIGHT:
50
50
  return "PARENTHESIS_RIGHT";
51
+ case PM_TOKEN_PIPE:
52
+ return "PIPE";
51
53
  case PM_TOKEN_SEMICOLON:
52
54
  return "SEMICOLON";
53
55
  case PM_TOKEN_AMPERSAND:
@@ -280,8 +282,6 @@ pm_token_type_name(pm_token_type_t token_type) {
280
282
  return "PERCENT_UPPER_I";
281
283
  case PM_TOKEN_PERCENT_UPPER_W:
282
284
  return "PERCENT_UPPER_W";
283
- case PM_TOKEN_PIPE:
284
- return "PIPE";
285
285
  case PM_TOKEN_PIPE_EQUAL:
286
286
  return "PIPE_EQUAL";
287
287
  case PM_TOKEN_PIPE_PIPE:
@@ -264,7 +264,7 @@ pm_constant_pool_insert(pm_constant_pool_t *pool, const uint8_t *start, size_t l
264
264
  // constant and replace it with the shared constant.
265
265
  xfree((void *) constant->start);
266
266
  constant->start = start;
267
- bucket->type = (unsigned int) (PM_CONSTANT_POOL_BUCKET_DEFAULT & 0x3);
267
+ bucket->type = (unsigned int) (type & 0x3);
268
268
  }
269
269
 
270
270
  return bucket->id;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prism
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
@@ -106,6 +106,8 @@ files:
106
106
  - lib/prism/translation/parser33.rb
107
107
  - lib/prism/translation/parser34.rb
108
108
  - lib/prism/translation/parser35.rb
109
+ - lib/prism/translation/parser40.rb
110
+ - lib/prism/translation/parser41.rb
109
111
  - lib/prism/translation/parser_current.rb
110
112
  - lib/prism/translation/ripper.rb
111
113
  - lib/prism/translation/ripper/sexp.rb
@@ -126,6 +128,8 @@ files:
126
128
  - rbi/prism/translation/parser33.rbi
127
129
  - rbi/prism/translation/parser34.rbi
128
130
  - rbi/prism/translation/parser35.rbi
131
+ - rbi/prism/translation/parser40.rbi
132
+ - rbi/prism/translation/parser41.rbi
129
133
  - rbi/prism/translation/ripper.rbi
130
134
  - rbi/prism/visitor.rbi
131
135
  - sig/prism.rbs