ruby-lsp 0.2.0 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -0
  3. data/VERSION +1 -1
  4. data/exe/ruby-lsp +1 -3
  5. data/lib/ruby-lsp.rb +2 -2
  6. data/lib/ruby_lsp/document.rb +10 -3
  7. data/lib/ruby_lsp/handler.rb +17 -138
  8. data/lib/ruby_lsp/internal.rb +3 -1
  9. data/lib/ruby_lsp/requests/document_highlight.rb +25 -42
  10. data/lib/ruby_lsp/requests/document_link.rb +119 -0
  11. data/lib/ruby_lsp/requests/folding_ranges.rb +5 -1
  12. data/lib/ruby_lsp/requests/formatting.rb +1 -0
  13. data/lib/ruby_lsp/requests/semantic_highlighting.rb +17 -7
  14. data/lib/ruby_lsp/requests/support/highlight_target.rb +88 -0
  15. data/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb +9 -2
  16. data/lib/ruby_lsp/requests/support/source_uri.rb +82 -0
  17. data/lib/ruby_lsp/requests.rb +3 -0
  18. data/lib/ruby_lsp/server.rb +193 -0
  19. data/lib/ruby_lsp/store.rb +12 -5
  20. metadata +6 -70
  21. data/.github/dependabot.yml +0 -11
  22. data/.github/probots.yml +0 -2
  23. data/.github/pull_request_template.md +0 -15
  24. data/.github/workflows/ci.yml +0 -31
  25. data/.github/workflows/publish_docs.yml +0 -32
  26. data/.gitignore +0 -9
  27. data/.rubocop.yml +0 -39
  28. data/.vscode/extensions.json +0 -5
  29. data/.vscode/settings.json +0 -5
  30. data/.vscode/tasks.json +0 -25
  31. data/CODE_OF_CONDUCT.md +0 -78
  32. data/Gemfile +0 -18
  33. data/Gemfile.lock +0 -126
  34. data/Rakefile +0 -28
  35. data/bin/console +0 -19
  36. data/bin/rubocop +0 -29
  37. data/bin/tapioca +0 -29
  38. data/bin/test +0 -9
  39. data/dev.yml +0 -20
  40. data/lib/ruby_lsp/cli.rb +0 -89
  41. data/rakelib/check_docs.rake +0 -81
  42. data/ruby-lsp.gemspec +0 -27
  43. data/service.yml +0 -2
  44. data/sorbet/config +0 -4
  45. data/sorbet/rbi/.rubocop.yml +0 -8
  46. data/sorbet/rbi/gems/ansi@1.5.0.rbi +0 -338
  47. data/sorbet/rbi/gems/ast@2.4.2.rbi +0 -522
  48. data/sorbet/rbi/gems/builder@3.2.4.rbi +0 -418
  49. data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -8
  50. data/sorbet/rbi/gems/debug@1.5.0.rbi +0 -1273
  51. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +0 -867
  52. data/sorbet/rbi/gems/io-console@0.5.11.rbi +0 -8
  53. data/sorbet/rbi/gems/irb@1.4.1.rbi +0 -376
  54. data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +0 -7325
  55. data/sorbet/rbi/gems/method_source@1.0.0.rbi +0 -8
  56. data/sorbet/rbi/gems/minitest-reporters@1.5.0.rbi +0 -612
  57. data/sorbet/rbi/gems/minitest@5.15.0.rbi +0 -994
  58. data/sorbet/rbi/gems/parallel@1.22.1.rbi +0 -163
  59. data/sorbet/rbi/gems/parser@3.1.2.0.rbi +0 -3968
  60. data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +0 -734
  61. data/sorbet/rbi/gems/pry@0.14.1.rbi +0 -8
  62. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +0 -227
  63. data/sorbet/rbi/gems/rake@13.0.6.rbi +0 -1853
  64. data/sorbet/rbi/gems/rbi@0.0.14.rbi +0 -2337
  65. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +0 -1854
  66. data/sorbet/rbi/gems/reline@0.3.1.rbi +0 -1274
  67. data/sorbet/rbi/gems/rexml@3.2.5.rbi +0 -3852
  68. data/sorbet/rbi/gems/rubocop-ast@1.18.0.rbi +0 -4180
  69. data/sorbet/rbi/gems/rubocop-minitest@0.20.0.rbi +0 -1369
  70. data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +0 -246
  71. data/sorbet/rbi/gems/rubocop-shopify@2.6.0.rbi +0 -8
  72. data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +0 -652
  73. data/sorbet/rbi/gems/rubocop@1.30.0.rbi +0 -36729
  74. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +0 -732
  75. data/sorbet/rbi/gems/spoom@1.1.11.rbi +0 -1600
  76. data/sorbet/rbi/gems/syntax_tree@2.7.1.rbi +0 -6777
  77. data/sorbet/rbi/gems/tapioca@0.8.1.rbi +0 -1972
  78. data/sorbet/rbi/gems/thor@1.2.1.rbi +0 -2921
  79. data/sorbet/rbi/gems/unicode-display_width@2.1.0.rbi +0 -27
  80. data/sorbet/rbi/gems/unparser@0.6.5.rbi +0 -2789
  81. data/sorbet/rbi/gems/webrick@1.7.0.rbi +0 -1779
  82. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +0 -289
  83. data/sorbet/rbi/gems/yard@0.9.27.rbi +0 -13048
  84. data/sorbet/rbi/shims/fiddle.rbi +0 -4
  85. data/sorbet/rbi/shims/hash.rbi +0 -6
  86. data/sorbet/rbi/shims/rdoc.rbi +0 -4
  87. data/sorbet/tapioca/config.yml +0 -13
  88. data/sorbet/tapioca/require.rb +0 -7
