prism 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -1
  3. data/Makefile +6 -0
  4. data/README.md +1 -1
  5. data/config.yml +50 -35
  6. data/docs/fuzzing.md +1 -1
  7. data/docs/serialization.md +28 -29
  8. data/ext/prism/api_node.c +802 -770
  9. data/ext/prism/api_pack.c +20 -9
  10. data/ext/prism/extension.c +464 -162
  11. data/ext/prism/extension.h +1 -1
  12. data/include/prism/ast.h +3173 -763
  13. data/include/prism/defines.h +32 -9
  14. data/include/prism/diagnostic.h +36 -3
  15. data/include/prism/enc/pm_encoding.h +118 -28
  16. data/include/prism/node.h +38 -13
  17. data/include/prism/options.h +204 -0
  18. data/include/prism/pack.h +44 -33
  19. data/include/prism/parser.h +445 -200
  20. data/include/prism/prettyprint.h +12 -1
  21. data/include/prism/regexp.h +16 -2
  22. data/include/prism/util/pm_buffer.h +94 -16
  23. data/include/prism/util/pm_char.h +162 -48
  24. data/include/prism/util/pm_constant_pool.h +126 -32
  25. data/include/prism/util/pm_list.h +68 -38
  26. data/include/prism/util/pm_memchr.h +18 -3
  27. data/include/prism/util/pm_newline_list.h +70 -27
  28. data/include/prism/util/pm_state_stack.h +25 -7
  29. data/include/prism/util/pm_string.h +115 -27
  30. data/include/prism/util/pm_string_list.h +25 -6
  31. data/include/prism/util/pm_strncasecmp.h +32 -0
  32. data/include/prism/util/pm_strpbrk.h +31 -17
  33. data/include/prism/version.h +27 -2
  34. data/include/prism.h +224 -31
  35. data/lib/prism/compiler.rb +6 -3
  36. data/lib/prism/debug.rb +23 -7
  37. data/lib/prism/dispatcher.rb +33 -18
  38. data/lib/prism/dsl.rb +10 -5
  39. data/lib/prism/ffi.rb +132 -80
  40. data/lib/prism/lex_compat.rb +25 -15
  41. data/lib/prism/mutation_compiler.rb +10 -5
  42. data/lib/prism/node.rb +370 -135
  43. data/lib/prism/node_ext.rb +1 -1
  44. data/lib/prism/node_inspector.rb +1 -1
  45. data/lib/prism/pack.rb +79 -40
  46. data/lib/prism/parse_result/comments.rb +7 -2
  47. data/lib/prism/parse_result/newlines.rb +4 -0
  48. data/lib/prism/parse_result.rb +150 -30
  49. data/lib/prism/pattern.rb +11 -0
  50. data/lib/prism/ripper_compat.rb +28 -10
  51. data/lib/prism/serialize.rb +86 -54
  52. data/lib/prism/visitor.rb +10 -3
  53. data/lib/prism.rb +20 -2
  54. data/prism.gemspec +4 -2
  55. data/rbi/prism.rbi +104 -60
  56. data/rbi/prism_static.rbi +16 -2
  57. data/sig/prism.rbs +72 -43
  58. data/sig/prism_static.rbs +14 -1
  59. data/src/diagnostic.c +56 -53
  60. data/src/enc/pm_big5.c +1 -0
  61. data/src/enc/pm_euc_jp.c +1 -0
  62. data/src/enc/pm_gbk.c +1 -0
  63. data/src/enc/pm_shift_jis.c +1 -0
  64. data/src/enc/pm_tables.c +316 -80
  65. data/src/enc/pm_unicode.c +53 -8
  66. data/src/enc/pm_windows_31j.c +1 -0
  67. data/src/node.c +334 -321
  68. data/src/options.c +170 -0
  69. data/src/prettyprint.c +74 -47
  70. data/src/prism.c +1642 -856
  71. data/src/regexp.c +151 -95
  72. data/src/serialize.c +44 -20
  73. data/src/token_type.c +3 -1
  74. data/src/util/pm_buffer.c +45 -15
  75. data/src/util/pm_char.c +103 -57
  76. data/src/util/pm_constant_pool.c +51 -21
  77. data/src/util/pm_list.c +12 -4
  78. data/src/util/pm_memchr.c +5 -3
  79. data/src/util/pm_newline_list.c +20 -12
  80. data/src/util/pm_state_stack.c +9 -3
  81. data/src/util/pm_string.c +95 -85
  82. data/src/util/pm_string_list.c +14 -15
  83. data/src/util/pm_strncasecmp.c +10 -3
  84. data/src/util/pm_strpbrk.c +25 -19
  85. metadata +5 -3
  86. data/docs/prism.png +0 -0
data/lib/prism/node.rb CHANGED
@@ -9,13 +9,15 @@ module Prism
9
9
  # This represents a node in the tree. It is the parent class of all of the
10
10
  # various node types.
11
11
  class Node
12
+ # A Location instance that represents the location of this node in the
13
+ # source.
12
14
  attr_reader :location
13
15
 
14
- def newline?
16
+ def newline? # :nodoc:
15
17
  @newline ? true : false
16
18
  end
17
19
 
18
- def set_newline_flag(newline_marked)
20
+ def set_newline_flag(newline_marked) # :nodoc:
19
21
  line = location.start_line
20
22
  unless newline_marked[line]
21
23
  newline_marked[line] = true
@@ -103,6 +105,7 @@ module Prism
103
105
  keyword_loc.slice
104
106
  end
105
107
 
108
+ # def inspect(inspector: NodeInspector) -> String
106
109
  def inspect(inspector = NodeInspector.new)
107
110
  inspector << inspector.header(self)
108
111
  inspector << "├── new_name:\n"
@@ -207,6 +210,7 @@ module Prism
207
210
  keyword_loc.slice
208
211
  end
209
212
 
213
+ # def inspect(inspector: NodeInspector) -> String
210
214
  def inspect(inspector = NodeInspector.new)
211
215
  inspector << inspector.header(self)
212
216
  inspector << "├── new_name:\n"
@@ -311,6 +315,7 @@ module Prism
311
315
  operator_loc.slice
312
316
  end
313
317
 
318
+ # def inspect(inspector: NodeInspector) -> String
314
319
  def inspect(inspector = NodeInspector.new)
315
320
  inspector << inspector.header(self)
316
321
  inspector << "├── left:\n"
@@ -415,6 +420,7 @@ module Prism
415
420
  operator_loc.slice
416
421
  end
417
422
 
423
+ # def inspect(inspector: NodeInspector) -> String
418
424
  def inspect(inspector = NodeInspector.new)
419
425
  inspector << inspector.header(self)
420
426
  inspector << "├── left:\n"
@@ -514,6 +520,7 @@ module Prism
514
520
  flags.anybits?(ArgumentsNodeFlags::KEYWORD_SPLAT)
515
521
  end
516
522
 
523
+ # def inspect(inspector: NodeInspector) -> String
517
524
  def inspect(inspector = NodeInspector.new)
518
525
  inspector << inspector.header(self)
519
526
  inspector << "├── arguments: #{inspector.list("#{inspector.prefix}│ ", arguments)}"
@@ -622,6 +629,7 @@ module Prism
622
629
  closing_loc&.slice
623
630
  end
624
631
 
632
+ # def inspect(inspector: NodeInspector) -> String
625
633
  def inspect(inspector = NodeInspector.new)
626
634
  inspector << inspector.header(self)
627
635
  inspector << "├── elements: #{inspector.list("#{inspector.prefix}│ ", elements)}"
@@ -761,6 +769,7 @@ module Prism
761
769
  closing_loc&.slice
762
770
  end
763
771
 
772
+ # def inspect(inspector: NodeInspector) -> String
764
773
  def inspect(inspector = NodeInspector.new)
765
774
  inspector << inspector.header(self)
766
775
  if (constant = self.constant).nil?
@@ -879,6 +888,7 @@ module Prism
879
888
  operator_loc&.slice
880
889
  end
881
890
 
891
+ # def inspect(inspector: NodeInspector) -> String
882
892
  def inspect(inspector = NodeInspector.new)
883
893
  inspector << inspector.header(self)
884
894
  inspector << "├── key:\n"
@@ -984,6 +994,7 @@ module Prism
984
994
  operator_loc.slice
985
995
  end
986
996
 
997
+ # def inspect(inspector: NodeInspector) -> String
987
998
  def inspect(inspector = NodeInspector.new)
988
999
  inspector << inspector.header(self)
989
1000
  if (value = self.value).nil?
@@ -1075,6 +1086,7 @@ module Prism
1075
1086
  { name: name, location: location }
1076
1087
  end
1077
1088
 
1089
+ # def inspect(inspector: NodeInspector) -> String
1078
1090
  def inspect(inspector = NodeInspector.new)
1079
1091
  inspector << inspector.header(self)
1080
1092
  inspector << "└── name: #{name.inspect}\n"
@@ -1151,7 +1163,7 @@ module Prism
1151
1163
  visitor.visit_begin_node(self)
1152
1164
  end
1153
1165
 
1154
- def set_newline_flag(newline_marked)
1166
+ def set_newline_flag(newline_marked) # :nodoc:
1155
1167
  # Never mark BeginNode with a newline flag, mark children instead
1156
1168
  end
1157
1169
 
@@ -1206,6 +1218,7 @@ module Prism
1206
1218
  end_keyword_loc&.slice
1207
1219
  end
1208
1220
 
1221
+ # def inspect(inspector: NodeInspector) -> String
1209
1222
  def inspect(inspector = NodeInspector.new)
1210
1223
  inspector << inspector.header(self)
1211
1224
  inspector << "├── begin_keyword_loc: #{inspector.location(begin_keyword_loc)}\n"
@@ -1328,6 +1341,7 @@ module Prism
1328
1341
  operator_loc.slice
1329
1342
  end
1330
1343
 
1344
+ # def inspect(inspector: NodeInspector) -> String
1331
1345
  def inspect(inspector = NodeInspector.new)
1332
1346
  inspector << inspector.header(self)
1333
1347
  if (expression = self.expression).nil?
@@ -1419,6 +1433,7 @@ module Prism
1419
1433
  { name: name, location: location }
1420
1434
  end
1421
1435
 
