prism 0.24.0 → 0.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/BSDmakefile +58 -0
- data/CHANGELOG.md +69 -1
- data/Makefile +22 -16
- data/README.md +45 -6
- data/config.yml +510 -4
- data/docs/build_system.md +31 -0
- data/docs/configuration.md +3 -0
- data/docs/cruby_compilation.md +1 -1
- data/docs/parser_translation.md +14 -9
- data/docs/releasing.md +7 -9
- data/docs/ripper_translation.md +50 -0
- data/docs/ruby_api.md +1 -0
- data/docs/serialization.md +26 -5
- data/ext/prism/api_node.c +911 -815
- data/ext/prism/api_pack.c +9 -0
- data/ext/prism/extconf.rb +34 -13
- data/ext/prism/extension.c +341 -68
- data/ext/prism/extension.h +5 -4
- data/include/prism/ast.h +213 -64
- data/include/prism/defines.h +106 -2
- data/include/prism/diagnostic.h +146 -72
- data/include/prism/encoding.h +22 -4
- data/include/prism/node.h +93 -0
- data/include/prism/options.h +82 -7
- data/include/prism/pack.h +11 -0
- data/include/prism/parser.h +203 -54
- data/include/prism/prettyprint.h +8 -0
- data/include/prism/static_literals.h +118 -0
- data/include/prism/util/pm_buffer.h +65 -2
- data/include/prism/util/pm_constant_pool.h +18 -1
- data/include/prism/util/pm_integer.h +119 -0
- data/include/prism/util/pm_list.h +1 -1
- data/include/prism/util/pm_newline_list.h +8 -0
- data/include/prism/util/pm_string.h +26 -2
- data/include/prism/version.h +2 -2
- data/include/prism.h +59 -1
- data/lib/prism/compiler.rb +8 -1
- data/lib/prism/debug.rb +46 -3
- data/lib/prism/desugar_compiler.rb +4 -2
- data/lib/prism/dispatcher.rb +29 -0
- data/lib/prism/dot_visitor.rb +87 -16
- data/lib/prism/dsl.rb +24 -12
- data/lib/prism/ffi.rb +77 -12
- data/lib/prism/lex_compat.rb +17 -15
- data/lib/prism/mutation_compiler.rb +11 -0
- data/lib/prism/node.rb +2112 -2499
- data/lib/prism/node_ext.rb +77 -29
- data/lib/prism/pack.rb +4 -0
- data/lib/prism/parse_result/comments.rb +34 -17
- data/lib/prism/parse_result/newlines.rb +3 -1
- data/lib/prism/parse_result.rb +83 -32
- data/lib/prism/pattern.rb +16 -4
- data/lib/prism/polyfill/string.rb +12 -0
- data/lib/prism/reflection.rb +421 -0
- data/lib/prism/serialize.rb +450 -102
- data/lib/prism/translation/parser/compiler.rb +189 -50
- data/lib/prism/translation/parser/lexer.rb +103 -22
- data/lib/prism/translation/parser/rubocop.rb +41 -13
- data/lib/prism/translation/parser.rb +119 -7
- data/lib/prism/translation/parser33.rb +1 -1
- data/lib/prism/translation/parser34.rb +1 -1
- data/lib/prism/translation/ripper/sexp.rb +125 -0
- data/lib/prism/translation/ripper/shim.rb +5 -0
- data/lib/prism/translation/ripper.rb +3212 -462
- data/lib/prism/translation/ruby_parser.rb +35 -18
- data/lib/prism/translation.rb +3 -1
- data/lib/prism/visitor.rb +10 -0
- data/lib/prism.rb +9 -18
- data/prism.gemspec +39 -6
- data/rbi/prism/compiler.rbi +14 -0
- data/rbi/prism/desugar_compiler.rbi +5 -0
- data/rbi/prism/mutation_compiler.rbi +5 -0
- data/rbi/prism/node.rbi +8674 -0
- data/rbi/prism/node_ext.rbi +102 -0
- data/rbi/prism/parse_result.rbi +307 -0
- data/rbi/prism/reflection.rbi +64 -0
- data/rbi/prism/translation/parser/compiler.rbi +13 -0
- data/rbi/prism/translation/parser.rbi +11 -0
- data/rbi/prism/translation/parser33.rbi +6 -0
- data/rbi/prism/translation/parser34.rbi +6 -0
- data/rbi/prism/translation/ripper/ripper_compiler.rbi +5 -0
- data/rbi/prism/translation/ripper.rbi +25 -0
- data/rbi/prism/translation/ruby_parser.rbi +11 -0
- data/rbi/prism/visitor.rbi +470 -0
- data/rbi/prism.rbi +38 -7748
- data/sig/prism/compiler.rbs +9 -0
- data/sig/prism/dispatcher.rbs +16 -0
- data/sig/prism/dot_visitor.rbs +6 -0
- data/sig/prism/dsl.rbs +462 -0
- data/sig/prism/mutation_compiler.rbs +158 -0
- data/sig/prism/node.rbs +3538 -0
- data/sig/prism/node_ext.rbs +78 -0
- data/sig/prism/pack.rbs +43 -0
- data/sig/prism/parse_result.rbs +128 -0
- data/sig/prism/pattern.rbs +13 -0
- data/sig/prism/reflection.rbs +56 -0
- data/sig/prism/serialize.rbs +7 -0
- data/sig/prism/visitor.rbs +168 -0
- data/sig/prism.rbs +188 -4767
- data/src/diagnostic.c +597 -230
- data/src/encoding.c +211 -108
- data/src/node.c +7526 -447
- data/src/options.c +66 -31
- data/src/pack.c +33 -17
- data/src/prettyprint.c +1294 -1385
- data/src/prism.c +4015 -1149
- data/src/regexp.c +17 -2
- data/src/serialize.c +47 -28
- data/src/static_literals.c +552 -0
- data/src/token_type.c +4 -3
- data/src/util/pm_buffer.c +147 -20
- data/src/util/pm_char.c +4 -4
- data/src/util/pm_constant_pool.c +35 -11
- data/src/util/pm_integer.c +635 -0
- data/src/util/pm_list.c +1 -1
- data/src/util/pm_newline_list.c +14 -5
- data/src/util/pm_string.c +134 -5
- data/src/util/pm_string_list.c +2 -2
- metadata +41 -8
- data/docs/ripper.md +0 -36
- data/include/prism/util/pm_state_stack.h +0 -42
- data/rbi/prism_static.rbi +0 -207
- data/sig/prism_static.rbs +0 -201
- data/src/util/pm_state_stack.c +0 -25
@@ -0,0 +1,102 @@
|
|
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
|
@@ -0,0 +1,307 @@
|
|
1
|
+
# typed: strict
|
2
|
+
|
3
|
+
class Prism::Source
|
4
|
+
sig { returns(String) }
|
5
|
+
attr_reader :source
|
6
|
+
|
7
|
+
sig { returns(Integer) }
|
8
|
+
attr_reader :start_line
|
9
|
+
|
10
|
+
sig { returns(T::Array[Integer]) }
|
11
|
+
attr_reader :offsets
|
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 { returns(Encoding) }
|
17
|
+
def encoding; end
|
18
|
+
|
19
|
+
sig { params(byte_offset: Integer, length: Integer).returns(String) }
|
20
|
+
def slice(byte_offset, length); end
|
21
|
+
|
22
|
+
sig { params(byte_offset: Integer).returns(Integer) }
|
23
|
+
def line(byte_offset); end
|
24
|
+
|
25
|
+
sig { params(byte_offset: Integer).returns(Integer) }
|
26
|
+
def line_start(byte_offset); end
|
27
|
+
|
28
|
+
sig { params(byte_offset: Integer).returns(Integer) }
|
29
|
+
def column(byte_offset); end
|
30
|
+
|
31
|
+
sig { params(byte_offset: Integer).returns(Integer) }
|
32
|
+
def character_offset(byte_offset); end
|
33
|
+
|
34
|
+
sig { params(byte_offset: Integer).returns(Integer) }
|
35
|
+
def character_column(byte_offset); end
|
36
|
+
|
37
|
+
sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) }
|
38
|
+
def code_units_offset(byte_offset, encoding); end
|
39
|
+
|
40
|
+
sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) }
|
41
|
+
def code_units_column(byte_offset, encoding); end
|
42
|
+
end
|
43
|
+
|
44
|
+
class Prism::Location
|
45
|
+
sig { returns(Prism::Source) }
|
46
|
+
attr_reader :source
|
47
|
+
|
48
|
+
sig { returns(Integer) }
|
49
|
+
attr_reader :start_offset
|
50
|
+
|
51
|
+
sig { returns(Integer) }
|
52
|
+
attr_reader :length
|
53
|
+
|
54
|
+
sig { params(source: Prism::Source, start_offset: Integer, length: Integer).void }
|
55
|
+
def initialize(source, start_offset, length); end
|
56
|
+
|
57
|
+
sig { returns(T::Array[Prism::Comment]) }
|
58
|
+
def leading_comments; end
|
59
|
+
|
60
|
+
sig { params(comment: Prism::Comment).void }
|
61
|
+
def leading_comment(comment); end
|
62
|
+
|
63
|
+
sig { returns(T::Array[Prism::Comment]) }
|
64
|
+
def trailing_comments; end
|
65
|
+
|
66
|
+
sig { params(comment: Prism::Comment).void }
|
67
|
+
def trailing_comment(comment); end
|
68
|
+
|
69
|
+
sig { returns(T::Array[Prism::Comment]) }
|
70
|
+
def comments; end
|
71
|
+
|
72
|
+
sig { params(source: Prism::Source, start_offset: Integer, length: Integer).returns(Prism::Location) }
|
73
|
+
def copy(source: self.source, start_offset: self.start_offset, length: self.length); end
|
74
|
+
|
75
|
+
sig { returns(Prism::Location) }
|
76
|
+
def chop; end
|
77
|
+
|
78
|
+
sig { returns(String) }
|
79
|
+
def inspect; end
|
80
|
+
|
81
|
+
sig { returns(String) }
|
82
|
+
def slice; end
|
83
|
+
|
84
|
+
sig { returns(Integer) }
|
85
|
+
def start_character_offset; end
|
86
|
+
|
87
|
+
sig { params(encoding: Encoding).returns(Integer) }
|
88
|
+
def start_code_units_offset(encoding = Encoding::UTF_16LE); end
|
89
|
+
|
90
|
+
sig { returns(Integer) }
|
91
|
+
def end_offset; end
|
92
|
+
|
93
|
+
sig { returns(Integer) }
|
94
|
+
def end_character_offset; end
|
95
|
+
|
96
|
+
sig { params(encoding: Encoding).returns(Integer) }
|
97
|
+
def end_code_units_offset(encoding = Encoding::UTF_16LE); end
|
98
|
+
|
99
|
+
sig { returns(Integer) }
|
100
|
+
def start_line; end
|
101
|
+
|
102
|
+
sig { returns(String) }
|
103
|
+
def start_line_slice; end
|
104
|
+
|
105
|
+
sig { returns(Integer) }
|
106
|
+
def end_line; end
|
107
|
+
|
108
|
+
sig { returns(Integer) }
|
109
|
+
def start_column; end
|
110
|
+
|
111
|
+
sig { returns(Integer) }
|
112
|
+
def start_character_column; end
|
113
|
+
|
114
|
+
sig { params(encoding: Encoding).returns(Integer) }
|
115
|
+
def start_code_units_column(encoding = Encoding::UTF_16LE); end
|
116
|
+
|
117
|
+
sig { returns(Integer) }
|
118
|
+
def end_column; end
|
119
|
+
|
120
|
+
sig { returns(Integer) }
|
121
|
+
def end_character_column; end
|
122
|
+
|
123
|
+
sig { params(encoding: Encoding).returns(Integer) }
|
124
|
+
def end_code_units_column(encoding = Encoding::UTF_16LE); end
|
125
|
+
|
126
|
+
sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
|
127
|
+
def deconstruct_keys(keys); end
|
128
|
+
|
129
|
+
sig { params(q: T.untyped).void }
|
130
|
+
def pretty_print(q); end
|
131
|
+
|
132
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
133
|
+
def ==(other); end
|
134
|
+
|
135
|
+
sig { params(other: Prism::Location).returns(Prism::Location) }
|
136
|
+
def join(other); end
|
137
|
+
end
|
138
|
+
|
139
|
+
class Prism::Comment
|
140
|
+
abstract!
|
141
|
+
|
142
|
+
sig { returns(Prism::Location) }
|
143
|
+
attr_reader :location
|
144
|
+
|
145
|
+
sig { params(location: Prism::Location).void }
|
146
|
+
def initialize(location); end
|
147
|
+
|
148
|
+
sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
|
149
|
+
def deconstruct_keys(keys); end
|
150
|
+
|
151
|
+
sig { returns(String) }
|
152
|
+
def slice; end
|
153
|
+
|
154
|
+
sig { abstract.returns(T::Boolean) }
|
155
|
+
def trailing?; end
|
156
|
+
end
|
157
|
+
|
158
|
+
class Prism::InlineComment < Prism::Comment
|
159
|
+
sig { override.returns(T::Boolean) }
|
160
|
+
def trailing?; end
|
161
|
+
|
162
|
+
sig { returns(String) }
|
163
|
+
def inspect; end
|
164
|
+
end
|
165
|
+
|
166
|
+
class Prism::EmbDocComment < Prism::Comment
|
167
|
+
sig { override.returns(T::Boolean) }
|
168
|
+
def trailing?; end
|
169
|
+
|
170
|
+
sig { returns(String) }
|
171
|
+
def inspect; end
|
172
|
+
end
|
173
|
+
|
174
|
+
class Prism::MagicComment
|
175
|
+
sig { returns(Prism::Location) }
|
176
|
+
attr_reader :key_loc
|
177
|
+
|
178
|
+
sig { returns(Prism::Location) }
|
179
|
+
attr_reader :value_loc
|
180
|
+
|
181
|
+
sig { params(key_loc: Prism::Location, value_loc: Prism::Location).void }
|
182
|
+
def initialize(key_loc, value_loc); end
|
183
|
+
|
184
|
+
sig { returns(String) }
|
185
|
+
def key; end
|
186
|
+
|
187
|
+
sig { returns(String) }
|
188
|
+
def value; end
|
189
|
+
|
190
|
+
sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
|
191
|
+
def deconstruct_keys(keys); end
|
192
|
+
|
193
|
+
sig { returns(String) }
|
194
|
+
def inspect; end
|
195
|
+
end
|
196
|
+
|
197
|
+
class Prism::ParseError
|
198
|
+
sig { returns(Symbol) }
|
199
|
+
attr_reader :type
|
200
|
+
|
201
|
+
sig { returns(String) }
|
202
|
+
attr_reader :message
|
203
|
+
|
204
|
+
sig { returns(Prism::Location) }
|
205
|
+
attr_reader :location
|
206
|
+
|
207
|
+
sig { returns(Symbol) }
|
208
|
+
attr_reader :level
|
209
|
+
|
210
|
+
sig { params(type: Symbol, message: String, location: Prism::Location, level: Symbol).void }
|
211
|
+
def initialize(type, message, location, level); end
|
212
|
+
|
213
|
+
sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
|
214
|
+
def deconstruct_keys(keys); end
|
215
|
+
|
216
|
+
sig { returns(String) }
|
217
|
+
def inspect; end
|
218
|
+
end
|
219
|
+
|
220
|
+
class Prism::ParseWarning
|
221
|
+
sig { returns(Symbol) }
|
222
|
+
attr_reader :type
|
223
|
+
|
224
|
+
sig { returns(String) }
|
225
|
+
attr_reader :message
|
226
|
+
|
227
|
+
sig { returns(Prism::Location) }
|
228
|
+
attr_reader :location
|
229
|
+
|
230
|
+
sig { returns(Symbol) }
|
231
|
+
attr_reader :level
|
232
|
+
|
233
|
+
sig { params(type: Symbol, message: String, location: Prism::Location, level: Symbol).void }
|
234
|
+
def initialize(type, message, location, level); end
|
235
|
+
|
236
|
+
sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
|
237
|
+
def deconstruct_keys(keys); end
|
238
|
+
|
239
|
+
sig { returns(String) }
|
240
|
+
def inspect; end
|
241
|
+
end
|
242
|
+
|
243
|
+
class Prism::ParseResult
|
244
|
+
Value = type_member
|
245
|
+
|
246
|
+
sig { returns(Value) }
|
247
|
+
attr_reader :value
|
248
|
+
|
249
|
+
sig { returns(T::Array[Prism::Comment]) }
|
250
|
+
attr_reader :comments
|
251
|
+
|
252
|
+
sig { returns(T::Array[Prism::MagicComment]) }
|
253
|
+
attr_reader :magic_comments
|
254
|
+
|
255
|
+
sig { returns(T.nilable(Prism::Location)) }
|
256
|
+
attr_reader :data_loc
|
257
|
+
|
258
|
+
sig { returns(T::Array[Prism::ParseError]) }
|
259
|
+
attr_reader :errors
|
260
|
+
|
261
|
+
sig { returns(T::Array[Prism::ParseWarning]) }
|
262
|
+
attr_reader :warnings
|
263
|
+
|
264
|
+
sig { returns(Prism::Source) }
|
265
|
+
attr_reader :source
|
266
|
+
|
267
|
+
sig { params(value: Value, 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 }
|
268
|
+
def initialize(value, comments, magic_comments, data_loc, errors, warnings, source); end
|
269
|
+
|
270
|
+
sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
|
271
|
+
def deconstruct_keys(keys); end
|
272
|
+
|
273
|
+
sig { returns(Encoding) }
|
274
|
+
def encoding; end
|
275
|
+
|
276
|
+
sig { returns(T::Boolean) }
|
277
|
+
def success?; end
|
278
|
+
|
279
|
+
sig { returns(T::Boolean) }
|
280
|
+
def failure?; end
|
281
|
+
end
|
282
|
+
|
283
|
+
class Prism::Token
|
284
|
+
sig { returns(Prism::Source) }
|
285
|
+
attr_reader :source
|
286
|
+
|
287
|
+
sig { returns(Symbol) }
|
288
|
+
attr_reader :type
|
289
|
+
|
290
|
+
sig { returns(String) }
|
291
|
+
attr_reader :value
|
292
|
+
|
293
|
+
sig { params(source: Prism::Source, type: Symbol, value: String, location: T.any(Integer, Prism::Location)).void }
|
294
|
+
def initialize(source, type, value, location); end
|
295
|
+
|
296
|
+
sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
|
297
|
+
def deconstruct_keys(keys); end
|
298
|
+
|
299
|
+
sig { returns(Prism::Location) }
|
300
|
+
def location; end
|
301
|
+
|
302
|
+
sig { params(q: T.untyped).void }
|
303
|
+
def pretty_print(q); end
|
304
|
+
|
305
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
306
|
+
def ==(other); end
|
307
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# typed: strict
|
2
|
+
|
3
|
+
module Prism::Reflection
|
4
|
+
end
|
5
|
+
|
6
|
+
class Prism::Reflection::Field
|
7
|
+
sig { returns(Symbol) }
|
8
|
+
attr_reader :name
|
9
|
+
|
10
|
+
sig { params(name: Symbol).void }
|
11
|
+
def initialize(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::UInt8Field < Prism::Reflection::Field
|
42
|
+
end
|
43
|
+
|
44
|
+
class Prism::Reflection::UInt32Field < Prism::Reflection::Field
|
45
|
+
end
|
46
|
+
|
47
|
+
class Prism::Reflection::FlagsField < Prism::Reflection::Field
|
48
|
+
sig { returns(T::Array[Symbol]) }
|
49
|
+
attr_reader :flags
|
50
|
+
|
51
|
+
sig { params(name: Symbol, flags: T::Array[Symbol]).void }
|
52
|
+
def initialize(name, flags); end
|
53
|
+
end
|
54
|
+
|
55
|
+
class Prism::Reflection::IntegerField < Prism::Reflection::Field
|
56
|
+
end
|
57
|
+
|
58
|
+
class Prism::Reflection::DoubleField < Prism::Reflection::Field
|
59
|
+
end
|
60
|
+
|
61
|
+
module Prism::Reflection
|
62
|
+
sig { params(node: T.class_of(Prism::Node)).returns(T::Array[Prism::Reflection::Field]) }
|
63
|
+
def self.fields_for(node); end
|
64
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# typed: strict
|
2
|
+
|
3
|
+
# We keep these shims in here because our client libraries might not have
|
4
|
+
# ast/parser in their bundle.
|
5
|
+
module AST; end
|
6
|
+
class AST::Node; end
|
7
|
+
module Parser; end
|
8
|
+
module Parser::AST; end
|
9
|
+
class Parser::AST::Node < AST::Node; end
|
10
|
+
|
11
|
+
class Prism::Translation::Parser::Compiler < Prism::Compiler
|
12
|
+
Result = type_member { { fixed: Parser::AST::Node } }
|
13
|
+
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,25 @@
|
|
1
|
+
# typed: strict
|
2
|
+
|
3
|
+
class Prism::Translation::Ripper < Prism::Compiler
|
4
|
+
Result = type_member
|
5
|
+
|
6
|
+
sig { returns(T::Boolean) }
|
7
|
+
def error?; end
|
8
|
+
|
9
|
+
sig { returns(T.nilable(Result)) }
|
10
|
+
def parse; end
|
11
|
+
|
12
|
+
sig { params(source: String, filename: String, lineno: Integer, raise_errors: T.untyped).returns(T.untyped) }
|
13
|
+
def self.sexp_raw(source, filename = "-", lineno = 1, raise_errors: false); end
|
14
|
+
|
15
|
+
sig { params(source: String, filename: String, lineno: Integer, raise_errors: T.untyped).returns(T.untyped) }
|
16
|
+
def self.sexp(source, filename = "-", lineno = 1, raise_errors: false); end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Prism::Translation::Ripper::SexpBuilder < Prism::Translation::Ripper
|
20
|
+
Result = type_member { { fixed: T::Array[T.untyped] } }
|
21
|
+
end
|
22
|
+
|
23
|
+
class Prism::Translation::Ripper::SexpBuilderPP < Prism::Translation::Ripper::SexpBuilder
|
24
|
+
Result = type_member { { fixed: T::Array[T.untyped] } }
|
25
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# typed: strict
|
2
|
+
|
3
|
+
# We keep this shim in here because our client libraries might not have
|
4
|
+
# ruby_parser in their bundle.
|
5
|
+
class Sexp < ::Array
|
6
|
+
Elem = type_member { { fixed: T.untyped }}
|
7
|
+
end
|
8
|
+
|
9
|
+
class Prism::Translation::RubyParser::Compiler < Prism::Compiler
|
10
|
+
Result = type_member { { fixed: Sexp } }
|
11
|
+
end
|