ruby-lsp 0.0.3 → 0.2.0

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