prism 0.27.0 → 0.28.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 +26 -1
  3. data/config.yml +39 -27
  4. data/docs/configuration.md +1 -0
  5. data/ext/prism/api_node.c +814 -807
  6. data/ext/prism/extension.c +5 -3
  7. data/ext/prism/extension.h +1 -1
  8. data/include/prism/ast.h +38 -16
  9. data/include/prism/diagnostic.h +12 -5
  10. data/include/prism/options.h +2 -2
  11. data/include/prism/parser.h +10 -0
  12. data/include/prism/static_literals.h +8 -6
  13. data/include/prism/version.h +2 -2
  14. data/lib/prism/dot_visitor.rb +22 -6
  15. data/lib/prism/dsl.rb +8 -8
  16. data/lib/prism/ffi.rb +3 -3
  17. data/lib/prism/inspect_visitor.rb +2156 -0
  18. data/lib/prism/lex_compat.rb +1 -1
  19. data/lib/prism/mutation_compiler.rb +2 -2
  20. data/lib/prism/node.rb +589 -1715
  21. data/lib/prism/node_ext.rb +34 -5
  22. data/lib/prism/parse_result.rb +78 -0
  23. data/lib/prism/pattern.rb +12 -6
  24. data/lib/prism/polyfill/byteindex.rb +13 -0
  25. data/lib/prism/polyfill/unpack1.rb +14 -0
  26. data/lib/prism/reflection.rb +13 -13
  27. data/lib/prism/serialize.rb +21 -14
  28. data/lib/prism/translation/parser/compiler.rb +2 -2
  29. data/lib/prism/translation/parser.rb +6 -6
  30. data/lib/prism/translation/ripper.rb +13 -9
  31. data/lib/prism/translation/ruby_parser.rb +4 -4
  32. data/lib/prism.rb +2 -1
  33. data/prism.gemspec +36 -38
  34. data/rbi/prism/compiler.rbi +3 -5
  35. data/rbi/prism/inspect_visitor.rbi +12 -0
  36. data/rbi/prism/node.rbi +354 -319
  37. data/rbi/prism/parse_result.rbi +23 -0
  38. data/rbi/prism/translation/ripper.rbi +1 -11
  39. data/sig/prism/dsl.rbs +3 -3
  40. data/sig/prism/inspect_visitor.rbs +22 -0
  41. data/sig/prism/node.rbs +64 -47
  42. data/sig/prism/parse_result.rbs +12 -0
  43. data/src/diagnostic.c +38 -24
  44. data/src/node.c +41 -16
  45. data/src/options.c +2 -2
  46. data/src/prettyprint.c +61 -18
  47. data/src/prism.c +607 -185
  48. data/src/serialize.c +5 -2
  49. data/src/static_literals.c +120 -34
  50. data/src/token_type.c +4 -4
  51. metadata +7 -9
  52. data/lib/prism/node_inspector.rb +0 -68
  53. data/lib/prism/polyfill/string.rb +0 -12
  54. data/rbi/prism/desugar_compiler.rbi +0 -5
  55. data/rbi/prism/mutation_compiler.rbi +0 -5
  56. data/rbi/prism/translation/parser/compiler.rbi +0 -13
  57. data/rbi/prism/translation/ripper/ripper_compiler.rbi +0 -5
  58. data/rbi/prism/translation/ruby_parser.rbi +0 -11
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.27.0"
5
+ spec.version = "0.28.0"
6
6
  spec.authors = ["Shopify"]
7
7
  spec.email = ["ruby@shopify.com"]
8
8
 
@@ -76,17 +76,18 @@ Gem::Specification.new do |spec|
76
76
  "lib/prism/dot_visitor.rb",
77
77
  "lib/prism/dsl.rb",
78
78
  "lib/prism/ffi.rb",
79
+ "lib/prism/inspect_visitor.rb",
79
80
  "lib/prism/lex_compat.rb",
80
81
  "lib/prism/mutation_compiler.rb",
81
82
  "lib/prism/node_ext.rb",
82
- "lib/prism/node_inspector.rb",
83
83
  "lib/prism/node.rb",
84
84
  "lib/prism/pack.rb",
85
85
  "lib/prism/parse_result.rb",
86
86
  "lib/prism/parse_result/comments.rb",
87
87
  "lib/prism/parse_result/newlines.rb",
88
88
  "lib/prism/pattern.rb",
89
- "lib/prism/polyfill/string.rb",
89
+ "lib/prism/polyfill/byteindex.rb",
90
+ "lib/prism/polyfill/unpack1.rb",
90
91
  "lib/prism/reflection.rb",
91
92
  "lib/prism/serialize.rb",
92
93
  "lib/prism/translation.rb",
@@ -101,11 +102,41 @@ Gem::Specification.new do |spec|
101
102
  "lib/prism/translation/ripper/shim.rb",
102
103
  "lib/prism/translation/ruby_parser.rb",
103
104
  "lib/prism/visitor.rb",