@@ -1,2789 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `unparser` gem.
5
- # Please instead update this file by running `bin/tapioca gem unparser`.
6
-
7
- # Library namespace
8
- module Unparser
9
- class << self
10
- # Construct a parser buffer from string
11
- #
12
- # @param source [String]
13
- # @return [Parser::Source::Buffer]
14
- def buffer(source, identification = T.unsafe(nil)); end
15
-
16
- # Parse string into AST
17
- #
18
- # @param source [String]
19
- # @return [Parser::AST::Node, nil]
20
- def parse(source); end
21
-
22
- # Parse string into either syntax error or AST
23
- #
24
- # @param source [String]
25
- # @return [Either<Parser::SyntaxError, (Parser::ASTNode, nil)>]
26
- def parse_either(source); end
27
-
28
- # Parse string into AST, with comments
29
- #
30
- # @param source [String]
31
- # @return [Parser::AST::Node]
32
- def parse_with_comments(source); end
33
-
34
- # Parser instance that produces AST unparser understands
35
- #
36
- # @api private
37
- # @return [Parser::Base]
38
- def parser; end
39
-
40
- # Unparse an AST (and, optionally, comments) into a string
41
- #
42
- # @api public
43
- # @param node [Parser::AST::Node, nil]
44
- # @param comment_array [Array]
45
- # @raise InvalidNodeError
46
- # if the node passed is invalid
47
- # @return [String]
48
- def unparse(node, comment_array = T.unsafe(nil)); end
49
-
50
- # Unparse capturing errors
51
- #
52
- # This is mostly useful for writing testing tools against unparser.
53
- #
54
- # @param node [Parser::AST::Node, nil]
55
- # @return [Either<Exception, String>]
56
- def unparse_either(node); end
57
-
58
- # Unparse with validation
59
- #
60
- # @param node [Parser::AST::Node, nil]
61
- # @param comment_array [Array]
62
- # @return [Either<Validation,String>]
63
- def unparse_validate(node, comment_array = T.unsafe(nil)); end
64
- end
65
- end
66
-
67
- # Namespace for AST processing tools
68
- module Unparser::AST
69
- class << self
70
- # Return local variables that get assigned in scope
71
- #
72
- # @api private
73
- # @param node [Parser::AST::Node]
74
- # @return [Set<Symbol>]
75
- def local_variable_assignments(node); end
76
-
77
- # Return local variables read
78
- #
79
- # @api private
80
- # @param node [Parser::AST::Node]
81
- # @return [Set<Symbol>]
82
- def local_variable_reads(node); end
83
-
84
- # Test for local variable inherited scope reset
85
- #
86
- # @api private
87
- # @param node [Parser::AST::Node]
88
- # @return [Boolean]
89
- def not_close_scope?(node); end
90
-
91
- # Test for local variable scope reset
92
- #
93
- # @api private
94
- # @param node [Parser::AST::Node]
95
- # @return [Boolean]
96
- def not_reset_scope?(node); end
97
- end
98
- end
99
-
100
- # Nodes that assign a local variable
101
- Unparser::AST::ASSIGN_NODES = T.let(T.unsafe(nil), Set)
102
-
103
- Unparser::AST::CLOSE_NODES = T.let(T.unsafe(nil), Array)
104
-
105
- # AST enumerator
106
- class Unparser::AST::Enumerator
107
- include ::Enumerable
108
- include ::Unparser::Equalizer::Methods
109
- include ::Unparser::Adamantium
110
- include ::Unparser::Adamantium::InstanceMethods
111
- extend ::Unparser::Adamantium::ModuleMethods
112
- extend ::Unparser::Adamantium::ClassMethods
113
-
114
- # Return each node
115
- #
116
- # @api private
117
- # @return [Enumerator<Parser::AST::Node>] if no block given
118
- # @return [self] otherwise
119
- def each(&block); end
120
-
121
- # Return nodes selected by type
122
- #
123
- # @api private
124
- # @param type [Symbol]
125
- # @return [Enumerable<Parser::AST::Node>]
126
- def type(type); end
127
-
128
- # Return nodes selected by types
129
- #
130
- # @api private
131
- # @param types [Enumerable<Symbol>]
132
- # @return [Enumerable<Parser::AST::Node>]
133
- def types(types); end
134
-
135
- class << self
136
- # Return new instance
137
- #
138
- # @api private
139
- # @param node [Parser::AST::Node]
140
- # @param controller [#call(node)]
141
- # @return [Enumerator]
142
- def new(node, controller = T.unsafe(nil)); end
143
-
144
- private
145
-
146
- # Return frozne set of objects
147
- #
148
- # @api private
149
- # @param enumerable [Enumerable]
150
- # @return [Set]
151
- def set(enumerable); end
152
-
153
- # Return nodes of type
154
- #
155
- # @api private
156
- # @param node [Parser::AST::Node]
157
- # @param type [Symbol]
158
- # @return [Enumerable<Parser::AST::Node]] Enumerable<Parser::AST::Node]
159
- def type(node, type); end
160
- end
161
- end
162
-
163
- Unparser::AST::FIRST_CHILD = T.let(T.unsafe(nil), Proc)
164
- Unparser::AST::INHERIT_NODES = T.let(T.unsafe(nil), Array)
165
-
166
- # Calculated local variable scope for a given node
167
- class Unparser::AST::LocalVariableScope
168
- include ::Unparser::Equalizer::Methods
169
- include ::Unparser::Adamantium
170
- include ::Unparser::Adamantium::InstanceMethods
171
- include ::Enumerable
172
- extend ::Unparser::Adamantium::ModuleMethods
173
- extend ::Unparser::Adamantium::ClassMethods
174
-
175
- # Initialize object
176
- #
177
- # @api private
178
- # @param node [Parser::AST::Node]
179
- # @return [undefined]
180
- def initialize(node); end
181
-
182
- # Test if local variable was first at given assignment
183
- #
184
- # @api private
185
- # @param node [Parser::AST::Node]
186
- # @return [Boolean]
187
- def first_assignment?(node); end
188
-
189
- # Test if local variables where first assigned in body and read by conditional
190
- #
191
- # @api private
192
- # @param body [Parser::AST::Node]
193
- # @param condition [Parser::AST::Node]
194
- # @return [Boolean]
195
- def first_assignment_in?(left, right); end
196
-
197
- # Test if local variable is defined for given node
198
- #
199
- # @api private
200
- # @param node [Parser::AST::Node]
201
- # @param name [Symbol]
202
- # @return [Boolean]
203
- def local_variable_defined_for_node?(node, name); end
204
-
205
- private
206
-
207
- def match(needle); end
208
- end
209
-
210
- # Local variable scope enumerator
211
- class Unparser::AST::LocalVariableScopeEnumerator
212
- include ::Enumerable
213
-
214
- # Initialize object
215
- #
216
- # @api private
217
- # @return [undefined]
218
- def initialize; end
219
-
220
- # Enumerate local variable scope scope
221
- #
222
- # @api private
223
- # @return [self] if block given
224
- # @return [Enumerator<Array<Symbol>>] ]
225
- # otherwise
226
- def each(node, &block); end
227
-
228
- private
229
-
230
- def current; end
231
- def define(name); end
232
- def enter(node); end
233
- def leave(node); end
234
- def pop; end
235
- def push_inherit; end
236
- def push_reset; end
237
-
238
- # @yield [node, current.dup, before]
239
- def visit(node, &block); end
240
-
241
- class << self
242
- # Enumerate each node with its local variable scope
243
- #
244
- # @api private
245
- # @param node [Parser::AST::Node]
246
- # @return [self]
247
- def each(node, &block); end
248
- end
249
- end
250
-
251
- Unparser::AST::RESET_NODES = T.let(T.unsafe(nil), Array)
252
- Unparser::AST::TAUTOLOGY = T.let(T.unsafe(nil), Proc)
253
-
254
- # Controlled AST walker walking the AST in deeth first search with pre order
255
- class Unparser::AST::Walker
256
- include ::Unparser::Equalizer::Methods
257
-
258
- # Call walker with node
259
- #
260
- # @api private
261
- # @param node [Parser::AST::Node]
262
- # @return [undefined]
263
- def call(node); end
264
-
265
- class << self
266
- # Call ast walker
267
- #
268
- # @api private
269
- # @param node [Parser::AST::Node]
270
- # @return [self]
271
- def call(node, controller = T.unsafe(nil), &block); end
272
- end
273
- end
274
-
275
- # Module to allow class and methods to be abstract
276
- #
277
- # Original code before vendoring and reduction from: https://github.com/dkubb/abstract_type.
278
- module Unparser::AbstractType
279
- mixes_in_class_methods ::Unparser::AbstractType::AbstractMethodDeclarations
280
-
281
- class << self
282
- private
283
-
284
- # Define the new method on the abstract type
285
- #
286
- # Ensures that the instance cannot be of the abstract type
287
- # and must be a descendant.
288
- #
289
- # @api private
290
- # @param abstract_class [Class]
291
- # @return [undefined]
292
- def create_new_method(abstract_class); end
293
-
294
- # Hook called when module is included
295
- #
296
- # @api private
297
- # @param descendant [Module] the module or class including AbstractType
298
- # @return [undefined]
299
- def included(descendant); end
300
- end
301
- end
302
-
303
- module Unparser::AbstractType::AbstractMethodDeclarations
304
- # Create abstract instance methods
305
- #
306
- # @api public
307
- # @example
308
- # class Foo
309
- # include AbstractType
310
- #
311
- # # Create an abstract instance method
312
- # abstract_method :some_method
313
- # end
314
- # @param names [Array<#to_s>]
315
- # @return [self]
316
- def abstract_method(*names); end
317
-
318
- # Create abstract singleton methods
319
- #
320
- # @api private
321
- # @example
322
- # class Foo
323
- # include AbstractType
324
- #
325
- # # Create an abstract instance method
326
- # abstract_singleton_method :some_method
327
- # end
328
- # @param names [Array<#to_s>]
329
- # @return [self]
330
- def abstract_singleton_method(*names); end
331
-
332
- private
333
-
334
- # Create abstract instance method
335
- #
336
- # @api private
337
- # @param name [#to_s] the name of the method to create
338
- # @return [undefined]
339
- def create_abstract_instance_method(name); end
340
-
341
- # Create abstract singleton method
342
- #
343
- # @api private
344
- # @param name [#to_s] the name of the method to create
345
- # @return [undefined]
346
- def create_abstract_singleton_method(name); end
347
- end
348
-
349
- # Allows objects to be made immutable
350
- #
351
- # Original code before vendoring and reduction from: https://github.com/dkubb/adamantium.
352
- module Unparser::Adamantium
353
- include ::Unparser::Adamantium::InstanceMethods
354
-
355
- mixes_in_class_methods ::Unparser::Adamantium::ModuleMethods
356
- mixes_in_class_methods ::Unparser::Adamantium::ClassMethods
357
-
358
- class << self
359
- private
360
-
361
- # ModuleMethods
362
- def included(descendant); end
363
- end
364
- end
365
-
366
- # Methods mixed in to adamantium classes
367
- module Unparser::Adamantium::ClassMethods
368
- # Instantiate a new frozen object
369
- #
370
- # @api public
371
- # @return [Object]
372
- def new(*_arg0); end
373
- end
374
-
375
- module Unparser::Adamantium::InstanceMethods
376
- # A noop #dup for immutable objects
377
- #
378
- # @api public
379
- # @return [self]
380
- def dup; end
381
-
382
- # Freeze the object
383
- #
384
- # @api public
385
- # @return [Object]
386
- def freeze; end
387
-
388
- private
389
-
390
- def memoized_method_cache; end
391
- end
392
-
393
- # Storage for memoized methods
394
- class Unparser::Adamantium::Memory
395
- # Initialize the memory storage for memoized methods
396
- #
397
- # @api private
398
- # @return [undefined]
399
- def initialize(values); end
400
-
401
- # Fetch the value from memory, or evaluate if it does not exist
402
- #
403
- # @api public
404
- # @param name [Symbol]
405
- # @yieldreturn [Object] the value to memoize
406
- def fetch(name); end
407
- end
408
-
409
- # Build the memoized method
410
- class Unparser::Adamantium::MethodBuilder
411
- # Initialize an object to build a memoized method
412
- #
413
- # @api private
414
- # @param descendant [Module]
415
- # @param method_name [Symbol]
416
- # @return [undefined]
417
- def initialize(descendant, method_name); end
418
-
419
- # Build a new memoized method
420
- #
421
- # @api public
422
- # @example
423
- # method_builder.call # => creates new method
424
- # @return [UnboundMethod]
425
- def call; end
426
-
427
- private
428
-
429
- def assert_arity(arity); end
430
- def create_memoized_method; end
431
- def remove_original_method; end
432
- def set_method_visibility; end
433
- def visibility; end
434
- end
435
-
436
- # Raised when a block is passed to a memoized method
437
- class Unparser::Adamantium::MethodBuilder::BlockNotAllowedError < ::ArgumentError
438
- # Initialize a block not allowed exception
439
- #
440
- # @api private
441
- # @param descendant [Module]
442
- # @param method [Symbol]
443
- # @return [BlockNotAllowedError] a new instance of BlockNotAllowedError
444
- def initialize(descendant, method); end
445
- end
446
-
447
- # Raised when the method arity is invalid
448
- class Unparser::Adamantium::MethodBuilder::InvalidArityError < ::ArgumentError
449
- # Initialize an invalid arity exception
450
- #
451
- # @api private
452
- # @param descendant [Module]
453
- # @param method [Symbol]
454
- # @param arity [Integer]
455
- # @return [InvalidArityError] a new instance of InvalidArityError
456
- def initialize(descendant, method, arity); end
457
- end
458
-
459
- # Methods mixed in to adamantium modules
460
- module Unparser::Adamantium::ModuleMethods
461
- # Memoize a list of methods
462
- #
463
- # @api public
464
- # @param methods [Array<#to_s>] a list of methods to memoize
465
- # @return [self]
466
- def memoize(*methods); end
467
-
468
- # Test if method is memoized
469
- #
470
- # @param name [Symbol]
471
- # @return [Bool]
472
- def memoized?(method_name); end
473
-
474
- # Return unmemoized instance method
475
- #
476
- # @api public
477
- # @param name [Symbol]
478
- # @raise [NameError] raised if the method is unknown
479
- # @return [UnboundMethod] the memoized method
480
- def unmemoized_instance_method(method_name); end
481
-
482
- private
483
-
484
- def memoize_method(method_name); end
485
- def memoized_methods; end
486
- end
487
-
488
- # Original code before vendoring and reduction from: https://github.com/mbj/anima.
489
- class Unparser::Anima < ::Module
490
- include ::Unparser::Equalizer::Methods
491
- include ::Unparser::Adamantium
492
- include ::Unparser::Adamantium::InstanceMethods
493
- extend ::Unparser::Adamantium::ModuleMethods
494
- extend ::Unparser::Adamantium::ClassMethods
495
-
496
- # Initialize object
497
- #
498
- #
499
- # @return [undefined]
500
- def initialize(*names); end
501
-
502
- # Return new anima with attributes added
503
- #
504
- # @example
505
- # anima = Anima.new(:foo)
506
- # anima.add(:bar) # equals Anima.new(:foo, :bar)
507
- # @return [Anima]
508
- def add(*names); end
509
-
510
- # Return attribute names
511
- #
512
- # @return [Enumerable<Symbol>]
513
- def attribute_names(&block); end
514
-
515
- # Return names
516
- #
517
- # @return [AttributeSet]
518
- def attributes; end
519
-
520
- # Return attributes hash for instance
521
- #
522
- # @param object [Object]
523
- # @return [Hash]
524
- def attributes_hash(object); end
525
-
526
- # Initialize instance
527
- #
528
- # @param object [Object]
529
- # @param attribute_hash [Hash]
530
- # @return [self]
531
- def initialize_instance(object, attribute_hash); end
532
-
533
- # Return new anima with attributes removed
534
- #
535
- # @example
536
- # anima = Anima.new(:foo, :bar)
537
- # anima.remove(:bar) # equals Anima.new(:foo)
538
- # @return [Anima]
539
- def remove(*names); end
540
-
541
- private
542
-
543
- # Fail unless keys in +attribute_hash+ matches #attribute_names
544
- #
545
- # @param klass [Class] the class being initialized
546
- # @param attribute_hash [Hash] the attributes to initialize +object+ with
547
- # @raise [Error]
548
- # @return [undefined]
549
- def assert_known_attributes(klass, attribute_hash); end
550
-
551
- # Infect the instance with anima
552
- #
553
- # @param scope [Class, Module]
554
- # @return [undefined]
555
- def included(descendant); end
556
-
557
- # Return new instance
558
- #
559
- # @param attributes [Enumerable<Symbol>]
560
- # @return [Anima]
561
- def new(attributes); end
562
- end
563
-
564
- # An attribute
565
- class Unparser::Anima::Attribute
566
- include ::Unparser::Equalizer::Methods
567
- include ::Unparser::Adamantium
568
- include ::Unparser::Adamantium::InstanceMethods
569
- extend ::Unparser::Adamantium::ModuleMethods
570
- extend ::Unparser::Adamantium::ClassMethods
571
-
572
- # Initialize attribute
573
- #
574
- # @param name [Symbol]
575
- # @return [Attribute] a new instance of Attribute
576
- def initialize(name); end
577
-
578
- # Get attribute value from object
579
- #
580
- # @param object [Object]
581
- # @return [Object]
582
- def get(object); end
583
-
584
- # Return instance variable name
585
- #
586
- # @return [Symbol]
587
- def instance_variable_name; end
588
-
589
- # Load attribute
590
- #
591
- # @param object [Object]
592
- # @param attributes [Hash]
593
- # @return [self]
594
- def load(object, attributes); end
595
-
596
- # Return attribute name
597
- #
598
- # @return [Symbol]
599
- def name; end
600
-
601
- # Set attribute value in object
602
- #
603
- # @param object [Object]
604
- # @param value [Object]
605
- # @return [self]
606
- def set(object, value); end
607
- end
608
-
609
- # Abstract base class for anima errors
610
- class Unparser::Anima::Error < ::RuntimeError
611
- # Initialize object
612
- #
613
- # @param klass [Class] the class being initialized
614
- # @param missing [Enumerable<Symbol>]
615
- # @param unknown [Enumerable<Symbol>]
616
- # @return [undefined]
617
- def initialize(klass, missing, unknown); end
618
- end
619
-
620
- Unparser::Anima::Error::FORMAT = T.let(T.unsafe(nil), String)
621
-
622
- # Static instance methods for anima infected classes
623
- module Unparser::Anima::InstanceMethods
624
- # Initialize an anima infected object
625
- #
626
- #
627
- # @param attributes [#to_h] a hash that matches anima defined attributes
628
- # @return [undefined]
629
- def initialize(attributes); end
630
-
631
- # Return a hash representation of an anima infected object
632
- #
633
- # @api public
634
- # @example
635
- # anima.to_h # => { :foo => : bar }
636
- # @return [Hash]
637
- def to_h; end
638
-
639
- # Return updated instance
640
- #
641
- # @api public
642
- # @example
643
- # klass = Class.new do
644
- # include Anima.new(:foo, :bar)
645
- # end
646
- #
647
- # foo = klass.new(:foo => 1, :bar => 2)
648
- # updated = foo.with(:foo => 3)
649
- # updated.foo # => 3
650
- # updated.bar # => 2
651
- # @param attributes [Hash]
652
- # @return [Anima]
653
- def with(attributes); end
654
- end
655
-
656
- # Buffer used to emit into
657
- class Unparser::Buffer
658
- # Initialize object
659
- #
660
- # @api private
661
- # @return [undefined]
662
- def initialize; end
663
-
664
- # Append string
665
- #
666
- # @api private
667
- # @param string [String]
668
- # @return [self]
669
- def append(string); end
670
-
671
- # Append a string without an indentation prefix
672
- #
673
- # @api private
674
- # @param string [String]
675
- # @return [self]
676
- def append_without_prefix(string); end
677
-
678
- # Capture the content written to the buffer within the block
679
- #
680
- # @api private
681
- # @return [String]
682
- def capture_content; end
683
-
684
- # Return content of buffer
685
- #
686
- # @api private
687
- # @return [String]
688
- def content; end
689
-
690
- # Test for a fresh line
691
- #
692
- # @api private
693
- # @return [Boolean]
694
- def fresh_line?; end
695
-
696
- # Increase indent
697
- #
698
- # @api private
699
- # @return [self]
700
- def indent; end
701
-
702
- # Write newline
703
- #
704
- # @api private
705
- # @return [self]
706
- def nl; end
707
-
708
- def root_indent; end
709
-
710
- # Decrease indent
711
- #
712
- # @api private
713
- # @return [self]
714
- def unindent; end
715
-
716
- # Write raw fragment to buffer
717
- #
718
- # Does not do indentation logic.
719
- #
720
- # @param fragment [String]
721
- # @return [self]
722
- def write(fragment); end
723
-
724
- private
725
-
726
- def prefix; end
727
- end
728
-
729
- Unparser::Buffer::INDENT_SPACE = T.let(T.unsafe(nil), String)
730
- Unparser::Buffer::NL = T.let(T.unsafe(nil), String)
731
-
732
- # Unparser specific AST builder defaulting to modern AST format
733
- class Unparser::Builder < ::Parser::Builders::Default
734
- # @return [Builder] a new instance of Builder
735
- def initialize; end
736
- end
737
-
738
- # Unparser CLI implementation
739
- class Unparser::CLI
740
- # Initialize object
741
- #
742
- # @api private
743
- # @param arguments [Array<String>]
744
- # @return [undefined]
745
- def initialize(arguments); end
746
-
747
- # Add options
748
- #
749
- #
750
- # @api private
751
- # @param builder [OptionParser]
752
- # @return [undefined]
753
- def add_options(builder); end
754
-
755
- # Return exit status
756
- #
757
- # @api private
758
- # @return [Integer]
759
- def exit_status; end
760
-
761
- private
762
-
763
- def effective_targets; end
764
- def process_target(target); end
765
- def targets(file_name); end
766
-
767
- class << self
768
- # Run CLI
769
- #
770
- # @api private
771
- # @param arguments [Array<String>]
772
- # @return [Integer] the exit status
773
- def run(*arguments); end
774
- end
775
- end
776
-
777
- Unparser::CLI::EXIT_FAILURE = T.let(T.unsafe(nil), Integer)
778
- Unparser::CLI::EXIT_SUCCESS = T.let(T.unsafe(nil), Integer)
779
-
780
- class Unparser::CLI::Target
781
- include ::Unparser::AbstractType
782
- extend ::Unparser::AbstractType::AbstractMethodDeclarations
783
-
784
- class << self
785
- def new(*args, &block); end
786
- end
787
- end
788
-
789
- # Path target
790
- class Unparser::CLI::Target::Path < ::Unparser::CLI::Target
791
- include ::Unparser::Equalizer::Methods
792
-
793
- # Literal for this target
794
- #
795
- # @return [Validation]
796
- def literal_validation; end
797
-
798
- # Validation for this target
799
- #
800
- # @return [Validation]
801
- def validation; end
802
- end
803
-
804
- # String target
805
- class Unparser::CLI::Target::String
806
- include ::Unparser::Equalizer::Methods
807
-
808
- # Literal for this target
809
- #
810
- # @return [Validation]
811
- def literal_validation; end
812
-
813
- # Validation for this target
814
- #
815
- # @return [Validation]
816
- def validation; end
817
- end
818
-
819
- # Class to colorize strings
820
- class Unparser::Color
821
- include ::Unparser::Equalizer::Methods
822
- include ::Unparser::Adamantium
823
- include ::Unparser::Adamantium::InstanceMethods
824
- extend ::Unparser::Adamantium::ModuleMethods
825
- extend ::Unparser::Adamantium::ClassMethods
826
-
827
- # Format text with color
828
- #
829
- # @param text [String]
830
- # @return [String]
831
- def format(text); end
832
- end
833
-
834
- Unparser::Color::GREEN = T.let(T.unsafe(nil), Unparser::Color)
835
- Unparser::Color::NONE = T.let(T.unsafe(nil), T.untyped)
836
- Unparser::Color::RED = T.let(T.unsafe(nil), Unparser::Color)
837
-
838
- # Holds the comments that remain to be emitted
839
- class Unparser::Comments
840
- # Initialize object
841
- #
842
- # @api private
843
- # @param comments [Array]
844
- # @return [undefined]
845
- def initialize(comments); end
846
-
847
- # Consume part or all of the node
848
- #
849
- # @api private
850
- # @param node [Parser::AST::Node]
851
- # @param source_part [Symbol]
852
- # @return [undefined]
853
- def consume(node, source_part = T.unsafe(nil)); end
854
-
855
- # Proxy to singleton
856
- #
857
- # NOTICE:
858
- # Delegating to stateless helpers is a pattern I saw many times in our code.
859
- # Maybe we should make another helper module? include SingletonDelegator.new(:source_range) ?
860
- #
861
- # @api private
862
- # @return [undefined]
863
- def source_range(*arguments); end
864
-
865
- # Take all remaining comments
866
- #
867
- # @api private
868
- # @return [Array]
869
- def take_all; end
870
-
871
- # Take comments appear in the source before the specified part of the node
872
- #
873
- # @api private
874
- # @param node [Parser::AST::Node]
875
- # @param source_part [Symbol]
876
- # @return [Array]
877
- def take_before(node, source_part); end
878
-
879
- # Take end-of-line comments
880
- #
881
- # @api private
882
- # @return [Array]
883
- def take_eol_comments; end
884
-
885
- private
886
-
887
- def take_up_to_line(line); end
888
- def take_while; end
889
- def unshift_documents(comments); end
890
-
891
- class << self
892
- # Return source location part
893
- #
894
- # FIXME: This method should not be needed. It does to much inline signalling.
895
- #
896
- # :reek:ManualDispatch
897
- #
898
- # @api private
899
- # @param node [Parser::AST::Node]
900
- # @param part [Symbol]
901
- # @return [Parser::Source::Range] if present
902
- # @return [nil] otherwise
903
- def source_range(node, part); end
904
- end
905
- end
906
-
907
- # A mixin to define a composition
908
- #
909
- # Original code before vendoring and reduction from: https://github.com/mbj/concord.
910
- class Unparser::Concord < ::Module
911
- include ::Unparser::Equalizer::Methods
912
- include ::Unparser::Adamantium
913
- include ::Unparser::Adamantium::InstanceMethods
914
- extend ::Unparser::Adamantium::ModuleMethods
915
- extend ::Unparser::Adamantium::ClassMethods
916
-
917
- # Initialize object
918
- #
919
- #
920
- # @api private
921
- # @return [undefined]
922
- def initialize(*names); end
923
-
924
- # Return names
925
- #
926
- # @api private
927
- # @return [Enumerable<Symbol>]
928
- def names; end
929
-
930
- private
931
-
932
- # Define equalizer
933
- #
934
- # @api private
935
- # @return [undefined]
936
- def define_equalizer; end
937
-
938
- # Define initialize method
939
- #
940
- # @api private
941
- # @return [undefined]
942
- def define_initialize; end
943
-
944
- # Define readers
945
- #
946
- # @api private
947
- # @return [undefined]
948
- def define_readers; end
949
-
950
- # Return instance variable names
951
- #
952
- # @api private
953
- # @return [String]
954
- def instance_variable_names; end
955
- end
956
-
957
- # The maximum number of objects the hosting class is composed of
958
- Unparser::Concord::MAX_NR_OF_OBJECTS = T.let(T.unsafe(nil), Integer)
959
-
960
- # Mixin for public attribute readers
961
- class Unparser::Concord::Public < ::Unparser::Concord
962
- # Hook called when module is included
963
- #
964
- # @api private
965
- # @param descendant [Class, Module]
966
- # @return [undefined]
967
- def included(descendant); end
968
- end
969
-
970
- # All unparser constants maybe included in other libraries.
971
- module Unparser::Constants; end
972
-
973
- # All binary operators of the ruby language
974
- Unparser::Constants::BINARY_OPERATORS = T.let(T.unsafe(nil), Set)
975
-
976
- Unparser::Constants::KEYWORDS = T.let(T.unsafe(nil), Set)
977
- Unparser::Constants::K_ALIAS = T.let(T.unsafe(nil), String)
978
- Unparser::Constants::K_AND = T.let(T.unsafe(nil), String)
979
- Unparser::Constants::K_BEGIN = T.let(T.unsafe(nil), String)
980
- Unparser::Constants::K_BREAK = T.let(T.unsafe(nil), String)
981
- Unparser::Constants::K_CASE = T.let(T.unsafe(nil), String)
982
- Unparser::Constants::K_CLASS = T.let(T.unsafe(nil), String)
983
- Unparser::Constants::K_DEF = T.let(T.unsafe(nil), String)
984
- Unparser::Constants::K_DEFINE = T.let(T.unsafe(nil), String)
985
- Unparser::Constants::K_DEFINED = T.let(T.unsafe(nil), String)
986
-
987
- # Keywords
988
- Unparser::Constants::K_DO = T.let(T.unsafe(nil), String)
989
-
990
- Unparser::Constants::K_EEND = T.let(T.unsafe(nil), String)
991
- Unparser::Constants::K_ELSE = T.let(T.unsafe(nil), String)
992
- Unparser::Constants::K_ELSIF = T.let(T.unsafe(nil), String)
993
- Unparser::Constants::K_ENCODING = T.let(T.unsafe(nil), String)
994
- Unparser::Constants::K_END = T.let(T.unsafe(nil), String)
995
- Unparser::Constants::K_ENSURE = T.let(T.unsafe(nil), String)
996
- Unparser::Constants::K_FALSE = T.let(T.unsafe(nil), String)
997
- Unparser::Constants::K_FILE = T.let(T.unsafe(nil), String)
998
- Unparser::Constants::K_FOR = T.let(T.unsafe(nil), String)
999
- Unparser::Constants::K_IF = T.let(T.unsafe(nil), String)
1000
- Unparser::Constants::K_IN = T.let(T.unsafe(nil), String)
1001
- Unparser::Constants::K_MODULE = T.let(T.unsafe(nil), String)
1002
- Unparser::Constants::K_NEXT = T.let(T.unsafe(nil), String)
1003
- Unparser::Constants::K_NIL = T.let(T.unsafe(nil), String)
1004
- Unparser::Constants::K_NOT = T.let(T.unsafe(nil), String)
1005
- Unparser::Constants::K_OR = T.let(T.unsafe(nil), String)
1006
- Unparser::Constants::K_POSTEXE = T.let(T.unsafe(nil), String)
1007
- Unparser::Constants::K_PREEXE = T.let(T.unsafe(nil), String)
1008
- Unparser::Constants::K_REDO = T.let(T.unsafe(nil), String)
1009
- Unparser::Constants::K_RESCUE = T.let(T.unsafe(nil), String)
1010
- Unparser::Constants::K_RETRY = T.let(T.unsafe(nil), String)
1011
- Unparser::Constants::K_RETURN = T.let(T.unsafe(nil), String)
1012
- Unparser::Constants::K_SELF = T.let(T.unsafe(nil), String)
1013
- Unparser::Constants::K_SUPER = T.let(T.unsafe(nil), String)
1014
- Unparser::Constants::K_THEN = T.let(T.unsafe(nil), String)
1015
- Unparser::Constants::K_TRUE = T.let(T.unsafe(nil), String)
1016
- Unparser::Constants::K_UNDEF = T.let(T.unsafe(nil), String)
1017
- Unparser::Constants::K_UNLESS = T.let(T.unsafe(nil), String)
1018
- Unparser::Constants::K_UNTIL = T.let(T.unsafe(nil), String)
1019
- Unparser::Constants::K_WHEN = T.let(T.unsafe(nil), String)
1020
- Unparser::Constants::K_WHILE = T.let(T.unsafe(nil), String)
1021
- Unparser::Constants::K_YIELD = T.let(T.unsafe(nil), String)
1022
-
1023
- # All unary operators of the ruby language
1024
- Unparser::Constants::UNARY_OPERATORS = T.let(T.unsafe(nil), Set)
1025
-
1026
- # DSL to help defining emitters
1027
- module Unparser::DSL
1028
- private
1029
-
1030
- def children(*names); end
1031
- def define_child(name, index); end
1032
- def define_group(name, range); end
1033
- def define_remaining_children(names); end
1034
- end
1035
-
1036
- # Class to create diffs from source code
1037
- class Unparser::Diff
1038
- include ::Unparser::Equalizer::Methods
1039
- include ::Unparser::Adamantium
1040
- include ::Unparser::Adamantium::InstanceMethods
1041
- extend ::Unparser::Adamantium::ModuleMethods
1042
- extend ::Unparser::Adamantium::ClassMethods
1043
-
1044
- # Colorized unified source diff between old and new
1045
- #
1046
- # @return [String] if there is a diff
1047
- # @return [nil] otherwise
1048
- def colorized_diff(&block); end
1049
-
1050
- # Unified source diff between old and new
1051
- #
1052
- # @return [String] if there is exactly one diff
1053
- # @return [nil] otherwise
1054
- def diff(&block); end
1055
-
1056
- private
1057
-
1058
- def diffs; end
1059
- def hunks; end
1060
- def max_length; end
1061
- def minimized_hunk; end
1062
-
1063
- class << self
1064
- # Build new object from source strings
1065
- #
1066
- # @param old [String]
1067
- # @param new [String]
1068
- # @return [Diff]
1069
- def build(old, new); end
1070
-
1071
- private
1072
-
1073
- def colorize_line(line); end
1074
-
1075
- # Break up source into lines
1076
- #
1077
- # @param source [String]
1078
- # @return [Array<String>]
1079
- def lines(source); end
1080
- end
1081
- end
1082
-
1083
- Unparser::Diff::ADDITION = T.let(T.unsafe(nil), String)
1084
- Unparser::Diff::DELETION = T.let(T.unsafe(nil), String)
1085
- Unparser::Diff::NEWLINE = T.let(T.unsafe(nil), String)
1086
- Unparser::EMPTY_ARRAY = T.let(T.unsafe(nil), Array)
1087
- Unparser::EMPTY_STRING = T.let(T.unsafe(nil), String)
1088
-
1089
- # RequireBLock
1090
- class Unparser::Either
1091
- include ::Unparser::RequireBlock
1092
- include ::Unparser::Equalizer::Methods
1093
- include ::Unparser::Adamantium
1094
- include ::Unparser::Adamantium::InstanceMethods
1095
- extend ::Unparser::Adamantium::ModuleMethods
1096
- extend ::Unparser::Adamantium::ClassMethods
1097
-
1098
- # Test for left constructor
1099
- #
1100
- # @return [Boolean]
1101
- def left?; end
1102
-
1103
- # Test for right constructor
1104
- #
1105
- # @return [Boolean]
1106
- def right?; end
1107
-
1108
- class << self
1109
- # Execute block and wrap error in left
1110
- #
1111
- # @param exception [Class<Exception>]
1112
- # @return [Either<Exception, Object>]
1113
- def wrap_error(*exceptions); end
1114
- end
1115
- end
1116
-
1117
- class Unparser::Either::Left < ::Unparser::Either
1118
- # Evaluate applicative block
1119
- #
1120
- # @return [Either::Left<Object>]
1121
- def bind(&block); end
1122
-
1123
- # Evaluate left side of branch
1124
- #
1125
- # @param left [#call]
1126
- # @param _right [#call]
1127
- def either(left, _right); end
1128
-
1129
- # Evaluate functor block
1130
- #
1131
- # @return [Either::Left<Object>]
1132
- def fmap(&block); end
1133
-
1134
- # Unwrap value from left
1135
- #
1136
- # @return [Object]
1137
- def from_left; end
1138
-
1139
- # Unwrap value from right
1140
- #
1141
- # @return [Object]
1142
- def from_right; end
1143
-
1144
- # Map over left value
1145
- #
1146
- # @return [Either::Right<Object>]
1147
- def lmap; end
1148
- end
1149
-
1150
- # Left
1151
- class Unparser::Either::Right < ::Unparser::Either
1152
- # Evaluate applicative block
1153
- #
1154
- # @return [Either<Object>]
1155
- # @yield [value]
1156
- def bind; end
1157
-
1158
- # Evaluate right side of branch
1159
- #
1160
- # @param _left [#call]
1161
- # @param right [#call]
1162
- def either(_left, right); end
1163
-
1164
- # Evaluate functor block
1165
- #
1166
- # @return [Either::Right<Object>]
1167
- def fmap; end
1168
-
1169
- # Unwrap value from left
1170
- #
1171
- # @return [Object]
1172
- def from_left; end
1173
-
1174
- # Unwrap value from right
1175
- #
1176
- # @return [Object]
1177
- def from_right; end
1178
-
1179
- # Map over left value
1180
- #
1181
- # @return [Either::Right<Object>]
1182
- def lmap(&block); end
1183
- end
1184
-
1185
- # Emitter base class
1186
- class Unparser::Emitter
1187
- include ::Unparser::NodeHelpers
1188
- include ::Unparser::Generation
1189
- include ::Unparser::Constants
1190
- include ::Unparser::AbstractType
1191
- include ::Unparser::Adamantium
1192
- include ::Unparser::Adamantium::InstanceMethods
1193
- include ::Unparser::Anima::InstanceMethods
1194
- include ::Unparser::Equalizer::Methods
1195
- extend ::Unparser::AbstractType::AbstractMethodDeclarations
1196
- extend ::Unparser::Adamantium::ModuleMethods
1197
- extend ::Unparser::Adamantium::ClassMethods
1198
- extend ::Unparser::DSL
1199
-
1200
- def buffer; end
1201
- def comments; end
1202
-
1203
- # Dispatch node write as statement
1204
- #
1205
- # @api private
1206
- # @return [undefined]
1207
- def dispatch(*_arg0); end
1208
-
1209
- def emit_mlhs; end
1210
- def local_variable_scope; end
1211
- def node; end
1212
-
1213
- # LocalVariableRoot
1214
- def node_type; end
1215
-
1216
- class << self
1217
- def anima; end
1218
-
1219
- # Return emitter
1220
- #
1221
- #
1222
- # @api private
1223
- # @return [Emitter]
1224
- def emitter(buffer:, comments:, node:, local_variable_scope:); end
1225
-
1226
- def new(*args, &block); end
1227
-
1228
- private
1229
-
1230
- # Register emitter for type
1231
- #
1232
- # @api private
1233
- # @param types [Symbol]
1234
- # @return [undefined]
1235
- def handle(*types); end
1236
- end
1237
- end
1238
-
1239
- # Emitter for alias nodes
1240
- class Unparser::Emitter::Alias < ::Unparser::Emitter
1241
- private
1242
-
1243
- def dispatch; end
1244
- def remaining_children; end
1245
- def source; end
1246
- def target; end
1247
- end
1248
-
1249
- # Arguments emitter
1250
- class Unparser::Emitter::Args < ::Unparser::Emitter
1251
- def emit_block_arguments; end
1252
- def emit_def_arguments; end
1253
- def emit_lambda_arguments; end
1254
-
1255
- private
1256
-
1257
- def emit_shadowargs; end
1258
- def normal_arguments(&block); end
1259
- def shadowargs(&block); end
1260
- end
1261
-
1262
- # Argument emitter
1263
- class Unparser::Emitter::Argument < ::Unparser::Emitter
1264
- private
1265
-
1266
- def dispatch; end
1267
- def name; end
1268
- def remaining_children; end
1269
- end
1270
-
1271
- # Array literal emitter
1272
- class Unparser::Emitter::Array < ::Unparser::Emitter
1273
- def emit_heredoc_reminders; end
1274
-
1275
- private
1276
-
1277
- def dispatch; end
1278
- def emitters(&block); end
1279
- end
1280
-
1281
- # Emitter for array patterns
1282
- class Unparser::Emitter::ArrayPattern < ::Unparser::Emitter
1283
- private
1284
-
1285
- def dispatch; end
1286
- def emit_member(node); end
1287
- end
1288
-
1289
- # Base class for assignment emitters
1290
- class Unparser::Emitter::Assignment < ::Unparser::Emitter
1291
- def emit_heredoc_reminders; end
1292
- def emit_left(*_arg0); end
1293
- def symbol_name; end
1294
-
1295
- private
1296
-
1297
- def dispatch; end
1298
- def emit_right; end
1299
- end
1300
-
1301
- Unparser::Emitter::Assignment::BINARY_OPERATOR = T.let(T.unsafe(nil), Array)
1302
-
1303
- # Constant assignment emitter
1304
- class Unparser::Emitter::Assignment::Constant < ::Unparser::Emitter::Assignment
1305
- private
1306
-
1307
- def base; end
1308
- def emit_left; end
1309
- def name; end
1310
- def remaining_children; end
1311
- def right; end
1312
- end
1313
-
1314
- # Variable assignment emitter
1315
- class Unparser::Emitter::Assignment::Variable < ::Unparser::Emitter::Assignment
1316
- private
1317
-
1318
- def emit_left; end
1319
- def name; end
1320
- def remaining_children; end
1321
- def right; end
1322
- end
1323
-
1324
- # Emitter for begin nodes
1325
- class Unparser::Emitter::Begin < ::Unparser::Emitter
1326
- def emit_heredoc_reminders; end
1327
-
1328
- private
1329
-
1330
- def body; end
1331
- def dispatch; end
1332
- def remaining_children; end
1333
- end
1334
-
1335
- # Non send binary operator / keyword emitter
1336
- class Unparser::Emitter::Binary < ::Unparser::Emitter
1337
- private
1338
-
1339
- def dispatch; end
1340
- def writer(&block); end
1341
- end
1342
-
1343
- # Base class for and and or op-assign
1344
- class Unparser::Emitter::BinaryAssign < ::Unparser::Emitter
1345
- def emit_heredoc_reminders; end
1346
-
1347
- private
1348
-
1349
- def dispatch; end
1350
- def expression; end
1351
- def remaining_children; end
1352
- def target; end
1353
- end
1354
-
1355
- Unparser::Emitter::BinaryAssign::MAP = T.let(T.unsafe(nil), Hash)
1356
-
1357
- # Block emitter
1358
- class Unparser::Emitter::Block < ::Unparser::Emitter
1359
- private
1360
-
1361
- def arguments; end
1362
- def body; end
1363
- def dispatch; end
1364
- def emit_block_arguments; end
1365
- def emit_lambda_arguments; end
1366
- def emit_send_target; end
1367
- def emit_target; end
1368
-
1369
- # @return [Boolean]
1370
- def need_do?; end
1371
-
1372
- # @return [Boolean]
1373
- def numblock?; end
1374
-
1375
- def remaining_children; end
1376
- def target; end
1377
- def target_writer(&block); end
1378
- def write_close; end
1379
- def write_open; end
1380
- end
1381
-
1382
- # Block pass node emitter
1383
- class Unparser::Emitter::BlockPass < ::Unparser::Emitter
1384
- private
1385
-
1386
- def dispatch; end
1387
- def name; end
1388
- def remaining_children; end
1389
- end
1390
-
1391
- # Emitter for toplevel constant reference nodes
1392
- class Unparser::Emitter::CBase < ::Unparser::Emitter
1393
- private
1394
-
1395
- # Perform dispatch
1396
- #
1397
- # @api private
1398
- # @return [undefined]
1399
- def dispatch; end
1400
- end
1401
-
1402
- # Emitter for case nodes
1403
- class Unparser::Emitter::Case < ::Unparser::Emitter
1404
- private
1405
-
1406
- def condition; end
1407
- def dispatch; end
1408
- def emit_condition; end
1409
- def emit_else; end
1410
- def emit_whens; end
1411
- def remaining_children; end
1412
- def whens(&block); end
1413
- end
1414
-
1415
- # Emitter for case guards
1416
- class Unparser::Emitter::CaseGuard < ::Unparser::Emitter
1417
- private
1418
-
1419
- def condition; end
1420
- def dispatch; end
1421
- def remaining_children; end
1422
- end
1423
-
1424
- Unparser::Emitter::CaseGuard::MAP = T.let(T.unsafe(nil), Hash)
1425
-
1426
- # Emitter for case matches
1427
- class Unparser::Emitter::CaseMatch < ::Unparser::Emitter
1428
- private
1429
-
1430
- def dispatch; end
1431
- def else_branch; end
1432
- def emit_else_branch; end
1433
- def patterns(&block); end
1434
- def remaining_children; end
1435
- def target; end
1436
- end
1437
-
1438
- # Emitter for class nodes
1439
- class Unparser::Emitter::Class < ::Unparser::Emitter
1440
- include ::Unparser::Emitter::LocalVariableRoot
1441
-
1442
- def local_variable_scope(&block); end
1443
-
1444
- private
1445
-
1446
- def body; end
1447
- def dispatch; end
1448
- def emit_superclass; end
1449
- def name; end
1450
- def remaining_children; end
1451
- def superclass; end
1452
- end
1453
-
1454
- # Emitter for constant access
1455
- class Unparser::Emitter::Const < ::Unparser::Emitter
1456
- private
1457
-
1458
- def dispatch; end
1459
- def emit_scope; end
1460
- def name; end
1461
- def remaining_children; end
1462
- def scope; end
1463
- end
1464
-
1465
- # Emitter for const pattern node
1466
- class Unparser::Emitter::ConstPattern < ::Unparser::Emitter
1467
- private
1468
-
1469
- def const; end
1470
- def dispatch; end
1471
- def pattern; end
1472
- def remaining_children; end
1473
- end
1474
-
1475
- # Dynamic string emitter
1476
- class Unparser::Emitter::DStr < ::Unparser::Emitter
1477
- def emit_heredoc_reminders; end
1478
-
1479
- private
1480
-
1481
- def dispatch; end
1482
- end
1483
-
1484
- # Dynamic symbol literal emitter
1485
- class Unparser::Emitter::DSym < ::Unparser::Emitter
1486
- private
1487
-
1488
- def dispatch; end
1489
- def emit_begin_child(component); end
1490
- def emit_str_child(value); end
1491
- end
1492
-
1493
- # Emitter for def node
1494
- class Unparser::Emitter::Def < ::Unparser::Emitter
1495
- include ::Unparser::Emitter::LocalVariableRoot
1496
-
1497
- def local_variable_scope(&block); end
1498
-
1499
- private
1500
-
1501
- def body(*_arg0); end
1502
- def dispatch; end
1503
- def emit_arguments; end
1504
- def emit_name(*_arg0); end
1505
- end
1506
-
1507
- # Instance def emitter
1508
- class Unparser::Emitter::Def::Instance < ::Unparser::Emitter::Def
1509
- private
1510
-
1511
- def arguments; end
1512
- def body; end
1513
- def emit_name; end
1514
- def name; end
1515
- def remaining_children; end
1516
- end
1517
-
1518
- # Emitter for defines on singleton
1519
- class Unparser::Emitter::Def::Singleton < ::Unparser::Emitter::Def
1520
- private
1521
-
1522
- def arguments; end
1523
- def body; end
1524
- def emit_name; end
1525
- def name; end
1526
- def remaining_children; end
1527
- def subject; end
1528
-
1529
- # @return [Boolean]
1530
- def subject_without_parens?; end
1531
- end
1532
-
1533
- # Emitter for defined? nodes
1534
- class Unparser::Emitter::Defined < ::Unparser::Emitter
1535
- private
1536
-
1537
- def dispatch; end
1538
- def remaining_children; end
1539
- def subject; end
1540
- end
1541
-
1542
- # Emitter for in pattern nodes
1543
- class Unparser::Emitter::FindPattern < ::Unparser::Emitter
1544
- private
1545
-
1546
- def dispatch; end
1547
- end
1548
-
1549
- # Emitter for flip flops
1550
- class Unparser::Emitter::FlipFlop < ::Unparser::Emitter
1551
- def symbol_name; end
1552
-
1553
- private
1554
-
1555
- def dispatch; end
1556
- def left; end
1557
- def remaining_children; end
1558
- def right; end
1559
- end
1560
-
1561
- Unparser::Emitter::FlipFlop::MAP = T.let(T.unsafe(nil), Hash)
1562
- Unparser::Emitter::FlipFlop::SYMBOLS = T.let(T.unsafe(nil), Hash)
1563
-
1564
- # Emiter for float literals
1565
- class Unparser::Emitter::Float < ::Unparser::Emitter
1566
- private
1567
-
1568
- def dispatch; end
1569
- def remaining_children; end
1570
- def value; end
1571
- end
1572
-
1573
- Unparser::Emitter::Float::INFINITY = T.let(T.unsafe(nil), Float)
1574
- Unparser::Emitter::Float::NEG_INFINITY = T.let(T.unsafe(nil), Float)
1575
-
1576
- # Emitter control flow modifiers
1577
- class Unparser::Emitter::FlowModifier < ::Unparser::Emitter
1578
- def emit_heredoc_reminders; end
1579
-
1580
- private
1581
-
1582
- def dispatch; end
1583
- def emit_arguments; end
1584
- end
1585
-
1586
- Unparser::Emitter::FlowModifier::MAP = T.let(T.unsafe(nil), Hash)
1587
-
1588
- # Emitter for for nodes
1589
- class Unparser::Emitter::For < ::Unparser::Emitter
1590
- private
1591
-
1592
- def assignment; end
1593
- def body; end
1594
- def condition; end
1595
- def dispatch; end
1596
- def emit_condition; end
1597
- def remaining_children; end
1598
- end
1599
-
1600
- # Emitter for Hash literals
1601
- class Unparser::Emitter::Hash < ::Unparser::Emitter
1602
- def emit_heredoc_reminders; end
1603
- def emit_last_argument_hash; end
1604
-
1605
- private
1606
-
1607
- def dispatch; end
1608
- def emit_hash_body; end
1609
- def emit_heredoc_reminder_member(node); end
1610
- end
1611
-
1612
- # Emitter for hash patterns
1613
- class Unparser::Emitter::HashPattern < ::Unparser::Emitter
1614
- def emit_const_pattern; end
1615
-
1616
- private
1617
-
1618
- def dispatch; end
1619
- def emit_hash_body; end
1620
- def emit_match_var(node); end
1621
- def emit_member(node); end
1622
- def emit_pair(node); end
1623
- def write_symbol_body(symbol); end
1624
- end
1625
-
1626
- # Base class for pre and postexe emitters
1627
- class Unparser::Emitter::Hookexe < ::Unparser::Emitter
1628
- private
1629
-
1630
- def body; end
1631
- def dispatch; end
1632
- def remaining_children; end
1633
- end
1634
-
1635
- Unparser::Emitter::Hookexe::MAP = T.let(T.unsafe(nil), Hash)
1636
-
1637
- # Emitter if nodes
1638
- class Unparser::Emitter::If < ::Unparser::Emitter
1639
- def emit_ternary; end
1640
-
1641
- private
1642
-
1643
- def condition; end
1644
- def dispatch; end
1645
- def else_branch; end
1646
- def emit_condition; end
1647
- def emit_else_branch; end
1648
- def emit_if_branch; end
1649
- def emit_normal; end
1650
- def emit_postcondition; end
1651
- def if_branch; end
1652
- def keyword; end
1653
-
1654
- # @return [Boolean]
1655
- def postcondition?; end
1656
-
1657
- def remaining_children; end
1658
-
1659
- # @return [Boolean]
1660
- def unless?; end
1661
- end
1662
-
1663
- # Emitter for in pattern nodes
1664
- class Unparser::Emitter::InMatch < ::Unparser::Emitter
1665
- private
1666
-
1667
- def dispatch; end
1668
- def pattern; end
1669
- def remaining_children; end
1670
- def target; end
1671
- end
1672
-
1673
- # Emitter for in pattern nodes
1674
- class Unparser::Emitter::InPattern < ::Unparser::Emitter
1675
- private
1676
-
1677
- def branch; end
1678
- def dispatch; end
1679
- def else_branch; end
1680
- def remaining_children; end
1681
- def target; end
1682
- def unless_guard; end
1683
- end
1684
-
1685
- # Emitter for send to index references
1686
- class Unparser::Emitter::Index < ::Unparser::Emitter
1687
- private
1688
-
1689
- def dispatch; end
1690
- def emit_receiver; end
1691
- end
1692
-
1693
- # Emitter for assign to index nodes
1694
- class Unparser::Emitter::Index::Assign < ::Unparser::Emitter::Index
1695
- def dispatch; end
1696
- def emit_heredoc_reminders; end
1697
- def emit_mlhs; end
1698
-
1699
- private
1700
-
1701
- def emit_operation(indices); end
1702
- end
1703
-
1704
- Unparser::Emitter::Index::Assign::NO_VALUE_PARENT = T.let(T.unsafe(nil), Set)
1705
- Unparser::Emitter::Index::Assign::VALUE_RANGE = T.let(T.unsafe(nil), Range)
1706
-
1707
- class Unparser::Emitter::Index::Reference < ::Unparser::Emitter::Index
1708
- private
1709
-
1710
- def emit_operation; end
1711
- def indices(&block); end
1712
- end
1713
-
1714
- # Emitter for explicit begins
1715
- class Unparser::Emitter::KWBegin < ::Unparser::Emitter
1716
- private
1717
-
1718
- def dispatch; end
1719
- def emit_multiple_body; end
1720
- end
1721
-
1722
- # Optional keyword argument emitter
1723
- class Unparser::Emitter::KeywordOptional < ::Unparser::Emitter
1724
- private
1725
-
1726
- def dispatch; end
1727
- def name; end
1728
- def remaining_children; end
1729
- def value; end
1730
- end
1731
-
1732
- # Emitter for splats
1733
- class Unparser::Emitter::KwSplat < ::Unparser::Emitter
1734
- private
1735
-
1736
- def dispatch; end
1737
- def remaining_children; end
1738
- def subject; end
1739
- end
1740
-
1741
- # Keyword argument emitter
1742
- class Unparser::Emitter::Kwarg < ::Unparser::Emitter
1743
- private
1744
-
1745
- def dispatch; end
1746
- def name; end
1747
- def remaining_children; end
1748
- end
1749
-
1750
- class Unparser::Emitter::Kwargs < ::Unparser::Emitter
1751
- def dispatch; end
1752
- end
1753
-
1754
- # Emitter for lambda nodes
1755
- class Unparser::Emitter::Lambda < ::Unparser::Emitter
1756
- private
1757
-
1758
- def dispatch; end
1759
- end
1760
-
1761
- module Unparser::Emitter::LocalVariableRoot
1762
- # Return local variable root
1763
- #
1764
- # @api private
1765
- # @return [Parser::AST::Node]
1766
- def local_variable_scope; end
1767
-
1768
- class << self
1769
- # @private
1770
- def included(descendant); end
1771
- end
1772
- end
1773
-
1774
- # Emitter for multiple assignment nodes
1775
- class Unparser::Emitter::MASGN < ::Unparser::Emitter
1776
- private
1777
-
1778
- def dispatch; end
1779
- def remaining_children; end
1780
- def source; end
1781
- def target; end
1782
- end
1783
-
1784
- # Emitter for multiple assignment left hand side
1785
- class Unparser::Emitter::MLHS < ::Unparser::Emitter
1786
- private
1787
-
1788
- def dispatch; end
1789
- def emit_many; end
1790
- def emit_one_child_mlhs; end
1791
- end
1792
-
1793
- Unparser::Emitter::MLHS::NO_COMMA = T.let(T.unsafe(nil), Array)
1794
-
1795
- # Base class for special match node emitters
1796
- class Unparser::Emitter::Match < ::Unparser::Emitter; end
1797
-
1798
- # Emitter for match current line
1799
- class Unparser::Emitter::Match::CurrentLine < ::Unparser::Emitter::Match
1800
- private
1801
-
1802
- def dispatch; end
1803
- def regexp; end
1804
- def remaining_children; end
1805
- end
1806
-
1807
- # Emitter for match with local variable assignment
1808
- class Unparser::Emitter::Match::Lvasgn < ::Unparser::Emitter::Match
1809
- private
1810
-
1811
- def dispatch; end
1812
- def lvasgn; end
1813
- def regexp; end
1814
- def remaining_children; end
1815
- end
1816
-
1817
- # Emitter for in pattern nodes
1818
- class Unparser::Emitter::MatchAlt < ::Unparser::Emitter
1819
- private
1820
-
1821
- def dispatch; end
1822
- def left; end
1823
- def remaining_children; end
1824
- def right; end
1825
- end
1826
-
1827
- # Emitter for in pattern nodes
1828
- class Unparser::Emitter::MatchAs < ::Unparser::Emitter
1829
- private
1830
-
1831
- def dispatch; end
1832
- def left; end
1833
- def remaining_children; end
1834
- def right; end
1835
- end
1836
-
1837
- # Emitter for in pattern nodes
1838
- class Unparser::Emitter::MatchPattern < ::Unparser::Emitter
1839
- private
1840
-
1841
- def dispatch; end
1842
- def pattern; end
1843
- def remaining_children; end
1844
- def target; end
1845
- end
1846
-
1847
- # Modern ast format emits `match_pattern`
1848
- # node on single line pre 3.0, but 3.0+ uses `match_pattern_p`
1849
- Unparser::Emitter::MatchPattern::SYMBOL = T.let(T.unsafe(nil), String)
1850
-
1851
- class Unparser::Emitter::MatchPatternP < ::Unparser::Emitter
1852
- private
1853
-
1854
- def dispatch; end
1855
- def pattern; end
1856
- def remaining_children; end
1857
- def target; end
1858
- end
1859
-
1860
- # Emiter for match rest nodes
1861
- class Unparser::Emitter::MatchRest < ::Unparser::Emitter
1862
- def dispatch; end
1863
- def emit_array_pattern; end
1864
- def emit_hash_pattern; end
1865
-
1866
- private
1867
-
1868
- def emit_match_var; end
1869
- def match_var; end
1870
- def remaining_children; end
1871
- end
1872
-
1873
- # Emitter for in pattern nodes
1874
- class Unparser::Emitter::MatchVar < ::Unparser::Emitter
1875
- private
1876
-
1877
- def dispatch; end
1878
- def name; end
1879
- def remaining_children; end
1880
- end
1881
-
1882
- # Emitter for module nodes
1883
- class Unparser::Emitter::Module < ::Unparser::Emitter
1884
- include ::Unparser::Emitter::LocalVariableRoot
1885
-
1886
- def local_variable_scope(&block); end
1887
-
1888
- private
1889
-
1890
- def body; end
1891
- def dispatch; end
1892
- def name; end
1893
- def remaining_children; end
1894
- end
1895
-
1896
- # Emitter for block and kwrestarg arguments
1897
- class Unparser::Emitter::Morearg < ::Unparser::Emitter
1898
- private
1899
-
1900
- def dispatch; end
1901
- def name; end
1902
- def remaining_children; end
1903
- end
1904
-
1905
- Unparser::Emitter::Morearg::MAP = T.let(T.unsafe(nil), Hash)
1906
- Unparser::Emitter::NO_INDENT = T.let(T.unsafe(nil), Array)
1907
-
1908
- # Emitter for nth_ref nodes (regexp captures)
1909
- class Unparser::Emitter::NthRef < ::Unparser::Emitter
1910
- private
1911
-
1912
- def dispatch; end
1913
- def name; end
1914
- def remaining_children; end
1915
- end
1916
-
1917
- Unparser::Emitter::NthRef::PREFIX = T.let(T.unsafe(nil), String)
1918
-
1919
- # Emitter for op assign
1920
- class Unparser::Emitter::OpAssign < ::Unparser::Emitter
1921
- private
1922
-
1923
- def dispatch; end
1924
- def emit_operator; end
1925
- def operator; end
1926
- def remaining_children; end
1927
- def target; end
1928
- def value; end
1929
- end
1930
-
1931
- # Optional argument emitter
1932
- class Unparser::Emitter::Optarg < ::Unparser::Emitter
1933
- private
1934
-
1935
- def dispatch; end
1936
- def name; end
1937
- def remaining_children; end
1938
- def value; end
1939
- end
1940
-
1941
- # Emitter for key value pairs in hash literals or kwargs
1942
- class Unparser::Emitter::Pair < ::Unparser::Emitter
1943
- private
1944
-
1945
- # @return [Boolean]
1946
- def colon?(key); end
1947
-
1948
- def dispatch; end
1949
- def key; end
1950
- def remaining_children; end
1951
- def value; end
1952
- end
1953
-
1954
- Unparser::Emitter::Pair::BAREWORD = T.let(T.unsafe(nil), Regexp)
1955
-
1956
- # Emitter for pin nodes
1957
- class Unparser::Emitter::Pin < ::Unparser::Emitter
1958
- private
1959
-
1960
- def dispatch; end
1961
- def remaining_children; end
1962
- def target; end
1963
- end
1964
-
1965
- # Emitter for postconditions
1966
- class Unparser::Emitter::Post < ::Unparser::Emitter
1967
- private
1968
-
1969
- def body; end
1970
- def condition; end
1971
- def dispatch; end
1972
- def remaining_children; end
1973
- end
1974
-
1975
- Unparser::Emitter::Post::MAP = T.let(T.unsafe(nil), Hash)
1976
-
1977
- # Base class for primitive emitters
1978
- class Unparser::Emitter::Primitive < ::Unparser::Emitter
1979
- private
1980
-
1981
- def remaining_children; end
1982
- def value; end
1983
- end
1984
-
1985
- # Emitter for complex literals
1986
- class Unparser::Emitter::Primitive::Complex < ::Unparser::Emitter::Primitive
1987
- private
1988
-
1989
- def dispatch; end
1990
- def emit_imaginary; end
1991
- def imaginary_node; end
1992
- end
1993
-
1994
- Unparser::Emitter::Primitive::Complex::MAP = T.let(T.unsafe(nil), Hash)
1995
- Unparser::Emitter::Primitive::Complex::RATIONAL_FORMAT = T.let(T.unsafe(nil), String)
1996
-
1997
- # Emitter for primitives based on Object#inspect
1998
- class Unparser::Emitter::Primitive::Inspect < ::Unparser::Emitter::Primitive
1999
- private
2000
-
2001
- def dispatch; end
2002
- end
2003
-
2004
- # Emiter for numeric literals
2005
- class Unparser::Emitter::Primitive::Numeric < ::Unparser::Emitter::Primitive
2006
- private
2007
-
2008
- def dispatch; end
2009
- end
2010
-
2011
- # Emitter for rational literals
2012
- class Unparser::Emitter::Primitive::Rational < ::Unparser::Emitter::Primitive
2013
- private
2014
-
2015
- def dispatch; end
2016
- def write_rational(value); end
2017
- end
2018
-
2019
- Unparser::Emitter::Primitive::Rational::RATIONAL_FORMAT = T.let(T.unsafe(nil), String)
2020
-
2021
- # Progarg emitter
2022
- class Unparser::Emitter::Procarg < ::Unparser::Emitter
2023
- private
2024
-
2025
- def dispatch; end
2026
-
2027
- # @return [Boolean]
2028
- def needs_parens?; end
2029
- end
2030
-
2031
- Unparser::Emitter::Procarg::PARENS = T.let(T.unsafe(nil), Array)
2032
-
2033
- # Registry for node emitters
2034
- Unparser::Emitter::REGISTRY = T.let(T.unsafe(nil), Hash)
2035
-
2036
- # Range emitters
2037
- class Unparser::Emitter::Range < ::Unparser::Emitter
2038
- def symbol_name; end
2039
-
2040
- private
2041
-
2042
- def begin_node; end
2043
- def dispatch; end
2044
- def end_node; end
2045
- def remaining_children; end
2046
- end
2047
-
2048
- Unparser::Emitter::Range::SYMBOLS = T.let(T.unsafe(nil), Hash)
2049
- Unparser::Emitter::Range::TOKENS = T.let(T.unsafe(nil), Hash)
2050
-
2051
- # Emitter for regexp literals
2052
- class Unparser::Emitter::Regexp < ::Unparser::Emitter
2053
- private
2054
-
2055
- def body(&block); end
2056
- def dispatch; end
2057
- def emit_body(node); end
2058
- def emit_options; end
2059
- end
2060
-
2061
- # Emitter for while and until nodes
2062
- class Unparser::Emitter::Repetition < ::Unparser::Emitter
2063
- private
2064
-
2065
- def body; end
2066
- def condition; end
2067
- def dispatch; end
2068
- def emit_keyword; end
2069
- def emit_normal; end
2070
- def emit_postcontrol; end
2071
-
2072
- # @return [Boolean]
2073
- def postcontrol?; end
2074
-
2075
- def remaining_children; end
2076
- end
2077
-
2078
- Unparser::Emitter::Repetition::MAP = T.let(T.unsafe(nil), Hash)
2079
-
2080
- # Emitter for rescue nodes
2081
- class Unparser::Emitter::Rescue < ::Unparser::Emitter
2082
- private
2083
-
2084
- def dispatch; end
2085
- end
2086
-
2087
- # Rest argument emitter
2088
- class Unparser::Emitter::Restarg < ::Unparser::Emitter
2089
- private
2090
-
2091
- def dispatch; end
2092
- def name; end
2093
- def remaining_children; end
2094
- end
2095
-
2096
- # Root emitter a special case
2097
- class Unparser::Emitter::Root < ::Unparser::Emitter
2098
- include ::Unparser::Emitter::LocalVariableRoot
2099
-
2100
- def dispatch; end
2101
- def local_variable_scope(&block); end
2102
- end
2103
-
2104
- Unparser::Emitter::Root::END_NL = T.let(T.unsafe(nil), Array)
2105
-
2106
- # Emitter for sclass nodes
2107
- class Unparser::Emitter::SClass < ::Unparser::Emitter
2108
- private
2109
-
2110
- def body; end
2111
- def dispatch; end
2112
- def object; end
2113
- def remaining_children; end
2114
- end
2115
-
2116
- # Emitter for send
2117
- class Unparser::Emitter::Send < ::Unparser::Emitter
2118
- def emit_heredoc_reminders; end
2119
- def emit_mlhs; end
2120
-
2121
- private
2122
-
2123
- def dispatch; end
2124
- def writer(&block); end
2125
- end
2126
-
2127
- # Emitter for simple nodes that generate a single token
2128
- class Unparser::Emitter::Simple < ::Unparser::Emitter
2129
- private
2130
-
2131
- def dispatch; end
2132
- end
2133
-
2134
- Unparser::Emitter::Simple::MAP = T.let(T.unsafe(nil), Hash)
2135
-
2136
- # Emitter for splats
2137
- class Unparser::Emitter::Splat < ::Unparser::Emitter
2138
- def emit_mlhs; end
2139
-
2140
- private
2141
-
2142
- def dispatch; end
2143
- def remaining_children; end
2144
- def subject; end
2145
- def subject_emitter(&block); end
2146
- end
2147
-
2148
- # Emitter for super nodes
2149
- class Unparser::Emitter::Super < ::Unparser::Emitter
2150
- private
2151
-
2152
- def dispatch; end
2153
- end
2154
-
2155
- # Emitter for undef nodes
2156
- class Unparser::Emitter::Undef < ::Unparser::Emitter
2157
- private
2158
-
2159
- def dispatch; end
2160
- end
2161
-
2162
- # Emitter for various variable accesses
2163
- class Unparser::Emitter::Variable < ::Unparser::Emitter
2164
- private
2165
-
2166
- def dispatch; end
2167
- def name; end
2168
- def remaining_children; end
2169
- end
2170
-
2171
- # Emitter for when nodes
2172
- class Unparser::Emitter::When < ::Unparser::Emitter
2173
- private
2174
-
2175
- def captures(&block); end
2176
- def dispatch; end
2177
- def emit_captures; end
2178
- end
2179
-
2180
- # Dynamic execute string literal emitter
2181
- class Unparser::Emitter::XStr < ::Unparser::Emitter
2182
- private
2183
-
2184
- def dispatch; end
2185
- def emit_begin(component); end
2186
- def emit_heredoc; end
2187
- def emit_string(value); end
2188
- def emit_xstr; end
2189
- def escape_xstr(input); end
2190
-
2191
- # @return [Boolean]
2192
- def heredoc?; end
2193
- end
2194
-
2195
- # Emitter for yield node
2196
- class Unparser::Emitter::Yield < ::Unparser::Emitter
2197
- private
2198
-
2199
- def dispatch; end
2200
- end
2201
-
2202
- # Define equality, equivalence and inspection methods
2203
- #
2204
- # Original code before vendoring and reduction from: https://github.com/dkubb/equalizer.
2205
- class Unparser::Equalizer < ::Module
2206
- # Initialize an Equalizer with the given keys
2207
- #
2208
- # Will use the keys with which it is initialized to define #cmp?,
2209
- # #hash, and #inspect
2210
- #
2211
- #
2212
- # @api private
2213
- # @param keys [Array<Symbol>]
2214
- # @return [undefined]
2215
- def initialize(*keys); end
2216
-
2217
- private
2218
-
2219
- def define_cmp_method; end
2220
- def define_hash_method; end
2221
- def define_inspect_method; end
2222
- def define_methods; end
2223
- def included(descendant); end
2224
- end
2225
-
2226
- # The comparison methods
2227
- module Unparser::Equalizer::Methods
2228
- # Compare the object with other object for equivalency
2229
- #
2230
- # @api public
2231
- # @example
2232
- # object == other # => true or false
2233
- # @param other [Object] the other object to compare with
2234
- # @return [Boolean]
2235
- def ==(other); end
2236
-
2237
- # Compare the object with other object for equality
2238
- #
2239
- # @api public
2240
- # @example
2241
- # object.eql?(other) # => true or false
2242
- # @param other [Object] the other object to compare with
2243
- # @return [Boolean]
2244
- def eql?(other); end
2245
- end
2246
-
2247
- module Unparser::Generation
2248
- def emit_heredoc_reminders; end
2249
- def symbol_name; end
2250
- def write_to_buffer; end
2251
-
2252
- private
2253
-
2254
- def children; end
2255
- def conditional_parentheses(flag, &block); end
2256
- def delimited(nodes, delimiter = T.unsafe(nil), &block); end
2257
- def emit_body(node, indent: T.unsafe(nil)); end
2258
- def emit_body_ensure_rescue(node); end
2259
- def emit_body_inner(node); end
2260
- def emit_body_member(node); end
2261
- def emit_body_rescue(node); end
2262
- def emit_comments(comments); end
2263
- def emit_comments_before(source_part = T.unsafe(nil)); end
2264
- def emit_ensure(node); end
2265
- def emit_eof_comments; end
2266
- def emit_eol_comments; end
2267
- def emit_join(nodes, emit_node, emit_delimiter); end
2268
- def emit_optional_body(node, indent: T.unsafe(nil)); end
2269
- def emit_optional_body_ensure_rescue(node); end
2270
- def emit_rescue_postcontrol(node); end
2271
- def emit_rescue_regular(node); end
2272
- def emitter(node); end
2273
- def first_child; end
2274
- def indented; end
2275
- def k_end; end
2276
- def nl; end
2277
- def parentheses(open = T.unsafe(nil), close = T.unsafe(nil)); end
2278
- def visit(node); end
2279
- def visit_deep(node); end
2280
- def with_comments; end
2281
- def write(*strings); end
2282
- def writer_with(klass, node); end
2283
- def ws; end
2284
- end
2285
-
2286
- Unparser::Generation::EXTRA_NL = T.let(T.unsafe(nil), Array)
2287
-
2288
- # Error raised when unparser encounters an invalid AST
2289
- class Unparser::InvalidNodeError < ::RuntimeError
2290
- # @return [InvalidNodeError] a new instance of InvalidNodeError
2291
- def initialize(message, node); end
2292
-
2293
- # Returns the value of attribute node.
2294
- def node; end
2295
- end
2296
-
2297
- module Unparser::NodeDetails
2298
- include ::Unparser::NodeHelpers
2299
- include ::Unparser::Constants
2300
-
2301
- private
2302
-
2303
- def children; end
2304
-
2305
- class << self
2306
- # @private
2307
- def included(descendant); end
2308
- end
2309
- end
2310
-
2311
- class Unparser::NodeDetails::Send
2312
- include ::Unparser::NodeHelpers
2313
- include ::Unparser::Constants
2314
- include ::Unparser::NodeDetails
2315
- include ::Unparser::Equalizer::Methods
2316
- include ::Unparser::Adamantium
2317
- include ::Unparser::Adamantium::InstanceMethods
2318
- extend ::Unparser::Adamantium::ModuleMethods
2319
- extend ::Unparser::Adamantium::ClassMethods
2320
- extend ::Unparser::DSL
2321
-
2322
- def arguments(&block); end
2323
-
2324
- # @return [Boolean]
2325
- def arguments?; end
2326
-
2327
- # @return [Boolean]
2328
- def assignment?(&block); end
2329
-
2330
- # @return [Boolean]
2331
- def assignment_operator?; end
2332
-
2333
- # @return [Boolean]
2334
- def binary_syntax_allowed?; end
2335
-
2336
- def non_assignment_selector; end
2337
- def receiver; end
2338
- def selector; end
2339
-
2340
- # @return [Boolean]
2341
- def selector_binary_operator?; end
2342
-
2343
- # @return [Boolean]
2344
- def selector_unary_operator?; end
2345
-
2346
- def string_selector(&block); end
2347
-
2348
- private
2349
-
2350
- def remaining_children; end
2351
- end
2352
-
2353
- Unparser::NodeDetails::Send::ASSIGN_SUFFIX = T.let(T.unsafe(nil), String)
2354
- Unparser::NodeDetails::Send::NON_ASSIGN_RANGE = T.let(T.unsafe(nil), Range)
2355
-
2356
- module Unparser::NodeHelpers
2357
- # Helper for building nodes
2358
- #
2359
- # @api private
2360
- # @param type [Symbol]
2361
- # @param children [Array]
2362
- # @return [Parser::AST::Node]
2363
- def n(type, children = T.unsafe(nil)); end
2364
-
2365
- # @return [Boolean]
2366
- def n?(type, node); end
2367
-
2368
- # Helper for building nodes
2369
- #
2370
- # @api private
2371
- # @param type [Symbol]
2372
- # @param children [Parser::AST::Node]
2373
- # @return [Parser::AST::Node]
2374
- def s(type, *children); end
2375
-
2376
- def unwrap_single_begin(node); end
2377
-
2378
- private
2379
-
2380
- def n_arg?(node); end
2381
- def n_args?(node); end
2382
- def n_array?(node); end
2383
- def n_array_pattern?(node); end
2384
- def n_begin?(node); end
2385
- def n_block?(node); end
2386
- def n_cbase?(node); end
2387
- def n_const?(node); end
2388
- def n_dstr?(node); end
2389
- def n_empty_else?(node); end
2390
- def n_ensure?(node); end
2391
- def n_hash?(node); end
2392
- def n_hash_pattern?(node); end
2393
- def n_if?(node); end
2394
- def n_in_pattern?(node); end
2395
- def n_int?(node); end
2396
- def n_kwarg?(node); end
2397
- def n_kwargs?(node); end
2398
- def n_kwsplat?(node); end
2399
- def n_lambda?(node); end
2400
- def n_match_rest?(node); end
2401
- def n_pair?(node); end
2402
- def n_rescue?(node); end
2403
- def n_send?(node); end
2404
- def n_shadowarg?(node); end
2405
- def n_splat?(node); end
2406
- def n_str?(node); end
2407
- def n_sym?(node); end
2408
- end
2409
-
2410
- module Unparser::RequireBlock
2411
- private
2412
-
2413
- # Raise error unless block is provided
2414
- #
2415
- # @raise [MissingBlockError] if no block is given
2416
- # @return [self]
2417
- def require_block; end
2418
- end
2419
-
2420
- class Unparser::UnknownNodeError < ::ArgumentError; end
2421
-
2422
- # Validation of unparser results
2423
- class Unparser::Validation
2424
- include ::Unparser::Anima::InstanceMethods
2425
- include ::Unparser::Equalizer::Methods
2426
- include ::Unparser::Adamantium
2427
- include ::Unparser::Adamantium::InstanceMethods
2428
- extend ::Unparser::Adamantium::ModuleMethods
2429
- extend ::Unparser::Adamantium::ClassMethods
2430
-
2431
- def generated_node; end
2432
- def generated_source; end
2433
- def identification; end
2434
- def original_node; end
2435
- def original_source; end
2436
-
2437
- # Return error report
2438
- #
2439
- # @api private
2440
- # @return [String]
2441
- def report(&block); end
2442
-
2443
- # Test if source could be unparsed successfully
2444
- #
2445
- # @api private
2446
- # @return [Boolean]
2447
- def success?; end
2448
-
2449
- private
2450
-
2451
- def make_report(label, attribute_name); end
2452
- def node_diff_report; end
2453
- def report_exception(exception); end
2454
-
2455
- class << self
2456
- def anima; end
2457
-
2458
- # Create validator from node
2459
- #
2460
- # @param original_node [Parser::AST::Node]
2461
- # @return [Validator]
2462
- def from_node(original_node); end
2463
-
2464
- # Create validator from file
2465
- #
2466
- # @param path [Pathname]
2467
- # @return [Validator]
2468
- def from_path(path); end
2469
-
2470
- # Create validator from string
2471
- #
2472
- # @param original_source [String]
2473
- # @return [Validator]
2474
- def from_string(original_source); end
2475
-
2476
- private
2477
-
2478
- def const_unit(_value); end
2479
- end
2480
- end
2481
-
2482
- class Unparser::Validation::Literal < ::Unparser::Validation
2483
- def report; end
2484
-
2485
- # @return [Boolean]
2486
- def success?; end
2487
-
2488
- private
2489
-
2490
- def source_diff_report; end
2491
- end
2492
-
2493
- module Unparser::Writer
2494
- include ::Unparser::NodeHelpers
2495
- include ::Unparser::Generation
2496
- include ::Unparser::Anima::InstanceMethods
2497
- include ::Unparser::Equalizer::Methods
2498
-
2499
- mixes_in_class_methods ::Unparser::DSL
2500
-
2501
- class << self
2502
- # @private
2503
- def included(descendant); end
2504
- end
2505
- end
2506
-
2507
- class Unparser::Writer::Binary
2508
- include ::Unparser::Adamantium
2509
- include ::Unparser::Adamantium::InstanceMethods
2510
- include ::Unparser::NodeHelpers
2511
- include ::Unparser::Generation
2512
- include ::Unparser::Writer
2513
- include ::Unparser::Anima::InstanceMethods
2514
- include ::Unparser::Equalizer::Methods
2515
- extend ::Unparser::Adamantium::ModuleMethods
2516
- extend ::Unparser::Adamantium::ClassMethods
2517
- extend ::Unparser::DSL
2518
-
2519
- def buffer; end
2520
- def comments; end
2521
- def dispatch; end
2522
- def emit_operator; end
2523
- def local_variable_scope; end
2524
- def node; end
2525
- def symbol_name; end
2526
-
2527
- private
2528
-
2529
- def effective_symbol; end
2530
- def emit_with(map); end
2531
- def keyword_symbol; end
2532
- def left; end
2533
- def left_emitter(&block); end
2534
- def operator_symbol; end
2535
- def remaining_children; end
2536
- def right; end
2537
- def right_emitter(&block); end
2538
-
2539
- class << self
2540
- def anima; end
2541
- end
2542
- end
2543
-
2544
- Unparser::Writer::Binary::KEYWORD_SYMBOLS = T.let(T.unsafe(nil), Hash)
2545
- Unparser::Writer::Binary::KEYWORD_TOKENS = T.let(T.unsafe(nil), Hash)
2546
- Unparser::Writer::Binary::MAP = T.let(T.unsafe(nil), Hash)
2547
- Unparser::Writer::Binary::NEED_KEYWORD = T.let(T.unsafe(nil), Array)
2548
- Unparser::Writer::Binary::OPERATOR_SYMBOLS = T.let(T.unsafe(nil), Hash)
2549
- Unparser::Writer::Binary::OPERATOR_TOKENS = T.let(T.unsafe(nil), Hash)
2550
-
2551
- class Unparser::Writer::DynamicString
2552
- include ::Unparser::Adamantium
2553
- include ::Unparser::Adamantium::InstanceMethods
2554
- include ::Unparser::NodeHelpers
2555
- include ::Unparser::Generation
2556
- include ::Unparser::Writer
2557
- include ::Unparser::Anima::InstanceMethods
2558
- include ::Unparser::Equalizer::Methods
2559
- extend ::Unparser::Adamantium::ModuleMethods
2560
- extend ::Unparser::Adamantium::ClassMethods
2561
- extend ::Unparser::DSL
2562
-
2563
- def buffer; end
2564
- def comments; end
2565
- def dispatch; end
2566
- def emit_heredoc_reminder; end
2567
- def local_variable_scope; end
2568
- def node; end
2569
-
2570
- private
2571
-
2572
- # @return [Boolean]
2573
- def breakpoint?(child, current); end
2574
-
2575
- def classify(node); end
2576
- def classify_str(node); end
2577
- def emit_body(children); end
2578
- def emit_dstr; end
2579
- def emit_dynamic(child); end
2580
- def emit_dynamic_component(node); end
2581
- def emit_heredoc_body; end
2582
- def emit_heredoc_footer; end
2583
- def emit_heredoc_header; end
2584
- def emit_normal_heredoc_body; end
2585
- def emit_segment(children, index); end
2586
- def emit_squiggly_heredoc_body; end
2587
- def escape_dynamic(string); end
2588
-
2589
- # @return [Boolean]
2590
- def heredoc?; end
2591
-
2592
- def heredoc_header; end
2593
-
2594
- # @return [Boolean]
2595
- def heredoc_pattern?; end
2596
-
2597
- # @return [Boolean]
2598
- def heredoc_pattern_2?; end
2599
-
2600
- # @return [Boolean]
2601
- def heredoc_pattern_3?; end
2602
-
2603
- # @return [Boolean]
2604
- def nl_last_child?; end
2605
-
2606
- def segments; end
2607
-
2608
- # @return [Boolean]
2609
- def str_empty?(node); end
2610
-
2611
- # @return [Boolean]
2612
- def str_nl?(node); end
2613
-
2614
- # @return [Boolean]
2615
- def str_ws?(node); end
2616
-
2617
- class << self
2618
- def anima; end
2619
- end
2620
- end
2621
-
2622
- Unparser::Writer::DynamicString::FLAT_INTERPOLATION = T.let(T.unsafe(nil), Set)
2623
- Unparser::Writer::DynamicString::PATTERNS_2 = T.let(T.unsafe(nil), Array)
2624
- Unparser::Writer::DynamicString::PATTERNS_3 = T.let(T.unsafe(nil), Array)
2625
-
2626
- # Writer for rescue bodies
2627
- class Unparser::Writer::Resbody
2628
- include ::Unparser::NodeHelpers
2629
- include ::Unparser::Generation
2630
- include ::Unparser::Writer
2631
- include ::Unparser::Anima::InstanceMethods
2632
- include ::Unparser::Equalizer::Methods
2633
- extend ::Unparser::DSL
2634
-
2635
- def buffer; end
2636
- def comments; end
2637
- def emit_postcontrol; end
2638
- def emit_regular; end
2639
- def local_variable_scope; end
2640
- def node; end
2641
-
2642
- private
2643
-
2644
- def assignment; end
2645
- def body; end
2646
- def emit_assignment; end
2647
- def emit_exception; end
2648
- def exception; end
2649
- def remaining_children; end
2650
-
2651
- class << self
2652
- def anima; end
2653
- end
2654
- end
2655
-
2656
- class Unparser::Writer::Rescue
2657
- include ::Unparser::Adamantium
2658
- include ::Unparser::Adamantium::InstanceMethods
2659
- include ::Unparser::NodeHelpers
2660
- include ::Unparser::Generation
2661
- include ::Unparser::Writer
2662
- include ::Unparser::Anima::InstanceMethods
2663
- include ::Unparser::Equalizer::Methods
2664
- extend ::Unparser::Adamantium::ModuleMethods
2665
- extend ::Unparser::Adamantium::ClassMethods
2666
- extend ::Unparser::DSL
2667
-
2668
- def buffer; end
2669
- def comments; end
2670
- def emit_heredoc_reminders; end
2671
- def emit_postcontrol; end
2672
- def emit_regular; end
2673
- def local_variable_scope; end
2674
- def node; end
2675
-
2676
- private
2677
-
2678
- def body; end
2679
- def else_node; end
2680
- def emit_rescue_body(node); end
2681
- def remaining_children; end
2682
- def rescue_bodies(&block); end
2683
- def rescue_body; end
2684
-
2685
- class << self
2686
- def anima; end
2687
- end
2688
- end
2689
-
2690
- # Writer for send
2691
- class Unparser::Writer::Send
2692
- include ::Unparser::NodeHelpers
2693
- include ::Unparser::Generation
2694
- include ::Unparser::Constants
2695
- include ::Unparser::Adamantium
2696
- include ::Unparser::Adamantium::InstanceMethods
2697
- include ::Unparser::Writer
2698
- include ::Unparser::Anima::InstanceMethods
2699
- include ::Unparser::Equalizer::Methods
2700
- extend ::Unparser::Adamantium::ModuleMethods
2701
- extend ::Unparser::Adamantium::ClassMethods
2702
- extend ::Unparser::DSL
2703
-
2704
- def buffer; end
2705
- def comments; end
2706
- def dispatch; end
2707
- def emit_heredoc_reminders; end
2708
- def emit_mlhs; end
2709
- def emit_selector; end
2710
- def local_variable_scope; end
2711
- def node; end
2712
-
2713
- private
2714
-
2715
- def arguments; end
2716
-
2717
- # @return [Boolean]
2718
- def avoid_clash?; end
2719
-
2720
- def details(&block); end
2721
- def effective_writer(&block); end
2722
- def effective_writer_class; end
2723
- def emit_arguments; end
2724
- def emit_heredoc_reminder(argument); end
2725
- def emit_normal_arguments; end
2726
- def emit_operator; end
2727
- def emit_send_regular(node); end
2728
-
2729
- # @return [Boolean]
2730
- def local_variable_clash?; end
2731
-
2732
- # @return [Boolean]
2733
- def parses_as_constant?; end
2734
-
2735
- def receiver; end
2736
- def remaining_children; end
2737
- def selector; end
2738
-
2739
- # @return [Boolean]
2740
- def write_as_attribute_assignment?; end
2741
-
2742
- class << self
2743
- def anima; end
2744
- end
2745
- end
2746
-
2747
- # Writer for send as attribute assignment
2748
- class Unparser::Writer::Send::AttributeAssignment < ::Unparser::Writer::Send
2749
- def dispatch; end
2750
- def emit_send_mlhs; end
2751
-
2752
- private
2753
-
2754
- def emit_attribute; end
2755
- def emit_receiver; end
2756
- def first_argument; end
2757
- def receiver; end
2758
- def remaining_children; end
2759
- def selector; end
2760
- end
2761
-
2762
- # Writer for binary sends
2763
- class Unparser::Writer::Send::Binary < ::Unparser::Writer::Send
2764
- def dispatch; end
2765
-
2766
- private
2767
-
2768
- def emit_operator; end
2769
- def emit_right; end
2770
- end
2771
-
2772
- Unparser::Writer::Send::INDEX_ASSIGN = T.let(T.unsafe(nil), Symbol)
2773
- Unparser::Writer::Send::INDEX_REFERENCE = T.let(T.unsafe(nil), Symbol)
2774
- Unparser::Writer::Send::OPERATORS = T.let(T.unsafe(nil), Hash)
2775
-
2776
- # Writer for "regular" receiver.selector(arguments...) case
2777
- class Unparser::Writer::Send::Regular < ::Unparser::Writer::Send
2778
- def dispatch; end
2779
- def emit_arguments_without_heredoc_body; end
2780
- def emit_receiver; end
2781
- def emit_send_mlhs; end
2782
- end
2783
-
2784
- # Writer for unary sends
2785
- class Unparser::Writer::Send::Unary < ::Unparser::Writer::Send
2786
- def dispatch; end
2787
- end
2788
-
2789
- Unparser::Writer::Send::Unary::MAP = T.let(T.unsafe(nil), Hash)