visualize_packwerk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +32 -0
  3. data/lib/visualize_packwerk/graph_interface.rb +17 -0
  4. data/lib/visualize_packwerk/node_interface.rb +29 -0
  5. data/lib/visualize_packwerk/package_graph.rb +48 -0
  6. data/lib/visualize_packwerk/package_node.rb +28 -0
  7. data/lib/visualize_packwerk/package_relationships.rb +158 -0
  8. data/lib/visualize_packwerk/railtie.rb +15 -0
  9. data/lib/visualize_packwerk/tasks/visualize_packwerk.rake +73 -0
  10. data/lib/visualize_packwerk/team_graph.rb +52 -0
  11. data/lib/visualize_packwerk/team_node.rb +27 -0
  12. data/lib/visualize_packwerk.rb +17 -0
  13. data/sorbet/config +2 -0
  14. data/sorbet/rbi/gems/activesupport@7.0.3.1.rbi +76 -0
  15. data/sorbet/rbi/gems/ast@2.4.2.rbi +522 -0
  16. data/sorbet/rbi/gems/code_ownership@1.28.0.rbi +411 -0
  17. data/sorbet/rbi/gems/code_teams@1.0.0.rbi +138 -0
  18. data/sorbet/rbi/gems/coderay@1.1.3.rbi +8 -0
  19. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +8 -0
  20. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +866 -0
  21. data/sorbet/rbi/gems/i18n@1.12.0.rbi +8 -0
  22. data/sorbet/rbi/gems/json@2.6.2.rbi +1423 -0
  23. data/sorbet/rbi/gems/method_source@1.0.0.rbi +8 -0
  24. data/sorbet/rbi/gems/minitest@5.16.2.rbi +9 -0
  25. data/sorbet/rbi/gems/package_protections@1.3.0.rbi +654 -0
  26. data/sorbet/rbi/gems/parallel@1.22.1.rbi +163 -0
  27. data/sorbet/rbi/gems/parse_packwerk@0.11.0.rbi +148 -0
  28. data/sorbet/rbi/gems/parser@3.1.2.0.rbi +4261 -0
  29. data/sorbet/rbi/gems/pry@0.14.1.rbi +8 -0
  30. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +8 -0
  31. data/sorbet/rbi/gems/rake@13.0.6.rbi +1854 -0
  32. data/sorbet/rbi/gems/rbi@0.0.15.rbi +2340 -0
  33. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +8 -0
  34. data/sorbet/rbi/gems/rexml@3.2.5.rbi +8 -0
  35. data/sorbet/rbi/gems/rspec-core@3.11.0.rbi +7698 -0
  36. data/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +6201 -0
  37. data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +3625 -0
  38. data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +1176 -0
  39. data/sorbet/rbi/gems/rspec@3.11.0.rbi +40 -0
  40. data/sorbet/rbi/gems/rubocop-ast@1.19.1.rbi +8 -0
  41. data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +8 -0
  42. data/sorbet/rbi/gems/rubocop@1.33.0.rbi +8 -0
  43. data/sorbet/rbi/gems/ruby-graphviz@1.2.5.rbi +840 -0
  44. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +8 -0
  45. data/sorbet/rbi/gems/spoom@1.1.11.rbi +1600 -0
  46. data/sorbet/rbi/gems/tapioca@0.8.3.rbi +1978 -0
  47. data/sorbet/rbi/gems/thor@1.2.1.rbi +2921 -0
  48. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +8 -0
  49. data/sorbet/rbi/gems/unicode-display_width@2.2.0.rbi +8 -0
  50. data/sorbet/rbi/gems/unparser@0.6.5.rbi +8 -0
  51. data/sorbet/rbi/gems/webrick@1.7.0.rbi +1802 -0
  52. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +288 -0
  53. data/sorbet/rbi/gems/yard@0.9.28.rbi +12863 -0
  54. data/sorbet/tapioca/config.yml +13 -0
  55. data/sorbet/tapioca/require.rb +7 -0
  56. metadata +241 -0
