prism 0.26.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +45 -1
  3. data/Makefile +3 -2
  4. data/config.yml +305 -20
  5. data/docs/configuration.md +1 -0
  6. data/ext/prism/api_node.c +884 -879
  7. data/ext/prism/extconf.rb +23 -4
  8. data/ext/prism/extension.c +16 -9
  9. data/ext/prism/extension.h +1 -1
  10. data/include/prism/ast.h +298 -9
  11. data/include/prism/diagnostic.h +15 -5
  12. data/include/prism/options.h +2 -2
  13. data/include/prism/parser.h +10 -0
  14. data/include/prism/static_literals.h +8 -6
  15. data/include/prism/version.h +2 -2
  16. data/lib/prism/dot_visitor.rb +22 -6
  17. data/lib/prism/dsl.rb +8 -8
  18. data/lib/prism/ffi.rb +4 -4
  19. data/lib/prism/inspect_visitor.rb +2156 -0
  20. data/lib/prism/lex_compat.rb +18 -1
  21. data/lib/prism/mutation_compiler.rb +2 -2
  22. data/lib/prism/node.rb +2345 -1964
  23. data/lib/prism/node_ext.rb +34 -5
  24. data/lib/prism/parse_result/newlines.rb +0 -2
  25. data/lib/prism/parse_result.rb +137 -13
  26. data/lib/prism/pattern.rb +12 -6
  27. data/lib/prism/polyfill/byteindex.rb +13 -0
  28. data/lib/prism/polyfill/unpack1.rb +14 -0
  29. data/lib/prism/reflection.rb +21 -31
  30. data/lib/prism/serialize.rb +27 -17
  31. data/lib/prism/translation/parser/compiler.rb +34 -15
  32. data/lib/prism/translation/parser.rb +6 -6
  33. data/lib/prism/translation/ripper.rb +72 -68
  34. data/lib/prism/translation/ruby_parser.rb +69 -31
  35. data/lib/prism.rb +3 -2
  36. data/prism.gemspec +36 -38
  37. data/rbi/prism/compiler.rbi +3 -5
  38. data/rbi/prism/inspect_visitor.rbi +12 -0
  39. data/rbi/prism/node.rbi +359 -321
  40. data/rbi/prism/parse_result.rbi +85 -34
  41. data/rbi/prism/reflection.rbi +7 -13
  42. data/rbi/prism/translation/ripper.rbi +1 -11
  43. data/rbi/prism.rbi +9 -9
  44. data/sig/prism/dsl.rbs +3 -3
  45. data/sig/prism/inspect_visitor.rbs +22 -0
  46. data/sig/prism/node.rbs +68 -48
  47. data/sig/prism/parse_result.rbs +42 -10
  48. data/sig/prism/reflection.rbs +2 -8
  49. data/sig/prism/serialize.rbs +2 -3
  50. data/sig/prism.rbs +9 -9
  51. data/src/diagnostic.c +44 -24
  52. data/src/node.c +41 -16
  53. data/src/options.c +2 -2
  54. data/src/prettyprint.c +61 -18
  55. data/src/prism.c +623 -188
  56. data/src/serialize.c +5 -2
  57. data/src/static_literals.c +120 -34
  58. data/src/token_type.c +4 -4
  59. data/src/util/pm_integer.c +9 -2
  60. metadata +7 -9
  61. data/lib/prism/node_inspector.rb +0 -68
  62. data/lib/prism/polyfill/string.rb +0 -12
  63. data/rbi/prism/desugar_compiler.rbi +0 -5
  64. data/rbi/prism/mutation_compiler.rbi +0 -5
  65. data/rbi/prism/translation/parser/compiler.rbi +0 -13
  66. data/rbi/prism/translation/ripper/ripper_compiler.rbi +0 -5
  67. 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.26.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