jruby-prism-parser 0.24.0-java → 1.4.0-java

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 (148) hide show
  1. checksums.yaml +4 -4
  2. data/BSDmakefile +58 -0
  3. data/CHANGELOG.md +269 -1
  4. data/CONTRIBUTING.md +0 -4
  5. data/Makefile +25 -18
  6. data/README.md +57 -6
  7. data/config.yml +1724 -140
  8. data/docs/build_system.md +39 -11
  9. data/docs/configuration.md +4 -0
  10. data/docs/cruby_compilation.md +1 -1
  11. data/docs/fuzzing.md +1 -1
  12. data/docs/parser_translation.md +14 -9
  13. data/docs/parsing_rules.md +4 -1
  14. data/docs/releasing.md +8 -10
  15. data/docs/relocation.md +34 -0
  16. data/docs/ripper_translation.md +72 -0
  17. data/docs/ruby_api.md +2 -1
  18. data/docs/serialization.md +29 -5
  19. data/ext/prism/api_node.c +3395 -1999
  20. data/ext/prism/api_pack.c +9 -0
  21. data/ext/prism/extconf.rb +55 -34
  22. data/ext/prism/extension.c +597 -346
  23. data/ext/prism/extension.h +6 -5
  24. data/include/prism/ast.h +2612 -455
  25. data/include/prism/defines.h +160 -2
  26. data/include/prism/diagnostic.h +188 -76
  27. data/include/prism/encoding.h +22 -4
  28. data/include/prism/node.h +89 -17
  29. data/include/prism/options.h +224 -12
  30. data/include/prism/pack.h +11 -0
  31. data/include/prism/parser.h +267 -66
  32. data/include/prism/prettyprint.h +8 -0
  33. data/include/prism/regexp.h +18 -8
  34. data/include/prism/static_literals.h +121 -0
  35. data/include/prism/util/pm_buffer.h +75 -2
  36. data/include/prism/util/pm_char.h +1 -2
  37. data/include/prism/util/pm_constant_pool.h +18 -9
  38. data/include/prism/util/pm_integer.h +126 -0
  39. data/include/prism/util/pm_list.h +1 -1
  40. data/include/prism/util/pm_newline_list.h +19 -0
  41. data/include/prism/util/pm_string.h +48 -8
  42. data/include/prism/version.h +3 -3
  43. data/include/prism.h +99 -5
  44. data/jruby-prism.jar +0 -0
  45. data/lib/prism/compiler.rb +11 -1
  46. data/lib/prism/desugar_compiler.rb +113 -74
  47. data/lib/prism/dispatcher.rb +45 -1
  48. data/lib/prism/dot_visitor.rb +201 -77
  49. data/lib/prism/dsl.rb +673 -461
  50. data/lib/prism/ffi.rb +233 -45
  51. data/lib/prism/inspect_visitor.rb +2389 -0
  52. data/lib/prism/lex_compat.rb +35 -16
  53. data/lib/prism/mutation_compiler.rb +24 -8
  54. data/lib/prism/node.rb +7731 -8460
  55. data/lib/prism/node_ext.rb +328 -32
  56. data/lib/prism/pack.rb +4 -0
  57. data/lib/prism/parse_result/comments.rb +34 -24
  58. data/lib/prism/parse_result/errors.rb +65 -0
  59. data/lib/prism/parse_result/newlines.rb +102 -12
  60. data/lib/prism/parse_result.rb +448 -44
  61. data/lib/prism/pattern.rb +28 -10
  62. data/lib/prism/polyfill/append_as_bytes.rb +15 -0
  63. data/lib/prism/polyfill/byteindex.rb +13 -0
  64. data/lib/prism/polyfill/unpack1.rb +14 -0
  65. data/lib/prism/reflection.rb +413 -0
  66. data/lib/prism/relocation.rb +504 -0
  67. data/lib/prism/serialize.rb +1940 -1198
  68. data/lib/prism/string_query.rb +30 -0
  69. data/lib/prism/translation/parser/builder.rb +61 -0
  70. data/lib/prism/translation/parser/compiler.rb +569 -195
  71. data/lib/prism/translation/parser/lexer.rb +516 -39
  72. data/lib/prism/translation/parser.rb +177 -12
  73. data/lib/prism/translation/parser33.rb +1 -1
  74. data/lib/prism/translation/parser34.rb +1 -1
  75. data/lib/prism/translation/parser35.rb +12 -0
  76. data/lib/prism/translation/ripper/sexp.rb +125 -0
  77. data/lib/prism/translation/ripper/shim.rb +5 -0
  78. data/lib/prism/translation/ripper.rb +3224 -462
  79. data/lib/prism/translation/ruby_parser.rb +194 -69
  80. data/lib/prism/translation.rb +4 -1
  81. data/lib/prism/version.rb +1 -1
  82. data/lib/prism/visitor.rb +13 -0
  83. data/lib/prism.rb +17 -27
  84. data/prism.gemspec +57 -17
  85. data/rbi/prism/compiler.rbi +12 -0
  86. data/rbi/prism/dsl.rbi +524 -0
  87. data/rbi/prism/inspect_visitor.rbi +12 -0
  88. data/rbi/prism/node.rbi +8722 -0
  89. data/rbi/prism/node_ext.rbi +107 -0
  90. data/rbi/prism/parse_result.rbi +404 -0
  91. data/rbi/prism/reflection.rbi +58 -0
  92. data/rbi/prism/string_query.rbi +12 -0
  93. data/rbi/prism/translation/parser.rbi +11 -0
  94. data/rbi/prism/translation/parser33.rbi +6 -0
  95. data/rbi/prism/translation/parser34.rbi +6 -0
  96. data/rbi/prism/translation/parser35.rbi +6 -0
  97. data/rbi/prism/translation/ripper.rbi +15 -0
  98. data/rbi/prism/visitor.rbi +473 -0
  99. data/rbi/prism.rbi +44 -7745
  100. data/sig/prism/compiler.rbs +9 -0
  101. data/sig/prism/dispatcher.rbs +16 -0
  102. data/sig/prism/dot_visitor.rbs +6 -0
  103. data/sig/prism/dsl.rbs +351 -0
  104. data/sig/prism/inspect_visitor.rbs +22 -0
  105. data/sig/prism/lex_compat.rbs +10 -0
  106. data/sig/prism/mutation_compiler.rbs +159 -0
  107. data/sig/prism/node.rbs +3614 -0
  108. data/sig/prism/node_ext.rbs +82 -0
  109. data/sig/prism/pack.rbs +43 -0
  110. data/sig/prism/parse_result.rbs +192 -0
  111. data/sig/prism/pattern.rbs +13 -0
  112. data/sig/prism/reflection.rbs +50 -0
  113. data/sig/prism/relocation.rbs +185 -0
  114. data/sig/prism/serialize.rbs +8 -0
  115. data/sig/prism/string_query.rbs +11 -0
  116. data/sig/prism/visitor.rbs +169 -0
  117. data/sig/prism.rbs +248 -4767
  118. data/src/diagnostic.c +672 -230
  119. data/src/encoding.c +211 -108
  120. data/src/node.c +7541 -1653
  121. data/src/options.c +135 -20
  122. data/src/pack.c +33 -17
  123. data/src/prettyprint.c +1543 -1485
  124. data/src/prism.c +7813 -3050
  125. data/src/regexp.c +225 -73
  126. data/src/serialize.c +101 -77
  127. data/src/static_literals.c +617 -0
  128. data/src/token_type.c +14 -13
  129. data/src/util/pm_buffer.c +187 -20
  130. data/src/util/pm_char.c +5 -5
  131. data/src/util/pm_constant_pool.c +39 -19
  132. data/src/util/pm_integer.c +670 -0
  133. data/src/util/pm_list.c +1 -1
  134. data/src/util/pm_newline_list.c +43 -5
  135. data/src/util/pm_string.c +213 -33
  136. data/src/util/pm_strncasecmp.c +13 -1
  137. data/src/util/pm_strpbrk.c +32 -6
  138. metadata +55 -19
  139. data/docs/ripper.md +0 -36
  140. data/include/prism/util/pm_state_stack.h +0 -42
  141. data/include/prism/util/pm_string_list.h +0 -44
  142. data/lib/prism/debug.rb +0 -206
  143. data/lib/prism/node_inspector.rb +0 -68
  144. data/lib/prism/translation/parser/rubocop.rb +0 -45
  145. data/rbi/prism_static.rbi +0 -207
  146. data/sig/prism_static.rbs +0 -201
  147. data/src/util/pm_state_stack.c +0 -25
  148. data/src/util/pm_string_list.c +0 -28