@@ -0,0 +1,4261 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `parser` gem.
5
+ # Please instead update this file by running `bin/tapioca gem parser`.
6
+
7
+ # @api public
8
+ module Parser; end
9
+
10
+ # @api public
11
+ module Parser::AST; end
12
+
13
+ # {Parser::AST::Node} contains information about a single AST node and its
14
+ # child nodes. It extends the basic [AST::Node](http://rdoc.info/gems/ast/AST/Node)
15
+ # class provided by gem [ast](http://rdoc.info/gems/ast).
16
+ #
17
+ # @api public
18
+ class Parser::AST::Node < ::AST::Node
19
+ # Assigns various properties to this AST node. Currently only the
20
+ # location can be set.
21
+ #
22
+ # @api public
23
+ # @option properties
24
+ # @param properties [Hash]
25
+ def assign_properties(properties); end
26
+
27
+ # Source map for this Node.
28
+ #
29
+ # @api public
30
+ # @return [Parser::Source::Map]
31
+ def loc; end
32
+
33
+ # Source map for this Node.
34
+ #
35
+ # @api public
36
+ # @return [Parser::Source::Map]
37
+ def location; end
38
+ end
39
+
40
+ # @api public
41
+ class Parser::AST::Processor < ::AST::Processor
42
+ # @api public
43
+ def on_alias(node); end
44
+
45
+ # @api public
46
+ def on_and(node); end
47
+
48
+ # @api public
49
+ def on_and_asgn(node); end
50
+
51
+ # @api public
52
+ # @private
53
+ def on_arg(node); end
54
+
55
+ # @api public
56
+ def on_arg_expr(node); end
57
+
58
+ # @api public
59
+ def on_args(node); end
60
+
61
+ # @api public
62
+ def on_argument(node); end
63
+
64
+ # @api public
65
+ def on_array(node); end
66
+
67
+ # @api public
68
+ def on_array_pattern(node); end
69
+
70
+ # @api public
71
+ def on_array_pattern_with_tail(node); end
72
+
73
+ # @api public
74
+ # @private
75
+ def on_back_ref(node); end
76
+
77
+ # @api public
78
+ def on_begin(node); end
79
+
80
+ # @api public
81
+ def on_block(node); end
82
+
83
+ # @api public
84
+ def on_block_pass(node); end
85
+
86
+ # @api public
87
+ # @private
88
+ def on_blockarg(node); end
89
+
90
+ # @api public
91
+ def on_blockarg_expr(node); end
92
+
93
+ # @api public
94
+ def on_break(node); end
95
+
96
+ # @api public
97
+ def on_case(node); end
98
+
99
+ # @api public
100
+ def on_case_match(node); end
101
+
102
+ # @api public
103
+ def on_casgn(node); end
104
+
105
+ # @api public
106
+ def on_class(node); end
107
+
108
+ # @api public
109
+ def on_const(node); end
110
+
111
+ # @api public
112
+ def on_const_pattern(node); end
113
+
114
+ # @api public
115
+ def on_csend(node); end
116
+
117
+ # @api public
118
+ # @private
119
+ def on_cvar(node); end
120
+
121
+ # @api public
122
+ # @private
123
+ def on_cvasgn(node); end
124
+
125
+ # @api public
126
+ def on_def(node); end
127
+
128
+ # @api public
129
+ def on_defined?(node); end
130
+
131
+ # @api public
132
+ def on_defs(node); end
133
+
134
+ # @api public
135
+ def on_dstr(node); end
136
+
137
+ # @api public
138
+ def on_dsym(node); end
139
+
140
+ # @api public
141
+ def on_eflipflop(node); end
142
+
143
+ # @api public
144
+ def on_empty_else(node); end
145
+
146
+ # @api public
147
+ def on_ensure(node); end
148
+
149
+ # @api public
150
+ def on_erange(node); end
151
+
152
+ # @api public
153
+ def on_find_pattern(node); end
154
+
155
+ # @api public
156
+ def on_for(node); end
157
+
158
+ # @api public
159
+ # @private
160
+ def on_forward_arg(node); end
161
+
162
+ # @api public
163
+ # @private
164
+ def on_gvar(node); end
165
+
166
+ # @api public
167
+ # @private
168
+ def on_gvasgn(node); end
169
+
170
+ # @api public
171
+ def on_hash(node); end
172
+
173
+ # @api public
174
+ def on_hash_pattern(node); end
175
+
176
+ # @api public
177
+ def on_if(node); end
178
+
179
+ # @api public
180
+ def on_if_guard(node); end
181
+
182
+ # @api public
183
+ def on_iflipflop(node); end
184
+
185
+ # @api public
186
+ def on_in_match(node); end
187
+
188
+ # @api public
189
+ def on_in_pattern(node); end
190
+
191
+ # @api public
192
+ def on_index(node); end
193
+
194
+ # @api public
195
+ def on_indexasgn(node); end
196
+
197
+ # @api public
198
+ def on_irange(node); end
199
+
200
+ # @api public
201
+ # @private
202
+ def on_ivar(node); end
203
+
204
+ # @api public
205
+ # @private
206
+ def on_ivasgn(node); end
207
+
208
+ # @api public
209
+ # @private
210
+ def on_kwarg(node); end
211
+
212
+ # @api public
213
+ def on_kwargs(node); end
214
+
215
+ # @api public
216
+ def on_kwbegin(node); end
217
+
218
+ # @api public
219
+ # @private
220
+ def on_kwoptarg(node); end
221
+
222
+ # @api public
223
+ # @private
224
+ def on_kwrestarg(node); end
225
+
226
+ # @api public
227
+ def on_kwsplat(node); end
228
+
229
+ # @api public
230
+ def on_lambda(node); end
231
+
232
+ # @api public
233
+ # @private
234
+ def on_lvar(node); end
235
+
236
+ # @api public
237
+ # @private
238
+ def on_lvasgn(node); end
239
+
240
+ # @api public
241
+ def on_masgn(node); end
242
+
243
+ # @api public
244
+ def on_match_alt(node); end
245
+
246
+ # @api public
247
+ def on_match_as(node); end
248
+
249
+ # @api public
250
+ def on_match_current_line(node); end
251
+
252
+ # @api public
253
+ def on_match_pattern(node); end
254
+
255
+ # @api public
256
+ def on_match_pattern_p(node); end
257
+
258
+ # @api public
259
+ def on_match_rest(node); end
260
+
261
+ # @api public
262
+ # @private
263
+ def on_match_var(node); end
264
+
265
+ # @api public
266
+ def on_match_with_lvasgn(node); end
267
+
268
+ # @api public
269
+ def on_mlhs(node); end
270
+
271
+ # @api public
272
+ def on_module(node); end
273
+
274
+ # @api public
275
+ def on_next(node); end
276
+
277
+ # @api public
278
+ def on_not(node); end
279
+
280
+ # @api public
281
+ # @private
282
+ def on_nth_ref(node); end
283
+
284
+ # @api public
285
+ def on_numblock(node); end
286
+
287
+ # @api public
288
+ def on_op_asgn(node); end
289
+
290
+ # @api public
291
+ # @private
292
+ def on_optarg(node); end
293
+
294
+ # @api public
295
+ def on_or(node); end
296
+
297
+ # @api public
298
+ def on_or_asgn(node); end
299
+
300
+ # @api public
301
+ def on_pair(node); end
302
+
303
+ # @api public
304
+ def on_pin(node); end
305
+
306
+ # @api public
307
+ def on_postexe(node); end
308
+
309
+ # @api public
310
+ def on_preexe(node); end
311
+
312
+ # @api public
313
+ def on_procarg0(node); end
314
+
315
+ # @api public
316
+ def on_redo(node); end
317
+
318
+ # @api public
319
+ def on_regexp(node); end
320
+
321
+ # @api public
322
+ def on_resbody(node); end
323
+
324
+ # @api public
325
+ def on_rescue(node); end
326
+
327
+ # @api public
328
+ # @private
329
+ def on_restarg(node); end
330
+
331
+ # @api public
332
+ def on_restarg_expr(node); end
333
+
334
+ # @api public
335
+ def on_retry(node); end
336
+
337
+ # @api public
338
+ def on_return(node); end
339
+
340
+ # @api public
341
+ def on_sclass(node); end
342
+
343
+ # @api public
344
+ def on_send(node); end
345
+
346
+ # @api public
347
+ # @private
348
+ def on_shadowarg(node); end
349
+
350
+ # @api public
351
+ def on_splat(node); end
352
+
353
+ # @api public
354
+ def on_super(node); end
355
+
356
+ # @api public
357
+ def on_undef(node); end
358
+
359
+ # @api public
360
+ def on_unless_guard(node); end
361
+
362
+ # @api public
363
+ def on_until(node); end
364
+
365
+ # @api public
366
+ def on_until_post(node); end
367
+
368
+ # @api public
369
+ def on_var(node); end
370
+
371
+ # @api public
372
+ def on_vasgn(node); end
373
+
374
+ # @api public
375
+ def on_when(node); end
376
+
377
+ # @api public
378
+ def on_while(node); end
379
+
380
+ # @api public
381
+ def on_while_post(node); end
382
+
383
+ # @api public
384
+ def on_xstr(node); end
385
+
386
+ # @api public
387
+ def on_yield(node); end
388
+
389
+ # @api public
390
+ # @private
391
+ def process_argument_node(node); end
392
+
393
+ # @api public
394
+ def process_regular_node(node); end
395
+
396
+ # @api public
397
+ # @private
398
+ def process_var_asgn_node(node); end
399
+
400
+ # @api public
401
+ # @private
402
+ def process_variable_node(node); end
403
+ end
404
+
405
+ # Base class for version-specific parsers.
406
+ #
407
+ # @api public
408
+ class Parser::Base < ::Racc::Parser
409
+ # @api public
410
+ # @param builder [Parser::Builders::Default] The AST builder to use.
411
+ # @return [Base] a new instance of Base
412
+ def initialize(builder = T.unsafe(nil)); end
413
+
414
+ # @api public
415
+ def builder; end
416
+
417
+ # @api public
418
+ def context; end
419
+
420
+ # @api public
421
+ def current_arg_stack; end
422
+
423
+ # @api public
424
+ # @return [Parser::Diagnostic::Engine]
425
+ def diagnostics; end
426
+
427
+ # @api public
428
+ def lexer; end
429
+
430
+ # @api public
431
+ def max_numparam_stack; end
432
+
433
+ # Parses a source buffer and returns the AST, or `nil` in case of a non fatal error.
434
+ #
435
+ # @api public
436
+ # @param source_buffer [Parser::Source::Buffer] The source buffer to parse.
437
+ # @return [Parser::AST::Node, nil]
438
+ def parse(source_buffer); end
439
+
440
+ # Parses a source buffer and returns the AST and the source code comments.
441
+ #
442
+ # @api public
443
+ # @return [Array]
444
+ # @see #parse
445
+ # @see Parser::Source::Comment#associate
446
+ def parse_with_comments(source_buffer); end
447
+
448
+ # @api public
449
+ def pattern_hash_keys; end
450
+
451
+ # @api public
452
+ def pattern_variables; end
453
+
454
+ # Resets the state of the parser.
455
+ #
456
+ # @api public
457
+ def reset; end
458
+
459
+ # @api public
460
+ def source_buffer; end
461
+
462
+ # @api public
463
+ # @return [Parser::StaticEnvironment]
464
+ def static_env; end
465
+
466
+ # Parses a source buffer and returns the AST, the source code comments,
467
+ # and the tokens emitted by the lexer. In case of a fatal error, a {SyntaxError}
468
+ # is raised, unless `recover` is true. In case of an error
469
+ # (non-fatal or recovered), `nil` is returned instead of the AST, and
470
+ # comments as well as tokens are only returned up to the location of
471
+ # the error.
472
+ #
473
+ # Currently, token stream format returned by #tokenize is not documented,
474
+ # but is considered part of a public API and only changed according
475
+ # to Semantic Versioning.
476
+ #
477
+ # However, note that the exact token composition of various constructs
478
+ # might vary. For example, a string `"foo"` is represented equally well
479
+ # by `:tSTRING_BEG " :tSTRING_CONTENT foo :tSTRING_END "` and
480
+ # `:tSTRING "foo"`; such details must not be relied upon.
481
+ #
482
+ # @api public
483
+ # @param source_buffer [Parser::Source::Buffer]
484
+ # @param recover [Boolean] If true, recover from syntax errors. False by default.
485
+ # @return [Array]
486
+ def tokenize(source_buffer, recover = T.unsafe(nil)); end
487
+
488
+ private
489
+
490
+ # @api public
491
+ def check_kwarg_name(name_t); end
492
+
493
+ # @api public
494
+ def diagnostic(level, reason, arguments, location_t, highlights_ts = T.unsafe(nil)); end
495
+
496
+ # @api public
497
+ def next_token; end
498
+
499
+ # @api public
500
+ def on_error(error_token_id, error_value, value_stack); end
501
+
502
+ class << self
503
+ # @api public
504
+ # @return [Parser::Base] parser with the default options set.
505
+ def default_parser; end
506
+
507
+ # Parses a string of Ruby code and returns the AST. If the source
508
+ # cannot be parsed, {SyntaxError} is raised and a diagnostic is
509
+ # printed to `stderr`.
510
+ #
511
+ # @api public
512
+ # @example
513
+ # Parser::Base.parse('puts "hello"')
514
+ # @param string [String] The block of code to parse.
515
+ # @param file [String] The name of the file the code originated from.
516
+ # @param line [Numeric] The initial line number.
517
+ # @return [Parser::AST::Node]
518
+ def parse(string, file = T.unsafe(nil), line = T.unsafe(nil)); end
519
+
520
+ # Parses Ruby source code by reading it from a file. If the source
521
+ # cannot be parsed, {SyntaxError} is raised and a diagnostic is
522
+ # printed to `stderr`.
523
+ #
524
+ # @api public
525
+ # @param filename [String] Path to the file to parse.
526
+ # @return [Parser::AST::Node]
527
+ # @see #parse
528
+ def parse_file(filename); end
529
+
530
+ # Parses Ruby source code by reading it from a file and returns the AST and
531
+ # comments. If the source cannot be parsed, {SyntaxError} is raised and a
532
+ # diagnostic is printed to `stderr`.
533
+ #
534
+ # @api public
535
+ # @param filename [String] Path to the file to parse.
536
+ # @return [Array]
537
+ # @see #parse
538
+ def parse_file_with_comments(filename); end
539
+
540
+ # Parses a string of Ruby code and returns the AST and comments. If the
541
+ # source cannot be parsed, {SyntaxError} is raised and a diagnostic is
542
+ # printed to `stderr`.
543
+ #
544
+ # @api public
545
+ # @example
546
+ # Parser::Base.parse_with_comments('puts "hello"')
547
+ # @param string [String] The block of code to parse.
548
+ # @param file [String] The name of the file the code originated from.
549
+ # @param line [Numeric] The initial line number.
550
+ # @return [Array]
551
+ def parse_with_comments(string, file = T.unsafe(nil), line = T.unsafe(nil)); end
552
+
553
+ private
554
+
555
+ # @api public
556
+ def setup_source_buffer(file, line, string, encoding); end
557
+ end
558
+ end
559
+
560
+ # @api public
561
+ module Parser::Builders; end
562
+
563
+ # Default AST builder. Uses {AST::Node}s.
564
+ #
565
+ # @api public
566
+ class Parser::Builders::Default
567
+ # Initializes attributes:
568
+ #
569
+ # * `emit_file_line_as_literals`: `true`
570
+ #
571
+ # @api public
572
+ # @return [Default] a new instance of Default
573
+ def initialize; end
574
+
575
+ # @api public
576
+ def __ENCODING__(__ENCODING__t); end
577
+
578
+ # @api public
579
+ def __FILE__(__FILE__t); end
580
+
581
+ # @api public
582
+ def __LINE__(__LINE__t); end
583
+
584
+ # @api public
585
+ def accessible(node); end
586
+
587
+ # @api public
588
+ def alias(alias_t, to, from); end
589
+
590
+ # @api public
591
+ def arg(name_t); end
592
+
593
+ # Ruby 1.8 block arguments
594
+ #
595
+ # @api public
596
+ def arg_expr(expr); end
597
+
598
+ # Formal arguments
599
+ #
600
+ # @api public
601
+ def args(begin_t, args, end_t, check_args = T.unsafe(nil)); end
602
+
603
+ # Arrays
604
+ #
605
+ # @api public
606
+ def array(begin_t, elements, end_t); end
607
+
608
+ # @api public
609
+ def array_pattern(lbrack_t, elements, rbrack_t); end
610
+
611
+ # @api public
612
+ def assign(lhs, eql_t, rhs); end
613
+
614
+ # Assignment
615
+ #
616
+ # @api public
617
+ def assignable(node); end
618
+
619
+ # @api public
620
+ def associate(begin_t, pairs, end_t); end
621
+
622
+ # @api public
623
+ def attr_asgn(receiver, dot_t, selector_t); end
624
+
625
+ # @api public
626
+ def back_ref(token); end
627
+
628
+ # @api public
629
+ def begin(begin_t, body, end_t); end
630
+
631
+ # @api public
632
+ def begin_body(compound_stmt, rescue_bodies = T.unsafe(nil), else_t = T.unsafe(nil), else_ = T.unsafe(nil), ensure_t = T.unsafe(nil), ensure_ = T.unsafe(nil)); end
633
+
634
+ # @api public
635
+ def begin_keyword(begin_t, body, end_t); end
636
+
637
+ # @api public
638
+ def binary_op(receiver, operator_t, arg); end
639
+
640
+ # @api public
641
+ def block(method_call, begin_t, args, body, end_t); end
642
+
643
+ # @api public
644
+ def block_pass(amper_t, arg); end
645
+
646
+ # @api public
647
+ def blockarg(amper_t, name_t); end
648
+
649
+ # @api public
650
+ def blockarg_expr(amper_t, expr); end
651
+
652
+ # @api public
653
+ def call_lambda(lambda_t); end
654
+
655
+ # @api public
656
+ def call_method(receiver, dot_t, selector_t, lparen_t = T.unsafe(nil), args = T.unsafe(nil), rparen_t = T.unsafe(nil)); end
657
+
658
+ # Method calls
659
+ #
660
+ # @api public
661
+ def call_type_for_dot(dot_t); end
662
+
663
+ # @api public
664
+ def case(case_t, expr, when_bodies, else_t, else_body, end_t); end
665
+
666
+ # PATTERN MATCHING
667
+ #
668
+ # @api public
669
+ def case_match(case_t, expr, in_bodies, else_t, else_body, end_t); end
670
+
671
+ # @api public
672
+ def character(char_t); end
673
+
674
+ # @api public
675
+ def complex(complex_t); end
676
+
677
+ # Expression grouping
678
+ #
679
+ # @api public
680
+ def compstmt(statements); end
681
+
682
+ # Conditionals
683
+ #
684
+ # @api public
685
+ def condition(cond_t, cond, then_t, if_true, else_t, if_false, end_t); end
686
+
687
+ # @api public
688
+ def condition_mod(if_true, if_false, cond_t, cond); end
689
+
690
+ # @api public
691
+ def const(name_t); end
692
+
693
+ # @api public
694
+ def const_fetch(scope, t_colon2, name_t); end
695
+
696
+ # @api public
697
+ def const_global(t_colon3, name_t); end
698
+
699
+ # @api public
700
+ def const_op_assignable(node); end
701
+
702
+ # @api public
703
+ def const_pattern(const, ldelim_t, pattern, rdelim_t); end
704
+
705
+ # @api public
706
+ def cvar(token); end
707
+
708
+ # Indented (interpolated, noninterpolated, executable) strings
709
+ #
710
+ # @api public
711
+ def dedent_string(node, dedent_level); end
712
+
713
+ # Class and module definition
714
+ #
715
+ # @api public
716
+ def def_class(class_t, name, lt_t, superclass, body, end_t); end
717
+
718
+ # @api public
719
+ def def_endless_method(def_t, name_t, args, assignment_t, body); end
720
+
721
+ # @api public
722
+ def def_endless_singleton(def_t, definee, dot_t, name_t, args, assignment_t, body); end
723
+
724
+ # Method (un)definition
725
+ #
726
+ # @api public
727
+ def def_method(def_t, name_t, args, body, end_t); end
728
+
729
+ # @api public
730
+ def def_module(module_t, name, body, end_t); end
731
+
732
+ # @api public
733
+ def def_sclass(class_t, lshft_t, expr, body, end_t); end
734
+
735
+ # @api public
736
+ def def_singleton(def_t, definee, dot_t, name_t, args, body, end_t); end
737
+
738
+ # If set to true (the default), `__FILE__` and `__LINE__` are transformed to
739
+ # literal nodes. For example, `s(:str, "lib/foo.rb")` and `s(:int, 10)`.
740
+ #
741
+ # If set to false, `__FILE__` and `__LINE__` are emitted as-is,
742
+ # i.e. as `s(:__FILE__)` and `s(:__LINE__)` nodes.
743
+ #
744
+ # Source maps are identical in both cases.
745
+ #
746
+ # @api public
747
+ # @return [Boolean]
748
+ def emit_file_line_as_literals; end
749
+
750
+ # If set to true (the default), `__FILE__` and `__LINE__` are transformed to
751
+ # literal nodes. For example, `s(:str, "lib/foo.rb")` and `s(:int, 10)`.
752
+ #
753
+ # If set to false, `__FILE__` and `__LINE__` are emitted as-is,
754
+ # i.e. as `s(:__FILE__)` and `s(:__LINE__)` nodes.
755
+ #
756
+ # Source maps are identical in both cases.
757
+ #
758
+ # @api public
759
+ # @return [Boolean]
760
+ def emit_file_line_as_literals=(_arg0); end
761
+
762
+ # @api public
763
+ def false(false_t); end
764
+
765
+ # @api public
766
+ def find_pattern(lbrack_t, elements, rbrack_t); end
767
+
768
+ # @api public
769
+ def float(float_t); end
770
+
771
+ # @api public
772
+ def for(for_t, iterator, in_t, iteratee, do_t, body, end_t); end
773
+
774
+ # @api public
775
+ def forward_arg(dots_t); end
776
+
777
+ # @api public
778
+ def forward_only_args(begin_t, dots_t, end_t); end
779
+
780
+ # @api public
781
+ def forwarded_args(dots_t); end
782
+
783
+ # @api public
784
+ def gvar(token); end
785
+
786
+ # @api public
787
+ def hash_pattern(lbrace_t, kwargs, rbrace_t); end
788
+
789
+ # @api public
790
+ def ident(token); end
791
+
792
+ # @api public
793
+ def if_guard(if_t, if_body); end
794
+
795
+ # @api public
796
+ def in_match(lhs, in_t, rhs); end
797
+
798
+ # @api public
799
+ def in_pattern(in_t, pattern, guard, then_t, body); end
800
+
801
+ # @api public
802
+ def index(receiver, lbrack_t, indexes, rbrack_t); end
803
+
804
+ # @api public
805
+ def index_asgn(receiver, lbrack_t, indexes, rbrack_t); end
806
+
807
+ # Numerics
808
+ #
809
+ # @api public
810
+ def integer(integer_t); end
811
+
812
+ # @api public
813
+ def ivar(token); end
814
+
815
+ # Keywords
816
+ #
817
+ # @api public
818
+ def keyword_cmd(type, keyword_t, lparen_t = T.unsafe(nil), args = T.unsafe(nil), rparen_t = T.unsafe(nil)); end
819
+
820
+ # @api public
821
+ def kwarg(name_t); end
822
+
823
+ # @api public
824
+ def kwnilarg(dstar_t, nil_t); end
825
+
826
+ # @api public
827
+ def kwoptarg(name_t, value); end
828
+
829
+ # @api public
830
+ def kwrestarg(dstar_t, name_t = T.unsafe(nil)); end
831
+
832
+ # @api public
833
+ def kwsplat(dstar_t, arg); end
834
+
835
+ # Logical operations: and, or
836
+ #
837
+ # @api public
838
+ def logical_op(type, lhs, op_t, rhs); end
839
+
840
+ # Loops
841
+ #
842
+ # @api public
843
+ def loop(type, keyword_t, cond, do_t, body, end_t); end
844
+
845
+ # @api public
846
+ def loop_mod(type, body, keyword_t, cond); end
847
+
848
+ # @api public
849
+ def match_alt(left, pipe_t, right); end
850
+
851
+ # @api public
852
+ def match_as(value, assoc_t, as); end
853
+
854
+ # @api public
855
+ def match_hash_var(name_t); end
856
+
857
+ # @api public
858
+ def match_hash_var_from_str(begin_t, strings, end_t); end
859
+
860
+ # @api public
861
+ def match_label(label_type, label); end
862
+
863
+ # @api public
864
+ def match_nil_pattern(dstar_t, nil_t); end
865
+
866
+ # @api public
867
+ def match_op(receiver, match_t, arg); end
868
+
869
+ # @api public
870
+ def match_pair(label_type, label, value); end
871
+
872
+ # @api public
873
+ def match_pattern(lhs, match_t, rhs); end
874
+
875
+ # @api public
876
+ def match_pattern_p(lhs, match_t, rhs); end
877
+
878
+ # @api public
879
+ def match_rest(star_t, name_t = T.unsafe(nil)); end
880
+
881
+ # @api public
882
+ def match_var(name_t); end
883
+
884
+ # @api public
885
+ def match_with_trailing_comma(match, comma_t); end
886
+
887
+ # @api public
888
+ def multi_assign(lhs, eql_t, rhs); end
889
+
890
+ # @api public
891
+ def multi_lhs(begin_t, items, end_t); end
892
+
893
+ # Singletons
894
+ #
895
+ # @api public
896
+ def nil(nil_t); end
897
+
898
+ # @api public
899
+ def not_op(not_t, begin_t = T.unsafe(nil), receiver = T.unsafe(nil), end_t = T.unsafe(nil)); end
900
+
901
+ # @api public
902
+ def nth_ref(token); end
903
+
904
+ # @api public
905
+ def numargs(max_numparam); end
906
+
907
+ # MacRuby Objective-C arguments
908
+ #
909
+ # @api public
910
+ def objc_kwarg(kwname_t, assoc_t, name_t); end
911
+
912
+ # @api public
913
+ def objc_restarg(star_t, name = T.unsafe(nil)); end
914
+
915
+ # @api public
916
+ def objc_varargs(pair, rest_of_varargs); end
917
+
918
+ # @api public
919
+ def op_assign(lhs, op_t, rhs); end
920
+
921
+ # @api public
922
+ def optarg(name_t, eql_t, value); end
923
+
924
+ # Hashes
925
+ #
926
+ # @api public
927
+ def pair(key, assoc_t, value); end
928
+
929
+ # @api public
930
+ def pair_keyword(key_t, value); end
931
+
932
+ # @api public
933
+ def pair_label(key_t); end
934
+
935
+ # @api public
936
+ def pair_list_18(list); end
937
+
938
+ # @api public
939
+ def pair_quoted(begin_t, parts, end_t, value); end
940
+
941
+ # @api private
942
+ def parser; end
943
+
944
+ # @api private
945
+ def parser=(_arg0); end
946
+
947
+ # @api public
948
+ def pin(pin_t, var); end
949
+
950
+ # @api public
951
+ def postexe(postexe_t, lbrace_t, compstmt, rbrace_t); end
952
+
953
+ # BEGIN, END
954
+ #
955
+ # @api public
956
+ def preexe(preexe_t, lbrace_t, compstmt, rbrace_t); end
957
+
958
+ # @api public
959
+ def procarg0(arg); end
960
+
961
+ # @api public
962
+ def range_exclusive(lhs, dot3_t, rhs); end
963
+
964
+ # Ranges
965
+ #
966
+ # @api public
967
+ def range_inclusive(lhs, dot2_t, rhs); end
968
+
969
+ # @api public
970
+ def rational(rational_t); end
971
+
972
+ # @api public
973
+ def regexp_compose(begin_t, parts, end_t, options); end
974
+
975
+ # Regular expressions
976
+ #
977
+ # @api public
978
+ def regexp_options(regopt_t); end
979
+
980
+ # Exception handling
981
+ #
982
+ # @api public
983
+ def rescue_body(rescue_t, exc_list, assoc_t, exc_var, then_t, compound_stmt); end
984
+
985
+ # @api public
986
+ def restarg(star_t, name_t = T.unsafe(nil)); end
987
+
988
+ # @api public
989
+ def restarg_expr(star_t, expr = T.unsafe(nil)); end
990
+
991
+ # Access
992
+ #
993
+ # @api public
994
+ def self(token); end
995
+
996
+ # @api public
997
+ def shadowarg(name_t); end
998
+
999
+ # @api public
1000
+ def splat(star_t, arg = T.unsafe(nil)); end
1001
+
1002
+ # Strings
1003
+ #
1004
+ # @api public
1005
+ def string(string_t); end
1006
+
1007
+ # @api public
1008
+ def string_compose(begin_t, parts, end_t); end
1009
+
1010
+ # @api public
1011
+ def string_internal(string_t); end
1012
+
1013
+ # Symbols
1014
+ #
1015
+ # @api public
1016
+ def symbol(symbol_t); end
1017
+
1018
+ # @api public
1019
+ def symbol_compose(begin_t, parts, end_t); end
1020
+
1021
+ # @api public
1022
+ def symbol_internal(symbol_t); end
1023
+
1024
+ # @api public
1025
+ def symbols_compose(begin_t, parts, end_t); end
1026
+
1027
+ # @api public
1028
+ def ternary(cond, question_t, if_true, colon_t, if_false); end
1029
+
1030
+ # @api public
1031
+ def true(true_t); end
1032
+
1033
+ # @api public
1034
+ def unary_num(unary_t, numeric); end
1035
+
1036
+ # @api public
1037
+ def unary_op(op_t, receiver); end
1038
+
1039
+ # @api public
1040
+ def undef_method(undef_t, names); end
1041
+
1042
+ # @api public
1043
+ def unless_guard(unless_t, unless_body); end
1044
+
1045
+ # Case matching
1046
+ #
1047
+ # @api public
1048
+ def when(when_t, patterns, then_t, body); end
1049
+
1050
+ # @api public
1051
+ def word(parts); end
1052
+
1053
+ # @api public
1054
+ def words_compose(begin_t, parts, end_t); end
1055
+
1056
+ # Executable strings
1057
+ #
1058
+ # @api public
1059
+ def xstring_compose(begin_t, parts, end_t); end
1060
+
1061
+ private
1062
+
1063
+ # @api public
1064
+ # @return [Boolean]
1065
+ def arg_name_collides?(this_name, that_name); end
1066
+
1067
+ # @api public
1068
+ def arg_prefix_map(op_t, name_t = T.unsafe(nil)); end
1069
+
1070
+ # @api public
1071
+ def binary_op_map(left_e, op_t, right_e); end
1072
+
1073
+ # @api public
1074
+ def block_map(receiver_l, begin_t, end_t); end
1075
+
1076
+ # @api public
1077
+ def check_assignment_to_numparam(name, loc); end
1078
+
1079
+ # VERIFICATION
1080
+ #
1081
+ # @api public
1082
+ def check_condition(cond); end
1083
+
1084
+ # @api public
1085
+ def check_duplicate_arg(this_arg, map = T.unsafe(nil)); end
1086
+
1087
+ # @api public
1088
+ def check_duplicate_args(args, map = T.unsafe(nil)); end
1089
+
1090
+ # @api public
1091
+ def check_duplicate_pattern_key(name, loc); end
1092
+
1093
+ # @api public
1094
+ def check_duplicate_pattern_variable(name, loc); end
1095
+
1096
+ # @api public
1097
+ def check_lvar_name(name, loc); end
1098
+
1099
+ # @api public
1100
+ def check_reserved_for_numparam(name, loc); end
1101
+
1102
+ # @api public
1103
+ # @return [Boolean]
1104
+ def collapse_string_parts?(parts); end
1105
+
1106
+ # @api public
1107
+ def collection_map(begin_t, parts, end_t); end
1108
+
1109
+ # @api public
1110
+ def condition_map(keyword_t, cond_e, begin_t, body_e, else_t, else_e, end_t); end
1111
+
1112
+ # @api public
1113
+ def constant_map(scope, colon2_t, name_t); end
1114
+
1115
+ # @api public
1116
+ def definition_map(keyword_t, operator_t, name_t, end_t); end
1117
+
1118
+ # @api public
1119
+ def delimited_string_map(string_t); end
1120
+
1121
+ # @api public
1122
+ def diagnostic(type, reason, arguments, location, highlights = T.unsafe(nil)); end
1123
+
1124
+ # @api public
1125
+ def eh_keyword_map(compstmt_e, keyword_t, body_es, else_t, else_e); end
1126
+
1127
+ # @api public
1128
+ def endless_definition_map(keyword_t, operator_t, name_t, assignment_t, body_e); end
1129
+
1130
+ # @api public
1131
+ def expr_map(loc); end
1132
+
1133
+ # @api public
1134
+ def for_map(keyword_t, in_t, begin_t, end_t); end
1135
+
1136
+ # @api public
1137
+ def guard_map(keyword_t, guard_body_e); end
1138
+
1139
+ # @api public
1140
+ def index_map(receiver_e, lbrack_t, rbrack_t); end
1141
+
1142
+ # @api public
1143
+ def join_exprs(left_expr, right_expr); end
1144
+
1145
+ # @api public
1146
+ def keyword_map(keyword_t, begin_t, args, end_t); end
1147
+
1148
+ # @api public
1149
+ def keyword_mod_map(pre_e, keyword_t, post_e); end
1150
+
1151
+ # @api public
1152
+ def kwarg_map(name_t, value_e = T.unsafe(nil)); end
1153
+
1154
+ # @api public
1155
+ # @return [Boolean]
1156
+ def kwargs?(node); end
1157
+
1158
+ # @api public
1159
+ def loc(token); end
1160
+
1161
+ # @api public
1162
+ def module_definition_map(keyword_t, name_e, operator_t, end_t); end
1163
+
1164
+ # SOURCE MAPS
1165
+ #
1166
+ # @api public
1167
+ def n(type, children, source_map); end
1168
+
1169
+ # @api public
1170
+ def n0(type, source_map); end
1171
+
1172
+ # @api public
1173
+ def numeric(kind, token); end
1174
+
1175
+ # @api public
1176
+ def pair_keyword_map(key_t, value_e); end
1177
+
1178
+ # @api public
1179
+ def pair_quoted_map(begin_t, end_t, value_e); end
1180
+
1181
+ # @api public
1182
+ def prefix_string_map(symbol); end
1183
+
1184
+ # @api public
1185
+ def range_map(start_e, op_t, end_e); end
1186
+
1187
+ # @api public
1188
+ def regexp_map(begin_t, end_t, options_e); end
1189
+
1190
+ # @api public
1191
+ def rescue_body_map(keyword_t, exc_list_e, assoc_t, exc_var_e, then_t, compstmt_e); end
1192
+
1193
+ # @api public
1194
+ def rewrite_hash_args_to_kwargs(args); end
1195
+
1196
+ # @api public
1197
+ def send_binary_op_map(lhs_e, selector_t, rhs_e); end
1198
+
1199
+ # @api public
1200
+ def send_index_map(receiver_e, lbrack_t, rbrack_t); end
1201
+
1202
+ # @api public
1203
+ def send_map(receiver_e, dot_t, selector_t, begin_t = T.unsafe(nil), args = T.unsafe(nil), end_t = T.unsafe(nil)); end
1204
+
1205
+ # @api public
1206
+ def send_unary_op_map(selector_t, arg_e); end
1207
+
1208
+ # @api public
1209
+ def static_regexp(parts, options); end
1210
+
1211
+ # @api public
1212
+ def static_regexp_node(node); end
1213
+
1214
+ # Extract a static string from e.g. a regular expression,
1215
+ # honoring the fact that MRI expands interpolations like #{""}
1216
+ # at parse time.
1217
+ #
1218
+ # @api public
1219
+ def static_string(nodes); end
1220
+
1221
+ # @api public
1222
+ def string_map(begin_t, parts, end_t); end
1223
+
1224
+ # @api public
1225
+ def string_value(token); end
1226
+
1227
+ # @api public
1228
+ def ternary_map(begin_e, question_t, mid_e, colon_t, end_e); end
1229
+
1230
+ # @api public
1231
+ def token_map(token); end
1232
+
1233
+ # @api public
1234
+ def unary_op_map(op_t, arg_e = T.unsafe(nil)); end
1235
+
1236
+ # @api public
1237
+ def unquoted_map(token); end
1238
+
1239
+ # @api public
1240
+ def validate_definee(definee); end
1241
+
1242
+ # @api public
1243
+ def validate_no_forward_arg_after_restarg(args); end
1244
+
1245
+ # @api public
1246
+ def value(token); end
1247
+
1248
+ # @api public
1249
+ def var_send_map(variable_e); end
1250
+
1251
+ # @api public
1252
+ def variable_map(name_t); end
1253
+
1254
+ class << self
1255
+ # AST compatibility attribute; causes a single non-mlhs
1256
+ # block argument to be wrapped in s(:procarg0).
1257
+ #
1258
+ # If set to false (the default), block arguments `|a|` are emitted as
1259
+ # `s(:args, s(:procarg0, :a))`
1260
+ #
1261
+ # If set to true, block arguments `|a|` are emitted as
1262
+ # `s(:args, s(:procarg0, s(:arg, :a))`
1263
+ #
1264
+ # @api public
1265
+ # @return [Boolean]
1266
+ def emit_arg_inside_procarg0; end
1267
+
1268
+ # AST compatibility attribute; causes a single non-mlhs
1269
+ # block argument to be wrapped in s(:procarg0).
1270
+ #
1271
+ # If set to false (the default), block arguments `|a|` are emitted as
1272
+ # `s(:args, s(:procarg0, :a))`
1273
+ #
1274
+ # If set to true, block arguments `|a|` are emitted as
1275
+ # `s(:args, s(:procarg0, s(:arg, :a))`
1276
+ #
1277
+ # @api public
1278
+ # @return [Boolean]
1279
+ def emit_arg_inside_procarg0=(_arg0); end
1280
+
1281
+ # AST compatibility attribute; locations of `__ENCODING__` are not the same
1282
+ # as locations of `Encoding::UTF_8` causing problems during rewriting,
1283
+ # all new code should set this attribute to true.
1284
+ #
1285
+ # If set to false (the default), `__ENCODING__` is emitted as
1286
+ # ` s(:const, s(:const, nil, :Encoding), :UTF_8)`.
1287
+ #
1288
+ # If set to true, `__ENCODING__` is emitted as
1289
+ # `s(:__ENCODING__)`.
1290
+ #
1291
+ # @api public
1292
+ # @return [Boolean]
1293
+ def emit_encoding; end
1294
+
1295
+ # AST compatibility attribute; locations of `__ENCODING__` are not the same
1296
+ # as locations of `Encoding::UTF_8` causing problems during rewriting,
1297
+ # all new code should set this attribute to true.
1298
+ #
1299
+ # If set to false (the default), `__ENCODING__` is emitted as
1300
+ # ` s(:const, s(:const, nil, :Encoding), :UTF_8)`.
1301
+ #
1302
+ # If set to true, `__ENCODING__` is emitted as
1303
+ # `s(:__ENCODING__)`.
1304
+ #
1305
+ # @api public
1306
+ # @return [Boolean]
1307
+ def emit_encoding=(_arg0); end
1308
+
1309
+ # AST compatibility attribute; arguments forwarding initially
1310
+ # didn't have support for leading arguments
1311
+ # (i.e. `def m(a, ...); end` was a syntax error). However, Ruby 3.0
1312
+ # added support for any number of arguments in front of the `...`.
1313
+ #
1314
+ # If set to false (the default):
1315
+ # 1. `def m(...) end` is emitted as
1316
+ # s(:def, :m, s(:forward_args), nil)
1317
+ # 2. `def m(a, b, ...) end` is emitted as
1318
+ # s(:def, :m,
1319
+ # s(:args, s(:arg, :a), s(:arg, :b), s(:forward_arg)))
1320
+ #
1321
+ # If set to true it uses a single format:
1322
+ # 1. `def m(...) end` is emitted as
1323
+ # s(:def, :m, s(:args, s(:forward_arg)))
1324
+ # 2. `def m(a, b, ...) end` is emitted as
1325
+ # s(:def, :m, s(:args, s(:arg, :a), s(:arg, :b), s(:forward_arg)))
1326
+ #
1327
+ # It does't matter that much on 2.7 (because there can't be any leading arguments),
1328
+ # but on 3.0 it should be better enabled to use a single AST format.
1329
+ #
1330
+ # @api public
1331
+ # @return [Boolean]
1332
+ def emit_forward_arg; end
1333
+
1334
+ # AST compatibility attribute; arguments forwarding initially
1335
+ # didn't have support for leading arguments
1336
+ # (i.e. `def m(a, ...); end` was a syntax error). However, Ruby 3.0
1337
+ # added support for any number of arguments in front of the `...`.
1338
+ #
1339
+ # If set to false (the default):
1340
+ # 1. `def m(...) end` is emitted as
1341
+ # s(:def, :m, s(:forward_args), nil)
1342
+ # 2. `def m(a, b, ...) end` is emitted as
1343
+ # s(:def, :m,
1344
+ # s(:args, s(:arg, :a), s(:arg, :b), s(:forward_arg)))
1345
+ #
1346
+ # If set to true it uses a single format:
1347
+ # 1. `def m(...) end` is emitted as
1348
+ # s(:def, :m, s(:args, s(:forward_arg)))
1349
+ # 2. `def m(a, b, ...) end` is emitted as
1350
+ # s(:def, :m, s(:args, s(:arg, :a), s(:arg, :b), s(:forward_arg)))
1351
+ #
1352
+ # It does't matter that much on 2.7 (because there can't be any leading arguments),
1353
+ # but on 3.0 it should be better enabled to use a single AST format.
1354
+ #
1355
+ # @api public
1356
+ # @return [Boolean]
1357
+ def emit_forward_arg=(_arg0); end
1358
+
1359
+ # AST compatibility attribute; indexed assignment, `x[] = 1`, is not
1360
+ # semantically equivalent to calling the method directly, `x.[]=(1)`.
1361
+ # Specifically, in the former case, the expression's value is always 1,
1362
+ # and in the latter case, the expression's value is the return value
1363
+ # of the `[]=` method.
1364
+ #
1365
+ # If set to false (the default), `self[1]` is emitted as
1366
+ # `s(:send, s(:self), :[], s(:int, 1))`, and `self[1] = 2` is
1367
+ # emitted as `s(:send, s(:self), :[]=, s(:int, 1), s(:int, 2))`.
1368
+ #
1369
+ # If set to true, `self[1]` is emitted as
1370
+ # `s(:index, s(:self), s(:int, 1))`, and `self[1] = 2` is
1371
+ # emitted as `s(:indexasgn, s(:self), s(:int, 1), s(:int, 2))`.
1372
+ #
1373
+ # @api public
1374
+ # @return [Boolean]
1375
+ def emit_index; end
1376
+
1377
+ # AST compatibility attribute; indexed assignment, `x[] = 1`, is not
1378
+ # semantically equivalent to calling the method directly, `x.[]=(1)`.
1379
+ # Specifically, in the former case, the expression's value is always 1,
1380
+ # and in the latter case, the expression's value is the return value
1381
+ # of the `[]=` method.
1382
+ #
1383
+ # If set to false (the default), `self[1]` is emitted as
1384
+ # `s(:send, s(:self), :[], s(:int, 1))`, and `self[1] = 2` is
1385
+ # emitted as `s(:send, s(:self), :[]=, s(:int, 1), s(:int, 2))`.
1386
+ #
1387
+ # If set to true, `self[1]` is emitted as
1388
+ # `s(:index, s(:self), s(:int, 1))`, and `self[1] = 2` is
1389
+ # emitted as `s(:indexasgn, s(:self), s(:int, 1), s(:int, 2))`.
1390
+ #
1391
+ # @api public
1392
+ # @return [Boolean]
1393
+ def emit_index=(_arg0); end
1394
+
1395
+ # AST compatibility attribute; Starting from Ruby 2.7 keyword arguments
1396
+ # of method calls that are passed explicitly as a hash (i.e. with curly braces)
1397
+ # are treated as positional arguments and Ruby 2.7 emits a warning on such method
1398
+ # call. Ruby 3.0 given an ArgumentError.
1399
+ #
1400
+ # If set to false (the default) the last hash argument is emitted as `hash`:
1401
+ #
1402
+ # ```
1403
+ # (send nil :foo
1404
+ # (hash
1405
+ # (pair
1406
+ # (sym :bar)
1407
+ # (int 42))))
1408
+ # ```
1409
+ #
1410
+ # If set to true it is emitted as `kwargs`:
1411
+ #
1412
+ # ```
1413
+ # (send nil :foo
1414
+ # (kwargs
1415
+ # (pair
1416
+ # (sym :bar)
1417
+ # (int 42))))
1418
+ # ```
1419
+ #
1420
+ # Note that `kwargs` node is just a replacement for `hash` argument,
1421
+ # so if there's are multiple arguments (or a `kwsplat`) all of them
1422
+ # are wrapped into `kwargs` instead of `hash`:
1423
+ #
1424
+ # ```
1425
+ # (send nil :foo
1426
+ # (kwargs
1427
+ # (pair
1428
+ # (sym :a)
1429
+ # (int 42))
1430
+ # (kwsplat
1431
+ # (send nil :b))
1432
+ # (pair
1433
+ # (sym :c)
1434
+ # (int 10))))
1435
+ # ```
1436
+ #
1437
+ # @api public
1438
+ def emit_kwargs; end
1439
+
1440
+ # AST compatibility attribute; Starting from Ruby 2.7 keyword arguments
1441
+ # of method calls that are passed explicitly as a hash (i.e. with curly braces)
1442
+ # are treated as positional arguments and Ruby 2.7 emits a warning on such method
1443
+ # call. Ruby 3.0 given an ArgumentError.
1444
+ #
1445
+ # If set to false (the default) the last hash argument is emitted as `hash`:
1446
+ #
1447
+ # ```
1448
+ # (send nil :foo
1449
+ # (hash
1450
+ # (pair
1451
+ # (sym :bar)
1452
+ # (int 42))))
1453
+ # ```
1454
+ #
1455
+ # If set to true it is emitted as `kwargs`:
1456
+ #
1457
+ # ```
1458
+ # (send nil :foo
1459
+ # (kwargs
1460
+ # (pair
1461
+ # (sym :bar)
1462
+ # (int 42))))
1463
+ # ```
1464
+ #
1465
+ # Note that `kwargs` node is just a replacement for `hash` argument,
1466
+ # so if there's are multiple arguments (or a `kwsplat`) all of them
1467
+ # are wrapped into `kwargs` instead of `hash`:
1468
+ #
1469
+ # ```
1470
+ # (send nil :foo
1471
+ # (kwargs
1472
+ # (pair
1473
+ # (sym :a)
1474
+ # (int 42))
1475
+ # (kwsplat
1476
+ # (send nil :b))
1477
+ # (pair
1478
+ # (sym :c)
1479
+ # (int 10))))
1480
+ # ```
1481
+ #
1482
+ # @api public
1483
+ def emit_kwargs=(_arg0); end
1484
+
1485
+ # AST compatibility attribute; since `-> {}` is not semantically
1486
+ # equivalent to `lambda {}`, all new code should set this attribute
1487
+ # to true.
1488
+ #
1489
+ # If set to false (the default), `-> {}` is emitted as
1490
+ # `s(:block, s(:send, nil, :lambda), s(:args), nil)`.
1491
+ #
1492
+ # If set to true, `-> {}` is emitted as
1493
+ # `s(:block, s(:lambda), s(:args), nil)`.
1494
+ #
1495
+ # @api public
1496
+ # @return [Boolean]
1497
+ def emit_lambda; end
1498
+
1499
+ # AST compatibility attribute; since `-> {}` is not semantically
1500
+ # equivalent to `lambda {}`, all new code should set this attribute
1501
+ # to true.
1502
+ #
1503
+ # If set to false (the default), `-> {}` is emitted as
1504
+ # `s(:block, s(:send, nil, :lambda), s(:args), nil)`.
1505
+ #
1506
+ # If set to true, `-> {}` is emitted as
1507
+ # `s(:block, s(:lambda), s(:args), nil)`.
1508
+ #
1509
+ # @api public
1510
+ # @return [Boolean]
1511
+ def emit_lambda=(_arg0); end
1512
+
1513
+ # AST compatibility attribute; Starting from 3.0 Ruby returns
1514
+ # true/false from single-line pattern matching with `in` keyword.
1515
+ #
1516
+ # Before 3.0 there was an exception if given value doesn't match pattern.
1517
+ #
1518
+ # NOTE: This attribute affects only Ruby 2.7 grammar.
1519
+ # 3.0 grammar always emits `match_pattern`/`match_pattern_p`
1520
+ #
1521
+ # If compatibility attribute set to false `foo in bar` is emitted as `in_match`:
1522
+ #
1523
+ # ```
1524
+ # (in-match
1525
+ # (send nil :foo)
1526
+ # (match-var :bar))
1527
+ # ```
1528
+ #
1529
+ # If set to true it's emitted as `match_pattern_p`:
1530
+ # ```
1531
+ # (match-pattern-p
1532
+ # (send nil :foo)
1533
+ # (match-var :bar))
1534
+ # ```
1535
+ #
1536
+ # @api public
1537
+ def emit_match_pattern; end
1538
+
1539
+ # AST compatibility attribute; Starting from 3.0 Ruby returns
1540
+ # true/false from single-line pattern matching with `in` keyword.
1541
+ #
1542
+ # Before 3.0 there was an exception if given value doesn't match pattern.
1543
+ #
1544
+ # NOTE: This attribute affects only Ruby 2.7 grammar.
1545
+ # 3.0 grammar always emits `match_pattern`/`match_pattern_p`
1546
+ #
1547
+ # If compatibility attribute set to false `foo in bar` is emitted as `in_match`:
1548
+ #
1549
+ # ```
1550
+ # (in-match
1551
+ # (send nil :foo)
1552
+ # (match-var :bar))
1553
+ # ```
1554
+ #
1555
+ # If set to true it's emitted as `match_pattern_p`:
1556
+ # ```
1557
+ # (match-pattern-p
1558
+ # (send nil :foo)
1559
+ # (match-var :bar))
1560
+ # ```
1561
+ #
1562
+ # @api public
1563
+ def emit_match_pattern=(_arg0); end
1564
+
1565
+ # AST compatibility attribute; block arguments of `m { |a| }` are
1566
+ # not semantically equivalent to block arguments of `m { |a,| }` or `m { |a, b| }`,
1567
+ # all new code should set this attribute to true.
1568
+ #
1569
+ # If set to false (the default), arguments of `m { |a| }` are emitted as
1570
+ # `s(:args, s(:arg, :a))`.
1571
+ #
1572
+ # If set to true, arguments of `m { |a| }` are emitted as
1573
+ # `s(:args, s(:procarg0, :a)).
1574
+ #
1575
+ # @api public
1576
+ # @return [Boolean]
1577
+ def emit_procarg0; end
1578
+
1579
+ # AST compatibility attribute; block arguments of `m { |a| }` are
1580
+ # not semantically equivalent to block arguments of `m { |a,| }` or `m { |a, b| }`,
1581
+ # all new code should set this attribute to true.
1582
+ #
1583
+ # If set to false (the default), arguments of `m { |a| }` are emitted as
1584
+ # `s(:args, s(:arg, :a))`.
1585
+ #
1586
+ # If set to true, arguments of `m { |a| }` are emitted as
1587
+ # `s(:args, s(:procarg0, :a)).
1588
+ #
1589
+ # @api public
1590
+ # @return [Boolean]
1591
+ def emit_procarg0=(_arg0); end
1592
+
1593
+ # @api private
1594
+ def modernize; end
1595
+ end
1596
+ end
1597
+
1598
+ # {Parser::ClobberingError} is raised when {Parser::Source::Rewriter}
1599
+ # detects a clobbering rewrite action. This class inherits {RuntimeError}
1600
+ # rather than {StandardError} for backward compatibility.
1601
+ #
1602
+ # @api public
1603
+ class Parser::ClobberingError < ::RuntimeError; end
1604
+
1605
+ # Context of parsing that is represented by a stack of scopes.
1606
+ #
1607
+ # Supported states:
1608
+ # + :class - in the class body (class A; end)
1609
+ # + :module - in the module body (module M; end)
1610
+ # + :sclass - in the singleton class body (class << obj; end)
1611
+ # + :def - in the method body (def m; end)
1612
+ # + :defs - in the singleton method body (def self.m; end)
1613
+ # + :def_open_args - in the arglist of the method definition
1614
+ # keep in mind that it's set **only** after reducing the first argument,
1615
+ # if you need to handle the first argument check `lex_state == expr_fname`
1616
+ # + :block - in the block body (tap {})
1617
+ # + :lambda - in the lambda body (-> {})
1618
+ #
1619
+ # @api public
1620
+ class Parser::Context
1621
+ # @api public
1622
+ # @return [Context] a new instance of Context
1623
+ def initialize; end
1624
+
1625
+ def in_argdef; end
1626
+ def in_argdef=(_arg0); end
1627
+ def in_block; end
1628
+ def in_block=(_arg0); end
1629
+ def in_class; end
1630
+ def in_class=(_arg0); end
1631
+ def in_def; end
1632
+ def in_def=(_arg0); end
1633
+ def in_defined; end
1634
+ def in_defined=(_arg0); end
1635
+
1636
+ # @api public
1637
+ # @return [Boolean]
1638
+ def in_dynamic_block?; end
1639
+
1640
+ def in_kwarg; end
1641
+ def in_kwarg=(_arg0); end
1642
+ def in_lambda; end
1643
+ def in_lambda=(_arg0); end
1644
+
1645
+ # @api public
1646
+ def reset; end
1647
+ end
1648
+
1649
+ # @api public
1650
+ Parser::Context::FLAGS = T.let(T.unsafe(nil), Array)
1651
+
1652
+ # Stack that holds names of current arguments,
1653
+ # i.e. while parsing
1654
+ # def m1(a = (def m2(b = def m3(c = 1); end); end)); end
1655
+ # ^
1656
+ # stack is [:a, :b, :c]
1657
+ #
1658
+ # Emulates `p->cur_arg` in MRI's parse.y
1659
+ #
1660
+ # @api private
1661
+ class Parser::CurrentArgStack
1662
+ # @api private
1663
+ # @return [CurrentArgStack] a new instance of CurrentArgStack
1664
+ def initialize; end
1665
+
1666
+ # @api private
1667
+ # @return [Boolean]
1668
+ def empty?; end
1669
+
1670
+ # @api private
1671
+ def pop; end
1672
+
1673
+ # @api private
1674
+ def push(value); end
1675
+
1676
+ # @api private
1677
+ def reset; end
1678
+
1679
+ # @api private
1680
+ def set(value); end
1681
+
1682
+ # @api private
1683
+ def stack; end
1684
+
1685
+ # @api private
1686
+ def top; end
1687
+ end
1688
+
1689
+ # @api private
1690
+ module Parser::Deprecation
1691
+ # @api private
1692
+ def warn_of_deprecation; end
1693
+
1694
+ # @api private
1695
+ def warned_of_deprecation=(_arg0); end
1696
+ end
1697
+
1698
+ # @api public
1699
+ class Parser::Diagnostic
1700
+ # @api public
1701
+ # @param level [Symbol]
1702
+ # @param reason [Symbol]
1703
+ # @param arguments [Hash]
1704
+ # @param location [Parser::Source::Range]
1705
+ # @param highlights [Array<Parser::Source::Range>]
1706
+ # @return [Diagnostic] a new instance of Diagnostic
1707
+ def initialize(level, reason, arguments, location, highlights = T.unsafe(nil)); end
1708
+
1709
+ # @api public
1710
+ # @return [Symbol] extended arguments that describe the error
1711
+ # @see Parser::MESSAGES
1712
+ def arguments; end
1713
+
1714
+ # Supplementary error-related source ranges.
1715
+ #
1716
+ # @api public
1717
+ # @return [Array<Parser::Source::Range>]
1718
+ def highlights; end
1719
+
1720
+ # @api public
1721
+ # @return [Symbol] diagnostic level
1722
+ # @see LEVELS
1723
+ def level; end
1724
+
1725
+ # Main error-related source range.
1726
+ #
1727
+ # @api public
1728
+ # @return [Parser::Source::Range]
1729
+ def location; end
1730
+
1731
+ # @api public
1732
+ # @return [String] the rendered message.
1733
+ def message; end
1734
+
1735
+ # @api public
1736
+ # @return [Symbol] reason for error
1737
+ # @see Parser::MESSAGES
1738
+ def reason; end
1739
+
1740
+ # Renders the diagnostic message as a clang-like diagnostic.
1741
+ #
1742
+ # @api public
1743
+ # @example
1744
+ # diagnostic.render # =>
1745
+ # # [
1746
+ # # "(fragment:0):1:5: error: unexpected token $end",
1747
+ # # "foo +",
1748
+ # # " ^"
1749
+ # # ]
1750
+ # @return [Array<String>]
1751
+ def render; end
1752
+
1753
+ private
1754
+
1755
+ # If necessary, shrink a `Range` so as to include only the first line.
1756
+ #
1757
+ # @api public
1758
+ # @return [Parser::Source::Range]
1759
+ def first_line_only(range); end
1760
+
1761
+ # If necessary, shrink a `Range` so as to include only the last line.
1762
+ #
1763
+ # @api public
1764
+ # @return [Parser::Source::Range]
1765
+ def last_line_only(range); end
1766
+
1767
+ # Renders one source line in clang diagnostic style, with highlights.
1768
+ #
1769
+ # @api public
1770
+ # @return [Array<String>]
1771
+ def render_line(range, ellipsis = T.unsafe(nil), range_end = T.unsafe(nil)); end
1772
+ end
1773
+
1774
+ class Parser::Diagnostic::Engine
1775
+ def initialize(consumer = T.unsafe(nil)); end
1776
+
1777
+ def all_errors_are_fatal; end
1778
+ def all_errors_are_fatal=(_arg0); end
1779
+ def consumer; end
1780
+ def consumer=(_arg0); end
1781
+ def ignore_warnings; end
1782
+ def ignore_warnings=(_arg0); end
1783
+ def process(diagnostic); end
1784
+
1785
+ protected
1786
+
1787
+ def ignore?(diagnostic); end
1788
+ def raise?(diagnostic); end
1789
+ end
1790
+
1791
+ # Collection of the available diagnostic levels.
1792
+ #
1793
+ # @api public
1794
+ # @return [Array]
1795
+ Parser::Diagnostic::LEVELS = T.let(T.unsafe(nil), Array)
1796
+
1797
+ # line 3 "lib/parser/lexer.rl"
1798
+ #
1799
+ # === BEFORE YOU START ===
1800
+ #
1801
+ # Read the Ruby Hacking Guide chapter 11, available in English at
1802
+ # http://whitequark.org/blog/2013/04/01/ruby-hacking-guide-ch-11-finite-state-lexer/
1803
+ #
1804
+ # Remember two things about Ragel scanners:
1805
+ #
1806
+ # 1) Longest match wins.
1807
+ #
1808
+ # 2) If two matches have the same length, the first
1809
+ # in source code wins.
1810
+ #
1811
+ # General rules of making Ragel and Bison happy:
1812
+ #
1813
+ # * `p` (position) and `@te` contain the index of the character
1814
+ # they're pointing to ("current"), plus one. `@ts` contains the index
1815
+ # of the corresponding character. The code for extracting matched token is:
1816
+ #
1817
+ # @source_buffer.slice(@ts...@te)
1818
+ #
1819
+ # * If your input is `foooooooobar` and the rule is:
1820
+ #
1821
+ # 'f' 'o'+
1822
+ #
1823
+ # the result will be:
1824
+ #
1825
+ # foooooooobar
1826
+ # ^ ts=0 ^ p=te=9
1827
+ #
1828
+ # * A Ragel lexer action should not emit more than one token, unless
1829
+ # you know what you are doing.
1830
+ #
1831
+ # * All Ragel commands (fnext, fgoto, ...) end with a semicolon.
1832
+ #
1833
+ # * If an action emits the token and transitions to another state, use
1834
+ # these Ragel commands:
1835
+ #
1836
+ # emit($whatever)
1837
+ # fnext $next_state; fbreak;
1838
+ #
1839
+ # If you perform `fgoto` in an action which does not emit a token nor
1840
+ # rewinds the stream pointer, the parser's side-effectful,
1841
+ # context-sensitive lookahead actions will break in a hard to detect
1842
+ # and debug way.
1843
+ #
1844
+ # * If an action does not emit a token:
1845
+ #
1846
+ # fgoto $next_state;
1847
+ #
1848
+ # * If an action features lookbehind, i.e. matches characters with the
1849
+ # intent of passing them to another action:
1850
+ #
1851
+ # p = @ts - 1
1852
+ # fgoto $next_state;
1853
+ #
1854
+ # or, if the lookbehind consists of a single character:
1855
+ #
1856
+ # fhold; fgoto $next_state;
1857
+ #
1858
+ # * Ragel merges actions. So, if you have `e_lparen = '(' %act` and
1859
+ # `c_lparen = '('` and a lexer action `e_lparen | c_lparen`, the result
1860
+ # _will_ invoke the action `act`.
1861
+ #
1862
+ # e_something stands for "something with **e**mbedded action".
1863
+ #
1864
+ # * EOF is explicit and is matched by `c_eof`. If you want to introspect
1865
+ # the state of the lexer, add this rule to the state:
1866
+ #
1867
+ # c_eof => do_eof;
1868
+ #
1869
+ # * If you proceed past EOF, the lexer will complain:
1870
+ #
1871
+ # NoMethodError: undefined method `ord' for nil:NilClass
1872
+ #
1873
+ # @api public
1874
+ class Parser::Lexer
1875
+ # @api public
1876
+ # @return [Lexer] a new instance of Lexer
1877
+ def initialize(version); end
1878
+
1879
+ # Return next token: [type, value].
1880
+ #
1881
+ # @api public
1882
+ def advance; end
1883
+
1884
+ # @api public
1885
+ def cmdarg; end
1886
+
1887
+ # @api public
1888
+ def cmdarg=(_arg0); end
1889
+
1890
+ # @api public
1891
+ def cmdarg_stack; end
1892
+
1893
+ # @api public
1894
+ def command_start; end
1895
+
1896
+ # @api public
1897
+ def command_start=(_arg0); end
1898
+
1899
+ # @api public
1900
+ def comments; end
1901
+
1902
+ # @api public
1903
+ def comments=(_arg0); end
1904
+
1905
+ # @api public
1906
+ def cond; end
1907
+
1908
+ # @api public
1909
+ def cond=(_arg0); end
1910
+
1911
+ # @api public
1912
+ def cond_stack; end
1913
+
1914
+ # @api public
1915
+ def context; end
1916
+
1917
+ # @api public
1918
+ def context=(_arg0); end
1919
+
1920
+ # @api public
1921
+ def dedent_level; end
1922
+
1923
+ # @api public
1924
+ def diagnostics; end
1925
+
1926
+ # @api public
1927
+ def diagnostics=(_arg0); end
1928
+
1929
+ # @api public
1930
+ def encoding; end
1931
+
1932
+ # @api public
1933
+ def force_utf32; end
1934
+
1935
+ # @api public
1936
+ def force_utf32=(_arg0); end
1937
+
1938
+ # @api public
1939
+ def lambda_stack; end
1940
+
1941
+ # @api public
1942
+ def paren_nest; end
1943
+
1944
+ # @api public
1945
+ def pop_cmdarg; end
1946
+
1947
+ # @api public
1948
+ def pop_cond; end
1949
+
1950
+ # @api public
1951
+ def push_cmdarg; end
1952
+
1953
+ # @api public
1954
+ def push_cond; end
1955
+
1956
+ # @api public
1957
+ def reset(reset_state = T.unsafe(nil)); end
1958
+
1959
+ # @api public
1960
+ def source_buffer; end
1961
+
1962
+ # @api public
1963
+ def source_buffer=(source_buffer); end
1964
+
1965
+ # @api public
1966
+ def state; end
1967
+
1968
+ # @api public
1969
+ def state=(state); end
1970
+
1971
+ # @api public
1972
+ def static_env; end
1973
+
1974
+ # @api public
1975
+ def static_env=(_arg0); end
1976
+
1977
+ # @api public
1978
+ def tokens; end
1979
+
1980
+ # @api public
1981
+ def tokens=(_arg0); end
1982
+
1983
+ protected
1984
+
1985
+ # @api public
1986
+ def arg_or_cmdarg(cmd_state); end
1987
+
1988
+ # @api public
1989
+ def diagnostic(type, reason, arguments = T.unsafe(nil), location = T.unsafe(nil), highlights = T.unsafe(nil)); end
1990
+
1991
+ # @api public
1992
+ def emit(type, value = T.unsafe(nil), s = T.unsafe(nil), e = T.unsafe(nil)); end
1993
+
1994
+ # @api public
1995
+ def emit_comment(s = T.unsafe(nil), e = T.unsafe(nil)); end
1996
+
1997
+ # @api public
1998
+ def emit_do(do_block = T.unsafe(nil)); end
1999
+
2000
+ # @api public
2001
+ def emit_table(table, s = T.unsafe(nil), e = T.unsafe(nil)); end
2002
+
2003
+ # @api public
2004
+ def encode_escape(ord); end
2005
+
2006
+ # @api public
2007
+ # @return [Boolean]
2008
+ def eof_codepoint?(point); end
2009
+
2010
+ # @api public
2011
+ def literal; end
2012
+
2013
+ # @api public
2014
+ def next_state_for_literal(literal); end
2015
+
2016
+ # @api public
2017
+ def pop_literal; end
2018
+
2019
+ # === LITERAL STACK ===
2020
+ #
2021
+ # @api public
2022
+ def push_literal(*args); end
2023
+
2024
+ # @api public
2025
+ def range(s = T.unsafe(nil), e = T.unsafe(nil)); end
2026
+
2027
+ # @api public
2028
+ def stack_pop; end
2029
+
2030
+ # @api public
2031
+ def tok(s = T.unsafe(nil), e = T.unsafe(nil)); end
2032
+
2033
+ # @api public
2034
+ # @return [Boolean]
2035
+ def version?(*versions); end
2036
+
2037
+ class << self
2038
+ # @api public
2039
+ def lex_en_expr_arg; end
2040
+
2041
+ # @api public
2042
+ def lex_en_expr_arg=(_arg0); end
2043
+
2044
+ # @api public
2045
+ def lex_en_expr_beg; end
2046
+
2047
+ # @api public
2048
+ def lex_en_expr_beg=(_arg0); end
2049
+
2050
+ # @api public
2051
+ def lex_en_expr_cmdarg; end
2052
+
2053
+ # @api public
2054
+ def lex_en_expr_cmdarg=(_arg0); end
2055
+
2056
+ # @api public
2057
+ def lex_en_expr_dot; end
2058
+
2059
+ # @api public
2060
+ def lex_en_expr_dot=(_arg0); end
2061
+
2062
+ # @api public
2063
+ def lex_en_expr_end; end
2064
+
2065
+ # @api public
2066
+ def lex_en_expr_end=(_arg0); end
2067
+
2068
+ # @api public
2069
+ def lex_en_expr_endarg; end
2070
+
2071
+ # @api public
2072
+ def lex_en_expr_endarg=(_arg0); end
2073
+
2074
+ # @api public
2075
+ def lex_en_expr_endfn; end
2076
+
2077
+ # @api public
2078
+ def lex_en_expr_endfn=(_arg0); end
2079
+
2080
+ # @api public
2081
+ def lex_en_expr_fname; end
2082
+
2083
+ # @api public
2084
+ def lex_en_expr_fname=(_arg0); end
2085
+
2086
+ # @api public
2087
+ def lex_en_expr_labelarg; end
2088
+
2089
+ # @api public
2090
+ def lex_en_expr_labelarg=(_arg0); end
2091
+
2092
+ # @api public
2093
+ def lex_en_expr_mid; end
2094
+
2095
+ # @api public
2096
+ def lex_en_expr_mid=(_arg0); end
2097
+
2098
+ # @api public
2099
+ def lex_en_expr_value; end
2100
+
2101
+ # @api public
2102
+ def lex_en_expr_value=(_arg0); end
2103
+
2104
+ # @api public
2105
+ def lex_en_expr_variable; end
2106
+
2107
+ # @api public
2108
+ def lex_en_expr_variable=(_arg0); end
2109
+
2110
+ # @api public
2111
+ def lex_en_interp_backslash_delimited; end
2112
+
2113
+ # @api public
2114
+ def lex_en_interp_backslash_delimited=(_arg0); end
2115
+
2116
+ # @api public
2117
+ def lex_en_interp_backslash_delimited_words; end
2118
+
2119
+ # @api public
2120
+ def lex_en_interp_backslash_delimited_words=(_arg0); end
2121
+
2122
+ # @api public
2123
+ def lex_en_interp_string; end
2124
+
2125
+ # @api public
2126
+ def lex_en_interp_string=(_arg0); end
2127
+
2128
+ # @api public
2129
+ def lex_en_interp_words; end
2130
+
2131
+ # @api public
2132
+ def lex_en_interp_words=(_arg0); end
2133
+
2134
+ # @api public
2135
+ def lex_en_leading_dot; end
2136
+
2137
+ # @api public
2138
+ def lex_en_leading_dot=(_arg0); end
2139
+
2140
+ # @api public
2141
+ def lex_en_line_begin; end
2142
+
2143
+ # @api public
2144
+ def lex_en_line_begin=(_arg0); end
2145
+
2146
+ # @api public
2147
+ def lex_en_line_comment; end
2148
+
2149
+ # @api public
2150
+ def lex_en_line_comment=(_arg0); end
2151
+
2152
+ # @api public
2153
+ def lex_en_plain_backslash_delimited; end
2154
+
2155
+ # @api public
2156
+ def lex_en_plain_backslash_delimited=(_arg0); end
2157
+
2158
+ # @api public
2159
+ def lex_en_plain_backslash_delimited_words; end
2160
+
2161
+ # @api public
2162
+ def lex_en_plain_backslash_delimited_words=(_arg0); end
2163
+
2164
+ # @api public
2165
+ def lex_en_plain_string; end
2166
+
2167
+ # @api public
2168
+ def lex_en_plain_string=(_arg0); end
2169
+
2170
+ # @api public
2171
+ def lex_en_plain_words; end
2172
+
2173
+ # @api public
2174
+ def lex_en_plain_words=(_arg0); end
2175
+
2176
+ # @api public
2177
+ def lex_en_regexp_modifiers; end
2178
+
2179
+ # @api public
2180
+ def lex_en_regexp_modifiers=(_arg0); end
2181
+
2182
+ # @api public
2183
+ def lex_error; end
2184
+
2185
+ # @api public
2186
+ def lex_error=(_arg0); end
2187
+
2188
+ # @api public
2189
+ def lex_start; end
2190
+
2191
+ # @api public
2192
+ def lex_start=(_arg0); end
2193
+
2194
+ private
2195
+
2196
+ # @api public
2197
+ def _lex_eof_trans; end
2198
+
2199
+ # @api public
2200
+ def _lex_eof_trans=(_arg0); end
2201
+
2202
+ # @api public
2203
+ def _lex_from_state_actions; end
2204
+
2205
+ # @api public
2206
+ def _lex_from_state_actions=(_arg0); end
2207
+
2208
+ # @api public
2209
+ def _lex_index_offsets; end
2210
+
2211
+ # @api public
2212
+ def _lex_index_offsets=(_arg0); end
2213
+
2214
+ # @api public
2215
+ def _lex_indicies; end
2216
+
2217
+ # @api public
2218
+ def _lex_indicies=(_arg0); end
2219
+
2220
+ # @api public
2221
+ def _lex_key_spans; end
2222
+
2223
+ # @api public
2224
+ def _lex_key_spans=(_arg0); end
2225
+
2226
+ # @api public
2227
+ def _lex_to_state_actions; end
2228
+
2229
+ # @api public
2230
+ def _lex_to_state_actions=(_arg0); end
2231
+
2232
+ # @api public
2233
+ def _lex_trans_actions; end
2234
+
2235
+ # @api public
2236
+ def _lex_trans_actions=(_arg0); end
2237
+
2238
+ # @api public
2239
+ def _lex_trans_keys; end
2240
+
2241
+ # @api public
2242
+ def _lex_trans_keys=(_arg0); end
2243
+
2244
+ # @api public
2245
+ def _lex_trans_targs; end
2246
+
2247
+ # @api public
2248
+ def _lex_trans_targs=(_arg0); end
2249
+ end
2250
+ end
2251
+
2252
+ class Parser::Lexer::Dedenter
2253
+ def initialize(dedent_level); end
2254
+
2255
+ def dedent(string); end
2256
+ def interrupt; end
2257
+ end
2258
+
2259
+ Parser::Lexer::Dedenter::TAB_WIDTH = T.let(T.unsafe(nil), Integer)
2260
+
2261
+ # %
2262
+ #
2263
+ # @api public
2264
+ Parser::Lexer::ESCAPES = T.let(T.unsafe(nil), Hash)
2265
+
2266
+ # @api public
2267
+ Parser::Lexer::KEYWORDS = T.let(T.unsafe(nil), Hash)
2268
+
2269
+ # @api public
2270
+ Parser::Lexer::KEYWORDS_BEGIN = T.let(T.unsafe(nil), Hash)
2271
+
2272
+ # @api public
2273
+ Parser::Lexer::LEX_STATES = T.let(T.unsafe(nil), Hash)
2274
+
2275
+ class Parser::Lexer::Literal
2276
+ def initialize(lexer, str_type, delimiter, str_s, heredoc_e = T.unsafe(nil), indent = T.unsafe(nil), dedent_body = T.unsafe(nil), label_allowed = T.unsafe(nil)); end
2277
+
2278
+ def backslash_delimited?; end
2279
+ def dedent_level; end
2280
+ def end_interp_brace_and_try_closing; end
2281
+ def extend_content; end
2282
+ def extend_space(ts, te); end
2283
+ def extend_string(string, ts, te); end
2284
+ def flush_string; end
2285
+ def heredoc?; end
2286
+ def heredoc_e; end
2287
+ def infer_indent_level(line); end
2288
+ def interpolate?; end
2289
+ def munge_escape?(character); end
2290
+ def nest_and_try_closing(delimiter, ts, te, lookahead = T.unsafe(nil)); end
2291
+ def plain_heredoc?; end
2292
+ def regexp?; end
2293
+ def saved_herebody_s; end
2294
+ def saved_herebody_s=(_arg0); end
2295
+ def squiggly_heredoc?; end
2296
+ def start_interp_brace; end
2297
+ def str_s; end
2298
+ def supports_line_continuation_via_slash?; end
2299
+ def type; end
2300
+ def words?; end
2301
+
2302
+ protected
2303
+
2304
+ def clear_buffer; end
2305
+ def coerce_encoding(string); end
2306
+ def delimiter?(delimiter); end
2307
+ def emit(token, type, s, e); end
2308
+ def emit_start_tok; end
2309
+ end
2310
+
2311
+ Parser::Lexer::Literal::DELIMITERS = T.let(T.unsafe(nil), Hash)
2312
+ Parser::Lexer::Literal::TYPES = T.let(T.unsafe(nil), Hash)
2313
+
2314
+ # Mapping of strings to parser tokens.
2315
+ #
2316
+ # @api public
2317
+ Parser::Lexer::PUNCTUATION = T.let(T.unsafe(nil), Hash)
2318
+
2319
+ # @api public
2320
+ Parser::Lexer::PUNCTUATION_BEGIN = T.let(T.unsafe(nil), Hash)
2321
+
2322
+ # @api public
2323
+ Parser::Lexer::REGEXP_META_CHARACTERS = T.let(T.unsafe(nil), Regexp)
2324
+
2325
+ class Parser::Lexer::StackState
2326
+ def initialize(name); end
2327
+
2328
+ def active?; end
2329
+ def clear; end
2330
+ def empty?; end
2331
+ def inspect; end
2332
+ def lexpop; end
2333
+ def pop; end
2334
+ def push(bit); end
2335
+ def to_s; end
2336
+ end
2337
+
2338
+ # Diagnostic messages (errors, warnings and notices) that can be generated.
2339
+ #
2340
+ # @api public
2341
+ # @see Diagnostic
2342
+ Parser::MESSAGES = T.let(T.unsafe(nil), Hash)
2343
+
2344
+ # Holds p->max_numparam from parse.y
2345
+ #
2346
+ # @api private
2347
+ class Parser::MaxNumparamStack
2348
+ # @api private
2349
+ # @return [MaxNumparamStack] a new instance of MaxNumparamStack
2350
+ def initialize; end
2351
+
2352
+ # @api private
2353
+ # @return [Boolean]
2354
+ def empty?; end
2355
+
2356
+ # @api private
2357
+ # @return [Boolean]
2358
+ def has_numparams?; end
2359
+
2360
+ # @api private
2361
+ def has_ordinary_params!; end
2362
+
2363
+ # @api private
2364
+ # @return [Boolean]
2365
+ def has_ordinary_params?; end
2366
+
2367
+ # @api private
2368
+ def pop; end
2369
+
2370
+ # @api private
2371
+ def push(static:); end
2372
+
2373
+ # @api private
2374
+ def register(numparam); end
2375
+
2376
+ # @api private
2377
+ def stack; end
2378
+
2379
+ # @api private
2380
+ def top; end
2381
+
2382
+ private
2383
+
2384
+ # @api private
2385
+ def set(value); end
2386
+ end
2387
+
2388
+ # @api private
2389
+ Parser::MaxNumparamStack::ORDINARY_PARAMS = T.let(T.unsafe(nil), Integer)
2390
+
2391
+ # @api private
2392
+ module Parser::Messages
2393
+ class << self
2394
+ # Formats the message, returns a raw template if there's nothing to interpolate
2395
+ #
2396
+ # Code like `format("", {})` gives a warning, and so this method tries interpolating
2397
+ # only if `arguments` hash is not empty.
2398
+ #
2399
+ # @api private
2400
+ def compile(reason, arguments); end
2401
+ end
2402
+ end
2403
+
2404
+ # Parser metadata
2405
+ #
2406
+ # @api public
2407
+ module Parser::Meta; end
2408
+
2409
+ # All node types that parser can produce. Not all parser versions
2410
+ # will be able to produce every possible node.
2411
+ #
2412
+ # @api public
2413
+ Parser::Meta::NODE_TYPES = T.let(T.unsafe(nil), Set)
2414
+
2415
+ # {Parser::Rewriter} is deprecated. Use {Parser::TreeRewriter} instead.
2416
+ # It has a backwards compatible API and uses {Parser::Source::TreeRewriter}
2417
+ # instead of {Parser::Source::Rewriter}.
2418
+ # Please check the documentation for {Parser::Source::Rewriter} for details.
2419
+ #
2420
+ # @api public
2421
+ # @deprecated Use {Parser::TreeRewriter}
2422
+ class Parser::Rewriter < ::Parser::AST::Processor
2423
+ extend ::Parser::Deprecation
2424
+
2425
+ # @api public
2426
+ # @return [Rewriter] a new instance of Rewriter
2427
+ def initialize(*_arg0); end
2428
+
2429
+ # Returns `true` if the specified node is an assignment node, returns false
2430
+ # otherwise.
2431
+ #
2432
+ # @api public
2433
+ # @param node [Parser::AST::Node]
2434
+ # @return [Boolean]
2435
+ def assignment?(node); end
2436
+
2437
+ # Inserts new code after the given source range.
2438
+ #
2439
+ # @api public
2440
+ # @param range [Parser::Source::Range]
2441
+ # @param content [String]
2442
+ def insert_after(range, content); end
2443
+
2444
+ # Inserts new code before the given source range.
2445
+ #
2446
+ # @api public
2447
+ # @param range [Parser::Source::Range]
2448
+ # @param content [String]
2449
+ def insert_before(range, content); end
2450
+
2451
+ # Removes the source range.
2452
+ #
2453
+ # @api public
2454
+ # @param range [Parser::Source::Range]
2455
+ def remove(range); end
2456
+
2457
+ # Replaces the code of the source range `range` with `content`.
2458
+ #
2459
+ # @api public
2460
+ # @param range [Parser::Source::Range]
2461
+ # @param content [String]
2462
+ def replace(range, content); end
2463
+
2464
+ # Rewrites the AST/source buffer and returns a String containing the new
2465
+ # version.
2466
+ #
2467
+ # @api public
2468
+ # @param source_buffer [Parser::Source::Buffer]
2469
+ # @param ast [Parser::AST::Node]
2470
+ # @return [String]
2471
+ def rewrite(source_buffer, ast); end
2472
+
2473
+ # Wraps the given source range with the given values.
2474
+ #
2475
+ # @api public
2476
+ # @param range [Parser::Source::Range]
2477
+ # @param content [String]
2478
+ def wrap(range, before, after); end
2479
+ end
2480
+
2481
+ # @api public
2482
+ Parser::Rewriter::DEPRECATION_WARNING = T.let(T.unsafe(nil), String)
2483
+
2484
+ # @api public
2485
+ module Parser::Source; end
2486
+
2487
+ # A buffer with source code. {Buffer} contains the source code itself,
2488
+ # associated location information (name and first line), and takes care
2489
+ # of encoding.
2490
+ #
2491
+ # A source buffer is immutable once populated.
2492
+ #
2493
+ # @api public
2494
+ class Parser::Source::Buffer
2495
+ # @api public
2496
+ # @return [Buffer] a new instance of Buffer
2497
+ def initialize(name, first_line = T.unsafe(nil), source: T.unsafe(nil)); end
2498
+
2499
+ # Convert a character index into the source to a column number.
2500
+ #
2501
+ # @api private
2502
+ # @param position [Integer]
2503
+ # @return [Integer] column
2504
+ def column_for_position(position); end
2505
+
2506
+ # Convert a character index into the source to a `[line, column]` tuple.
2507
+ #
2508
+ # @api public
2509
+ # @param position [Integer]
2510
+ # @return [[Integer, Integer]] `[line, column]`
2511
+ def decompose_position(position); end
2512
+
2513
+ # First line of the buffer, 1 by default.
2514
+ #
2515
+ # @api public
2516
+ # @return [Integer] first line
2517
+ def first_line; end
2518
+
2519
+ # @api public
2520
+ def freeze; end
2521
+
2522
+ # @api public
2523
+ def inspect; end
2524
+
2525
+ # Number of last line in the buffer
2526
+ #
2527
+ # @api public
2528
+ # @return [Integer]
2529
+ def last_line; end
2530
+
2531
+ # Convert a character index into the source to a line number.
2532
+ #
2533
+ # @api private
2534
+ # @param position [Integer]
2535
+ # @return [Integer] line
2536
+ def line_for_position(position); end
2537
+
2538
+ # Extract line `lineno` as a new `Range`, taking `first_line` into account.
2539
+ #
2540
+ # @api public
2541
+ # @param lineno [Integer]
2542
+ # @raise [IndexError] if `lineno` is out of bounds
2543
+ # @return [Range]
2544
+ def line_range(lineno); end
2545
+
2546
+ # Buffer name. If the buffer was created from a file, the name corresponds
2547
+ # to relative path to the file.
2548
+ #
2549
+ # @api public
2550
+ # @return [String] buffer name
2551
+ def name; end
2552
+
2553
+ # Populate this buffer from a string without encoding autodetection.
2554
+ #
2555
+ # @api public
2556
+ # @param input [String]
2557
+ # @raise [ArgumentError] if already populated
2558
+ # @return [String]
2559
+ def raw_source=(input); end
2560
+
2561
+ # Populate this buffer from correspondingly named file.
2562
+ #
2563
+ # @api public
2564
+ # @example
2565
+ # Parser::Source::Buffer.new('foo/bar.rb').read
2566
+ # @raise [ArgumentError] if already populated
2567
+ # @return [Buffer] self
2568
+ def read; end
2569
+
2570
+ # @api public
2571
+ def slice(range); end
2572
+
2573
+ # Source code contained in this buffer.
2574
+ #
2575
+ # @api public
2576
+ # @raise [RuntimeError] if buffer is not populated yet
2577
+ # @return [String] source code
2578
+ def source; end
2579
+
2580
+ # Populate this buffer from a string with encoding autodetection.
2581
+ # `input` is mutated if not frozen.
2582
+ #
2583
+ # @api public
2584
+ # @param input [String]
2585
+ # @raise [ArgumentError] if already populated
2586
+ # @raise [EncodingError] if `input` includes invalid byte sequence for the encoding
2587
+ # @return [String]
2588
+ def source=(input); end
2589
+
2590
+ # Extract line `lineno` from source, taking `first_line` into account.
2591
+ #
2592
+ # @api public
2593
+ # @param lineno [Integer]
2594
+ # @raise [IndexError] if `lineno` is out of bounds
2595
+ # @return [String]
2596
+ def source_line(lineno); end
2597
+
2598
+ # Return an `Array` of source code lines.
2599
+ #
2600
+ # @api public
2601
+ # @return [Array<String>]
2602
+ def source_lines; end
2603
+
2604
+ # @api public
2605
+ # @return [Range] A range covering the whole source
2606
+ def source_range; end
2607
+
2608
+ private
2609
+
2610
+ # @api public
2611
+ def bsearch(line_begins, position); end
2612
+
2613
+ # @api public
2614
+ def line_begins; end
2615
+
2616
+ # @api public
2617
+ def line_index_for_position(position); end
2618
+
2619
+ class << self
2620
+ # Try to recognize encoding of `string` as Ruby would, i.e. by looking for
2621
+ # magic encoding comment or UTF-8 BOM. `string` can be in any encoding.
2622
+ #
2623
+ # @api public
2624
+ # @param string [String]
2625
+ # @return [String, nil] encoding name, if recognized
2626
+ def recognize_encoding(string); end
2627
+
2628
+ # Recognize encoding of `input` and process it so it could be lexed.
2629
+ #
2630
+ # * If `input` does not contain BOM or magic encoding comment, it is
2631
+ # kept in the original encoding.
2632
+ # * If the detected encoding is binary, `input` is kept in binary.
2633
+ # * Otherwise, `input` is re-encoded into UTF-8 and returned as a
2634
+ # new string.
2635
+ #
2636
+ # This method mutates the encoding of `input`, but not its content.
2637
+ #
2638
+ # @api public
2639
+ # @param input [String]
2640
+ # @raise [EncodingError]
2641
+ # @return [String]
2642
+ def reencode_string(input); end
2643
+ end
2644
+ end
2645
+
2646
+ # @api private
2647
+ Parser::Source::Buffer::ENCODING_RE = T.let(T.unsafe(nil), Regexp)
2648
+
2649
+ # A comment in the source code.
2650
+ #
2651
+ # @api public
2652
+ class Parser::Source::Comment
2653
+ # @api public
2654
+ # @param range [Parser::Source::Range]
2655
+ # @return [Comment] a new instance of Comment
2656
+ def initialize(range); end
2657
+
2658
+ # Compares comments. Two comments are equal if they
2659
+ # correspond to the same source range.
2660
+ #
2661
+ # @api public
2662
+ # @param other [Object]
2663
+ # @return [Boolean]
2664
+ def ==(other); end
2665
+
2666
+ # @api public
2667
+ # @return [Boolean] true if this is a block comment.
2668
+ # @see #type
2669
+ def document?; end
2670
+
2671
+ # @api public
2672
+ # @return [Boolean] true if this is an inline comment.
2673
+ # @see #type
2674
+ def inline?; end
2675
+
2676
+ # @api public
2677
+ # @return [String] a human-readable representation of this comment
2678
+ def inspect; end
2679
+
2680
+ # @api public
2681
+ # @return [Parser::Source::Range]
2682
+ def loc; end
2683
+
2684
+ # @api public
2685
+ # @return [Parser::Source::Range]
2686
+ def location; end
2687
+
2688
+ # @api public
2689
+ # @return [String]
2690
+ def text; end
2691
+
2692
+ # Type of this comment.
2693
+ #
2694
+ # * Inline comments correspond to `:inline`:
2695
+ #
2696
+ # # whatever
2697
+ #
2698
+ # * Block comments correspond to `:document`:
2699
+ #
2700
+ # =begin
2701
+ # hi i am a document
2702
+ # =end
2703
+ #
2704
+ # @api public
2705
+ # @return [Symbol]
2706
+ def type; end
2707
+
2708
+ class << self
2709
+ # Associate `comments` with `ast` nodes by their corresponding node.
2710
+ #
2711
+ # @api public
2712
+ # @deprecated Use {associate_locations}.
2713
+ # @param ast [Parser::AST::Node]
2714
+ # @param comments [Array<Comment>]
2715
+ # @return [Hash<Parser::AST::Node, Array<Comment>>]
2716
+ # @see Parser::Source::Comment::Associator#associate
2717
+ def associate(ast, comments); end
2718
+
2719
+ # Associate `comments` with `ast` nodes using identity.
2720
+ #
2721
+ # @api public
2722
+ # @param ast [Parser::AST::Node]
2723
+ # @param comments [Array<Comment>]
2724
+ # @return [Hash<Parser::Source::Node, Array<Comment>>]
2725
+ # @see Parser::Source::Comment::Associator#associate_by_identity
2726
+ def associate_by_identity(ast, comments); end
2727
+
2728
+ # Associate `comments` with `ast` nodes by their location in the
2729
+ # source.
2730
+ #
2731
+ # @api public
2732
+ # @param ast [Parser::AST::Node]
2733
+ # @param comments [Array<Comment>]
2734
+ # @return [Hash<Parser::Source::Map, Array<Comment>>]
2735
+ # @see Parser::Source::Comment::Associator#associate_locations
2736
+ def associate_locations(ast, comments); end
2737
+ end
2738
+ end
2739
+
2740
+ class Parser::Source::Comment::Associator
2741
+ def initialize(ast, comments); end
2742
+
2743
+ def associate; end
2744
+ def associate_by_identity; end
2745
+ def associate_locations; end
2746
+ def skip_directives; end
2747
+ def skip_directives=(_arg0); end
2748
+
2749
+ private
2750
+
2751
+ def advance_comment; end
2752
+ def advance_through_directives; end
2753
+ def associate_and_advance_comment(node); end
2754
+ def children_in_source_order(node); end
2755
+ def current_comment_before?(node); end
2756
+ def current_comment_before_end?(node); end
2757
+ def current_comment_decorates?(node); end
2758
+ def do_associate; end
2759
+ def process_leading_comments(node); end
2760
+ def process_trailing_comments(node); end
2761
+ def visit(node); end
2762
+ end
2763
+
2764
+ Parser::Source::Comment::Associator::MAGIC_COMMENT_RE = T.let(T.unsafe(nil), Regexp)
2765
+ Parser::Source::Comment::Associator::POSTFIX_TYPES = T.let(T.unsafe(nil), Set)
2766
+
2767
+ # {Map} relates AST nodes to the source code they were parsed from.
2768
+ # More specifically, a {Map} or its subclass contains a set of ranges:
2769
+ #
2770
+ # * `expression`: smallest range which includes all source corresponding
2771
+ # to the node and all `expression` ranges of its children.
2772
+ # * other ranges (`begin`, `end`, `operator`, ...): node-specific ranges
2773
+ # pointing to various interesting tokens corresponding to the node.
2774
+ #
2775
+ # Note that the {Map::Heredoc} map is the only one whose `expression` does
2776
+ # not include other ranges. It only covers the heredoc marker (`<<HERE`),
2777
+ # not the here document itself.
2778
+ #
2779
+ # All ranges except `expression` are defined by {Map} subclasses.
2780
+ #
2781
+ # Ranges (except `expression`) can be `nil` if the corresponding token is
2782
+ # not present in source. For example, a hash may not have opening/closing
2783
+ # braces, and so would its source map.
2784
+ #
2785
+ # p Parser::CurrentRuby.parse('[1 => 2]').children[0].loc
2786
+ # # => <Parser::Source::Map::Collection:0x007f5492b547d8
2787
+ # # @end=nil, @begin=nil,
2788
+ # # @expression=#<Source::Range (string) 1...7>>
2789
+ #
2790
+ # The {file:doc/AST_FORMAT.md} document describes how ranges associated to source
2791
+ # code tokens. For example, the entry
2792
+ #
2793
+ # (array (int 1) (int 2))
2794
+ #
2795
+ # "[1, 2]"
2796
+ # ^ begin
2797
+ # ^ end
2798
+ # ~~~~~~ expression
2799
+ #
2800
+ # means that if `node` is an {Parser::AST::Node} `(array (int 1) (int 2))`,
2801
+ # then `node.loc` responds to `begin`, `end` and `expression`, and
2802
+ # `node.loc.begin` returns a range pointing at the opening bracket, and so on.
2803
+ #
2804
+ # If you want to write code polymorphic by the source map (i.e. accepting
2805
+ # several subclasses of {Map}), use `respond_to?` instead of `is_a?` to
2806
+ # check whether the map features the range you need. Concrete {Map}
2807
+ # subclasses may not be preserved between versions, but their interfaces
2808
+ # will be kept compatible.
2809
+ #
2810
+ # You can visualize the source maps with `ruby-parse -E` command-line tool.
2811
+ #
2812
+ # @api public
2813
+ # @example
2814
+ # require 'parser/current'
2815
+ #
2816
+ # p Parser::CurrentRuby.parse('[1, 2]').loc
2817
+ # # => #<Parser::Source::Map::Collection:0x007f14b80eccd8
2818
+ # # @end=#<Source::Range (string) 5...6>,
2819
+ # # @begin=#<Source::Range (string) 0...1>,
2820
+ # # @expression=#<Source::Range (string) 0...6>>
2821
+ class Parser::Source::Map
2822
+ # @api public
2823
+ # @param expression [Range]
2824
+ # @return [Map] a new instance of Map
2825
+ def initialize(expression); end
2826
+
2827
+ # Compares source maps.
2828
+ #
2829
+ # @api public
2830
+ # @return [Boolean]
2831
+ def ==(other); end
2832
+
2833
+ # A shortcut for `self.expression.column`.
2834
+ #
2835
+ # @api public
2836
+ # @return [Integer]
2837
+ def column; end
2838
+
2839
+ # @api public
2840
+ # @return [Range]
2841
+ def expression; end
2842
+
2843
+ # A shortcut for `self.expression.line`.
2844
+ #
2845
+ # @api public
2846
+ # @return [Integer]
2847
+ def first_line; end
2848
+
2849
+ # A shortcut for `self.expression.last_column`.
2850
+ #
2851
+ # @api public
2852
+ # @return [Integer]
2853
+ def last_column; end
2854
+
2855
+ # A shortcut for `self.expression.last_line`.
2856
+ #
2857
+ # @api public
2858
+ # @return [Integer]
2859
+ def last_line; end
2860
+
2861
+ # A shortcut for `self.expression.line`.
2862
+ #
2863
+ # @api public
2864
+ # @return [Integer]
2865
+ def line; end
2866
+
2867
+ # The node that is described by this map. Nodes and maps have 1:1 correspondence.
2868
+ #
2869
+ # @api public
2870
+ # @return [Parser::AST::Node]
2871
+ def node; end
2872
+
2873
+ # @api private
2874
+ def node=(node); end
2875
+
2876
+ # Converts this source map to a hash with keys corresponding to
2877
+ # ranges. For example, if called on an instance of {Collection},
2878
+ # which adds the `begin` and `end` ranges, the resulting hash
2879
+ # will contain keys `:expression`, `:begin` and `:end`.
2880
+ #
2881
+ # @api public
2882
+ # @example
2883
+ # require 'parser/current'
2884
+ #
2885
+ # p Parser::CurrentRuby.parse('[1, 2]').loc.to_hash
2886
+ # # => {
2887
+ # # :begin => #<Source::Range (string) 0...1>,
2888
+ # # :end => #<Source::Range (string) 5...6>,
2889
+ # # :expression => #<Source::Range (string) 0...6>
2890
+ # # }
2891
+ # @return [Hash<Symbol, Parser::Source::Range>]
2892
+ def to_hash; end
2893
+
2894
+ # @api private
2895
+ def with_expression(expression_l); end
2896
+
2897
+ protected
2898
+
2899
+ # @api public
2900
+ def update_expression(expression_l); end
2901
+
2902
+ # @api public
2903
+ def with(&block); end
2904
+
2905
+ private
2906
+
2907
+ # @api private
2908
+ def initialize_copy(other); end
2909
+ end
2910
+
2911
+ # @api public
2912
+ class Parser::Source::Map::Collection < ::Parser::Source::Map
2913
+ # @api public
2914
+ # @return [Collection] a new instance of Collection
2915
+ def initialize(begin_l, end_l, expression_l); end
2916
+
2917
+ # @api public
2918
+ def begin; end
2919
+
2920
+ # @api public
2921
+ def end; end
2922
+ end
2923
+
2924
+ # @api public
2925
+ class Parser::Source::Map::Condition < ::Parser::Source::Map
2926
+ # @api public
2927
+ # @return [Condition] a new instance of Condition
2928
+ def initialize(keyword_l, begin_l, else_l, end_l, expression_l); end
2929
+
2930
+ # @api public
2931
+ def begin; end
2932
+
2933
+ # @api public
2934
+ def else; end
2935
+
2936
+ # @api public
2937
+ def end; end
2938
+
2939
+ # @api public
2940
+ def keyword; end
2941
+ end
2942
+
2943
+ # @api public
2944
+ class Parser::Source::Map::Constant < ::Parser::Source::Map
2945
+ # @api public
2946
+ # @return [Constant] a new instance of Constant
2947
+ def initialize(double_colon, name, expression); end
2948
+
2949
+ # @api public
2950
+ def double_colon; end
2951
+
2952
+ # @api public
2953
+ def name; end
2954
+
2955
+ # @api public
2956
+ def operator; end
2957
+
2958
+ # @api private
2959
+ def with_operator(operator_l); end
2960
+
2961
+ protected
2962
+
2963
+ # @api public
2964
+ def update_operator(operator_l); end
2965
+ end
2966
+
2967
+ # @api public
2968
+ class Parser::Source::Map::Definition < ::Parser::Source::Map
2969
+ # @api public
2970
+ # @return [Definition] a new instance of Definition
2971
+ def initialize(keyword_l, operator_l, name_l, end_l); end
2972
+
2973
+ # @api public
2974
+ def end; end
2975
+
2976
+ # @api public
2977
+ def keyword; end
2978
+
2979
+ # @api public
2980
+ def name; end
2981
+
2982
+ # @api public
2983
+ def operator; end
2984
+ end
2985
+
2986
+ # @api public
2987
+ class Parser::Source::Map::For < ::Parser::Source::Map
2988
+ # @api public
2989
+ # @return [For] a new instance of For
2990
+ def initialize(keyword_l, in_l, begin_l, end_l, expression_l); end
2991
+
2992
+ # @api public
2993
+ def begin; end
2994
+
2995
+ # @api public
2996
+ def end; end
2997
+
2998
+ # @api public
2999
+ def in; end
3000
+
3001
+ # @api public
3002
+ def keyword; end
3003
+ end
3004
+
3005
+ # @api public
3006
+ class Parser::Source::Map::Heredoc < ::Parser::Source::Map
3007
+ # @api public
3008
+ # @return [Heredoc] a new instance of Heredoc
3009
+ def initialize(begin_l, body_l, end_l); end
3010
+
3011
+ # @api public
3012
+ def heredoc_body; end
3013
+
3014
+ # @api public
3015
+ def heredoc_end; end
3016
+ end
3017
+
3018
+ # @api public
3019
+ class Parser::Source::Map::Index < ::Parser::Source::Map
3020
+ # @api public
3021
+ # @return [Index] a new instance of Index
3022
+ def initialize(begin_l, end_l, expression_l); end
3023
+
3024
+ # @api public
3025
+ def begin; end
3026
+
3027
+ # @api public
3028
+ def end; end
3029
+
3030
+ # @api public
3031
+ def operator; end
3032
+
3033
+ # @api private
3034
+ def with_operator(operator_l); end
3035
+
3036
+ protected
3037
+
3038
+ # @api public
3039
+ def update_operator(operator_l); end
3040
+ end
3041
+
3042
+ # @api public
3043
+ class Parser::Source::Map::Keyword < ::Parser::Source::Map
3044
+ # @api public
3045
+ # @return [Keyword] a new instance of Keyword
3046
+ def initialize(keyword_l, begin_l, end_l, expression_l); end
3047
+
3048
+ # @api public
3049
+ def begin; end
3050
+
3051
+ # @api public
3052
+ def end; end
3053
+
3054
+ # @api public
3055
+ def keyword; end
3056
+ end
3057
+
3058
+ # @api public
3059
+ class Parser::Source::Map::MethodDefinition < ::Parser::Source::Map
3060
+ # @api public
3061
+ # @return [MethodDefinition] a new instance of MethodDefinition
3062
+ def initialize(keyword_l, operator_l, name_l, end_l, assignment_l, body_l); end
3063
+
3064
+ # @api public
3065
+ def assignment; end
3066
+
3067
+ # @api public
3068
+ def end; end
3069
+
3070
+ # @api public
3071
+ def keyword; end
3072
+
3073
+ # @api public
3074
+ def name; end
3075
+
3076
+ # @api public
3077
+ def operator; end
3078
+ end
3079
+
3080
+ # @api public
3081
+ class Parser::Source::Map::ObjcKwarg < ::Parser::Source::Map
3082
+ # @api public
3083
+ # @return [ObjcKwarg] a new instance of ObjcKwarg
3084
+ def initialize(keyword_l, operator_l, argument_l, expression_l); end
3085
+
3086
+ # @api public
3087
+ def argument; end
3088
+
3089
+ # @api public
3090
+ def keyword; end
3091
+
3092
+ # @api public
3093
+ def operator; end
3094
+ end
3095
+
3096
+ # @api public
3097
+ class Parser::Source::Map::Operator < ::Parser::Source::Map
3098
+ # @api public
3099
+ # @return [Operator] a new instance of Operator
3100
+ def initialize(operator, expression); end
3101
+
3102
+ # @api public
3103
+ def operator; end
3104
+ end
3105
+
3106
+ # @api public
3107
+ class Parser::Source::Map::RescueBody < ::Parser::Source::Map
3108
+ # @api public
3109
+ # @return [RescueBody] a new instance of RescueBody
3110
+ def initialize(keyword_l, assoc_l, begin_l, expression_l); end
3111
+
3112
+ # @api public
3113
+ def assoc; end
3114
+
3115
+ # @api public
3116
+ def begin; end
3117
+
3118
+ # @api public
3119
+ def keyword; end
3120
+ end
3121
+
3122
+ # @api public
3123
+ class Parser::Source::Map::Send < ::Parser::Source::Map
3124
+ # @api public
3125
+ # @return [Send] a new instance of Send
3126
+ def initialize(dot_l, selector_l, begin_l, end_l, expression_l); end
3127
+
3128
+ # @api public
3129
+ def begin; end
3130
+
3131
+ # @api public
3132
+ def dot; end
3133
+
3134
+ # @api public
3135
+ def end; end
3136
+
3137
+ # @api public
3138
+ def operator; end
3139
+
3140
+ # @api public
3141
+ def selector; end
3142
+
3143
+ # @api private
3144
+ def with_operator(operator_l); end
3145
+
3146
+ protected
3147
+
3148
+ # @api public
3149
+ def update_operator(operator_l); end
3150
+ end
3151
+
3152
+ # @api public
3153
+ class Parser::Source::Map::Ternary < ::Parser::Source::Map
3154
+ # @api public
3155
+ # @return [Ternary] a new instance of Ternary
3156
+ def initialize(question_l, colon_l, expression_l); end
3157
+
3158
+ # @api public
3159
+ def colon; end
3160
+
3161
+ # @api public
3162
+ def question; end
3163
+ end
3164
+
3165
+ # @api public
3166
+ class Parser::Source::Map::Variable < ::Parser::Source::Map
3167
+ # @api public
3168
+ # @return [Variable] a new instance of Variable
3169
+ def initialize(name_l, expression_l = T.unsafe(nil)); end
3170
+
3171
+ # @api public
3172
+ def name; end
3173
+
3174
+ # @api public
3175
+ def operator; end
3176
+
3177
+ # @api private
3178
+ def with_operator(operator_l); end
3179
+
3180
+ protected
3181
+
3182
+ # @api public
3183
+ def update_operator(operator_l); end
3184
+ end
3185
+
3186
+ # A range of characters in a particular source buffer.
3187
+ #
3188
+ # The range is always exclusive, i.e. a range with `begin_pos` of 3 and
3189
+ # `end_pos` of 5 will contain the following characters:
3190
+ #
3191
+ # example
3192
+ # ^^
3193
+ #
3194
+ # @api public
3195
+ class Parser::Source::Range
3196
+ include ::Comparable
3197
+
3198
+ # @api public
3199
+ # @param source_buffer [Buffer]
3200
+ # @param begin_pos [Integer]
3201
+ # @param end_pos [Integer]
3202
+ # @return [Range] a new instance of Range
3203
+ def initialize(source_buffer, begin_pos, end_pos); end
3204
+
3205
+ # Compare ranges, first by begin_pos, then by end_pos.
3206
+ #
3207
+ # @api public
3208
+ def <=>(other); end
3209
+
3210
+ # by the given amount(s)
3211
+ #
3212
+ # @api public
3213
+ # @param Endpoint(s) [Hash] to change, any combination of :begin_pos or :end_pos
3214
+ # @return [Range] the same range as this range but with the given end point(s) adjusted
3215
+ def adjust(begin_pos: T.unsafe(nil), end_pos: T.unsafe(nil)); end
3216
+
3217
+ # @api public
3218
+ # @return [Range] a zero-length range located just before the beginning
3219
+ # of this range.
3220
+ def begin; end
3221
+
3222
+ # @api public
3223
+ # @return [Integer] index of the first character in the range
3224
+ def begin_pos; end
3225
+
3226
+ # @api public
3227
+ # @return [Integer] zero-based column number of the beginning of this range.
3228
+ def column; end
3229
+
3230
+ # @api public
3231
+ # @raise RangeError
3232
+ # @return [::Range] a range of columns spanned by this range.
3233
+ def column_range; end
3234
+
3235
+ # Return `other.contains?(self)`
3236
+ #
3237
+ # Two ranges must be one and only one of ==, disjoint?, contains?, contained? or crossing?
3238
+ #
3239
+ # @api public
3240
+ # @param other [Range]
3241
+ # @return [Boolean]
3242
+ def contained?(other); end
3243
+
3244
+ # Returns true iff this range contains (strictly) `other`.
3245
+ #
3246
+ # Two ranges must be one and only one of ==, disjoint?, contains?, contained? or crossing?
3247
+ #
3248
+ # @api public
3249
+ # @param other [Range]
3250
+ # @return [Boolean]
3251
+ def contains?(other); end
3252
+
3253
+ # Returns true iff both ranges intersect and also have different elements from one another.
3254
+ #
3255
+ # Two ranges must be one and only one of ==, disjoint?, contains?, contained? or crossing?
3256
+ #
3257
+ # @api public
3258
+ # @param other [Range]
3259
+ # @return [Boolean]
3260
+ def crossing?(other); end
3261
+
3262
+ # Return `true` iff this range and `other` are disjoint.
3263
+ #
3264
+ # Two ranges must be one and only one of ==, disjoint?, contains?, contained? or crossing?
3265
+ #
3266
+ # @api public
3267
+ # @param other [Range]
3268
+ # @return [Boolean]
3269
+ def disjoint?(other); end
3270
+
3271
+ # Checks if a range is empty; if it contains no characters
3272
+ #
3273
+ # @api public
3274
+ # @return [Boolean]
3275
+ def empty?; end
3276
+
3277
+ # @api public
3278
+ # @return [Range] a zero-length range located just after the end
3279
+ # of this range.
3280
+ def end; end
3281
+
3282
+ # @api public
3283
+ # @return [Integer] index of the character after the last character in the range
3284
+ def end_pos; end
3285
+
3286
+ # @api public
3287
+ def eql?(_arg0); end
3288
+
3289
+ # Line number of the beginning of this range. By default, the first line
3290
+ # of a buffer is 1; as such, line numbers are most commonly one-based.
3291
+ #
3292
+ # @api public
3293
+ # @return [Integer] line number of the beginning of this range.
3294
+ # @see Buffer
3295
+ def first_line; end
3296
+
3297
+ # Support for Ranges be used in as Hash indices and in Sets.
3298
+ #
3299
+ # @api public
3300
+ def hash; end
3301
+
3302
+ # @api public
3303
+ # @return [String] a human-readable representation of this range.
3304
+ def inspect; end
3305
+
3306
+ # @api public
3307
+ # @param other [Range]
3308
+ # @return [Range] overlapping region of this range and `other`, or `nil`
3309
+ # if they do not overlap
3310
+ def intersect(other); end
3311
+
3312
+ # `is?` provides a concise way to compare the source corresponding to this range.
3313
+ # For example, `r.source == '(' || r.source == 'begin'` is equivalent to
3314
+ # `r.is?('(', 'begin')`.
3315
+ #
3316
+ # @api public
3317
+ # @return [Boolean]
3318
+ def is?(*what); end
3319
+
3320
+ # @api public
3321
+ # @param other [Range]
3322
+ # @return [Range] smallest possible range spanning both this range and `other`.
3323
+ def join(other); end
3324
+
3325
+ # @api public
3326
+ # @return [Integer] zero-based column number of the end of this range.
3327
+ def last_column; end
3328
+
3329
+ # @api public
3330
+ # @return [Integer] line number of the end of this range.
3331
+ def last_line; end
3332
+
3333
+ # @api public
3334
+ # @return [Integer] amount of characters included in this range.
3335
+ def length; end
3336
+
3337
+ # Line number of the beginning of this range. By default, the first line
3338
+ # of a buffer is 1; as such, line numbers are most commonly one-based.
3339
+ #
3340
+ # @api public
3341
+ # @return [Integer] line number of the beginning of this range.
3342
+ # @see Buffer
3343
+ def line; end
3344
+
3345
+ # Return `true` iff this range is not disjoint from `other`.
3346
+ #
3347
+ # @api public
3348
+ # @param other [Range]
3349
+ # @return [Boolean] `true` if this range and `other` overlap
3350
+ def overlaps?(other); end
3351
+
3352
+ # @api public
3353
+ # @param new_size [Integer]
3354
+ # @return [Range] a range beginning at the same point as this range and length `new_size`.
3355
+ def resize(new_size); end
3356
+
3357
+ # @api public
3358
+ # @return [Integer] amount of characters included in this range.
3359
+ def size; end
3360
+
3361
+ # @api public
3362
+ # @return [String] all source code covered by this range.
3363
+ def source; end
3364
+
3365
+ # @api public
3366
+ # @return [Parser::Source::Buffer]
3367
+ def source_buffer; end
3368
+
3369
+ # @api public
3370
+ # @return [String] a line of source code containing the beginning of this range.
3371
+ def source_line; end
3372
+
3373
+ # @api public
3374
+ # @return [Array<Integer>] a set of character indexes contained in this range.
3375
+ def to_a; end
3376
+
3377
+ # @api public
3378
+ # @return [Range] a Ruby range with the same `begin_pos` and `end_pos`
3379
+ def to_range; end
3380
+
3381
+ # Composes a GNU/Clang-style string representation of the beginning of this
3382
+ # range.
3383
+ #
3384
+ # For example, for the following range in file `foo.rb`,
3385
+ #
3386
+ # def foo
3387
+ # ^^^
3388
+ #
3389
+ # `to_s` will return `foo.rb:1:5`.
3390
+ # Note that the column index is one-based.
3391
+ #
3392
+ # @api public
3393
+ # @return [String]
3394
+ def to_s; end
3395
+
3396
+ # to the given value(s).
3397
+ #
3398
+ # @api public
3399
+ # @param Endpoint(s) [Hash] to change, any combination of :begin_pos or :end_pos
3400
+ # @return [Range] the same range as this range but with the given end point(s) changed
3401
+ def with(begin_pos: T.unsafe(nil), end_pos: T.unsafe(nil)); end
3402
+ end
3403
+
3404
+ # {Rewriter} is deprecated. Use {TreeRewriter} instead.
3405
+ #
3406
+ # TreeRewriter has simplified semantics, and customizable policies
3407
+ # with regards to clobbering. Please read the documentation.
3408
+ #
3409
+ # Keep in mind:
3410
+ # - Rewriter was discarding the `end_pos` of the given range for `insert_before`,
3411
+ # and the `begin_pos` for `insert_after`. These are meaningful in TreeRewriter.
3412
+ # - TreeRewriter's wrap/insert_before/insert_after are multiple by default, while
3413
+ # Rewriter would raise clobbering errors if the non '_multi' version was called.
3414
+ # - The TreeRewriter policy closest to Rewriter's behavior is:
3415
+ # different_replacements: :raise,
3416
+ # swallowed_insertions: :raise,
3417
+ # crossing_deletions: :accept
3418
+ #
3419
+ # @api public
3420
+ # @deprecated Use {TreeRewriter}
3421
+ class Parser::Source::Rewriter
3422
+ extend ::Parser::Deprecation
3423
+
3424
+ # @api public
3425
+ # @deprecated Use {TreeRewriter}
3426
+ # @param source_buffer [Source::Buffer]
3427
+ # @return [Rewriter] a new instance of Rewriter
3428
+ def initialize(source_buffer); end
3429
+
3430
+ # @api public
3431
+ # @return [Diagnostic::Engine]
3432
+ def diagnostics; end
3433
+
3434
+ # Inserts new code after the given source range.
3435
+ #
3436
+ # @api public
3437
+ # @deprecated Use {TreeRewriter#insert_after}
3438
+ # @param range [Range]
3439
+ # @param content [String]
3440
+ # @raise [ClobberingError] when clobbering is detected
3441
+ # @return [Rewriter] self
3442
+ def insert_after(range, content); end
3443
+
3444
+ # Inserts new code after the given source range by allowing other
3445
+ # insertions at the same position.
3446
+ # Note that an insertion with latter invocation comes _after_ earlier
3447
+ # insertion at the same position in the rewritten source.
3448
+ #
3449
+ # @api public
3450
+ # @deprecated Use {TreeRewriter#insert_after}
3451
+ # @example Inserting ')]'
3452
+ # rewriter.
3453
+ # insert_after_multi(range, ')').
3454
+ # insert_after_multi(range, ']').
3455
+ # process
3456
+ # @param range [Range]
3457
+ # @param content [String]
3458
+ # @raise [ClobberingError] when clobbering is detected
3459
+ # @return [Rewriter] self
3460
+ def insert_after_multi(range, content); end
3461
+
3462
+ # Inserts new code before the given source range.
3463
+ #
3464
+ # @api public
3465
+ # @deprecated Use {TreeRewriter#insert_before}
3466
+ # @param range [Range]
3467
+ # @param content [String]
3468
+ # @raise [ClobberingError] when clobbering is detected
3469
+ # @return [Rewriter] self
3470
+ def insert_before(range, content); end
3471
+
3472
+ # Inserts new code before the given source range by allowing other
3473
+ # insertions at the same position.
3474
+ # Note that an insertion with latter invocation comes _before_ earlier
3475
+ # insertion at the same position in the rewritten source.
3476
+ #
3477
+ # @api public
3478
+ # @deprecated Use {TreeRewriter#insert_before}
3479
+ # @example Inserting '[('
3480
+ # rewriter.
3481
+ # insert_before_multi(range, '(').
3482
+ # insert_before_multi(range, '[').
3483
+ # process
3484
+ # @param range [Range]
3485
+ # @param content [String]
3486
+ # @raise [ClobberingError] when clobbering is detected
3487
+ # @return [Rewriter] self
3488
+ def insert_before_multi(range, content); end
3489
+
3490
+ # Applies all scheduled changes to the `source_buffer` and returns
3491
+ # modified source as a new string.
3492
+ #
3493
+ # @api public
3494
+ # @deprecated Use {TreeRewriter#process}
3495
+ # @return [String]
3496
+ def process; end
3497
+
3498
+ # Removes the source range.
3499
+ #
3500
+ # @api public
3501
+ # @deprecated Use {TreeRewriter#remove}
3502
+ # @param range [Range]
3503
+ # @raise [ClobberingError] when clobbering is detected
3504
+ # @return [Rewriter] self
3505
+ def remove(range); end
3506
+
3507
+ # Replaces the code of the source range `range` with `content`.
3508
+ #
3509
+ # @api public
3510
+ # @deprecated Use {TreeRewriter#replace}
3511
+ # @param range [Range]
3512
+ # @param content [String]
3513
+ # @raise [ClobberingError] when clobbering is detected
3514
+ # @return [Rewriter] self
3515
+ def replace(range, content); end
3516
+
3517
+ # @api public
3518
+ # @return [Source::Buffer]
3519
+ def source_buffer; end
3520
+
3521
+ # Provides a protected block where a sequence of multiple rewrite actions
3522
+ # are handled atomically. If any of the actions failed by clobbering,
3523
+ # all the actions are rolled back.
3524
+ #
3525
+ # @api public
3526
+ # @deprecated Use {TreeRewriter#transaction}
3527
+ # @example
3528
+ # begin
3529
+ # rewriter.transaction do
3530
+ # rewriter.insert_before(range_of_something, '(')
3531
+ # rewriter.insert_after(range_of_something, ')')
3532
+ # end
3533
+ # rescue Parser::ClobberingError
3534
+ # end
3535
+ # @raise [RuntimeError] when no block is passed
3536
+ # @raise [RuntimeError] when already in a transaction
3537
+ def transaction; end
3538
+
3539
+ # Inserts new code before and after the given source range.
3540
+ #
3541
+ # @api public
3542
+ # @deprecated Use {TreeRewriter#wrap}
3543
+ # @param range [Range]
3544
+ # @param before [String]
3545
+ # @param after [String]
3546
+ # @raise [ClobberingError] when clobbering is detected
3547
+ # @return [Rewriter] self
3548
+ def wrap(range, before, after); end
3549
+
3550
+ private
3551
+
3552
+ # @api public
3553
+ def active_clobber; end
3554
+
3555
+ # @api public
3556
+ def active_clobber=(value); end
3557
+
3558
+ # @api public
3559
+ def active_insertions; end
3560
+
3561
+ # @api public
3562
+ def active_insertions=(value); end
3563
+
3564
+ # @api public
3565
+ def active_queue; end
3566
+
3567
+ # @api public
3568
+ # @return [Boolean]
3569
+ def adjacent?(range1, range2); end
3570
+
3571
+ # @api public
3572
+ def adjacent_insertion_mask(range); end
3573
+
3574
+ # @api public
3575
+ # @return [Boolean]
3576
+ def adjacent_insertions?(range); end
3577
+
3578
+ # @api public
3579
+ def adjacent_position_mask(range); end
3580
+
3581
+ # @api public
3582
+ # @return [Boolean]
3583
+ def adjacent_updates?(range); end
3584
+
3585
+ # Schedule a code update. If it overlaps with another update, check
3586
+ # whether they conflict, and raise a clobbering error if they do.
3587
+ # (As a special case, zero-length ranges at the same position are
3588
+ # considered to "overlap".) Otherwise, merge them.
3589
+ #
3590
+ # Updates which are adjacent to each other, but do not overlap, are also
3591
+ # merged.
3592
+ #
3593
+ # RULES:
3594
+ #
3595
+ # - Insertion ("replacing" a zero-length range):
3596
+ # - Two insertions at the same point conflict. This is true even
3597
+ # if the earlier insertion has already been merged with an adjacent
3598
+ # update, and even if they are both inserting the same text.
3599
+ # - An insertion never conflicts with a replace or remove operation
3600
+ # on its right or left side, which does not overlap it (in other
3601
+ # words, which does not update BOTH its right and left sides).
3602
+ # - An insertion always conflicts with a remove operation which spans
3603
+ # both its sides.
3604
+ # - An insertion conflicts with a replace operation which spans both its
3605
+ # sides, unless the replacement text is longer than the replaced text
3606
+ # by the size of the insertion (or more), and the portion of
3607
+ # replacement text immediately after the insertion position is
3608
+ # identical to the inserted text.
3609
+ #
3610
+ # - Removal operations never conflict with each other.
3611
+ #
3612
+ # - Replacement operations:
3613
+ # - Take the portion of each replacement text which falls within:
3614
+ # - The other operation's replaced region
3615
+ # - The other operation's replacement text, if it extends past the
3616
+ # end of its own replaced region (in other words, if the replacement
3617
+ # text is longer than the text it replaces)
3618
+ # - If and only if the taken texts are identical for both operations,
3619
+ # they do not conflict.
3620
+ #
3621
+ # @api public
3622
+ def append(action); end
3623
+
3624
+ # @api public
3625
+ # @return [Boolean]
3626
+ def can_merge?(action, existing); end
3627
+
3628
+ # @api public
3629
+ # @return [Boolean]
3630
+ def clobbered_insertion?(insertion); end
3631
+
3632
+ # @api public
3633
+ def clobbered_position_mask(range); end
3634
+
3635
+ # @api public
3636
+ # @return [Boolean]
3637
+ def in_transaction?; end
3638
+
3639
+ # @api public
3640
+ def merge_actions(action, existing); end
3641
+
3642
+ # @api public
3643
+ def merge_actions!(action, existing); end
3644
+
3645
+ # @api public
3646
+ def merge_replacements(actions); end
3647
+
3648
+ # @api public
3649
+ # @raise [ClobberingError]
3650
+ def raise_clobber_error(action, existing); end
3651
+
3652
+ # @api public
3653
+ def record_insertion(range); end
3654
+
3655
+ # @api public
3656
+ def record_replace(range); end
3657
+
3658
+ # @api public
3659
+ def replace_actions(old, updated); end
3660
+
3661
+ # @api public
3662
+ # @return [Boolean]
3663
+ def replace_compatible_with_insertion?(replace, insertion); end
3664
+ end
3665
+
3666
+ class Parser::Source::Rewriter::Action
3667
+ include ::Comparable
3668
+
3669
+ def initialize(range, replacement = T.unsafe(nil), allow_multiple_insertions = T.unsafe(nil), order = T.unsafe(nil)); end
3670
+
3671
+ def <=>(other); end
3672
+ def allow_multiple_insertions; end
3673
+ def allow_multiple_insertions?; end
3674
+ def order; end
3675
+ def range; end
3676
+ def replacement; end
3677
+ def to_s; end
3678
+ end
3679
+
3680
+ # @api public
3681
+ Parser::Source::Rewriter::DEPRECATION_WARNING = T.let(T.unsafe(nil), String)
3682
+
3683
+ # {TreeRewriter} performs the heavy lifting in the source rewriting process.
3684
+ # It schedules code updates to be performed in the correct order.
3685
+ #
3686
+ # For simple cases, the resulting source will be obvious.
3687
+ #
3688
+ # Examples for more complex cases follow. Assume these examples are acting on
3689
+ # the source `'puts(:hello, :world)`. The methods #wrap, #remove, etc.
3690
+ # receive a Range as first argument; for clarity, examples below use english
3691
+ # sentences and a string of raw code instead.
3692
+ #
3693
+ # ## Overlapping ranges:
3694
+ #
3695
+ # Any two rewriting actions on overlapping ranges will fail and raise
3696
+ # a `ClobberingError`, unless they are both deletions (covered next).
3697
+ #
3698
+ # * wrap ':hello, ' with '(' and ')'
3699
+ # * wrap ', :world' with '(' and ')'
3700
+ # => CloberringError
3701
+ #
3702
+ # ## Overlapping deletions:
3703
+ #
3704
+ # * remove ':hello, '
3705
+ # * remove ', :world'
3706
+ #
3707
+ # The overlapping ranges are merged and `':hello, :world'` will be removed.
3708
+ # This policy can be changed. `:crossing_deletions` defaults to `:accept`
3709
+ # but can be set to `:warn` or `:raise`.
3710
+ #
3711
+ # ## Multiple actions at the same end points:
3712
+ #
3713
+ # Results will always be independent on the order they were given.
3714
+ # Exception: rewriting actions done on exactly the same range (covered next).
3715
+ #
3716
+ # Example:
3717
+ # * replace ', ' by ' => '
3718
+ # * wrap ':hello, :world' with '{' and '}'
3719
+ # * replace ':world' with ':everybody'
3720
+ # * wrap ':world' with '[', ']'
3721
+ #
3722
+ # The resulting string will be `'puts({:hello => [:everybody]})'`
3723
+ # and this result is independent on the order the instructions were given in.
3724
+ #
3725
+ # Note that if the two "replace" were given as a single replacement of ', :world'
3726
+ # for ' => :everybody', the result would be a `ClobberingError` because of the wrap
3727
+ # in square brackets.
3728
+ #
3729
+ # ## Multiple wraps on same range:
3730
+ # * wrap ':hello' with '(' and ')'
3731
+ # * wrap ':hello' with '[' and ']'
3732
+ #
3733
+ # The wraps are combined in order given and results would be `'puts([(:hello)], :world)'`.
3734
+ #
3735
+ # ## Multiple replacements on same range:
3736
+ # * replace ':hello' by ':hi', then
3737
+ # * replace ':hello' by ':hey'
3738
+ #
3739
+ # The replacements are made in the order given, so the latter replacement
3740
+ # supersedes the former and ':hello' will be replaced by ':hey'.
3741
+ #
3742
+ # This policy can be changed. `:different_replacements` defaults to `:accept`
3743
+ # but can be set to `:warn` or `:raise`.
3744
+ #
3745
+ # ## Swallowed insertions:
3746
+ # wrap 'world' by '__', '__'
3747
+ # replace ':hello, :world' with ':hi'
3748
+ #
3749
+ # A containing replacement will swallow the contained rewriting actions
3750
+ # and `':hello, :world'` will be replaced by `':hi'`.
3751
+ #
3752
+ # This policy can be changed for swallowed insertions. `:swallowed_insertions`
3753
+ # defaults to `:accept` but can be set to `:warn` or `:raise`
3754
+ #
3755
+ # ## Implementation
3756
+ # The updates are organized in a tree, according to the ranges they act on
3757
+ # (where children are strictly contained by their parent), hence the name.
3758
+ #
3759
+ # @api public
3760
+ class Parser::Source::TreeRewriter
3761
+ extend ::Parser::Deprecation
3762
+
3763
+ # @api public
3764
+ # @param source_buffer [Source::Buffer]
3765
+ # @return [TreeRewriter] a new instance of TreeRewriter
3766
+ def initialize(source_buffer, crossing_deletions: T.unsafe(nil), different_replacements: T.unsafe(nil), swallowed_insertions: T.unsafe(nil)); end
3767
+
3768
+ # Returns a representation of the rewriter as nested insertions (:wrap) and replacements.
3769
+ #
3770
+ # rewriter.as_actions # =>[ [:wrap, 1...10, '(', ')'],
3771
+ # [:wrap, 2...6, '', '!'], # aka "insert_after"
3772
+ # [:replace, 2...4, 'foo'],
3773
+ # [:replace, 5...6, ''], # aka "removal"
3774
+ # ],
3775
+ #
3776
+ # Contrary to `as_replacements`, this representation is sufficient to recreate exactly
3777
+ # the rewriter.
3778
+ #
3779
+ # @api public
3780
+ # @return [Array<(Symbol, Range, String{, String})>]
3781
+ def as_nested_actions; end
3782
+
3783
+ # Returns a representation of the rewriter as an ordered list of replacements.
3784
+ #
3785
+ # rewriter.as_replacements # => [ [1...1, '('],
3786
+ # [2...4, 'foo'],
3787
+ # [5...6, ''],
3788
+ # [6...6, '!'],
3789
+ # [10...10, ')'],
3790
+ # ]
3791
+ #
3792
+ # This representation is sufficient to recreate the result of `process` but it is
3793
+ # not sufficient to recreate completely the rewriter for further merging/actions.
3794
+ # See `as_nested_actions`
3795
+ #
3796
+ # @api public
3797
+ # @return [Array<Range, String>] an ordered list of pairs of range & replacement
3798
+ def as_replacements; end
3799
+
3800
+ # @api public
3801
+ # @return [Diagnostic::Engine]
3802
+ def diagnostics; end
3803
+
3804
+ # Returns true iff no (non trivial) update has been recorded
3805
+ #
3806
+ # @api public
3807
+ # @return [Boolean]
3808
+ def empty?; end
3809
+
3810
+ # For special cases where one needs to merge a rewriter attached to a different source_buffer
3811
+ # or that needs to be offset. Policies of the receiver are used.
3812
+ #
3813
+ # @api public
3814
+ # @param rewriter [TreeRewriter] from different source_buffer
3815
+ # @param offset [Integer]
3816
+ # @raise [IndexError] if action ranges (once offset) don't fit the current buffer
3817
+ # @return [Rewriter] self
3818
+ def import!(foreign_rewriter, offset: T.unsafe(nil)); end
3819
+
3820
+ # @api public
3821
+ # @return [Boolean]
3822
+ def in_transaction?; end
3823
+
3824
+ # Shortcut for `wrap(range, nil, content)`
3825
+ #
3826
+ # @api public
3827
+ # @param range [Range]
3828
+ # @param content [String]
3829
+ # @raise [ClobberingError] when clobbering is detected
3830
+ # @return [Rewriter] self
3831
+ def insert_after(range, content); end
3832
+
3833
+ # @api private
3834
+ # @deprecated Use insert_after or wrap
3835
+ def insert_after_multi(range, text); end
3836
+
3837
+ # Shortcut for `wrap(range, content, nil)`
3838
+ #
3839
+ # @api public
3840
+ # @param range [Range]
3841
+ # @param content [String]
3842
+ # @raise [ClobberingError] when clobbering is detected
3843
+ # @return [Rewriter] self
3844
+ def insert_before(range, content); end
3845
+
3846
+ # @api private
3847
+ # @deprecated Use insert_after or wrap
3848
+ def insert_before_multi(range, text); end
3849
+
3850
+ # @api public
3851
+ def inspect; end
3852
+
3853
+ # Returns a new rewriter that consists of the updates of the received
3854
+ # and the given argument. Policies of the receiver are used.
3855
+ #
3856
+ # @api public
3857
+ # @param with [Rewriter]
3858
+ # @raise [ClobberingError] when clobbering is detected
3859
+ # @return [Rewriter] merge of receiver and argument
3860
+ def merge(with); end
3861
+
3862
+ # Merges the updates of argument with the receiver.
3863
+ # Policies of the receiver are used.
3864
+ # This action is atomic in that it won't change the receiver
3865
+ # unless it succeeds.
3866
+ #
3867
+ # @api public
3868
+ # @param with [Rewriter]
3869
+ # @raise [ClobberingError] when clobbering is detected
3870
+ # @return [Rewriter] self
3871
+ def merge!(with); end
3872
+
3873
+ # Applies all scheduled changes to the `source_buffer` and returns
3874
+ # modified source as a new string.
3875
+ #
3876
+ # @api public
3877
+ # @return [String]
3878
+ def process; end
3879
+
3880
+ # Shortcut for `replace(range, '')`
3881
+ #
3882
+ # @api public
3883
+ # @param range [Range]
3884
+ # @raise [ClobberingError] when clobbering is detected
3885
+ # @return [Rewriter] self
3886
+ def remove(range); end
3887
+
3888
+ # Replaces the code of the source range `range` with `content`.
3889
+ #
3890
+ # @api public
3891
+ # @param range [Range]
3892
+ # @param content [String]
3893
+ # @raise [ClobberingError] when clobbering is detected
3894
+ # @return [Rewriter] self
3895
+ def replace(range, content); end
3896
+
3897
+ # @api public
3898
+ # @return [Source::Buffer]
3899
+ def source_buffer; end
3900
+
3901
+ # Provides a protected block where a sequence of multiple rewrite actions
3902
+ # are handled atomically. If any of the actions failed by clobbering,
3903
+ # all the actions are rolled back. Transactions can be nested.
3904
+ #
3905
+ # @api public
3906
+ # @raise [RuntimeError] when no block is passed
3907
+ def transaction; end
3908
+
3909
+ # Inserts the given strings before and after the given range.
3910
+ #
3911
+ # @api public
3912
+ # @param range [Range]
3913
+ # @param insert_before [String, nil]
3914
+ # @param insert_after [String, nil]
3915
+ # @raise [ClobberingError] when clobbering is detected
3916
+ # @return [Rewriter] self
3917
+ def wrap(range, insert_before, insert_after); end
3918
+
3919
+ protected
3920
+
3921
+ # @api public
3922
+ def action_root; end
3923
+
3924
+ private
3925
+
3926
+ # @api public
3927
+ def action_summary; end
3928
+
3929
+ # @api public
3930
+ # @raise [ArgumentError]
3931
+ def check_policy_validity; end
3932
+
3933
+ # @api public
3934
+ def check_range_validity(range); end
3935
+
3936
+ # @api public
3937
+ def combine(range, attributes); end
3938
+
3939
+ # @api public
3940
+ def enforce_policy(event); end
3941
+
3942
+ # @api public
3943
+ # @raise [Parser::ClobberingError]
3944
+ def trigger_policy(event, range: T.unsafe(nil), conflict: T.unsafe(nil), **arguments); end
3945
+ end
3946
+
3947
+ # @api public
3948
+ Parser::Source::TreeRewriter::ACTIONS = T.let(T.unsafe(nil), Array)
3949
+
3950
+ # Actions are arranged in a tree and get combined so that:
3951
+ # children are strictly contained by their parent
3952
+ # sibblings all disjoint from one another and ordered
3953
+ # only actions with replacement==nil may have children
3954
+ #
3955
+ # @api private
3956
+ class Parser::Source::TreeRewriter::Action
3957
+ # @api private
3958
+ # @return [Action] a new instance of Action
3959
+ def initialize(range, enforcer, insert_before: T.unsafe(nil), replacement: T.unsafe(nil), insert_after: T.unsafe(nil), children: T.unsafe(nil)); end
3960
+
3961
+ # @api private
3962
+ def combine(action); end
3963
+
3964
+ # A root action has its range set to the whole source range, even
3965
+ # though it typically do not act on that range.
3966
+ # This method returns the action as if it was a child action with
3967
+ # its range contracted.
3968
+ #
3969
+ # @api private
3970
+ # @return [Action]
3971
+ def contract; end
3972
+
3973
+ # @api private
3974
+ # @return [Boolean]
3975
+ def empty?; end
3976
+
3977
+ # @api private
3978
+ def insert_after; end
3979
+
3980
+ # @api private
3981
+ def insert_before; end
3982
+
3983
+ # @api private
3984
+ # @return [Boolean]
3985
+ def insertion?; end
3986
+
3987
+ # No check is done on validity of resulting range.
3988
+ #
3989
+ # @api private
3990
+ # @return [Action] that has been moved to the given source_buffer and with the given offset
3991
+ def moved(source_buffer, offset); end
3992
+
3993
+ # @api private
3994
+ def nested_actions; end
3995
+
3996
+ # @api private
3997
+ def ordered_replacements; end
3998
+
3999
+ # @api private
4000
+ def range; end
4001
+
4002
+ # @api private
4003
+ def replacement; end
4004
+
4005
+ protected
4006
+
4007
+ # Returns the children in a hierarchy with respect to `action`:
4008
+ # :sibbling_left, sibbling_right (for those that are disjoint from `action`)
4009
+ # :parent (in case one of our children contains `action`)
4010
+ # :child (in case `action` strictly contains some of our children)
4011
+ # :fusible (in case `action` overlaps some children but they can be fused in one deletion)
4012
+ # or raises a `CloberingError`
4013
+ # In case a child has equal range to `action`, it is returned as `:parent`
4014
+ # Reminder: an empty range 1...1 is considered disjoint from 1...10
4015
+ #
4016
+ # @api private
4017
+ def analyse_hierarchy(action); end
4018
+
4019
+ # Similar to @children.bsearch_index || size
4020
+ # except allows for a starting point
4021
+ # and `bsearch_index` is only Ruby 2.3+
4022
+ #
4023
+ # @api private
4024
+ def bsearch_child_index(from = T.unsafe(nil)); end
4025
+
4026
+ # @api private
4027
+ def call_enforcer_for_merge(action); end
4028
+
4029
+ # @api private
4030
+ # @param fusible [Array(Action | nil)]
4031
+ def check_fusible(action, *fusible); end
4032
+
4033
+ # @api private
4034
+ def children; end
4035
+
4036
+ # Assumes `more_children` all contained within `@range`
4037
+ #
4038
+ # @api private
4039
+ def combine_children(more_children); end
4040
+
4041
+ # Assumes range.contains?(action.range) && action.children.empty?
4042
+ #
4043
+ # @api private
4044
+ def do_combine(action); end
4045
+
4046
+ # @api private
4047
+ def fuse_deletions(action, fusible, other_sibblings); end
4048
+
4049
+ # Assumes action.range == range && action.children.empty?
4050
+ #
4051
+ # @api private
4052
+ def merge(action); end
4053
+
4054
+ # @api private
4055
+ def place_in_hierarchy(action); end
4056
+
4057
+ # @api private
4058
+ def swallow(children); end
4059
+
4060
+ # @api private
4061
+ def with(range: T.unsafe(nil), enforcer: T.unsafe(nil), children: T.unsafe(nil), insert_before: T.unsafe(nil), replacement: T.unsafe(nil), insert_after: T.unsafe(nil)); end
4062
+ end
4063
+
4064
+ # @api public
4065
+ Parser::Source::TreeRewriter::DEPRECATION_WARNING = T.let(T.unsafe(nil), String)
4066
+
4067
+ # @api public
4068
+ Parser::Source::TreeRewriter::POLICY_TO_LEVEL = T.let(T.unsafe(nil), Hash)
4069
+
4070
+ # @api public
4071
+ class Parser::StaticEnvironment
4072
+ # @api public
4073
+ # @return [StaticEnvironment] a new instance of StaticEnvironment
4074
+ def initialize; end
4075
+
4076
+ # @api public
4077
+ def declare(name); end
4078
+
4079
+ # @api public
4080
+ def declare_anonymous_blockarg; end
4081
+
4082
+ # @api public
4083
+ def declare_forward_args; end
4084
+
4085
+ # @api public
4086
+ # @return [Boolean]
4087
+ def declared?(name); end
4088
+
4089
+ # @api public
4090
+ # @return [Boolean]
4091
+ def declared_anonymous_blockarg?; end
4092
+
4093
+ # @api public
4094
+ # @return [Boolean]
4095
+ def declared_forward_args?; end
4096
+
4097
+ # @api public
4098
+ # @return [Boolean]
4099
+ def empty?; end
4100
+
4101
+ # @api public
4102
+ def extend_dynamic; end
4103
+
4104
+ # @api public
4105
+ def extend_static; end
4106
+
4107
+ # @api public
4108
+ def reset; end
4109
+
4110
+ # @api public
4111
+ def unextend; end
4112
+ end
4113
+
4114
+ # @api public
4115
+ Parser::StaticEnvironment::ANONYMOUS_BLOCKARG = T.let(T.unsafe(nil), Symbol)
4116
+
4117
+ # @api public
4118
+ Parser::StaticEnvironment::FORWARD_ARGS = T.let(T.unsafe(nil), Symbol)
4119
+
4120
+ # {Parser::SyntaxError} is raised whenever parser detects a syntax error,
4121
+ # similar to the standard SyntaxError class.
4122
+ #
4123
+ # @api public
4124
+ class Parser::SyntaxError < ::StandardError
4125
+ # @api public
4126
+ # @return [SyntaxError] a new instance of SyntaxError
4127
+ def initialize(diagnostic); end
4128
+
4129
+ # @api public
4130
+ # @return [Parser::Diagnostic]
4131
+ def diagnostic; end
4132
+ end
4133
+
4134
+ # {Parser::TreeRewriter} offers a basic API that makes it easy to rewrite
4135
+ # existing ASTs. It's built on top of {Parser::AST::Processor} and
4136
+ # {Parser::Source::TreeRewriter}
4137
+ #
4138
+ # For example, assume you want to remove `do` tokens from a while statement.
4139
+ # You can do this as following:
4140
+ #
4141
+ # require 'parser/current'
4142
+ #
4143
+ # class RemoveDo < Parser::TreeRewriter
4144
+ # def on_while(node)
4145
+ # # Check if the statement starts with "do"
4146
+ # if node.location.begin.is?('do')
4147
+ # remove(node.location.begin)
4148
+ # end
4149
+ # end
4150
+ # end
4151
+ #
4152
+ # code = <<-EOF
4153
+ # while true do
4154
+ # puts 'hello'
4155
+ # end
4156
+ # EOF
4157
+ #
4158
+ # ast = Parser::CurrentRuby.parse code
4159
+ # buffer = Parser::Source::Buffer.new('(example)', source: code)
4160
+ # rewriter = RemoveDo.new
4161
+ #
4162
+ # # Rewrite the AST, returns a String with the new form.
4163
+ # puts rewriter.rewrite(buffer, ast)
4164
+ #
4165
+ # This would result in the following Ruby code:
4166
+ #
4167
+ # while true
4168
+ # puts 'hello'
4169
+ # end
4170
+ #
4171
+ # Keep in mind that {Parser::TreeRewriter} does not take care of indentation when
4172
+ # inserting/replacing code so you'll have to do this yourself.
4173
+ #
4174
+ # See also [a blog entry](http://whitequark.org/blog/2013/04/26/lets-play-with-ruby-code/)
4175
+ # describing rewriters in greater detail.
4176
+ #
4177
+ # @api public
4178
+ class Parser::TreeRewriter < ::Parser::AST::Processor
4179
+ # Returns `true` if the specified node is an assignment node, returns false
4180
+ # otherwise.
4181
+ #
4182
+ # @api public
4183
+ # @param node [Parser::AST::Node]
4184
+ # @return [Boolean]
4185
+ def assignment?(node); end
4186
+
4187
+ # Inserts new code after the given source range.
4188
+ #
4189
+ # @api public
4190
+ # @param range [Parser::Source::Range]
4191
+ # @param content [String]
4192
+ def insert_after(range, content); end
4193
+
4194
+ # Inserts new code before the given source range.
4195
+ #
4196
+ # @api public
4197
+ # @param range [Parser::Source::Range]
4198
+ # @param content [String]
4199
+ def insert_before(range, content); end
4200
+
4201
+ # Removes the source range.
4202
+ #
4203
+ # @api public
4204
+ # @param range [Parser::Source::Range]
4205
+ def remove(range); end
4206
+
4207
+ # Replaces the code of the source range `range` with `content`.
4208
+ #
4209
+ # @api public
4210
+ # @param range [Parser::Source::Range]
4211
+ # @param content [String]
4212
+ def replace(range, content); end
4213
+
4214
+ # Rewrites the AST/source buffer and returns a String containing the new
4215
+ # version.
4216
+ #
4217
+ # @api public
4218
+ # @param source_buffer [Parser::Source::Buffer]
4219
+ # @param ast [Parser::AST::Node]
4220
+ # @param crossing_deletions:, [Symbol] different_replacements:, swallowed_insertions:
4221
+ # policy arguments for TreeRewriter (optional)
4222
+ # @return [String]
4223
+ def rewrite(source_buffer, ast, **policy); end
4224
+
4225
+ # Wraps the given source range with the given values.
4226
+ #
4227
+ # @api public
4228
+ # @param range [Parser::Source::Range]
4229
+ # @param content [String]
4230
+ def wrap(range, before, after); end
4231
+ end
4232
+
4233
+ # @api public
4234
+ Parser::VERSION = T.let(T.unsafe(nil), String)
4235
+
4236
+ # @api public
4237
+ class Parser::VariablesStack
4238
+ # @api public
4239
+ # @return [VariablesStack] a new instance of VariablesStack
4240
+ def initialize; end
4241
+
4242
+ # @api public
4243
+ def declare(name); end
4244
+
4245
+ # @api public
4246
+ # @return [Boolean]
4247
+ def declared?(name); end
4248
+
4249
+ # @api public
4250
+ # @return [Boolean]
4251
+ def empty?; end
4252
+
4253
+ # @api public
4254
+ def pop; end
4255
+
4256
+ # @api public
4257
+ def push; end
4258
+
4259
+ # @api public
4260
+ def reset; end
4261
+ end