1436
+ # def inspect(inspector: NodeInspector) -> String
1422
1437
  def inspect(inspector = NodeInspector.new)
1423
1438
  inspector << inspector.header(self)
1424
1439
  inspector << "└── name: #{name.inspect}\n"
@@ -1537,6 +1552,7 @@ module Prism
1537
1552
  closing_loc.slice
1538
1553
  end
1539
1554
 
1555
+ # def inspect(inspector: NodeInspector) -> String
1540
1556
  def inspect(inspector = NodeInspector.new)
1541
1557
  inspector << inspector.header(self)
1542
1558
  inspector << "├── locals: #{locals.inspect}\n"
@@ -1652,6 +1668,7 @@ module Prism
1652
1668
  operator_loc.slice
1653
1669
  end
1654
1670
 
1671
+ # def inspect(inspector: NodeInspector) -> String
1655
1672
  def inspect(inspector = NodeInspector.new)
1656
1673
  inspector << inspector.header(self)
1657
1674
  if (name = self.name).nil?
@@ -1775,6 +1792,7 @@ module Prism
1775
1792
  closing_loc&.slice
1776
1793
  end
1777
1794
 
1795
+ # def inspect(inspector: NodeInspector) -> String
1778
1796
  def inspect(inspector = NodeInspector.new)
1779
1797
  inspector << inspector.header(self)
1780
1798
  if (parameters = self.parameters).nil?
@@ -1880,6 +1898,7 @@ module Prism
1880
1898
  keyword_loc.slice
1881
1899
  end
1882
1900
 
1901
+ # def inspect(inspector: NodeInspector) -> String
1883
1902
  def inspect(inspector = NodeInspector.new)
1884
1903
  inspector << inspector.header(self)
1885
1904
  if (arguments = self.arguments).nil?
@@ -2034,6 +2053,7 @@ module Prism
2034
2053
  operator_loc.slice
2035
2054
  end
2036
2055
 
2056
+ # def inspect(inspector: NodeInspector) -> String
2037
2057
  def inspect(inspector = NodeInspector.new)
2038
2058
  inspector << inspector.header(self)
2039
2059
  if (receiver = self.receiver).nil?
@@ -2222,6 +2242,7 @@ module Prism
2222
2242
  flags.anybits?(CallNodeFlags::VARIABLE_CALL)
2223
2243
  end
2224
2244
 
2245
+ # def inspect(inspector: NodeInspector) -> String
2225
2246
  def inspect(inspector = NodeInspector.new)
2226
2247
  inspector << inspector.header(self)
2227
2248
  if (receiver = self.receiver).nil?
@@ -2394,6 +2415,7 @@ module Prism
2394
2415
  flags.anybits?(CallNodeFlags::VARIABLE_CALL)
2395
2416
  end
2396
2417
 
2418
+ # def inspect(inspector: NodeInspector) -> String
2397
2419
  def inspect(inspector = NodeInspector.new)
2398
2420
  inspector << inspector.header(self)
2399
2421
  if (receiver = self.receiver).nil?
@@ -2557,6 +2579,7 @@ module Prism
2557
2579
  operator_loc.slice
2558
2580
  end
2559
2581
 
2582
+ # def inspect(inspector: NodeInspector) -> String
2560
2583
  def inspect(inspector = NodeInspector.new)
2561
2584
  inspector << inspector.header(self)
2562
2585
  if (receiver = self.receiver).nil?
@@ -2671,6 +2694,7 @@ module Prism
2671
2694
  operator_loc.slice
2672
2695
  end
2673
2696
 
2697
+ # def inspect(inspector: NodeInspector) -> String
2674
2698
  def inspect(inspector = NodeInspector.new)
2675
2699
  inspector << inspector.header(self)
2676
2700
  inspector << "├── value:\n"
@@ -2712,10 +2736,10 @@ module Prism
2712
2736
 
2713
2737
  # Represents the use of a case statement.
2714
2738
  #
2715
- # case true
2716
- # ^^^^^^^^^
2717
- # when false
2718
- # end
2739
+ # case true
2740
+ # when false
2741
+ # end
2742
+ # ^^^^^^^^^^
2719
2743
  class CaseNode < Node
2720
2744
  # attr_reader predicate: Node?
2721
2745
  attr_reader :predicate
@@ -2796,6 +2820,7 @@ module Prism
2796
2820
  end_keyword_loc.slice
2797
2821
  end
2798
2822
 
2823
+ # def inspect(inspector: NodeInspector) -> String
2799
2824
  def inspect(inspector = NodeInspector.new)
2800
2825
  inspector << inspector.header(self)
2801
2826
  if (predicate = self.predicate).nil?
@@ -2949,6 +2974,7 @@ module Prism
2949
2974
  end_keyword_loc.slice
2950
2975
  end
2951
2976
 
2977
+ # def inspect(inspector: NodeInspector) -> String
2952
2978
  def inspect(inspector = NodeInspector.new)
2953
2979
  inspector << inspector.header(self)
2954
2980
  inspector << "├── locals: #{locals.inspect}\n"
@@ -3005,7 +3031,7 @@ module Prism
3005
3031
  # Represents the use of the `&&=` operator for assignment to a class variable.
3006
3032
  #
3007
3033
  # @@target &&= value
3008
- # ^^^^^^^^^^^^^^^^
3034
+ # ^^^^^^^^^^^^^^^^^^
3009
3035
  class ClassVariableAndWriteNode < Node
3010
3036
  # attr_reader name: Symbol
3011
3037
  attr_reader :name
@@ -3072,6 +3098,7 @@ module Prism
3072
3098
  operator_loc.slice
3073
3099
  end
3074
3100
 
3101
+ # def inspect(inspector: NodeInspector) -> String
3075
3102
  def inspect(inspector = NodeInspector.new)
3076
3103
  inspector << inspector.header(self)
3077
3104
  inspector << "├── name: #{name.inspect}\n"