@@ -0,0 +1,107 @@
1
+ # typed: strict
2
+
3
+ class Prism::InterpolatedMatchLastLineNode < Prism::Node
4
+ sig { returns(Integer) }
5
+ def options; end
6
+ end
7
+
8
+ class Prism::InterpolatedRegularExpressionNode < Prism::Node
9
+ sig { returns(Integer) }
10
+ def options; end
11
+ end
12
+
13
+ class Prism::MatchLastLineNode < Prism::Node
14
+ sig { returns(Integer) }
15
+ def options; end
16
+ end
17
+
18
+ class Prism::RegularExpressionNode < Prism::Node
19
+ sig { returns(Integer) }
20
+ def options; end
21
+ end
22
+
23
+ class Prism::InterpolatedStringNode < Prism::Node
24
+ sig { returns(T::Boolean) }
25
+ def heredoc?; end
26
+ end
27
+
28
+ class Prism::InterpolatedXStringNode < Prism::Node
29
+ sig { returns(T::Boolean) }
30
+ def heredoc?; end
31
+ end
32
+
33
+ class Prism::StringNode < Prism::Node
34
+ sig { returns(T::Boolean) }
35
+ def heredoc?; end
36
+
37
+ sig { returns(Prism::InterpolatedStringNode) }
38
+ def to_interpolated; end
39
+ end
40
+
41
+ class Prism::XStringNode < Prism::Node
42
+ sig { returns(T::Boolean) }
43
+ def heredoc?; end
44
+
45
+ sig { returns(Prism::InterpolatedXStringNode) }
46
+ def to_interpolated; end
47
+ end
48
+
49
+ class Prism::ImaginaryNode < Prism::Node
50
+ sig { returns(Complex) }
51
+ def value; end
52
+ end
53
+
54
+ class Prism::RationalNode < Prism::Node
55
+ sig { returns(Rational) }
56
+ def value; end
57
+ end
58
+
59
+ class Prism::ConstantReadNode < Prism::Node
60
+ sig { returns(T::Array[Symbol]) }
61
+ def full_name_parts; end
62
+
63
+ sig { returns(String) }
64
+ def full_name; end
65
+ end
66
+
67
+ class Prism::ConstantWriteNode < Prism::Node
68
+ sig { returns(T::Array[Symbol]) }
69
+ def full_name_parts; end
70
+
71
+ sig { returns(String) }
72
+ def full_name; end
73
+ end
74
+
75
+ class Prism::ConstantPathNode < Prism::Node
76
+ sig { returns(T::Array[Symbol]) }
77
+ def full_name_parts; end
78
+
79
+ sig { returns(String) }
80
+ def full_name; end
81
+ end
82
+
83
+ class Prism::ConstantPathTargetNode < Prism::Node
84
+ sig { returns(T::Array[Symbol]) }
85
+ def full_name_parts; end
86
+
87
+ sig { returns(String) }
88
+ def full_name; end
89
+ end
90
+
91
+ class Prism::ConstantTargetNode < Prism::Node
92
+ sig { returns(T::Array[Symbol]) }
93
+ def full_name_parts; end
94
+
95
+ sig { returns(String) }
96
+ def full_name; end
97
+ end
98
+
99
+ class Prism::ParametersNode < Prism::Node
100
+ sig { returns(T::Array[T.any([Symbol, Symbol], [Symbol])]) }
101
+ def signature; end
102
+ end
103
+
104
+ class Prism::CallNode < Prism::Node
105
+ sig { returns(T.nilable(Prism::Location)) }
106
+ def full_message_loc; end
107
+ end
@@ -0,0 +1,404 @@
1
+ # typed: strict
2
+
3
+ class Prism::Source
4
+ sig { returns(String) }
5
+ def source; end
6
+
7
+ sig { returns(Integer) }
8
+ def start_line; end
9
+
10
+ sig { returns(T::Array[Integer]) }
11
+ def offsets; end
12
+
13
+ sig { params(source: String, start_line: Integer, offsets: T::Array[Integer]).void }
14
+ def initialize(source, start_line = 1, offsets = []); end
15
+
16
+ sig { params(start_line: Integer).void }
17
+ def replace_start_line(start_line); end
18
+
19
+ sig { params(offsets: T::Array[Integer]).void }
20
+ def replace_offsets(offsets); end
21
+
22
+ sig { returns(Encoding) }
23
+ def encoding; end
24
+
25
+ sig { returns(T::Array[String]) }
26
+ def lines; end
27
+
28
+ sig { params(byte_offset: Integer, length: Integer).returns(String) }
29
+ def slice(byte_offset, length); end
30
+
31
+ sig { params(byte_offset: Integer).returns(Integer) }
32
+ def line(byte_offset); end
33
+
34
+ sig { params(byte_offset: Integer).returns(Integer) }
35
+ def line_start(byte_offset); end
36
+
37
+ sig { params(byte_offset: Integer).returns(Integer) }
38
+ def column(byte_offset); end
39
+
40
+ sig { params(byte_offset: Integer).returns(Integer) }
41
+ def character_offset(byte_offset); end
42
+
43
+ sig { params(byte_offset: Integer).returns(Integer) }
44
+ def character_column(byte_offset); end
45
+
46
+ sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) }
47
+ def code_units_offset(byte_offset, encoding); end
48
+
49
+ sig { params(encoding: Encoding).returns(T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer))) }
50
+ def code_units_cache(encoding); end
51
+
52
+ sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) }
53
+ def code_units_column(byte_offset, encoding); end
54
+ end
55
+
56
+ class Prism::CodeUnitsCache
57
+ sig { params(source: String, encoding: Encoding).void }
58
+ def initialize(source, encoding); end
59
+
60
+ sig { params(byte_offset: Integer).returns(Integer) }
61
+ def [](byte_offset); end
62
+ end
63
+
64
+ class Prism::ASCIISource < Prism::Source
65
+ sig { params(byte_offset: Integer).returns(Integer) }
66
+ def character_offset(byte_offset); end
67
+
68
+ sig { params(byte_offset: Integer).returns(Integer) }
69
+ def character_column(byte_offset); end
70
+
71
+ sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) }
72
+ def code_units_offset(byte_offset, encoding); end
73
+
74
+ sig { params(encoding: Encoding).returns(T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer))) }
75
+ def code_units_cache(encoding); end
76
+
77
+ sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) }
78
+ def code_units_column(byte_offset, encoding); end
79
+ end
80
+
81
+ class Prism::Location
82
+ sig { returns(Prism::Source) }
83
+ def source; end
84
+
85
+ sig { returns(Integer) }
86
+ def start_offset; end
87
+
88
+ sig { returns(Integer) }
89
+ def length; end
90
+
91
+ sig { params(source: Prism::Source, start_offset: Integer, length: Integer).void }
92
+ def initialize(source, start_offset, length); end
93
+
94
+ sig { returns(T::Array[Prism::Comment]) }
95
+ def leading_comments; end
96
+
97
+ sig { params(comment: Prism::Comment).void }
98
+ def leading_comment(comment); end
99
+
100
+ sig { returns(T::Array[Prism::Comment]) }
101
+ def trailing_comments; end
102
+
103
+ sig { params(comment: Prism::Comment).void }
104
+ def trailing_comment(comment); end
105
+
106
+ sig { returns(T::Array[Prism::Comment]) }
107
+ def comments; end
108
+
109
+ sig { params(source: Prism::Source, start_offset: Integer, length: Integer).returns(Prism::Location) }
110
+ def copy(source: self.source, start_offset: self.start_offset, length: self.length); end
111
+
112
+ sig { returns(Prism::Location) }
113
+ def chop; end
114
+
115
+ sig { returns(String) }
116
+ def inspect; end
117
+
118
+ sig { returns(T::Array[String]) }
119
+ def source_lines; end
120
+
121
+ sig { returns(String) }
122
+ def slice; end
123
+
124
+ sig { returns(Integer) }
125
+ def start_character_offset; end
126
+
127
+ sig { params(encoding: Encoding).returns(Integer) }
128
+ def start_code_units_offset(encoding = Encoding::UTF_16LE); end
129
+
130
+ sig { params(cache: T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer))).returns(Integer) }
131
+ def cached_start_code_units_offset(cache); end
132
+
133
+ sig { returns(Integer) }
134
+ def end_offset; end
135
+
136
+ sig { returns(Integer) }
137
+ def end_character_offset; end
138
+
139
+ sig { params(encoding: Encoding).returns(Integer) }
140
+ def end_code_units_offset(encoding = Encoding::UTF_16LE); end
141
+
142
+ sig { params(cache: T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer))).returns(Integer) }
143
+ def cached_end_code_units_offset(cache); end
144
+
145
+ sig { returns(Integer) }
146
+ def start_line; end
147
+
148
+ sig { returns(String) }
149
+ def start_line_slice; end
150
+
151
+ sig { returns(Integer) }
152
+ def end_line; end
153
+
154
+ sig { returns(Integer) }
155
+ def start_column; end
156
+
157
+ sig { returns(Integer) }
158
+ def start_character_column; end
159
+
160
+ sig { params(encoding: Encoding).returns(Integer) }
161
+ def start_code_units_column(encoding = Encoding::UTF_16LE); end
162
+
163
+ sig { params(cache: T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer))).returns(Integer) }
164
+ def cached_start_code_units_column(cache); end
165
+
166
+ sig { returns(Integer) }
167
+ def end_column; end
168
+
169
+ sig { returns(Integer) }
170
+ def end_character_column; end
171
+
172
+ sig { params(encoding: Encoding).returns(Integer) }
173
+ def end_code_units_column(encoding = Encoding::UTF_16LE); end
174
+
175
+ sig { params(cache: T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer))).returns(Integer) }
176
+ def cached_end_code_units_column(cache); end
177
+
178
+ sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
179
+ def deconstruct_keys(keys); end
180
+
181
+ sig { params(q: T.untyped).void }
182
+ def pretty_print(q); end
183
+
184
+ sig { params(other: T.untyped).returns(T::Boolean) }
185
+ def ==(other); end
186
+
187
+ sig { params(other: Prism::Location).returns(Prism::Location) }
188
+ def join(other); end
189
+
190
+ sig { params(string: String).returns(Prism::Location) }
191
+ def adjoin(string); end
192
+ end
193
+
194
+ class Prism::Comment
195
+ abstract!
196
+
197
+ sig { returns(Prism::Location) }
198
+ def location; end
199
+
200
+ sig { params(location: Prism::Location).void }
201
+ def initialize(location); end
202
+
203
+ sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
204
+ def deconstruct_keys(keys); end
205
+
206
+ sig { returns(String) }
207
+ def slice; end
208
+
209
+ sig { abstract.returns(T::Boolean) }
210
+ def trailing?; end
211
+ end
212
+
213
+ class Prism::InlineComment < Prism::Comment
214
+ sig { override.returns(T::Boolean) }
215
+ def trailing?; end
216
+
217
+ sig { returns(String) }
218
+ def inspect; end
219
+ end
220
+
221
+ class Prism::EmbDocComment < Prism::Comment
222
+ sig { override.returns(T::Boolean) }
223
+ def trailing?; end
224
+
225
+ sig { returns(String) }
226
+ def inspect; end
227
+ end
228
+
229
+ class Prism::MagicComment
230
+ sig { returns(Prism::Location) }
231
+ def key_loc; end
232
+
233
+ sig { returns(Prism::Location) }
234
+ def value_loc; end
235
+
236
+ sig { params(key_loc: Prism::Location, value_loc: Prism::Location).void }
237
+ def initialize(key_loc, value_loc); end
238
+
239
+ sig { returns(String) }
240
+ def key; end
241
+
242
+ sig { returns(String) }
243
+ def value; end
244
+
245
+ sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
246
+ def deconstruct_keys(keys); end
247
+
248
+ sig { returns(String) }
249
+ def inspect; end
250
+ end
251
+
252
+ class Prism::ParseError
253
+ sig { returns(Symbol) }
254
+ def type; end
255
+
256
+ sig { returns(String) }
257
+ def message; end
258
+
259
+ sig { returns(Prism::Location) }
260
+ def location; end
261
+
262
+ sig { returns(Symbol) }
263
+ def level; end
264
+
265
+ sig { params(type: Symbol, message: String, location: Prism::Location, level: Symbol).void }
266
+ def initialize(type, message, location, level); end
267
+
268
+ sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
269
+ def deconstruct_keys(keys); end
270
+
271
+ sig { returns(String) }
272
+ def inspect; end
273
+ end
274
+
275
+ class Prism::ParseWarning
276
+ sig { returns(Symbol) }
277
+ def type; end
278
+
279
+ sig { returns(String) }
280
+ def message; end
281
+
282
+ sig { returns(Prism::Location) }
283
+ def location; end
284
+
285
+ sig { returns(Symbol) }
286
+ def level; end
287
+
288
+ sig { params(type: Symbol, message: String, location: Prism::Location, level: Symbol).void }
289
+ def initialize(type, message, location, level); end
290
+
291
+ sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
292
+ def deconstruct_keys(keys); end
293
+
294
+ sig { returns(String) }
295
+ def inspect; end
296
+ end
297
+
298
+ class Prism::Result
299
+ sig { params(comments: T::Array[Prism::Comment], magic_comments: T::Array[Prism::MagicComment], data_loc: T.nilable(Prism::Location), errors: T::Array[Prism::ParseError], warnings: T::Array[Prism::ParseWarning], source: Prism::Source).void }
300
+ def initialize(comments, magic_comments, data_loc, errors, warnings, source); end
301
+
302
+ sig { returns(T::Array[Prism::Comment]) }
303
+ def comments; end
304
+
305
+ sig { returns(T::Array[Prism::MagicComment]) }
306
+ def magic_comments; end
307
+
308
+ sig { returns(T.nilable(Prism::Location)) }
309
+ def data_loc; end
310
+
311
+ sig { returns(T::Array[Prism::ParseError]) }
312
+ def errors; end
313
+
314
+ sig { returns(T::Array[Prism::ParseWarning]) }
315
+ def warnings; end
316
+
317
+ sig { returns(Prism::Source) }
318
+ def source; end
319
+
320
+ sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
321
+ def deconstruct_keys(keys); end
322
+
323
+ sig { returns(Encoding) }
324
+ def encoding; end
325
+
326
+ sig { returns(T::Boolean) }
327
+ def success?; end
328
+
329
+ sig { returns(T::Boolean) }
330
+ def failure?; end
331
+
332
+ sig { params(encoding: Encoding).returns(T.any(Prism::CodeUnitsCache, T.proc.params(byte_offset: Integer).returns(Integer))) }
333
+ def code_units_cache(encoding); end
334
+ end
335
+
336
+ class Prism::ParseResult < Prism::Result
337
+ sig { params(value: Prism::ProgramNode, comments: T::Array[Prism::Comment], magic_comments: T::Array[Prism::MagicComment], data_loc: T.nilable(Prism::Location), errors: T::Array[Prism::ParseError], warnings: T::Array[Prism::ParseWarning], source: Prism::Source).void }
338
+ def initialize(value, comments, magic_comments, data_loc, errors, warnings, source); end
339
+
340
+ sig { returns(Prism::ProgramNode) }
341
+ def value; end
342
+
343
+ sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
344
+ def deconstruct_keys(keys); end
345
+ end
346
+
347
+ class Prism::LexResult < Prism::Result
348
+ sig { params(value: T::Array[T.untyped], comments: T::Array[Prism::Comment], magic_comments: T::Array[Prism::MagicComment], data_loc: T.nilable(Prism::Location), errors: T::Array[Prism::ParseError], warnings: T::Array[Prism::ParseWarning], source: Prism::Source).void }
349
+ def initialize(value, comments, magic_comments, data_loc, errors, warnings, source); end
350
+
351
+ sig { returns(T::Array[T.untyped]) }
352
+ def value; end
353
+
354
+ sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
355
+ def deconstruct_keys(keys); end
356
+ end
357
+
358
+ class Prism::ParseLexResult < Prism::Result
359
+ sig { params(value: [Prism::ProgramNode, T::Array[T.untyped]], comments: T::Array[Prism::Comment], magic_comments: T::Array[Prism::MagicComment], data_loc: T.nilable(Prism::Location), errors: T::Array[Prism::ParseError], warnings: T::Array[Prism::ParseWarning], source: Prism::Source).void }
360
+ def initialize(value, comments, magic_comments, data_loc, errors, warnings, source); end
361
+
362
+ sig { returns([Prism::ProgramNode, T::Array[T.untyped]]) }
363
+ def value; end
364
+
365
+ sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
366
+ def deconstruct_keys(keys); end
367
+ end
368
+
369
+ class Prism::Token
370
+ sig { returns(Prism::Source) }
371
+ def source; end
372
+
373
+ sig { returns(Symbol) }
374
+ def type; end
375
+
376
+ sig { returns(String) }
377
+ def value; end
378
+
379
+ sig { params(source: Prism::Source, type: Symbol, value: String, location: T.any(Integer, Prism::Location)).void }
380
+ def initialize(source, type, value, location); end
381
+
382
+ sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
383
+ def deconstruct_keys(keys); end
384
+
385
+ sig { returns(Prism::Location) }
386
+ def location; end
387
+
388
+ sig { params(q: T.untyped).void }
389
+ def pretty_print(q); end
390
+
391
+ sig { params(other: T.untyped).returns(T::Boolean) }
392
+ def ==(other); end
393
+ end
394
+
395
+ class Prism::Scope
396
+ sig { returns(T::Array[Symbol]) }
397
+ def locals; end
398
+
399
+ sig { returns(T::Array[Symbol]) }
400
+ def forwarding; end
401
+
402
+ sig { params(locals: T::Array[Symbol], forwarding: T::Array[Symbol]).void }
403
+ def initialize(locals, forwarding); end
404
+ end
@@ -0,0 +1,58 @@
1
+ # typed: strict
2
+
3
+ module Prism::Reflection
4
+ end
5
+
6
+ class Prism::Reflection::Field
7
+ sig { params(name: Symbol).void }
8
+ def initialize(name); end
9
+
10
+ sig { returns(Symbol) }
11
+ def name; end
12
+ end
13
+
14
+ class Prism::Reflection::NodeField < Prism::Reflection::Field
15
+ end
16
+
17
+ class Prism::Reflection::OptionalNodeField < Prism::Reflection::Field
18
+ end
19
+
20
+ class Prism::Reflection::NodeListField < Prism::Reflection::Field
21
+ end
22
+
23
+ class Prism::Reflection::ConstantField < Prism::Reflection::Field
24
+ end
25
+
26
+ class Prism::Reflection::OptionalConstantField < Prism::Reflection::Field
27
+ end
28
+
29
+ class Prism::Reflection::ConstantListField < Prism::Reflection::Field
30
+ end
31
+
32
+ class Prism::Reflection::StringField < Prism::Reflection::Field
33
+ end
34
+
35
+ class Prism::Reflection::LocationField < Prism::Reflection::Field
36
+ end
37
+
38
+ class Prism::Reflection::OptionalLocationField < Prism::Reflection::Field
39
+ end
40
+
41
+ class Prism::Reflection::IntegerField < Prism::Reflection::Field
42
+ end
43
+
44
+ class Prism::Reflection::FloatField < Prism::Reflection::Field
45
+ end
46
+
47
+ class Prism::Reflection::FlagsField < Prism::Reflection::Field
48
+ sig { params(name: Symbol, flags: T::Array[Symbol]).void }
49
+ def initialize(name, flags); end
50
+
51
+ sig { returns(T::Array[Symbol]) }
52
+ def flags; end
53
+ end
54
+
55
+ module Prism::Reflection
56
+ sig { params(node: T.class_of(Prism::Node)).returns(T::Array[Prism::Reflection::Field]) }
57
+ def self.fields_for(node); end
58
+ end
@@ -0,0 +1,12 @@
1
+ # typed: strict
2
+
3
+ class Prism::StringQuery
4
+ sig { params(string: String).returns(T::Boolean) }
5
+ def self.local?(string); end
6
+
7
+ sig { params(string: String).returns(T::Boolean) }
8
+ def self.constant?(string); end
9
+
10
+ sig { params(string: String).returns(T::Boolean) }
11
+ def self.method_name?(string); end
12
+ end
@@ -0,0 +1,11 @@
1
+ # typed: strict
2
+
3
+ # We keep these shims in here because our client libraries might not have parser
4
+ # in their bundle.
5
+ module Parser; end
6
+ class Parser::Base; end
7
+
8
+ class Prism::Translation::Parser < Parser::Base
9
+ sig { overridable.returns(Integer) }
10
+ def version; end
11
+ end
@@ -0,0 +1,6 @@
1
+ # typed: strict
2
+
3
+ class Prism::Translation::Parser33 < Prism::Translation::Parser
4
+ sig { override.returns(Integer) }
5
+ def version; end
6
+ end
@@ -0,0 +1,6 @@
1
+ # typed: strict
2
+
3
+ class Prism::Translation::Parser34 < Prism::Translation::Parser
4
+ sig { override.returns(Integer) }
5
+ def version; end
6
+ end
@@ -0,0 +1,6 @@
1
+ # typed: strict
2
+
3
+ class Prism::Translation::Parser35 < Prism::Translation::Parser
4
+ sig { override.returns(Integer) }
5
+ def version; end
6
+ end
@@ -0,0 +1,15 @@
1
+ # typed: strict
2
+
3
+ class Prism::Translation::Ripper < Prism::Compiler
4
+ sig { returns(T::Boolean) }
5
+ def error?; end
6
+
7
+ sig { returns(T.untyped) }
8
+ def parse; end
9
+
10
+ sig { params(source: String, filename: String, lineno: Integer, raise_errors: T.untyped).returns(T.untyped) }
11
+ def self.sexp_raw(source, filename = "-", lineno = 1, raise_errors: false); end
12
+
13
+ sig { params(source: String, filename: String, lineno: Integer, raise_errors: T.untyped).returns(T.untyped) }
14
+ def self.sexp(source, filename = "-", lineno = 1, raise_errors: false); end
15
+ end