prism 0.19.0 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +102 -1
  3. data/Makefile +5 -0
  4. data/README.md +9 -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 +84 -16
  11. data/docs/ruby_api.md +1 -1
  12. data/docs/ruby_parser_translation.md +19 -0
  13. data/docs/serialization.md +19 -5
  14. data/ext/prism/api_node.c +1989 -1525
  15. data/ext/prism/extension.c +130 -30
  16. data/ext/prism/extension.h +2 -2
  17. data/include/prism/ast.h +1700 -505
  18. data/include/prism/defines.h +8 -0
  19. data/include/prism/diagnostic.h +49 -7
  20. data/include/prism/encoding.h +17 -0
  21. data/include/prism/options.h +40 -14
  22. data/include/prism/parser.h +34 -18
  23. data/include/prism/util/pm_buffer.h +9 -0
  24. data/include/prism/util/pm_constant_pool.h +18 -0
  25. data/include/prism/util/pm_newline_list.h +4 -14
  26. data/include/prism/util/pm_strpbrk.h +4 -1
  27. data/include/prism/version.h +2 -2
  28. data/include/prism.h +19 -2
  29. data/lib/prism/debug.rb +11 -5
  30. data/lib/prism/desugar_compiler.rb +225 -80
  31. data/lib/prism/dot_visitor.rb +36 -14
  32. data/lib/prism/dsl.rb +302 -299
  33. data/lib/prism/ffi.rb +107 -76
  34. data/lib/prism/lex_compat.rb +17 -1
  35. data/lib/prism/node.rb +4580 -2607
  36. data/lib/prism/node_ext.rb +27 -4
  37. data/lib/prism/parse_result.rb +75 -29
  38. data/lib/prism/serialize.rb +633 -305
  39. data/lib/prism/translation/parser/compiler.rb +1838 -0
  40. data/lib/prism/translation/parser/lexer.rb +335 -0
  41. data/lib/prism/translation/parser/rubocop.rb +45 -0
  42. data/lib/prism/translation/parser.rb +190 -0
  43. data/lib/prism/translation/parser33.rb +12 -0
  44. data/lib/prism/translation/parser34.rb +12 -0
  45. data/lib/prism/translation/ripper.rb +696 -0
  46. data/lib/prism/translation/ruby_parser.rb +1521 -0
  47. data/lib/prism/translation.rb +11 -0
  48. data/lib/prism.rb +1 -1
  49. data/prism.gemspec +18 -7
  50. data/rbi/prism.rbi +150 -88
  51. data/rbi/prism_static.rbi +15 -3
  52. data/sig/prism.rbs +996 -961
  53. data/sig/prism_static.rbs +123 -46
  54. data/src/diagnostic.c +264 -219
  55. data/src/encoding.c +21 -26
  56. data/src/node.c +2 -6
  57. data/src/options.c +29 -5
  58. data/src/prettyprint.c +176 -44
  59. data/src/prism.c +1499 -564
  60. data/src/serialize.c +35 -21
  61. data/src/token_type.c +353 -4
  62. data/src/util/pm_buffer.c +11 -0
  63. data/src/util/pm_constant_pool.c +37 -11
  64. data/src/util/pm_newline_list.c +6 -15
  65. data/src/util/pm_string.c +0 -7
  66. data/src/util/pm_strpbrk.c +122 -14
  67. metadata +16 -5
  68. data/docs/building.md +0 -29
  69. data/lib/prism/ripper_compat.rb +0 -207
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Prism
4
+ # This module is responsible for converting the prism syntax tree into other
5
+ # syntax trees.
6
+ module Translation
7
+ autoload :Parser, "prism/translation/parser"
8
+ autoload :Ripper, "prism/translation/ripper"
9
+ autoload :RubyParser, "prism/translation/ruby_parser"
10
+ end
11
+ end
data/lib/prism.rb CHANGED
@@ -22,10 +22,10 @@ module Prism
22
22
  autoload :LexRipper, "prism/lex_compat"
23
23
  autoload :MutationCompiler, "prism/mutation_compiler"
24
24
  autoload :NodeInspector, "prism/node_inspector"
25
- autoload :RipperCompat, "prism/ripper_compat"
26
25
  autoload :Pack, "prism/pack"
27
26
  autoload :Pattern, "prism/pattern"
28
27
  autoload :Serialize, "prism/serialize"
28
+ autoload :Translation, "prism/translation"
29
29
  autoload :Visitor, "prism/visitor"
30
30
 
31
31
  # Some of these constants are not meant to be exposed, so marking them as
data/prism.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "prism"
5
- spec.version = "0.19.0"
5
+ spec.version = "0.24.0"
6
6
  spec.authors = ["Shopify"]
7
7
  spec.email = ["ruby@shopify.com"]
8
8
 
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.homepage = "https://github.com/ruby/prism"
11
11
  spec.license = "MIT"
12
12
 
13
- spec.required_ruby_version = ">= 3.0.0"
13
+ spec.required_ruby_version = ">= 2.7.0"
14
14
 
15
15
  spec.require_paths = ["lib"]
16
16
  spec.files = [
@@ -22,8 +22,8 @@ Gem::Specification.new do |spec|
22
22
  "README.md",
23
23
  "config.yml",
24
24
  "docs/build_system.md",
25
- "docs/building.md",
26
25
  "docs/configuration.md",
26
+ "docs/cruby_compilation.md",
27
27
  "docs/design.md",
28
28
  "docs/encoding.md",
29
29
  "docs/fuzzing.md",
@@ -31,9 +31,12 @@ Gem::Specification.new do |spec|
31
31
  "docs/javascript.md",
32
32
  "docs/local_variable_depth.md",
33
33
  "docs/mapping.md",
34
+ "docs/parser_translation.md",
35
+ "docs/parsing_rules.md",
34
36
  "docs/releasing.md",
35
37
  "docs/ripper.md",
36
38
  "docs/ruby_api.md",
39
+ "docs/ruby_parser_translation.md",
37
40
  "docs/serialization.md",
38
41
  "docs/testing.md",
39
42
  "ext/prism/api_node.c",
@@ -73,16 +76,24 @@ Gem::Specification.new do |spec|
73
76
  "lib/prism/ffi.rb",
74
77
  "lib/prism/lex_compat.rb",
75
78
  "lib/prism/mutation_compiler.rb",
76
- "lib/prism/node.rb",
77
79
  "lib/prism/node_ext.rb",
78
80
  "lib/prism/node_inspector.rb",
81
+ "lib/prism/node.rb",
79
82
  "lib/prism/pack.rb",
80
83
  "lib/prism/parse_result.rb",
81
- "lib/prism/pattern.rb",
82
- "lib/prism/ripper_compat.rb",
83
- "lib/prism/serialize.rb",
84
84
  "lib/prism/parse_result/comments.rb",
85
85
  "lib/prism/parse_result/newlines.rb",
86
+ "lib/prism/pattern.rb",
87
+ "lib/prism/serialize.rb",
88
+ "lib/prism/translation.rb",
89
+ "lib/prism/translation/parser.rb",
90
+ "lib/prism/translation/parser33.rb",
91
+ "lib/prism/translation/parser34.rb",
92
+ "lib/prism/translation/parser/compiler.rb",
93
+ "lib/prism/translation/parser/lexer.rb",
94
+ "lib/prism/translation/parser/rubocop.rb",
95
+ "lib/prism/translation/ripper.rb",
96
+ "lib/prism/translation/ruby_parser.rb",
86
97
  "lib/prism/visitor.rb",
87
98
  "src/diagnostic.c",
88
99
  "src/encoding.c",