105
+ "prism.gemspec",
106
+ "rbi/prism.rbi",
107
+ "rbi/prism/compiler.rbi",
108
+ "rbi/prism/inspect_visitor.rbi",
109
+ "rbi/prism/node_ext.rbi",
110
+ "rbi/prism/node.rbi",
111
+ "rbi/prism/parse_result.rbi",
112
+ "rbi/prism/reflection.rbi",
113
+ "rbi/prism/translation/parser.rbi",
114
+ "rbi/prism/translation/parser33.rbi",
115
+ "rbi/prism/translation/parser34.rbi",
116
+ "rbi/prism/translation/ripper.rbi",
117
+ "rbi/prism/visitor.rbi",
118
+ "sig/prism.rbs",
119
+ "sig/prism/compiler.rbs",
120
+ "sig/prism/dispatcher.rbs",
121
+ "sig/prism/dot_visitor.rbs",
122
+ "sig/prism/dsl.rbs",
123
+ "sig/prism/inspect_visitor.rbs",
124
+ "sig/prism/mutation_compiler.rbs",
125
+ "sig/prism/node_ext.rbs",
126
+ "sig/prism/node.rbs",
127
+ "sig/prism/pack.rbs",
128
+ "sig/prism/parse_result.rbs",
129
+ "sig/prism/pattern.rbs",
130
+ "sig/prism/reflection.rbs",
131
+ "sig/prism/serialize.rbs",
132
+ "sig/prism/visitor.rbs",
104
133
  "src/diagnostic.c",
105
134
  "src/encoding.c",
106
135
  "src/node.c",
136
+ "src/options.c",
107
137
  "src/pack.c",
108
138
  "src/prettyprint.c",
139
+ "src/prism.c",
109
140
  "src/regexp.c",
110
141
  "src/serialize.c",
111
142
  "src/static_literals.c",
@@ -117,43 +148,10 @@ Gem::Specification.new do |spec|
117
148
  "src/util/pm_list.c",
118
149
  "src/util/pm_memchr.c",
119
150
  "src/util/pm_newline_list.c",
120
- "src/util/pm_string.c",
121
151
  "src/util/pm_string_list.c",
152
+ "src/util/pm_string.c",
122
153
  "src/util/pm_strncasecmp.c",
123
- "src/util/pm_strpbrk.c",
124
- "src/options.c",
125
- "src/prism.c",
126
- "prism.gemspec",
127
- "sig/prism.rbs",
128
- "sig/prism/compiler.rbs",
129
- "sig/prism/dispatcher.rbs",
130
- "sig/prism/dot_visitor.rbs",
131
- "sig/prism/dsl.rbs",
132
- "sig/prism/mutation_compiler.rbs",
133
- "sig/prism/node.rbs",
134
- "sig/prism/node_ext.rbs",
135
- "sig/prism/pack.rbs",
136
- "sig/prism/parse_result.rbs",
137
- "sig/prism/pattern.rbs",
138
- "sig/prism/reflection.rbs",
139
- "sig/prism/serialize.rbs",
140
- "sig/prism/visitor.rbs",
141
- "rbi/prism.rbi",
142
- "rbi/prism/compiler.rbi",
143
- "rbi/prism/desugar_compiler.rbi",
144
- "rbi/prism/mutation_compiler.rbi",
145
- "rbi/prism/node_ext.rbi",
146
- "rbi/prism/node.rbi",
147
- "rbi/prism/parse_result.rbi",
148
- "rbi/prism/reflection.rbi",
149
- "rbi/prism/translation/parser.rbi",
150
- "rbi/prism/translation/parser/compiler.rbi",
151
- "rbi/prism/translation/parser33.rbi",
152
- "rbi/prism/translation/parser34.rbi",
153
- "rbi/prism/translation/ripper.rbi",
154
- "rbi/prism/translation/ripper/ripper_compiler.rbi",
155
- "rbi/prism/translation/ruby_parser.rbi",
156
- "rbi/prism/visitor.rbi"
154
+ "src/util/pm_strpbrk.c"
157
155
  ]
158
156
 
159
157
  spec.extensions = ["ext/prism/extconf.rb"]
@@ -1,14 +1,12 @@
1
1
  # typed: strict
2
2
 
3
3
  class Prism::Compiler
4
- Result = type_member
5
-
6
- sig { params(node: T.nilable(Prism::Node)).returns(T.nilable(Result)) }
4
+ sig { params(node: T.nilable(Prism::Node)).returns(T.untyped) }
7
5
  def visit(node); end
8
6
 
9
- sig { params(nodes: T::Array[T.nilable(Prism::Node)]).returns(T::Array[T.nilable(Result)]) }
7
+ sig { params(nodes: T::Array[T.nilable(Prism::Node)]).returns(T::Array[T.untyped]) }
10
8
  def visit_all(nodes); end
11
9
 
12
- sig { params(node: Prism::Node).returns(T::Array[T.nilable(Result)]) }
10
+ sig { params(node: Prism::Node).returns(T::Array[T.untyped]) }
13
11
  def visit_child_nodes(node); end
14
12
  end
@@ -0,0 +1,12 @@
1
+ # typed: strict
2
+
3
+ class Prism::InspectVisitor < Prism::Visitor
4
+ sig { params(indent: String).void }
5
+ def initialize(indent = ""); end
6
+
7
+ sig { params(node: Prism::Node).returns(String) }
8
+ def self.compose(node); end
9
+
10
+ sig { returns(String) }
11
+ def compose; end
12
+ end