@@ -3181,6 +3208,7 @@ module Prism
3181
3208
  { name: name, name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
3182
3209
  end
3183
3210
 
3211
+ # def inspect(inspector: NodeInspector) -> String
3184
3212
  def inspect(inspector = NodeInspector.new)
3185
3213
  inspector << inspector.header(self)
3186
3214
  inspector << "├── name: #{name.inspect}\n"
@@ -3291,6 +3319,7 @@ module Prism
3291
3319
  operator_loc.slice
3292
3320
  end
3293
3321
 
3322
+ # def inspect(inspector: NodeInspector) -> String
3294
3323
  def inspect(inspector = NodeInspector.new)
3295
3324
  inspector << inspector.header(self)
3296
3325
  inspector << "├── name: #{name.inspect}\n"
@@ -3380,6 +3409,7 @@ module Prism
3380
3409
  { name: name, location: location }
3381
3410
  end
3382
3411
 
3412
+ # def inspect(inspector: NodeInspector) -> String
3383
3413
  def inspect(inspector = NodeInspector.new)
3384
3414
  inspector << inspector.header(self)
3385
3415
  inspector << "└── name: #{name.inspect}\n"
@@ -3465,6 +3495,7 @@ module Prism
3465
3495
  { name: name, location: location }
3466
3496
  end
3467
3497
 
3498
+ # def inspect(inspector: NodeInspector) -> String
3468
3499
  def inspect(inspector = NodeInspector.new)
3469
3500
  inspector << inspector.header(self)
3470
3501
  inspector << "└── name: #{name.inspect}\n"
@@ -3570,6 +3601,7 @@ module Prism
3570
3601
  operator_loc&.slice
3571
3602
  end
3572
3603
 
3604
+ # def inspect(inspector: NodeInspector) -> String
3573
3605
  def inspect(inspector = NodeInspector.new)
3574
3606
  inspector << inspector.header(self)
3575
3607
  inspector << "├── name: #{name.inspect}\n"
@@ -3679,6 +3711,7 @@ module Prism
3679
3711
  operator_loc.slice
3680
3712
  end
3681
3713
 
3714
+ # def inspect(inspector: NodeInspector) -> String
3682
3715
  def inspect(inspector = NodeInspector.new)
3683
3716
  inspector << inspector.header(self)
3684
3717
  inspector << "├── name: #{name.inspect}\n"
@@ -3788,6 +3821,7 @@ module Prism
3788
3821
  { name: name, name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
3789
3822
  end
3790
3823
 
3824
+ # def inspect(inspector: NodeInspector) -> String
3791
3825
  def inspect(inspector = NodeInspector.new)
3792
3826
  inspector << inspector.header(self)
3793
3827
  inspector << "├── name: #{name.inspect}\n"
@@ -3898,6 +3932,7 @@ module Prism
3898
3932
  operator_loc.slice
3899
3933
  end
3900
3934
 
3935
+ # def inspect(inspector: NodeInspector) -> String
3901
3936
  def inspect(inspector = NodeInspector.new)
3902
3937
  inspector << inspector.header(self)
3903
3938
  inspector << "├── name: #{name.inspect}\n"
@@ -4002,6 +4037,7 @@ module Prism
4002
4037
  operator_loc.slice
4003
4038
  end
4004
4039
 
4040
+ # def inspect(inspector: NodeInspector) -> String
4005
4041
  def inspect(inspector = NodeInspector.new)
4006
4042
  inspector << inspector.header(self)
4007
4043
  inspector << "├── target:\n"
@@ -4109,6 +4145,7 @@ module Prism
4109
4145
  delimiter_loc.slice
4110
4146
  end
4111
4147
 
4148
+ # def inspect(inspector: NodeInspector) -> String
4112
4149
  def inspect(inspector = NodeInspector.new)
4113
4150
  inspector << inspector.header(self)
4114
4151
  if (parent = self.parent).nil?
@@ -4217,6 +4254,7 @@ module Prism
4217
4254
  { target: target, operator_loc: operator_loc, value: value, operator: operator, location: location }
4218
4255
  end
4219
4256
 
4257
+ # def inspect(inspector: NodeInspector) -> String
4220
4258
  def inspect(inspector = NodeInspector.new)
4221
4259
  inspector << inspector.header(self)
4222
4260
  inspector << "├── target:\n"
@@ -4322,6 +4360,7 @@ module Prism
4322
4360
  operator_loc.slice
4323
4361
  end
4324
4362
 
4363
+ # def inspect(inspector: NodeInspector) -> String
4325
4364
  def inspect(inspector = NodeInspector.new)
4326
4365
  inspector << inspector.header(self)
4327
4366
  inspector << "├── target:\n"
@@ -4429,6 +4468,7 @@ module Prism
4429
4468
  delimiter_loc.slice
4430
4469
  end
4431
4470
 
4471
+ # def inspect(inspector: NodeInspector) -> String
4432
4472
  def inspect(inspector = NodeInspector.new)
4433
4473
  inspector << inspector.header(self)
4434
4474
  if (parent = self.parent).nil?
@@ -4543,6 +4583,7 @@ module Prism
4543
4583
  operator_loc.slice
4544
4584
  end
4545
4585
 
4586
+ # def inspect(inspector: NodeInspector) -> String
4546
4587
  def inspect(inspector = NodeInspector.new)
4547
4588
  inspector << inspector.header(self)
4548
4589
  inspector << "├── target:\n"
@@ -4632,6 +4673,7 @@ module Prism
4632
4673
  { name: name, location: location }
4633
4674
  end
4634
4675
 
4676
+ # def inspect(inspector: NodeInspector) -> String
4635
4677
  def inspect(inspector = NodeInspector.new)
4636
4678
  inspector << inspector.header(self)
4637
4679
  inspector << "└── name: #{name.inspect}\n"
@@ -4717,6 +4759,7 @@ module Prism
4717
4759
  { name: name, location: location }
4718
4760
  end
4719
4761
 
4762
+ # def inspect(inspector: NodeInspector) -> String
4720
4763
  def inspect(inspector = NodeInspector.new)
4721
4764
  inspector << inspector.header(self)
4722
4765
  inspector << "└── name: #{name.inspect}\n"
@@ -4822,6 +4865,7 @@ module Prism
4822
4865
  operator_loc.slice
4823
4866
  end
4824
4867
 
4868
+ # def inspect(inspector: NodeInspector) -> String
4825
4869
  def inspect(inspector = NodeInspector.new)
4826
4870
  inspector << inspector.header(self)
4827
4871
  inspector << "├── name: #{name.inspect}\n"
@@ -5001,6 +5045,7 @@ module Prism
5001
5045
  end_keyword_loc&.slice
5002
5046
  end
5003
5047
 
5048
+ # def inspect(inspector: NodeInspector) -> String
5004
5049
  def inspect(inspector = NodeInspector.new)
5005
5050
  inspector << inspector.header(self)
5006
5051
  inspector << "├── name: #{name.inspect}\n"
@@ -5142,6 +5187,7 @@ module Prism
5142
5187
  keyword_loc.slice
5143
5188
  end
5144
5189
 
5190
+ # def inspect(inspector: NodeInspector) -> String
5145
5191
  def inspect(inspector = NodeInspector.new)
5146
5192
  inspector << inspector.header(self)
5147
5193
  inspector << "├── lparen_loc: #{inspector.location(lparen_loc)}\n"
@@ -5253,6 +5299,7 @@ module Prism
5253
5299
  end_keyword_loc&.slice
5254
5300
  end
5255
5301
 
5302
+ # def inspect(inspector: NodeInspector) -> String
5256
5303
  def inspect(inspector = NodeInspector.new)
5257
5304
  inspector << inspector.header(self)
5258
5305
  inspector << "├── else_keyword_loc: #{inspector.location(else_keyword_loc)}\n"
@@ -5367,6 +5414,7 @@ module Prism
5367
5414
  closing_loc.slice
5368
5415
  end
5369
5416
 
5417
+ # def inspect(inspector: NodeInspector) -> String
5370
5418
  def inspect(inspector = NodeInspector.new)
5371
5419
  inspector << inspector.header(self)
5372
5420
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -5469,6 +5517,7 @@ module Prism
5469
5517
  operator_loc.slice
5470
5518
  end
5471
5519
 
5520
+ # def inspect(inspector: NodeInspector) -> String
5472
5521
  def inspect(inspector = NodeInspector.new)
5473
5522
  inspector << inspector.header(self)
5474
5523
  inspector << "├── operator_loc: #{inspector.location(operator_loc)}\n"
@@ -5582,6 +5631,7 @@ module Prism
5582
5631
  end_keyword_loc.slice
5583
5632
  end
5584
5633
 
5634
+ # def inspect(inspector: NodeInspector) -> String
5585
5635
  def inspect(inspector = NodeInspector.new)
5586
5636
  inspector << inspector.header(self)
5587
5637
  inspector << "├── ensure_keyword_loc: #{inspector.location(ensure_keyword_loc)}\n"
@@ -5669,6 +5719,7 @@ module Prism
5669
5719
  { location: location }
5670
5720
  end
5671
5721
 
5722
+ # def inspect(inspector: NodeInspector) -> String
5672
5723
  def inspect(inspector = NodeInspector.new)
5673
5724
  inspector << inspector.header(self)
5674
5725
  inspector.to_str
@@ -5706,13 +5757,13 @@ module Prism
5706
5757
  # Represents a find pattern in pattern matching.
5707
5758
  #
5708
5759
  # foo in *bar, baz, *qux
5709
- # ^^^^^^^^^^^^^^^^^^^^^^
5760
+ # ^^^^^^^^^^^^^^^
5710
5761
  #
5711
5762
  # foo in [*bar, baz, *qux]
5712
- # ^^^^^^^^^^^^^^^^^^^^^^^^
5763
+ # ^^^^^^^^^^^^^^^^^
5713
5764
  #
5714
5765
  # foo in Foo(*bar, baz, *qux)
5715
- # ^^^^^^^^^^^^^^^^^^^^^^^^^^^
5766
+ # ^^^^^^^^^^^^^^^^^^^^
5716
5767
  class FindPatternNode < Node
5717
5768
  # attr_reader constant: Node?
5718
5769
  attr_reader :constant
@@ -5799,6 +5850,7 @@ module Prism
5799
5850
  closing_loc&.slice
5800
5851
  end
5801
5852
 
5853
+ # def inspect(inspector: NodeInspector) -> String
5802
5854
  def inspect(inspector = NodeInspector.new)
5803
5855
  inspector << inspector.header(self)
5804
5856
  if (constant = self.constant).nil?
@@ -5924,6 +5976,7 @@ module Prism
5924
5976
  flags.anybits?(RangeFlags::EXCLUDE_END)
5925
5977
  end
5926
5978
 
5979
+ # def inspect(inspector: NodeInspector) -> String
5927
5980
  def inspect(inspector = NodeInspector.new)
5928
5981
  inspector << inspector.header(self)
5929
5982
  if (left = self.left).nil?
@@ -6018,6 +6071,7 @@ module Prism
6018
6071
  { location: location }
6019
6072
  end
6020
6073
 
6074
+ # def inspect(inspector: NodeInspector) -> String
6021
6075
  def inspect(inspector = NodeInspector.new)
6022
6076
  inspector << inspector.header(self)
6023
6077
  inspector.to_str
@@ -6156,6 +6210,7 @@ module Prism
6156
6210
  end_keyword_loc.slice
6157
6211
  end
6158
6212
 
6213
+ # def inspect(inspector: NodeInspector) -> String
6159
6214
  def inspect(inspector = NodeInspector.new)
6160
6215
  inspector << inspector.header(self)
6161
6216
  inspector << "├── index:\n"
@@ -6208,7 +6263,7 @@ module Prism
6208
6263
  #
6209
6264
  # def foo(...)
6210
6265
  # bar(...)
6211
- # ^^^^^^^^
6266
+ # ^^^
6212
6267
  # end
6213
6268
  class ForwardingArgumentsNode < Node
6214
6269
  # def initialize: (location: Location) -> void
@@ -6251,6 +6306,7 @@ module Prism
6251
6306
  { location: location }
6252
6307
  end
6253
6308
 
6309
+ # def inspect(inspector: NodeInspector) -> String
6254
6310
  def inspect(inspector = NodeInspector.new)
6255
6311
  inspector << inspector.header(self)
6256
6312
  inspector.to_str
@@ -6331,6 +6387,7 @@ module Prism
6331
6387
  { location: location }
6332
6388
  end
6333
6389
 
6390
+ # def inspect(inspector: NodeInspector) -> String
6334
6391
  def inspect(inspector = NodeInspector.new)
6335
6392
  inspector << inspector.header(self)
6336
6393
  inspector.to_str
@@ -6417,6 +6474,7 @@ module Prism
6417
6474
  { block: block, location: location }
6418
6475
  end
6419
6476
 
6477
+ # def inspect(inspector: NodeInspector) -> String
6420
6478
  def inspect(inspector = NodeInspector.new)
6421
6479
  inspector << inspector.header(self)
6422
6480
  if (block = self.block).nil?
@@ -6527,6 +6585,7 @@ module Prism
6527
6585
  operator_loc.slice
6528
6586
  end
6529
6587
 
6588
+ # def inspect(inspector: NodeInspector) -> String
6530
6589
  def inspect(inspector = NodeInspector.new)
6531
6590
  inspector << inspector.header(self)
6532
6591
  inspector << "├── name: #{name.inspect}\n"
@@ -6636,6 +6695,7 @@ module Prism
6636
6695
  { name: name, name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
6637
6696
  end
6638
6697
 
6698
+ # def inspect(inspector: NodeInspector) -> String
6639
6699
  def inspect(inspector = NodeInspector.new)
6640
6700
  inspector << inspector.header(self)
6641
6701
  inspector << "├── name: #{name.inspect}\n"
@@ -6746,6 +6806,7 @@ module Prism
6746
6806
  operator_loc.slice
6747
6807
  end
6748
6808
 
6809
+ # def inspect(inspector: NodeInspector) -> String
6749
6810
  def inspect(inspector = NodeInspector.new)
6750
6811
  inspector << inspector.header(self)
6751
6812
  inspector << "├── name: #{name.inspect}\n"
@@ -6835,6 +6896,7 @@ module Prism
6835
6896
  { name: name, location: location }
6836
6897
  end
6837
6898
 
6899
+ # def inspect(inspector: NodeInspector) -> String
6838
6900
  def inspect(inspector = NodeInspector.new)
6839
6901
  inspector << inspector.header(self)
6840
6902
  inspector << "└── name: #{name.inspect}\n"
@@ -6920,6 +6982,7 @@ module Prism
6920
6982
  { name: name, location: location }
6921
6983
  end
6922
6984
 
6985
+ # def inspect(inspector: NodeInspector) -> String
6923
6986
  def inspect(inspector = NodeInspector.new)
6924
6987
  inspector << inspector.header(self)
6925
6988
  inspector << "└── name: #{name.inspect}\n"
@@ -7025,6 +7088,7 @@ module Prism
7025
7088
  operator_loc.slice
7026
7089
  end
7027
7090
 
7091
+ # def inspect(inspector: NodeInspector) -> String
7028
7092
  def inspect(inspector = NodeInspector.new)
7029
7093
  inspector << inspector.header(self)
7030
7094
  inspector << "├── name: #{name.inspect}\n"
@@ -7134,6 +7198,7 @@ module Prism
7134
7198
  closing_loc.slice
7135
7199
  end
7136
7200
 
7201
+ # def inspect(inspector: NodeInspector) -> String
7137
7202
  def inspect(inspector = NodeInspector.new)
7138
7203
  inspector << inspector.header(self)
7139
7204
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -7258,6 +7323,7 @@ module Prism
7258
7323
  closing_loc&.slice
7259
7324
  end
7260
7325
 
7326
+ # def inspect(inspector: NodeInspector) -> String
7261
7327
  def inspect(inspector = NodeInspector.new)
7262
7328
  inspector << inspector.header(self)
7263
7329
  if (constant = self.constant).nil?
@@ -7345,7 +7411,7 @@ module Prism
7345
7411
  visitor.visit_if_node(self)
7346
7412
  end
7347
7413
 
7348
- def set_newline_flag(newline_marked)
7414
+ def set_newline_flag(newline_marked) # :nodoc:
7349
7415
  predicate.set_newline_flag(newline_marked)
7350
7416
  end
7351
7417
 
@@ -7398,6 +7464,7 @@ module Prism
7398
7464
  end_keyword_loc&.slice
7399
7465
  end
7400
7466
 
7467
+ # def inspect(inspector: NodeInspector) -> String
7401
7468
  def inspect(inspector = NodeInspector.new)
7402
7469
  inspector << inspector.header(self)
7403
7470
  inspector << "├── if_keyword_loc: #{inspector.location(if_keyword_loc)}\n"
@@ -7498,6 +7565,7 @@ module Prism
7498
7565
  { numeric: numeric, location: location }
7499
7566
  end
7500
7567
 
7568
+ # def inspect(inspector: NodeInspector) -> String
7501
7569
  def inspect(inspector = NodeInspector.new)
7502
7570
  inspector << inspector.header(self)
7503
7571
  inspector << "└── numeric:\n"
@@ -7588,6 +7656,7 @@ module Prism
7588
7656
  { value: value, location: location }
7589
7657
  end
7590
7658
 
7659
+ # def inspect(inspector: NodeInspector) -> String
7591
7660
  def inspect(inspector = NodeInspector.new)
7592
7661
  inspector << inspector.header(self)
7593
7662
  inspector << "└── value:\n"
@@ -7702,6 +7771,7 @@ module Prism
7702
7771
  then_loc&.slice
7703
7772
  end
7704
7773
 
7774
+ # def inspect(inspector: NodeInspector) -> String
7705
7775
  def inspect(inspector = NodeInspector.new)
7706
7776
  inspector << inspector.header(self)
7707
7777
  inspector << "├── pattern:\n"
@@ -7871,6 +7941,7 @@ module Prism
7871
7941
  operator_loc.slice
7872
7942
  end
7873
7943
 
7944
+ # def inspect(inspector: NodeInspector) -> String
7874
7945
  def inspect(inspector = NodeInspector.new)
7875
7946
  inspector << inspector.header(self)
7876
7947
  if (receiver = self.receiver).nil?
@@ -8056,6 +8127,7 @@ module Prism
8056
8127
  flags.anybits?(CallNodeFlags::VARIABLE_CALL)
8057
8128
  end
8058
8129
 
8130
+ # def inspect(inspector: NodeInspector) -> String
8059
8131
  def inspect(inspector = NodeInspector.new)
8060
8132
  inspector << inspector.header(self)
8061
8133
  if (receiver = self.receiver).nil?
@@ -8242,6 +8314,7 @@ module Prism
8242
8314
  operator_loc.slice
8243
8315
  end
8244
8316
 
8317
+ # def inspect(inspector: NodeInspector) -> String
8245
8318
  def inspect(inspector = NodeInspector.new)
8246
8319
  inspector << inspector.header(self)
8247
8320
  if (receiver = self.receiver).nil?
@@ -8372,6 +8445,7 @@ module Prism
8372
8445
  operator_loc.slice
8373
8446
  end
8374
8447
 
8448
+ # def inspect(inspector: NodeInspector) -> String
8375
8449
  def inspect(inspector = NodeInspector.new)
8376
8450
  inspector << inspector.header(self)
8377
8451
  inspector << "├── name: #{name.inspect}\n"
@@ -8481,6 +8555,7 @@ module Prism
8481
8555
  { name: name, name_loc: name_loc, operator_loc: operator_loc, value: value, operator: operator, location: location }
8482
8556
  end
8483
8557
 
8558
+ # def inspect(inspector: NodeInspector) -> String
8484
8559
  def inspect(inspector = NodeInspector.new)
8485
8560
  inspector << inspector.header(self)
8486
8561
  inspector << "├── name: #{name.inspect}\n"
@@ -8591,6 +8666,7 @@ module Prism
8591
8666
  operator_loc.slice
8592
8667
  end
8593
8668
 
8669
+ # def inspect(inspector: NodeInspector) -> String
8594
8670
  def inspect(inspector = NodeInspector.new)
8595
8671
  inspector << inspector.header(self)
8596
8672
  inspector << "├── name: #{name.inspect}\n"
@@ -8680,6 +8756,7 @@ module Prism
8680
8756
  { name: name, location: location }
8681
8757
  end
8682
8758
 
8759
+ # def inspect(inspector: NodeInspector) -> String
8683
8760
  def inspect(inspector = NodeInspector.new)
8684
8761
  inspector << inspector.header(self)
8685
8762
  inspector << "└── name: #{name.inspect}\n"
@@ -8765,6 +8842,7 @@ module Prism
8765
8842
  { name: name, location: location }
8766
8843
  end
8767
8844
 
8845
+ # def inspect(inspector: NodeInspector) -> String
8768
8846
  def inspect(inspector = NodeInspector.new)
8769
8847
  inspector << inspector.header(self)
8770
8848
  inspector << "└── name: #{name.inspect}\n"
@@ -8870,6 +8948,7 @@ module Prism
8870
8948
  operator_loc.slice
8871
8949
  end
8872
8950
 
8951
+ # def inspect(inspector: NodeInspector) -> String
8873
8952
  def inspect(inspector = NodeInspector.new)
8874
8953
  inspector << inspector.header(self)
8875
8954
  inspector << "├── name: #{name.inspect}\n"
@@ -8979,6 +9058,7 @@ module Prism
8979
9058
  flags.anybits?(IntegerBaseFlags::HEXADECIMAL)
8980
9059
  end
8981
9060
 
9061
+ # def inspect(inspector: NodeInspector) -> String
8982
9062
  def inspect(inspector = NodeInspector.new)
8983
9063
  inspector << inspector.header(self)
8984
9064
  flags = [("binary" if binary?), ("octal" if octal?), ("decimal" if decimal?), ("hexadecimal" if hexadecimal?)].compact
@@ -9048,7 +9128,7 @@ module Prism
9048
9128
  visitor.visit_interpolated_match_last_line_node(self)
9049
9129
  end
9050
9130
 
9051
- def set_newline_flag(newline_marked)
9131
+ def set_newline_flag(newline_marked) # :nodoc:
9052
9132
  first = parts.first
9053
9133
  first.set_newline_flag(newline_marked) if first
9054
9134
  end
@@ -9137,6 +9217,7 @@ module Prism
9137
9217
  flags.anybits?(RegularExpressionFlags::UTF_8)
9138
9218
  end
9139
9219
 
9220
+ # def inspect(inspector: NodeInspector) -> String
9140
9221
  def inspect(inspector = NodeInspector.new)
9141
9222
  inspector << inspector.header(self)
9142
9223
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -9207,7 +9288,7 @@ module Prism
9207
9288
  visitor.visit_interpolated_regular_expression_node(self)
9208
9289
  end
9209
9290
 
9210
- def set_newline_flag(newline_marked)
9291
+ def set_newline_flag(newline_marked) # :nodoc:
9211
9292
  first = parts.first
9212
9293
  first.set_newline_flag(newline_marked) if first
9213
9294
  end
@@ -9296,6 +9377,7 @@ module Prism
9296
9377
  flags.anybits?(RegularExpressionFlags::UTF_8)
9297
9378
  end
9298
9379
 
9380
+ # def inspect(inspector: NodeInspector) -> String
9299
9381
  def inspect(inspector = NodeInspector.new)
9300
9382
  inspector << inspector.header(self)
9301
9383
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -9362,7 +9444,7 @@ module Prism
9362
9444
  visitor.visit_interpolated_string_node(self)
9363
9445
  end
9364
9446
 
9365
- def set_newline_flag(newline_marked)
9447
+ def set_newline_flag(newline_marked) # :nodoc:
9366
9448
  first = parts.first
9367
9449
  first.set_newline_flag(newline_marked) if first
9368
9450
  end
@@ -9410,6 +9492,7 @@ module Prism
9410
9492
  closing_loc&.slice
9411
9493
  end
9412
9494
 
9495
+ # def inspect(inspector: NodeInspector) -> String
9413
9496
  def inspect(inspector = NodeInspector.new)
9414
9497
  inspector << inspector.header(self)
9415
9498
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -9474,7 +9557,7 @@ module Prism
9474
9557
  visitor.visit_interpolated_symbol_node(self)
9475
9558
  end
9476
9559
 
9477
- def set_newline_flag(newline_marked)
9560
+ def set_newline_flag(newline_marked) # :nodoc:
9478
9561
  first = parts.first
9479
9562
  first.set_newline_flag(newline_marked) if first
9480
9563
  end
@@ -9522,6 +9605,7 @@ module Prism
9522
9605
  closing_loc&.slice
9523
9606
  end
9524
9607
 
9608
+ # def inspect(inspector: NodeInspector) -> String
9525
9609
  def inspect(inspector = NodeInspector.new)
9526
9610
  inspector << inspector.header(self)
9527
9611
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -9586,7 +9670,7 @@ module Prism
9586
9670
  visitor.visit_interpolated_x_string_node(self)
9587
9671
  end
9588
9672
 
9589
- def set_newline_flag(newline_marked)
9673
+ def set_newline_flag(newline_marked) # :nodoc:
9590
9674
  first = parts.first
9591
9675
  first.set_newline_flag(newline_marked) if first
9592
9676
  end
@@ -9634,6 +9718,7 @@ module Prism
9634
9718
  closing_loc.slice
9635
9719
  end
9636
9720
 
9721
+ # def inspect(inspector: NodeInspector) -> String
9637
9722
  def inspect(inspector = NodeInspector.new)
9638
9723
  inspector << inspector.header(self)
9639
9724
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -9721,6 +9806,7 @@ module Prism
9721
9806
  { elements: elements, location: location }
9722
9807
  end
9723
9808
 
9809
+ # def inspect(inspector: NodeInspector) -> String
9724
9810
  def inspect(inspector = NodeInspector.new)
9725
9811
  inspector << inspector.header(self)
9726
9812
  inspector << "└── elements: #{inspector.list("#{inspector.prefix} ", elements)}"
@@ -9756,115 +9842,6 @@ module Prism
9756
9842
  end
9757
9843
  end
9758
9844
 
9759
- # Represents a keyword parameter to a method, block, or lambda definition.
9760
- #
9761
- # def a(b:)
9762
- # ^^
9763
- # end
9764
- #
9765
- # def a(b: 1)
9766
- # ^^^^
9767
- # end
9768
- class KeywordParameterNode < Node
9769
- # attr_reader name: Symbol
9770
- attr_reader :name
9771
-
9772
- # attr_reader name_loc: Location
9773
- attr_reader :name_loc
9774
-
9775
- # attr_reader value: Node?
9776
- attr_reader :value
9777
-
9778
- # def initialize: (name: Symbol, name_loc: Location, value: Node?, location: Location) -> void
9779
- def initialize(name, name_loc, value, location)
9780
- @name = name
9781
- @name_loc = name_loc
9782
- @value = value
9783
- @location = location
9784
- end
9785
-
9786
- # def accept: (visitor: Visitor) -> void
9787
- def accept(visitor)
9788
- visitor.visit_keyword_parameter_node(self)
9789
- end
9790
-
9791
- # def child_nodes: () -> Array[nil | Node]
9792
- def child_nodes
9793
- [value]
9794
- end
9795
-
9796
- # def compact_child_nodes: () -> Array[Node]
9797
- def compact_child_nodes
9798
- compact = []
9799
- compact << value if value
9800
- compact
9801
- end
9802
-
9803
- # def comment_targets: () -> Array[Node | Location]
9804
- def comment_targets
9805
- [name_loc, *value]
9806
- end
9807
-
9808
- # def copy: (**params) -> KeywordParameterNode
9809
- def copy(**params)
9810
- KeywordParameterNode.new(
9811
- params.fetch(:name) { name },
9812
- params.fetch(:name_loc) { name_loc },
9813
- params.fetch(:value) { value },
9814
- params.fetch(:location) { location },
9815
- )
9816
- end
9817
-
9818
- # def deconstruct: () -> Array[nil | Node]
9819
- alias deconstruct child_nodes
9820
-
9821
- # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
9822
- def deconstruct_keys(keys)
9823
- { name: name, name_loc: name_loc, value: value, location: location }
9824
- end
9825
-
9826
- def inspect(inspector = NodeInspector.new)
9827
- inspector << inspector.header(self)
9828
- inspector << "├── name: #{name.inspect}\n"
9829
- inspector << "├── name_loc: #{inspector.location(name_loc)}\n"
9830
- if (value = self.value).nil?
9831
- inspector << "└── value: ∅\n"
9832
- else
9833
- inspector << "└── value:\n"
9834
- inspector << value.inspect(inspector.child_inspector(" ")).delete_prefix(inspector.prefix)
9835
- end
9836
- inspector.to_str
9837
- end
9838
-
9839
- # Sometimes you want to check an instance of a node against a list of
9840
- # classes to see what kind of behavior to perform. Usually this is done by
9841
- # calling `[cls1, cls2].include?(node.class)` or putting the node into a
9842
- # case statement and doing `case node; when cls1; when cls2; end`. Both of
9843
- # these approaches are relatively slow because of the constant lookups,
9844
- # method calls, and/or array allocations.
9845
- #
9846
- # Instead, you can call #type, which will return to you a symbol that you
9847
- # can use for comparison. This is faster than the other approaches because
9848
- # it uses a single integer comparison, but also because if you're on CRuby
9849
- # you can take advantage of the fact that case statements with all symbol
9850
- # keys will use a jump table.
9851
- #
9852
- # def type: () -> Symbol
9853
- def type
9854
- :keyword_parameter_node
9855
- end
9856
-
9857
- # Similar to #type, this method returns a symbol that you can use for
9858
- # splitting on the type of the node without having to do a long === chain.
9859
- # Note that like #type, it will still be slower than using == for a single
9860
- # class, but should be faster in a case statement or an array comparison.
9861
- #
9862
- # def self.type: () -> Symbol
9863
- def self.type
9864
- :keyword_parameter_node
9865
- end
9866
- end
9867
-
9868
9845
  # Represents a keyword rest parameter to a method, block, or lambda definition.
9869
9846
  #
9870
9847
  # def a(**b)
@@ -9931,6 +9908,7 @@ module Prism
9931
9908
  operator_loc.slice
9932
9909
  end
9933
9910
 
9911
+ # def inspect(inspector: NodeInspector) -> String
9934
9912
  def inspect(inspector = NodeInspector.new)
9935
9913
  inspector << inspector.header(self)
9936
9914
  if (name = self.name).nil?
@@ -10065,6 +10043,7 @@ module Prism
10065
10043
  closing_loc.slice
10066
10044
  end
10067
10045
 
10046
+ # def inspect(inspector: NodeInspector) -> String
10068
10047
  def inspect(inspector = NodeInspector.new)
10069
10048
  inspector << inspector.header(self)
10070
10049
  inspector << "├── locals: #{locals.inspect}\n"
@@ -10190,6 +10169,7 @@ module Prism
10190
10169
  operator_loc.slice
10191
10170
  end
10192
10171
 
10172
+ # def inspect(inspector: NodeInspector) -> String
10193
10173
  def inspect(inspector = NodeInspector.new)
10194
10174
  inspector << inspector.header(self)
10195
10175
  inspector << "├── name_loc: #{inspector.location(name_loc)}\n"
@@ -10305,6 +10285,7 @@ module Prism
10305
10285
  { name_loc: name_loc, operator_loc: operator_loc, value: value, name: name, operator: operator, depth: depth, location: location }
10306
10286
  end
10307
10287
 
10288
+ # def inspect(inspector: NodeInspector) -> String
10308
10289
  def inspect(inspector = NodeInspector.new)
10309
10290
  inspector << inspector.header(self)
10310
10291
  inspector << "├── name_loc: #{inspector.location(name_loc)}\n"
@@ -10421,6 +10402,7 @@ module Prism
10421
10402
  operator_loc.slice
10422
10403
  end
10423
10404
 
10405
+ # def inspect(inspector: NodeInspector) -> String
10424
10406
  def inspect(inspector = NodeInspector.new)
10425
10407
  inspector << inspector.header(self)
10426
10408
  inspector << "├── name_loc: #{inspector.location(name_loc)}\n"
@@ -10518,6 +10500,7 @@ module Prism
10518
10500
  { name: name, depth: depth, location: location }
10519
10501
  end
10520
10502
 
10503
+ # def inspect(inspector: NodeInspector) -> String
10521
10504
  def inspect(inspector = NodeInspector.new)
10522
10505
  inspector << inspector.header(self)
10523
10506
  inspector << "├── name: #{name.inspect}\n"
@@ -10609,6 +10592,7 @@ module Prism
10609
10592
  { name: name, depth: depth, location: location }
10610
10593
  end
10611
10594
 
10595
+ # def inspect(inspector: NodeInspector) -> String
10612
10596
  def inspect(inspector = NodeInspector.new)
10613
10597
  inspector << inspector.header(self)
10614
10598
  inspector << "├── name: #{name.inspect}\n"
@@ -10720,6 +10704,7 @@ module Prism
10720
10704
  operator_loc.slice
10721
10705
  end
10722
10706
 
10707
+ # def inspect(inspector: NodeInspector) -> String
10723
10708
  def inspect(inspector = NodeInspector.new)
10724
10709
  inspector << inspector.header(self)
10725
10710
  inspector << "├── name: #{name.inspect}\n"
@@ -10887,6 +10872,7 @@ module Prism
10887
10872
  flags.anybits?(RegularExpressionFlags::UTF_8)
10888
10873
  end
10889
10874
 
10875
+ # def inspect(inspector: NodeInspector) -> String
10890
10876
  def inspect(inspector = NodeInspector.new)
10891
10877
  inspector << inspector.header(self)
10892
10878
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -10992,6 +10978,7 @@ module Prism
10992
10978
  operator_loc.slice
10993
10979
  end
10994
10980
 
10981
+ # def inspect(inspector: NodeInspector) -> String
10995
10982
  def inspect(inspector = NodeInspector.new)
10996
10983
  inspector << inspector.header(self)
10997
10984
  inspector << "├── value:\n"
@@ -11096,6 +11083,7 @@ module Prism
11096
11083
  operator_loc.slice
11097
11084
  end
11098
11085
 
11086
+ # def inspect(inspector: NodeInspector) -> String
11099
11087
  def inspect(inspector = NodeInspector.new)
11100
11088
  inspector << inspector.header(self)
11101
11089
  inspector << "├── value:\n"
@@ -11191,6 +11179,7 @@ module Prism
11191
11179
  { call: call, locals: locals, location: location }
11192
11180
  end
11193
11181
 
11182
+ # def inspect(inspector: NodeInspector) -> String
11194
11183
  def inspect(inspector = NodeInspector.new)
11195
11184
  inspector << inspector.header(self)
11196
11185
  inspector << "├── call:\n"
@@ -11271,6 +11260,7 @@ module Prism
11271
11260
  { location: location }
11272
11261
  end
11273
11262
 
11263
+ # def inspect(inspector: NodeInspector) -> String
11274
11264
  def inspect(inspector = NodeInspector.new)
11275
11265
  inspector << inspector.header(self)
11276
11266
  inspector.to_str
@@ -11393,6 +11383,7 @@ module Prism
11393
11383
  end_keyword_loc.slice
11394
11384
  end
11395
11385
 
11386
+ # def inspect(inspector: NodeInspector) -> String
11396
11387
  def inspect(inspector = NodeInspector.new)
11397
11388
  inspector << inspector.header(self)
11398
11389
  inspector << "├── locals: #{locals.inspect}\n"
@@ -11523,6 +11514,7 @@ module Prism
11523
11514
  rparen_loc&.slice
11524
11515
  end
11525
11516
 
11517
+ # def inspect(inspector: NodeInspector) -> String
11526
11518
  def inspect(inspector = NodeInspector.new)
11527
11519
  inspector << inspector.header(self)
11528
11520
  inspector << "├── lefts: #{inspector.list("#{inspector.prefix}│ ", lefts)}"
@@ -11667,6 +11659,7 @@ module Prism
11667
11659
  operator_loc.slice
11668
11660
  end
11669
11661
 
11662
+ # def inspect(inspector: NodeInspector) -> String
11670
11663
  def inspect(inspector = NodeInspector.new)
11671
11664
  inspector << inspector.header(self)
11672
11665
  inspector << "├── lefts: #{inspector.list("#{inspector.prefix}│ ", lefts)}"
@@ -11776,6 +11769,7 @@ module Prism
11776
11769
  keyword_loc.slice
11777
11770
  end
11778
11771
 
11772
+ # def inspect(inspector: NodeInspector) -> String
11779
11773
  def inspect(inspector = NodeInspector.new)
11780
11774
  inspector << inspector.header(self)
11781
11775
  if (arguments = self.arguments).nil?
@@ -11862,6 +11856,7 @@ module Prism
11862
11856
  { location: location }
11863
11857
  end
11864
11858
 
11859
+ # def inspect(inspector: NodeInspector) -> String
11865
11860
  def inspect(inspector = NodeInspector.new)
11866
11861
  inspector << inspector.header(self)
11867
11862
  inspector.to_str
@@ -11962,6 +11957,7 @@ module Prism
11962
11957
  keyword_loc.slice
11963
11958
  end
11964
11959
 
11960
+ # def inspect(inspector: NodeInspector) -> String
11965
11961
  def inspect(inspector = NodeInspector.new)
11966
11962
  inspector << inspector.header(self)
11967
11963
  inspector << "├── operator_loc: #{inspector.location(operator_loc)}\n"
@@ -12048,6 +12044,7 @@ module Prism
12048
12044
  { number: number, location: location }
12049
12045
  end
12050
12046
 
12047
+ # def inspect(inspector: NodeInspector) -> String
12051
12048
  def inspect(inspector = NodeInspector.new)
12052
12049
  inspector << inspector.header(self)
12053
12050
  inspector << "└── number: #{number.inspect}\n"
@@ -12083,6 +12080,106 @@ module Prism
12083
12080
  end
12084
12081
  end
12085
12082
 
12083
+ # Represents an optional keyword parameter to a method, block, or lambda definition.
12084
+ #
12085
+ # def a(b: 1)
12086
+ # ^^^^
12087
+ # end
12088
+ class OptionalKeywordParameterNode < Node
12089
+ # attr_reader name: Symbol
12090
+ attr_reader :name
12091
+
12092
+ # attr_reader name_loc: Location
12093
+ attr_reader :name_loc
12094
+
12095
+ # attr_reader value: Node
12096
+ attr_reader :value
12097
+
12098
+ # def initialize: (name: Symbol, name_loc: Location, value: Node, location: Location) -> void
12099
+ def initialize(name, name_loc, value, location)
12100
+ @name = name
12101
+ @name_loc = name_loc
12102
+ @value = value
12103
+ @location = location
12104
+ end
12105
+
12106
+ # def accept: (visitor: Visitor) -> void
12107
+ def accept(visitor)
12108
+ visitor.visit_optional_keyword_parameter_node(self)
12109
+ end
12110
+
12111
+ # def child_nodes: () -> Array[nil | Node]
12112
+ def child_nodes
12113
+ [value]
12114
+ end
12115
+
12116
+ # def compact_child_nodes: () -> Array[Node]
12117
+ def compact_child_nodes
12118
+ [value]
12119
+ end
12120
+
12121
+ # def comment_targets: () -> Array[Node | Location]
12122
+ def comment_targets
12123
+ [name_loc, value]
12124
+ end
12125
+
12126
+ # def copy: (**params) -> OptionalKeywordParameterNode
12127
+ def copy(**params)
12128
+ OptionalKeywordParameterNode.new(
12129
+ params.fetch(:name) { name },
12130
+ params.fetch(:name_loc) { name_loc },
12131
+ params.fetch(:value) { value },
12132
+ params.fetch(:location) { location },
12133
+ )
12134
+ end
12135
+
12136
+ # def deconstruct: () -> Array[nil | Node]
12137
+ alias deconstruct child_nodes
12138
+
12139
+ # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
12140
+ def deconstruct_keys(keys)
12141
+ { name: name, name_loc: name_loc, value: value, location: location }
12142
+ end
12143
+
12144
+ # def inspect(inspector: NodeInspector) -> String
12145
+ def inspect(inspector = NodeInspector.new)
12146
+ inspector << inspector.header(self)
12147
+ inspector << "├── name: #{name.inspect}\n"
12148
+ inspector << "├── name_loc: #{inspector.location(name_loc)}\n"
12149
+ inspector << "└── value:\n"
12150
+ inspector << inspector.child_node(value, " ")
12151
+ inspector.to_str
12152
+ end
12153
+
12154
+ # Sometimes you want to check an instance of a node against a list of
12155
+ # classes to see what kind of behavior to perform. Usually this is done by
12156
+ # calling `[cls1, cls2].include?(node.class)` or putting the node into a
12157
+ # case statement and doing `case node; when cls1; when cls2; end`. Both of
12158
+ # these approaches are relatively slow because of the constant lookups,
12159
+ # method calls, and/or array allocations.
12160
+ #
12161
+ # Instead, you can call #type, which will return to you a symbol that you
12162
+ # can use for comparison. This is faster than the other approaches because
12163
+ # it uses a single integer comparison, but also because if you're on CRuby
12164
+ # you can take advantage of the fact that case statements with all symbol
12165
+ # keys will use a jump table.
12166
+ #
12167
+ # def type: () -> Symbol
12168
+ def type
12169
+ :optional_keyword_parameter_node
12170
+ end
12171
+
12172
+ # Similar to #type, this method returns a symbol that you can use for
12173
+ # splitting on the type of the node without having to do a long === chain.
12174
+ # Note that like #type, it will still be slower than using == for a single
12175
+ # class, but should be faster in a case statement or an array comparison.
12176
+ #
12177
+ # def self.type: () -> Symbol
12178
+ def self.type
12179
+ :optional_keyword_parameter_node
12180
+ end
12181
+ end
12182
+
12086
12183
  # Represents an optional parameter to a method, block, or lambda definition.
12087
12184
  #
12088
12185
  # def a(b = 1)
@@ -12154,6 +12251,7 @@ module Prism
12154
12251
  operator_loc.slice
12155
12252
  end
12156
12253
 
12254
+ # def inspect(inspector: NodeInspector) -> String
12157
12255
  def inspect(inspector = NodeInspector.new)
12158
12256
  inspector << inspector.header(self)
12159
12257
  inspector << "├── name: #{name.inspect}\n"
@@ -12258,6 +12356,7 @@ module Prism
12258
12356
  operator_loc.slice
12259
12357
  end
12260
12358
 
12359
+ # def inspect(inspector: NodeInspector) -> String
12261
12360
  def inspect(inspector = NodeInspector.new)
12262
12361
  inspector << inspector.header(self)
12263
12362
  inspector << "├── left:\n"
@@ -12386,6 +12485,7 @@ module Prism
12386
12485
  { requireds: requireds, optionals: optionals, rest: rest, posts: posts, keywords: keywords, keyword_rest: keyword_rest, block: block, location: location }
12387
12486
  end
12388
12487
 
12488
+ # def inspect(inspector: NodeInspector) -> String
12389
12489
  def inspect(inspector = NodeInspector.new)
12390
12490
  inspector << inspector.header(self)
12391
12491
  inspector << "├── requireds: #{inspector.list("#{inspector.prefix}│ ", requireds)}"
@@ -12469,7 +12569,7 @@ module Prism
12469
12569
  visitor.visit_parentheses_node(self)
12470
12570
  end
12471
12571
 
12472
- def set_newline_flag(newline_marked)
12572
+ def set_newline_flag(newline_marked) # :nodoc:
12473
12573
  # Never mark ParenthesesNode with a newline flag, mark children instead
12474
12574
  end
12475
12575
 
@@ -12518,6 +12618,7 @@ module Prism
12518
12618
  closing_loc.slice
12519
12619
  end
12520
12620
 
12621
+ # def inspect(inspector: NodeInspector) -> String
12521
12622
  def inspect(inspector = NodeInspector.new)
12522
12623
  inspector << inspector.header(self)
12523
12624
  if (body = self.body).nil?
@@ -12641,6 +12742,7 @@ module Prism
12641
12742
  rparen_loc.slice
12642
12743
  end
12643
12744
 
12745
+ # def inspect(inspector: NodeInspector) -> String
12644
12746
  def inspect(inspector = NodeInspector.new)
12645
12747
  inspector << inspector.header(self)
12646
12748
  inspector << "├── expression:\n"
@@ -12741,6 +12843,7 @@ module Prism
12741
12843
  operator_loc.slice
12742
12844
  end
12743
12845
 
12846
+ # def inspect(inspector: NodeInspector) -> String
12744
12847
  def inspect(inspector = NodeInspector.new)
12745
12848
  inspector << inspector.header(self)
12746
12849
  inspector << "├── variable:\n"
@@ -12860,6 +12963,7 @@ module Prism
12860
12963
  closing_loc.slice
12861
12964
  end
12862
12965
 
12966
+ # def inspect(inspector: NodeInspector) -> String
12863
12967
  def inspect(inspector = NodeInspector.new)
12864
12968
  inspector << inspector.header(self)
12865
12969
  if (statements = self.statements).nil?
@@ -12985,6 +13089,7 @@ module Prism
12985
13089
  closing_loc.slice
12986
13090
  end
12987
13091
 
13092
+ # def inspect(inspector: NodeInspector) -> String
12988
13093
  def inspect(inspector = NodeInspector.new)
12989
13094
  inspector << inspector.header(self)
12990
13095
  if (statements = self.statements).nil?
@@ -13080,6 +13185,7 @@ module Prism
13080
13185
  { locals: locals, statements: statements, location: location }
13081
13186
  end
13082
13187
 
13188
+ # def inspect(inspector: NodeInspector) -> String
13083
13189
  def inspect(inspector = NodeInspector.new)
13084
13190
  inspector << inspector.header(self)
13085
13191
  inspector << "├── locals: #{locals.inspect}\n"
@@ -13198,6 +13304,7 @@ module Prism
13198
13304
  flags.anybits?(RangeFlags::EXCLUDE_END)
13199
13305
  end
13200
13306
 
13307
+ # def inspect(inspector: NodeInspector) -> String
13201
13308
  def inspect(inspector = NodeInspector.new)
13202
13309
  inspector << inspector.header(self)
13203
13310
  if (left = self.left).nil?
@@ -13297,6 +13404,7 @@ module Prism
13297
13404
  { numeric: numeric, location: location }
13298
13405
  end
13299
13406
 
13407
+ # def inspect(inspector: NodeInspector) -> String
13300
13408
  def inspect(inspector = NodeInspector.new)
13301
13409
  inspector << inspector.header(self)
13302
13410
  inspector << "└── numeric:\n"
@@ -13378,6 +13486,7 @@ module Prism
13378
13486
  { location: location }
13379
13487
  end
13380
13488
 
13489
+ # def inspect(inspector: NodeInspector) -> String
13381
13490
  def inspect(inspector = NodeInspector.new)
13382
13491
  inspector << inspector.header(self)
13383
13492
  inspector.to_str
@@ -13537,6 +13646,7 @@ module Prism
13537
13646
  flags.anybits?(RegularExpressionFlags::UTF_8)
13538
13647
  end
13539
13648
 
13649
+ # def inspect(inspector: NodeInspector) -> String
13540
13650
  def inspect(inspector = NodeInspector.new)
13541
13651
  inspector << inspector.header(self)
13542
13652
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -13577,6 +13687,99 @@ module Prism
13577
13687
  end
13578
13688
  end
13579
13689
 
13690
+ # Represents a required keyword parameter to a method, block, or lambda definition.
13691
+ #
13692
+ # def a(b: )
13693
+ # ^^
13694
+ # end
13695
+ class RequiredKeywordParameterNode < Node
13696
+ # attr_reader name: Symbol
13697
+ attr_reader :name
13698
+
13699
+ # attr_reader name_loc: Location
13700
+ attr_reader :name_loc
13701
+
13702
+ # def initialize: (name: Symbol, name_loc: Location, location: Location) -> void
13703
+ def initialize(name, name_loc, location)
13704
+ @name = name
13705
+ @name_loc = name_loc
13706
+ @location = location
13707
+ end
13708
+
13709
+ # def accept: (visitor: Visitor) -> void
13710
+ def accept(visitor)
13711
+ visitor.visit_required_keyword_parameter_node(self)
13712
+ end
13713
+
13714
+ # def child_nodes: () -> Array[nil | Node]
13715
+ def child_nodes
13716
+ []
13717
+ end
13718
+
13719
+ # def compact_child_nodes: () -> Array[Node]
13720
+ def compact_child_nodes
13721
+ []
13722
+ end
13723
+
13724
+ # def comment_targets: () -> Array[Node | Location]
13725
+ def comment_targets
13726
+ [name_loc]
13727
+ end
13728
+
13729
+ # def copy: (**params) -> RequiredKeywordParameterNode
13730
+ def copy(**params)
13731
+ RequiredKeywordParameterNode.new(
13732
+ params.fetch(:name) { name },
13733
+ params.fetch(:name_loc) { name_loc },
13734
+ params.fetch(:location) { location },
13735
+ )
13736
+ end
13737
+
13738
+ # def deconstruct: () -> Array[nil | Node]
13739
+ alias deconstruct child_nodes
13740
+
13741
+ # def deconstruct_keys: (keys: Array[Symbol]) -> Hash[Symbol, nil | Node | Array[Node] | String | Token | Array[Token] | Location]
13742
+ def deconstruct_keys(keys)
13743
+ { name: name, name_loc: name_loc, location: location }
13744
+ end
13745
+
13746
+ # def inspect(inspector: NodeInspector) -> String
13747
+ def inspect(inspector = NodeInspector.new)
13748
+ inspector << inspector.header(self)
13749
+ inspector << "├── name: #{name.inspect}\n"
13750
+ inspector << "└── name_loc: #{inspector.location(name_loc)}\n"
13751
+ inspector.to_str
13752
+ end
13753
+
13754
+ # Sometimes you want to check an instance of a node against a list of
13755
+ # classes to see what kind of behavior to perform. Usually this is done by
13756
+ # calling `[cls1, cls2].include?(node.class)` or putting the node into a
13757
+ # case statement and doing `case node; when cls1; when cls2; end`. Both of
13758
+ # these approaches are relatively slow because of the constant lookups,
13759
+ # method calls, and/or array allocations.
13760
+ #
13761
+ # Instead, you can call #type, which will return to you a symbol that you
13762
+ # can use for comparison. This is faster than the other approaches because
13763
+ # it uses a single integer comparison, but also because if you're on CRuby
13764
+ # you can take advantage of the fact that case statements with all symbol
13765
+ # keys will use a jump table.
13766
+ #
13767
+ # def type: () -> Symbol
13768
+ def type
13769
+ :required_keyword_parameter_node
13770
+ end
13771
+
13772
+ # Similar to #type, this method returns a symbol that you can use for
13773
+ # splitting on the type of the node without having to do a long === chain.
13774
+ # Note that like #type, it will still be slower than using == for a single
13775
+ # class, but should be faster in a case statement or an array comparison.
13776
+ #
13777
+ # def self.type: () -> Symbol
13778
+ def self.type
13779
+ :required_keyword_parameter_node
13780
+ end
13781
+ end
13782
+
13580
13783
  # Represents a required parameter to a method, block, or lambda definition.
13581
13784
  #
13582
13785
  # def a(b)
@@ -13628,6 +13831,7 @@ module Prism
13628
13831
  { name: name, location: location }
13629
13832
  end
13630
13833
 
13834
+ # def inspect(inspector: NodeInspector) -> String
13631
13835
  def inspect(inspector = NodeInspector.new)
13632
13836
  inspector << inspector.header(self)
13633
13837
  inspector << "└── name: #{name.inspect}\n"
@@ -13665,8 +13869,8 @@ module Prism
13665
13869
 
13666
13870
  # Represents an expression modified with a rescue.
13667
13871
  #
13668
- # foo rescue nil
13669
- # ^^^^^^^^^^^^^^
13872
+ # foo rescue nil
13873
+ # ^^^^^^^^^^^^^^
13670
13874
  class RescueModifierNode < Node
13671
13875
  # attr_reader expression: Node
13672
13876
  attr_reader :expression
@@ -13690,7 +13894,7 @@ module Prism
13690
13894
  visitor.visit_rescue_modifier_node(self)
13691
13895
  end
13692
13896
 
13693
- def set_newline_flag(newline_marked)
13897
+ def set_newline_flag(newline_marked) # :nodoc:
13694
13898
  expression.set_newline_flag(newline_marked)
13695
13899
  end
13696
13900
 
@@ -13732,6 +13936,7 @@ module Prism
13732
13936
  keyword_loc.slice
13733
13937
  end
13734
13938
 
13939
+ # def inspect(inspector: NodeInspector) -> String
13735
13940
  def inspect(inspector = NodeInspector.new)
13736
13941
  inspector << inspector.header(self)
13737
13942
  inspector << "├── expression:\n"
@@ -13775,8 +13980,8 @@ module Prism
13775
13980
  #
13776
13981
  # begin
13777
13982
  # rescue Foo, *splat, Bar => ex
13778
- # ^^^^^^
13779
13983
  # foo
13984
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13780
13985
  # end
13781
13986
  #
13782
13987
  # `Foo, *splat, Bar` are in the `exceptions` field.
@@ -13867,6 +14072,7 @@ module Prism
13867
14072
  operator_loc&.slice
13868
14073
  end
13869
14074
 
14075
+ # def inspect(inspector: NodeInspector) -> String
13870
14076
  def inspect(inspector = NodeInspector.new)
13871
14077
  inspector << inspector.header(self)
13872
14078
  inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n"
@@ -13988,6 +14194,7 @@ module Prism
13988
14194
  operator_loc.slice
13989
14195
  end
13990
14196
 
14197
+ # def inspect(inspector: NodeInspector) -> String
13991
14198
  def inspect(inspector = NodeInspector.new)
13992
14199
  inspector << inspector.header(self)
13993
14200
  if (name = self.name).nil?
@@ -14074,6 +14281,7 @@ module Prism
14074
14281
  { location: location }
14075
14282
  end
14076
14283
 
14284
+ # def inspect(inspector: NodeInspector) -> String
14077
14285
  def inspect(inspector = NodeInspector.new)
14078
14286
  inspector << inspector.header(self)
14079
14287
  inspector.to_str
@@ -14170,6 +14378,7 @@ module Prism
14170
14378
  keyword_loc.slice
14171
14379
  end
14172
14380
 
14381
+ # def inspect(inspector: NodeInspector) -> String
14173
14382
  def inspect(inspector = NodeInspector.new)
14174
14383
  inspector << inspector.header(self)
14175
14384
  inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n"
@@ -14256,6 +14465,7 @@ module Prism
14256
14465
  { location: location }
14257
14466
  end
14258
14467
 
14468
+ # def inspect(inspector: NodeInspector) -> String
14259
14469
  def inspect(inspector = NodeInspector.new)
14260
14470
  inspector << inspector.header(self)
14261
14471
  inspector.to_str
@@ -14383,6 +14593,7 @@ module Prism
14383
14593
  end_keyword_loc.slice
14384
14594
  end
14385
14595
 
14596
+ # def inspect(inspector: NodeInspector) -> String
14386
14597
  def inspect(inspector = NodeInspector.new)
14387
14598
  inspector << inspector.header(self)
14388
14599
  inspector << "├── locals: #{locals.inspect}\n"
@@ -14474,6 +14685,7 @@ module Prism
14474
14685
  { location: location }
14475
14686
  end
14476
14687
 
14688
+ # def inspect(inspector: NodeInspector) -> String
14477
14689
  def inspect(inspector = NodeInspector.new)
14478
14690
  inspector << inspector.header(self)
14479
14691
  inspector.to_str
@@ -14558,6 +14770,7 @@ module Prism
14558
14770
  { filepath: filepath, location: location }
14559
14771
  end
14560
14772
 
14773
+ # def inspect(inspector: NodeInspector) -> String
14561
14774
  def inspect(inspector = NodeInspector.new)
14562
14775
  inspector << inspector.header(self)
14563
14776
  inspector << "└── filepath: #{filepath.inspect}\n"
@@ -14638,6 +14851,7 @@ module Prism
14638
14851
  { location: location }
14639
14852
  end
14640
14853
 
14854
+ # def inspect(inspector: NodeInspector) -> String
14641
14855
  def inspect(inspector = NodeInspector.new)
14642
14856
  inspector << inspector.header(self)
14643
14857
  inspector.to_str
@@ -14734,6 +14948,7 @@ module Prism
14734
14948
  operator_loc.slice
14735
14949
  end
14736
14950
 
14951
+ # def inspect(inspector: NodeInspector) -> String
14737
14952
  def inspect(inspector = NodeInspector.new)
14738
14953
  inspector << inspector.header(self)
14739
14954
  inspector << "├── operator_loc: #{inspector.location(operator_loc)}\n"
@@ -14825,6 +15040,7 @@ module Prism
14825
15040
  { body: body, location: location }
14826
15041
  end
14827
15042
 
15043
+ # def inspect(inspector: NodeInspector) -> String
14828
15044
  def inspect(inspector = NodeInspector.new)
14829
15045
  inspector << inspector.header(self)
14830
15046
  inspector << "└── body: #{inspector.list("#{inspector.prefix} ", body)}"
@@ -14915,6 +15131,7 @@ module Prism
14915
15131
  { left: left, right: right, location: location }
14916
15132
  end
14917
15133
 
15134
+ # def inspect(inspector: NodeInspector) -> String
14918
15135
  def inspect(inspector = NodeInspector.new)
14919
15136
  inspector << inspector.header(self)
14920
15137
  inspector << "├── left:\n"
@@ -15050,6 +15267,7 @@ module Prism
15050
15267
  closing_loc&.slice
15051
15268
  end
15052
15269
 
15270
+ # def inspect(inspector: NodeInspector) -> String
15053
15271
  def inspect(inspector = NodeInspector.new)
15054
15272
  inspector << inspector.header(self)
15055
15273
  flags = [("frozen" if frozen?)].compact
@@ -15181,6 +15399,7 @@ module Prism
15181
15399
  rparen_loc&.slice
15182
15400
  end
15183
15401
 
15402
+ # def inspect(inspector: NodeInspector) -> String
15184
15403
  def inspect(inspector = NodeInspector.new)
15185
15404
  inspector << inspector.header(self)
15186
15405
  inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n"
@@ -15313,6 +15532,7 @@ module Prism
15313
15532
  closing_loc&.slice
15314
15533
  end
15315
15534
 
15535
+ # def inspect(inspector: NodeInspector) -> String
15316
15536
  def inspect(inspector = NodeInspector.new)
15317
15537
  inspector << inspector.header(self)
15318
15538
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -15396,6 +15616,7 @@ module Prism
15396
15616
  { location: location }
15397
15617
  end
15398
15618
 
15619
+ # def inspect(inspector: NodeInspector) -> String
15399
15620
  def inspect(inspector = NodeInspector.new)
15400
15621
  inspector << inspector.header(self)
15401
15622
  inspector.to_str
@@ -15490,6 +15711,7 @@ module Prism
15490
15711
  keyword_loc.slice
15491
15712
  end
15492
15713
 
15714
+ # def inspect(inspector: NodeInspector) -> String
15493
15715
  def inspect(inspector = NodeInspector.new)
15494
15716
  inspector << inspector.header(self)
15495
15717
  inspector << "├── names: #{inspector.list("#{inspector.prefix}│ ", names)}"
@@ -15564,7 +15786,7 @@ module Prism
15564
15786
  visitor.visit_unless_node(self)
15565
15787
  end
15566
15788
 
15567
- def set_newline_flag(newline_marked)
15789
+ def set_newline_flag(newline_marked) # :nodoc:
15568
15790
  predicate.set_newline_flag(newline_marked)
15569
15791
  end
15570
15792
 
@@ -15617,6 +15839,7 @@ module Prism
15617
15839
  end_keyword_loc&.slice
15618
15840
  end
15619
15841
 
15842
+ # def inspect(inspector: NodeInspector) -> String
15620
15843
  def inspect(inspector = NodeInspector.new)
15621
15844
  inspector << inspector.header(self)
15622
15845
  inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n"
@@ -15705,7 +15928,7 @@ module Prism
15705
15928
  visitor.visit_until_node(self)
15706
15929
  end
15707
15930
 
15708
- def set_newline_flag(newline_marked)
15931
+ def set_newline_flag(newline_marked) # :nodoc:
15709
15932
  predicate.set_newline_flag(newline_marked)
15710
15933
  end
15711
15934
 
@@ -15762,6 +15985,7 @@ module Prism
15762
15985
  flags.anybits?(LoopFlags::BEGIN_MODIFIER)
15763
15986
  end
15764
15987
 
15988
+ # def inspect(inspector: NodeInspector) -> String
15765
15989
  def inspect(inspector = NodeInspector.new)
15766
15990
  inspector << inspector.header(self)
15767
15991
  inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n"
@@ -15878,6 +16102,7 @@ module Prism
15878
16102
  keyword_loc.slice
15879
16103
  end
15880
16104
 
16105
+ # def inspect(inspector: NodeInspector) -> String
15881
16106
  def inspect(inspector = NodeInspector.new)
15882
16107
  inspector << inspector.header(self)
15883
16108
  inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n"
@@ -15958,7 +16183,7 @@ module Prism
15958
16183
  visitor.visit_while_node(self)
15959
16184
  end
15960
16185
 
15961
- def set_newline_flag(newline_marked)
16186
+ def set_newline_flag(newline_marked) # :nodoc:
15962
16187
  predicate.set_newline_flag(newline_marked)
15963
16188
  end
15964
16189
 
@@ -16015,6 +16240,7 @@ module Prism
16015
16240
  flags.anybits?(LoopFlags::BEGIN_MODIFIER)
16016
16241
  end
16017
16242
 
16243
+ # def inspect(inspector: NodeInspector) -> String
16018
16244
  def inspect(inspector = NodeInspector.new)
16019
16245
  inspector << inspector.header(self)
16020
16246
  inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n"
@@ -16141,6 +16367,7 @@ module Prism
16141
16367
  closing_loc.slice
16142
16368
  end
16143
16369
 
16370
+ # def inspect(inspector: NodeInspector) -> String
16144
16371
  def inspect(inspector = NodeInspector.new)
16145
16372
  inspector << inspector.header(self)
16146
16373
  inspector << "├── opening_loc: #{inspector.location(opening_loc)}\n"
@@ -16261,6 +16488,7 @@ module Prism
16261
16488
  rparen_loc&.slice
16262
16489
  end
16263
16490
 
16491
+ # def inspect(inspector: NodeInspector) -> String
16264
16492
  def inspect(inspector = NodeInspector.new)
16265
16493
  inspector << inspector.header(self)
16266
16494
  inspector << "├── keyword_loc: #{inspector.location(keyword_loc)}\n"
@@ -16304,11 +16532,13 @@ module Prism
16304
16532
  end
16305
16533
  end
16306
16534
 
16535
+ # Flags for arguments nodes.
16307
16536
  module ArgumentsNodeFlags
16308
16537
  # if arguments contain keyword splat
16309
16538
  KEYWORD_SPLAT = 1 << 0
16310
16539
  end
16311
16540
 
16541
+ # Flags for call nodes.
16312
16542
  module CallNodeFlags
16313
16543
  # &. operator
16314
16544
  SAFE_NAVIGATION = 1 << 0
@@ -16317,6 +16547,7 @@ module Prism
16317
16547
  VARIABLE_CALL = 1 << 1
16318
16548
  end
16319
16549
 
16550
+ # Flags for integer nodes that correspond to the base of the integer.
16320
16551
  module IntegerBaseFlags
16321
16552
  # 0b prefix
16322
16553
  BINARY = 1 << 0
@@ -16331,16 +16562,19 @@ module Prism
16331
16562
  HEXADECIMAL = 1 << 3
16332
16563
  end
16333
16564
 
16565
+ # Flags for while and until loop nodes.
16334
16566
  module LoopFlags
16335
16567
  # a loop after a begin statement, so the body is executed first before the condition
16336
16568
  BEGIN_MODIFIER = 1 << 0
16337
16569
  end
16338
16570
 
16571
+ # Flags for range and flip-flop nodes.
16339
16572
  module RangeFlags
16340
16573
  # ... operator
16341
16574
  EXCLUDE_END = 1 << 0
16342
16575
  end
16343
16576
 
16577
+ # Flags for regular expression and match last line nodes.
16344
16578
  module RegularExpressionFlags
16345
16579
  # i - ignores the case of characters when matching
16346
16580
  IGNORE_CASE = 1 << 0
@@ -16367,6 +16601,7 @@ module Prism
16367
16601
  UTF_8 = 1 << 7
16368
16602
  end
16369
16603
 
16604
+ # Flags for string nodes.
16370
16605
  module StringFlags
16371
16606
  # frozen by virtue of a `frozen_string_literal` comment
16372
16607
  FROZEN = 1 << 0