prism 0.26.0 → 0.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +45 -1
- data/Makefile +3 -2
- data/config.yml +305 -20
- data/docs/configuration.md +1 -0
- data/ext/prism/api_node.c +884 -879
- data/ext/prism/extconf.rb +23 -4
- data/ext/prism/extension.c +16 -9
- data/ext/prism/extension.h +1 -1
- data/include/prism/ast.h +298 -9
- data/include/prism/diagnostic.h +15 -5
- data/include/prism/options.h +2 -2
- data/include/prism/parser.h +10 -0
- data/include/prism/static_literals.h +8 -6
- data/include/prism/version.h +2 -2
- data/lib/prism/dot_visitor.rb +22 -6
- data/lib/prism/dsl.rb +8 -8
- data/lib/prism/ffi.rb +4 -4
- data/lib/prism/inspect_visitor.rb +2156 -0
- data/lib/prism/lex_compat.rb +18 -1
- data/lib/prism/mutation_compiler.rb +2 -2
- data/lib/prism/node.rb +2345 -1964
- data/lib/prism/node_ext.rb +34 -5
- data/lib/prism/parse_result/newlines.rb +0 -2
- data/lib/prism/parse_result.rb +137 -13
- data/lib/prism/pattern.rb +12 -6
- data/lib/prism/polyfill/byteindex.rb +13 -0
- data/lib/prism/polyfill/unpack1.rb +14 -0
- data/lib/prism/reflection.rb +21 -31
- data/lib/prism/serialize.rb +27 -17
- data/lib/prism/translation/parser/compiler.rb +34 -15
- data/lib/prism/translation/parser.rb +6 -6
- data/lib/prism/translation/ripper.rb +72 -68
- data/lib/prism/translation/ruby_parser.rb +69 -31
- data/lib/prism.rb +3 -2
- data/prism.gemspec +36 -38
- data/rbi/prism/compiler.rbi +3 -5
- data/rbi/prism/inspect_visitor.rbi +12 -0
- data/rbi/prism/node.rbi +359 -321
- data/rbi/prism/parse_result.rbi +85 -34
- data/rbi/prism/reflection.rbi +7 -13
- data/rbi/prism/translation/ripper.rbi +1 -11
- data/rbi/prism.rbi +9 -9
- data/sig/prism/dsl.rbs +3 -3
- data/sig/prism/inspect_visitor.rbs +22 -0
- data/sig/prism/node.rbs +68 -48
- data/sig/prism/parse_result.rbs +42 -10
- data/sig/prism/reflection.rbs +2 -8
- data/sig/prism/serialize.rbs +2 -3
- data/sig/prism.rbs +9 -9
- data/src/diagnostic.c +44 -24
- data/src/node.c +41 -16
- data/src/options.c +2 -2
- data/src/prettyprint.c +61 -18
- data/src/prism.c +623 -188
- data/src/serialize.c +5 -2
- data/src/static_literals.c +120 -34
- data/src/token_type.c +4 -4
- data/src/util/pm_integer.c +9 -2
- metadata +7 -9
- data/lib/prism/node_inspector.rb +0 -68
- data/lib/prism/polyfill/string.rb +0 -12
- data/rbi/prism/desugar_compiler.rbi +0 -5
- data/rbi/prism/mutation_compiler.rbi +0 -5
- data/rbi/prism/translation/parser/compiler.rbi +0 -13
- data/rbi/prism/translation/ripper/ripper_compiler.rbi +0 -5
- data/rbi/prism/translation/ruby_parser.rbi +0 -11
data/rbi/prism/parse_result.rbi
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
class Prism::Source
|
4
4
|
sig { returns(String) }
|
5
|
-
|
5
|
+
def source; end
|
6
6
|
|
7
7
|
sig { returns(Integer) }
|
8
|
-
|
8
|
+
def start_line; end
|
9
9
|
|
10
10
|
sig { returns(T::Array[Integer]) }
|
11
|
-
|
11
|
+
def offsets; end
|
12
12
|
|
13
13
|
sig { params(source: String, start_line: Integer, offsets: T::Array[Integer]).void }
|
14
14
|
def initialize(source, start_line = 1, offsets = []); end
|
@@ -16,6 +16,9 @@ class Prism::Source
|
|
16
16
|
sig { returns(Encoding) }
|
17
17
|
def encoding; end
|
18
18
|
|
19
|
+
sig { returns(T::Array[Integer]) }
|
20
|
+
def lines; end
|
21
|
+
|
19
22
|
sig { params(byte_offset: Integer, length: Integer).returns(String) }
|
20
23
|
def slice(byte_offset, length); end
|
21
24
|
|
@@ -41,15 +44,29 @@ class Prism::Source
|
|
41
44
|
def code_units_column(byte_offset, encoding); end
|
42
45
|
end
|
43
46
|
|
47
|
+
class Prism::ASCIISource < Prism::Source
|
48
|
+
sig { params(byte_offset: Integer).returns(Integer) }
|
49
|
+
def character_offset(byte_offset); end
|
50
|
+
|
51
|
+
sig { params(byte_offset: Integer).returns(Integer) }
|
52
|
+
def character_column(byte_offset); end
|
53
|
+
|
54
|
+
sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) }
|
55
|
+
def code_units_offset(byte_offset, encoding); end
|
56
|
+
|
57
|
+
sig { params(byte_offset: Integer, encoding: Encoding).returns(Integer) }
|
58
|
+
def code_units_column(byte_offset, encoding); end
|
59
|
+
end
|
60
|
+
|
44
61
|
class Prism::Location
|
45
62
|
sig { returns(Prism::Source) }
|
46
|
-
|
63
|
+
def source; end
|
47
64
|
|
48
65
|
sig { returns(Integer) }
|
49
|
-
|
66
|
+
def start_offset; end
|
50
67
|
|
51
68
|
sig { returns(Integer) }
|
52
|
-
|
69
|
+
def length; end
|
53
70
|
|
54
71
|
sig { params(source: Prism::Source, start_offset: Integer, length: Integer).void }
|
55
72
|
def initialize(source, start_offset, length); end
|
@@ -78,6 +95,9 @@ class Prism::Location
|
|
78
95
|
sig { returns(String) }
|
79
96
|
def inspect; end
|
80
97
|
|
98
|
+
sig { returns(T::Array[String]) }
|
99
|
+
def source_lines; end
|
100
|
+
|
81
101
|
sig { returns(String) }
|
82
102
|
def slice; end
|
83
103
|
|
@@ -134,13 +154,16 @@ class Prism::Location
|
|
134
154
|
|
135
155
|
sig { params(other: Prism::Location).returns(Prism::Location) }
|
136
156
|
def join(other); end
|
157
|
+
|
158
|
+
sig { params(string: String).returns(Prism::Location) }
|
159
|
+
def adjoin(string); end
|
137
160
|
end
|
138
161
|
|
139
162
|
class Prism::Comment
|
140
163
|
abstract!
|
141
164
|
|
142
165
|
sig { returns(Prism::Location) }
|
143
|
-
|
166
|
+
def location; end
|
144
167
|
|
145
168
|
sig { params(location: Prism::Location).void }
|
146
169
|
def initialize(location); end
|
@@ -173,10 +196,10 @@ end
|
|
173
196
|
|
174
197
|
class Prism::MagicComment
|
175
198
|
sig { returns(Prism::Location) }
|
176
|
-
|
199
|
+
def key_loc; end
|
177
200
|
|
178
201
|
sig { returns(Prism::Location) }
|
179
|
-
|
202
|
+
def value_loc; end
|
180
203
|
|
181
204
|
sig { params(key_loc: Prism::Location, value_loc: Prism::Location).void }
|
182
205
|
def initialize(key_loc, value_loc); end
|
@@ -196,16 +219,16 @@ end
|
|
196
219
|
|
197
220
|
class Prism::ParseError
|
198
221
|
sig { returns(Symbol) }
|
199
|
-
|
222
|
+
def type; end
|
200
223
|
|
201
224
|
sig { returns(String) }
|
202
|
-
|
225
|
+
def message; end
|
203
226
|
|
204
227
|
sig { returns(Prism::Location) }
|
205
|
-
|
228
|
+
def location; end
|
206
229
|
|
207
230
|
sig { returns(Symbol) }
|
208
|
-
|
231
|
+
def level; end
|
209
232
|
|
210
233
|
sig { params(type: Symbol, message: String, location: Prism::Location, level: Symbol).void }
|
211
234
|
def initialize(type, message, location, level); end
|
@@ -219,16 +242,16 @@ end
|
|
219
242
|
|
220
243
|
class Prism::ParseWarning
|
221
244
|
sig { returns(Symbol) }
|
222
|
-
|
245
|
+
def type; end
|
223
246
|
|
224
247
|
sig { returns(String) }
|
225
|
-
|
248
|
+
def message; end
|
226
249
|
|
227
250
|
sig { returns(Prism::Location) }
|
228
|
-
|
251
|
+
def location; end
|
229
252
|
|
230
253
|
sig { returns(Symbol) }
|
231
|
-
|
254
|
+
def level; end
|
232
255
|
|
233
256
|
sig { params(type: Symbol, message: String, location: Prism::Location, level: Symbol).void }
|
234
257
|
def initialize(type, message, location, level); end
|
@@ -240,32 +263,27 @@ class Prism::ParseWarning
|
|
240
263
|
def inspect; end
|
241
264
|
end
|
242
265
|
|
243
|
-
class Prism::
|
244
|
-
|
245
|
-
|
246
|
-
sig { returns(Value) }
|
247
|
-
attr_reader :value
|
266
|
+
class Prism::Result
|
267
|
+
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 }
|
268
|
+
def initialize(comments, magic_comments, data_loc, errors, warnings, source); end
|
248
269
|
|
249
270
|
sig { returns(T::Array[Prism::Comment]) }
|
250
|
-
|
271
|
+
def comments; end
|
251
272
|
|
252
273
|
sig { returns(T::Array[Prism::MagicComment]) }
|
253
|
-
|
274
|
+
def magic_comments; end
|
254
275
|
|
255
276
|
sig { returns(T.nilable(Prism::Location)) }
|
256
|
-
|
277
|
+
def data_loc; end
|
257
278
|
|
258
279
|
sig { returns(T::Array[Prism::ParseError]) }
|
259
|
-
|
280
|
+
def errors; end
|
260
281
|
|
261
282
|
sig { returns(T::Array[Prism::ParseWarning]) }
|
262
|
-
|
283
|
+
def warnings; end
|
263
284
|
|
264
285
|
sig { returns(Prism::Source) }
|
265
|
-
|
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
|
286
|
+
def source; end
|
269
287
|
|
270
288
|
sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
|
271
289
|
def deconstruct_keys(keys); end
|
@@ -280,15 +298,48 @@ class Prism::ParseResult
|
|
280
298
|
def failure?; end
|
281
299
|
end
|
282
300
|
|
301
|
+
class Prism::ParseResult < Prism::Result
|
302
|
+
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 }
|
303
|
+
def initialize(value, comments, magic_comments, data_loc, errors, warnings, source); end
|
304
|
+
|
305
|
+
sig { returns(Prism::ProgramNode) }
|
306
|
+
def value; end
|
307
|
+
|
308
|
+
sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
|
309
|
+
def deconstruct_keys(keys); end
|
310
|
+
end
|
311
|
+
|
312
|
+
class Prism::LexResult < Prism::Result
|
313
|
+
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 }
|
314
|
+
def initialize(value, comments, magic_comments, data_loc, errors, warnings, source); end
|
315
|
+
|
316
|
+
sig { returns(T::Array[T.untyped]) }
|
317
|
+
def value; end
|
318
|
+
|
319
|
+
sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
|
320
|
+
def deconstruct_keys(keys); end
|
321
|
+
end
|
322
|
+
|
323
|
+
class Prism::ParseLexResult < Prism::Result
|
324
|
+
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 }
|
325
|
+
def initialize(value, comments, magic_comments, data_loc, errors, warnings, source); end
|
326
|
+
|
327
|
+
sig { returns([Prism::ProgramNode, T::Array[T.untyped]]) }
|
328
|
+
def value; end
|
329
|
+
|
330
|
+
sig { params(keys: T.nilable(T::Array[Symbol])).returns(T::Hash[Symbol, T.untyped]) }
|
331
|
+
def deconstruct_keys(keys); end
|
332
|
+
end
|
333
|
+
|
283
334
|
class Prism::Token
|
284
335
|
sig { returns(Prism::Source) }
|
285
|
-
|
336
|
+
def source; end
|
286
337
|
|
287
338
|
sig { returns(Symbol) }
|
288
|
-
|
339
|
+
def type; end
|
289
340
|
|
290
341
|
sig { returns(String) }
|
291
|
-
|
342
|
+
def value; end
|
292
343
|
|
293
344
|
sig { params(source: Prism::Source, type: Symbol, value: String, location: T.any(Integer, Prism::Location)).void }
|
294
345
|
def initialize(source, type, value, location); end
|
data/rbi/prism/reflection.rbi
CHANGED
@@ -4,11 +4,11 @@ module Prism::Reflection
|
|
4
4
|
end
|
5
5
|
|
6
6
|
class Prism::Reflection::Field
|
7
|
-
sig { returns(Symbol) }
|
8
|
-
attr_reader :name
|
9
|
-
|
10
7
|
sig { params(name: Symbol).void }
|
11
8
|
def initialize(name); end
|
9
|
+
|
10
|
+
sig { returns(Symbol) }
|
11
|
+
def name; end
|
12
12
|
end
|
13
13
|
|
14
14
|
class Prism::Reflection::NodeField < Prism::Reflection::Field
|
@@ -38,24 +38,18 @@ end
|
|
38
38
|
class Prism::Reflection::OptionalLocationField < Prism::Reflection::Field
|
39
39
|
end
|
40
40
|
|
41
|
-
class Prism::Reflection::
|
41
|
+
class Prism::Reflection::IntegerField < Prism::Reflection::Field
|
42
42
|
end
|
43
43
|
|
44
|
-
class Prism::Reflection::
|
44
|
+
class Prism::Reflection::FloatField < Prism::Reflection::Field
|
45
45
|
end
|
46
46
|
|
47
47
|
class Prism::Reflection::FlagsField < Prism::Reflection::Field
|
48
|
-
sig { returns(T::Array[Symbol]) }
|
49
|
-
attr_reader :flags
|
50
|
-
|
51
48
|
sig { params(name: Symbol, flags: T::Array[Symbol]).void }
|
52
49
|
def initialize(name, flags); end
|
53
|
-
end
|
54
|
-
|
55
|
-
class Prism::Reflection::IntegerField < Prism::Reflection::Field
|
56
|
-
end
|
57
50
|
|
58
|
-
|
51
|
+
sig { returns(T::Array[Symbol]) }
|
52
|
+
def flags; end
|
59
53
|
end
|
60
54
|
|
61
55
|
module Prism::Reflection
|
@@ -1,12 +1,10 @@
|
|
1
1
|
# typed: strict
|
2
2
|
|
3
3
|
class Prism::Translation::Ripper < Prism::Compiler
|
4
|
-
Result = type_member
|
5
|
-
|
6
4
|
sig { returns(T::Boolean) }
|
7
5
|
def error?; end
|
8
6
|
|
9
|
-
sig { returns(T.
|
7
|
+
sig { returns(T.untyped) }
|
10
8
|
def parse; end
|
11
9
|
|
12
10
|
sig { params(source: String, filename: String, lineno: Integer, raise_errors: T.untyped).returns(T.untyped) }
|
@@ -15,11 +13,3 @@ class Prism::Translation::Ripper < Prism::Compiler
|
|
15
13
|
sig { params(source: String, filename: String, lineno: Integer, raise_errors: T.untyped).returns(T.untyped) }
|
16
14
|
def self.sexp(source, filename = "-", lineno = 1, raise_errors: false); end
|
17
15
|
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
|
data/rbi/prism.rbi
CHANGED
@@ -7,28 +7,28 @@ module Prism
|
|
7
7
|
sig { params(filepath: String, command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(String) }
|
8
8
|
def self.dump_file(filepath, command_line: nil, encoding: nil, frozen_string_literal: nil, line: nil, scopes: nil, version: nil); end
|
9
9
|
|
10
|
-
sig { params(source: String, command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), filepath: T.nilable(String), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(Prism::
|
10
|
+
sig { params(source: String, command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), filepath: T.nilable(String), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(Prism::LexResult) }
|
11
11
|
def self.lex(source, command_line: nil, encoding: nil, filepath: nil, frozen_string_literal: nil, line: nil, scopes: nil, version: nil); end
|
12
12
|
|
13
|
-
sig { params(filepath: String, command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(Prism::
|
13
|
+
sig { params(filepath: String, command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(Prism::LexResult) }
|
14
14
|
def self.lex_file(filepath, command_line: nil, encoding: nil, frozen_string_literal: nil, line: nil, scopes: nil, version: nil); end
|
15
15
|
|
16
|
-
sig { params(source: String, options: T::Hash[Symbol, T.untyped]).returns(Prism::
|
16
|
+
sig { params(source: String, options: T::Hash[Symbol, T.untyped]).returns(Prism::LexCompat::Result) }
|
17
17
|
def self.lex_compat(source, **options); end
|
18
18
|
|
19
19
|
sig { params(source: String).returns(T::Array[T.untyped]) }
|
20
20
|
def self.lex_ripper(source); end
|
21
21
|
|
22
|
-
sig { params(source: String, serialized: String).returns(Prism::ParseResult
|
22
|
+
sig { params(source: String, serialized: String).returns(Prism::ParseResult) }
|
23
23
|
def self.load(source, serialized); end
|
24
24
|
|
25
|
-
sig { params(source: String, command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), filepath: T.nilable(String), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(Prism::ParseResult
|
25
|
+
sig { params(source: String, command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), filepath: T.nilable(String), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(Prism::ParseResult) }
|
26
26
|
def self.parse(source, command_line: nil, encoding: nil, filepath: nil, frozen_string_literal: nil, line: nil, scopes: nil, version: nil); end
|
27
27
|
|
28
|
-
sig { params(filepath: String, command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(Prism::ParseResult
|
28
|
+
sig { params(filepath: String, command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(Prism::ParseResult) }
|
29
29
|
def self.parse_file(filepath, command_line: nil, encoding: nil, frozen_string_literal: nil, line: nil, scopes: nil, version: nil); end
|
30
30
|
|
31
|
-
sig { params(stream: T.any(IO, StringIO), command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), filepath: T.nilable(String), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(Prism::ParseResult
|
31
|
+
sig { params(stream: T.any(IO, StringIO), command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), filepath: T.nilable(String), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(Prism::ParseResult) }
|
32
32
|
def self.parse_stream(stream, command_line: nil, encoding: nil, filepath: nil, frozen_string_literal: nil, line: nil, scopes: nil, version: nil); end
|
33
33
|
|
34
34
|
sig { params(source: String, command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), filepath: T.nilable(String), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(T::Array[Prism::Comment]) }
|
@@ -37,10 +37,10 @@ module Prism
|
|
37
37
|
sig { params(filepath: String, command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(T::Array[Prism::Comment]) }
|
38
38
|
def self.parse_file_comments(filepath, command_line: nil, encoding: nil, frozen_string_literal: nil, line: nil, scopes: nil, version: nil); end
|
39
39
|
|
40
|
-
sig { params(source: String, command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), filepath: T.nilable(String), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(Prism::
|
40
|
+
sig { params(source: String, command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), filepath: T.nilable(String), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(Prism::ParseLexResult) }
|
41
41
|
def self.parse_lex(source, command_line: nil, encoding: nil, filepath: nil, frozen_string_literal: nil, line: nil, scopes: nil, version: nil); end
|
42
42
|
|
43
|
-
sig { params(filepath: String, command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(Prism::
|
43
|
+
sig { params(filepath: String, command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(Prism::ParseLexResult) }
|
44
44
|
def self.parse_lex_file(filepath, command_line: nil, encoding: nil, frozen_string_literal: nil, line: nil, scopes: nil, version: nil); end
|
45
45
|
|
46
46
|
sig { params(source: String, command_line: T.nilable(String), encoding: T.nilable(T.any(String, Encoding)), filepath: T.nilable(String), frozen_string_literal: T.nilable(T::Boolean), line: T.nilable(Integer), scopes: T.nilable(T::Array[T::Array[Symbol]]), version: T.nilable(String)).returns(T::Boolean) }
|
data/sig/prism/dsl.rbs
CHANGED
@@ -118,7 +118,7 @@ module Prism
|
|
118
118
|
def ConstantPathAndWriteNode: (ConstantPathNode target, Location operator_loc, Prism::node value, ?Source source, ?Location location) -> ConstantPathAndWriteNode
|
119
119
|
|
120
120
|
# Create a new ConstantPathNode node
|
121
|
-
def ConstantPathNode: (Prism::node? parent,
|
121
|
+
def ConstantPathNode: (Prism::node? parent, Symbol? name, Location delimiter_loc, Location name_loc, ?Source source, ?Location location) -> ConstantPathNode
|
122
122
|
|
123
123
|
# Create a new ConstantPathOperatorWriteNode node
|
124
124
|
def ConstantPathOperatorWriteNode: (ConstantPathNode target, Location operator_loc, Prism::node value, Symbol operator, ?Source source, ?Location location) -> ConstantPathOperatorWriteNode
|
@@ -127,7 +127,7 @@ module Prism
|
|
127
127
|
def ConstantPathOrWriteNode: (ConstantPathNode target, Location operator_loc, Prism::node value, ?Source source, ?Location location) -> ConstantPathOrWriteNode
|
128
128
|
|
129
129
|
# Create a new ConstantPathTargetNode node
|
130
|
-
def ConstantPathTargetNode: (Prism::node? parent,
|
130
|
+
def ConstantPathTargetNode: (Prism::node? parent, Symbol? name, Location delimiter_loc, Location name_loc, ?Source source, ?Location location) -> ConstantPathTargetNode
|
131
131
|
|
132
132
|
# Create a new ConstantPathWriteNode node
|
133
133
|
def ConstantPathWriteNode: (ConstantPathNode target, Location operator_loc, Prism::node value, ?Source source, ?Location location) -> ConstantPathWriteNode
|
@@ -400,7 +400,7 @@ module Prism
|
|
400
400
|
def RetryNode: (?Source source, ?Location location) -> RetryNode
|
401
401
|
|
402
402
|
# Create a new ReturnNode node
|
403
|
-
def ReturnNode: (Location keyword_loc, ArgumentsNode? arguments, ?Source source, ?Location location) -> ReturnNode
|
403
|
+
def ReturnNode: (Integer flags, Location keyword_loc, ArgumentsNode? arguments, ?Source source, ?Location location) -> ReturnNode
|
404
404
|
|
405
405
|
# Create a new SelfNode node
|
406
406
|
def SelfNode: (?Source source, ?Location location) -> SelfNode
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Prism
|
2
|
+
class InspectVisitor < Visitor
|
3
|
+
class Replace
|
4
|
+
attr_reader value: String
|
5
|
+
|
6
|
+
def initialize: (String value) -> void
|
7
|
+
end
|
8
|
+
|
9
|
+
attr_reader indent: String
|
10
|
+
attr_reader commands: Array[[String | node | Replace, String]]
|
11
|
+
|
12
|
+
def initialize: (?String indent) -> void
|
13
|
+
def compose: () -> String
|
14
|
+
|
15
|
+
def self.compose: (node node) -> String
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def inspect_node: (String name, node node) -> String
|
20
|
+
def inspect_location: (Location? location) -> String
|
21
|
+
end
|
22
|
+
end
|