prism 2.0.0.rc1-aarch64-linux-gnu → 2.0.0.rc2-aarch64-linux-gnu
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/CODE_OF_CONDUCT.md +1 -1
- data/LICENSE.md +1 -1
- data/docs/serialization.md +1 -0
- data/ext/prism/api_node.c +1 -1
- data/ext/prism/extension.c +20 -2
- data/ext/prism/extension.h +1 -1
- data/include/prism/compiler/accel.h +3 -1
- data/include/prism/compiler/bswap.h +46 -0
- data/include/prism/compiler/endianness.h +34 -0
- data/include/prism/internal/buffer.h +3 -0
- data/include/prism/internal/parser.h +20 -0
- data/include/prism/internal/xxh3.h +16 -0
- data/include/prism/parser.h +21 -0
- data/include/prism/string_query.h +11 -0
- data/include/prism/version.h +1 -1
- data/lib/prism/3.3/prism.so +0 -0
- data/lib/prism/3.4/prism.so +0 -0
- data/lib/prism/4.0/prism.so +0 -0
- data/lib/prism/ffi.rb +6 -0
- data/lib/prism/node.rb +736 -0
- data/lib/prism/parse_result.rb +23 -8
- data/lib/prism/serialize.rb +19 -6
- data/lib/prism/string_query.rb +8 -0
- data/prism.gemspec +8 -4
- data/rbi/generated/prism/node.rbi +1706 -980
- data/rbi/generated/prism/parse_result.rbi +16 -4
- data/rbi/generated/prism/serialize.rbi +3 -0
- data/rbi/generated/prism/string_query.rbi +7 -0
- data/sig/generated/prism/node.rbs +1713 -977
- data/sig/generated/prism/parse_result.rbs +16 -4
- data/sig/generated/prism/serialize.rbs +3 -0
- data/sig/generated/prism/string_query.rbs +7 -0
- data/src/buffer.c +9 -0
- data/src/parser.c +18 -0
- data/src/prism.c +406 -225
- data/src/serialize.c +2 -1
- data/src/string_query.c +14 -0
- data/src/xxh3.c +292 -0
- metadata +7 -3
|
@@ -274,8 +274,10 @@ module Prism
|
|
|
274
274
|
|
|
275
275
|
# Represents the use of the `alias` keyword to alias a global variable.
|
|
276
276
|
#
|
|
277
|
-
#
|
|
278
|
-
#
|
|
277
|
+
# ```rb
|
|
278
|
+
# alias $foo $bar
|
|
279
|
+
# ^^^^^^^^^^^^^^^
|
|
280
|
+
# ```
|
|
279
281
|
class AliasGlobalVariableNode < Node
|
|
280
282
|
@keyword_loc: Location
|
|
281
283
|
|
|
@@ -341,8 +343,10 @@ module Prism
|
|
|
341
343
|
#
|
|
342
344
|
# Represents the new name of the global variable that can be used after aliasing.
|
|
343
345
|
#
|
|
344
|
-
#
|
|
345
|
-
#
|
|
346
|
+
# ```rb
|
|
347
|
+
# alias $foo $bar
|
|
348
|
+
# ^^^^
|
|
349
|
+
# ```
|
|
346
350
|
#
|
|
347
351
|
# : () -> (GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode)
|
|
348
352
|
def new_name: () -> (GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode)
|
|
@@ -352,8 +356,10 @@ module Prism
|
|
|
352
356
|
#
|
|
353
357
|
# Represents the old name of the global variable that can be used before aliasing.
|
|
354
358
|
#
|
|
355
|
-
#
|
|
356
|
-
#
|
|
359
|
+
# ```rb
|
|
360
|
+
# alias $foo $bar
|
|
361
|
+
# ^^^^
|
|
362
|
+
# ```
|
|
357
363
|
#
|
|
358
364
|
# : () -> (GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode)
|
|
359
365
|
def old_name: () -> (GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode)
|
|
@@ -364,8 +370,10 @@ module Prism
|
|
|
364
370
|
#
|
|
365
371
|
# The Location of the `alias` keyword.
|
|
366
372
|
#
|
|
367
|
-
#
|
|
368
|
-
#
|
|
373
|
+
# ```rb
|
|
374
|
+
# alias $foo $bar
|
|
375
|
+
# ^^^^^
|
|
376
|
+
# ```
|
|
369
377
|
#
|
|
370
378
|
# : () -> Location
|
|
371
379
|
def keyword_loc: () -> Location
|
|
@@ -391,8 +399,10 @@ module Prism
|
|
|
391
399
|
|
|
392
400
|
# Represents the use of the `alias` keyword to alias a method.
|
|
393
401
|
#
|
|
394
|
-
#
|
|
395
|
-
#
|
|
402
|
+
# ```rb
|
|
403
|
+
# alias foo bar
|
|
404
|
+
# ^^^^^^^^^^^^^
|
|
405
|
+
# ```
|
|
396
406
|
class AliasMethodNode < Node
|
|
397
407
|
@keyword_loc: Location
|
|
398
408
|
|
|
@@ -458,14 +468,16 @@ module Prism
|
|
|
458
468
|
#
|
|
459
469
|
# Represents the new name of the method that will be aliased.
|
|
460
470
|
#
|
|
461
|
-
#
|
|
462
|
-
#
|
|
471
|
+
# ```rb
|
|
472
|
+
# alias foo bar
|
|
473
|
+
# ^^^
|
|
463
474
|
#
|
|
464
|
-
#
|
|
465
|
-
#
|
|
475
|
+
# alias :foo :bar
|
|
476
|
+
# ^^^^
|
|
466
477
|
#
|
|
467
|
-
#
|
|
468
|
-
#
|
|
478
|
+
# alias :"#{foo}" :"#{bar}"
|
|
479
|
+
# ^^^^^^^^^
|
|
480
|
+
# ```
|
|
469
481
|
#
|
|
470
482
|
# : () -> (SymbolNode | InterpolatedSymbolNode)
|
|
471
483
|
def new_name: () -> (SymbolNode | InterpolatedSymbolNode)
|
|
@@ -475,14 +487,16 @@ module Prism
|
|
|
475
487
|
#
|
|
476
488
|
# Represents the old name of the method that will be aliased.
|
|
477
489
|
#
|
|
478
|
-
#
|
|
479
|
-
#
|
|
490
|
+
# ```rb
|
|
491
|
+
# alias foo bar
|
|
492
|
+
# ^^^
|
|
480
493
|
#
|
|
481
|
-
#
|
|
482
|
-
#
|
|
494
|
+
# alias :foo :bar
|
|
495
|
+
# ^^^^
|
|
483
496
|
#
|
|
484
|
-
#
|
|
485
|
-
#
|
|
497
|
+
# alias :"#{foo}" :"#{bar}"
|
|
498
|
+
# ^^^^^^^^^
|
|
499
|
+
# ```
|
|
486
500
|
#
|
|
487
501
|
# : () -> (SymbolNode | InterpolatedSymbolNode)
|
|
488
502
|
def old_name: () -> (SymbolNode | InterpolatedSymbolNode)
|
|
@@ -493,8 +507,10 @@ module Prism
|
|
|
493
507
|
#
|
|
494
508
|
# Represents the Location of the `alias` keyword.
|
|
495
509
|
#
|
|
496
|
-
#
|
|
497
|
-
#
|
|
510
|
+
# ```rb
|
|
511
|
+
# alias foo bar
|
|
512
|
+
# ^^^^^
|
|
513
|
+
# ```
|
|
498
514
|
#
|
|
499
515
|
# : () -> Location
|
|
500
516
|
def keyword_loc: () -> Location
|
|
@@ -520,8 +536,10 @@ module Prism
|
|
|
520
536
|
|
|
521
537
|
# Represents an alternation pattern in pattern matching.
|
|
522
538
|
#
|
|
523
|
-
#
|
|
524
|
-
#
|
|
539
|
+
# ```rb
|
|
540
|
+
# foo => bar | baz
|
|
541
|
+
# ^^^^^^^^^
|
|
542
|
+
# ```
|
|
525
543
|
class AlternationPatternNode < Node
|
|
526
544
|
@operator_loc: Location
|
|
527
545
|
|
|
@@ -587,8 +605,10 @@ module Prism
|
|
|
587
605
|
#
|
|
588
606
|
# Represents the left side of the expression.
|
|
589
607
|
#
|
|
590
|
-
#
|
|
591
|
-
#
|
|
608
|
+
# ```rb
|
|
609
|
+
# foo => bar | baz
|
|
610
|
+
# ^^^
|
|
611
|
+
# ```
|
|
592
612
|
#
|
|
593
613
|
# : () -> Prism::node
|
|
594
614
|
def left: () -> Prism::node
|
|
@@ -598,8 +618,10 @@ module Prism
|
|
|
598
618
|
#
|
|
599
619
|
# Represents the right side of the expression.
|
|
600
620
|
#
|
|
601
|
-
#
|
|
602
|
-
#
|
|
621
|
+
# ```rb
|
|
622
|
+
# foo => bar | baz
|
|
623
|
+
# ^^^
|
|
624
|
+
# ```
|
|
603
625
|
#
|
|
604
626
|
# : () -> Prism::node
|
|
605
627
|
def right: () -> Prism::node
|
|
@@ -610,8 +632,10 @@ module Prism
|
|
|
610
632
|
#
|
|
611
633
|
# Represents the alternation operator Location.
|
|
612
634
|
#
|
|
613
|
-
#
|
|
614
|
-
#
|
|
635
|
+
# ```rb
|
|
636
|
+
# foo => bar | baz
|
|
637
|
+
# ^
|
|
638
|
+
# ```
|
|
615
639
|
#
|
|
616
640
|
# : () -> Location
|
|
617
641
|
def operator_loc: () -> Location
|
|
@@ -637,8 +661,10 @@ module Prism
|
|
|
637
661
|
|
|
638
662
|
# Represents the use of the `&&` operator or the `and` keyword.
|
|
639
663
|
#
|
|
640
|
-
#
|
|
641
|
-
#
|
|
664
|
+
# ```rb
|
|
665
|
+
# left and right
|
|
666
|
+
# ^^^^^^^^^^^^^^
|
|
667
|
+
# ```
|
|
642
668
|
class AndNode < Node
|
|
643
669
|
@operator_loc: Location
|
|
644
670
|
|
|
@@ -704,11 +730,13 @@ module Prism
|
|
|
704
730
|
#
|
|
705
731
|
# Represents the left side of the expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
706
732
|
#
|
|
707
|
-
#
|
|
708
|
-
#
|
|
733
|
+
# ```rb
|
|
734
|
+
# left and right
|
|
735
|
+
# ^^^^
|
|
709
736
|
#
|
|
710
|
-
#
|
|
711
|
-
#
|
|
737
|
+
# 1 && 2
|
|
738
|
+
# ^
|
|
739
|
+
# ```
|
|
712
740
|
#
|
|
713
741
|
# : () -> Prism::node
|
|
714
742
|
def left: () -> Prism::node
|
|
@@ -718,11 +746,13 @@ module Prism
|
|
|
718
746
|
#
|
|
719
747
|
# Represents the right side of the expression.
|
|
720
748
|
#
|
|
721
|
-
#
|
|
722
|
-
#
|
|
749
|
+
# ```rb
|
|
750
|
+
# left && right
|
|
751
|
+
# ^^^^^
|
|
723
752
|
#
|
|
724
|
-
#
|
|
725
|
-
#
|
|
753
|
+
# 1 and 2
|
|
754
|
+
# ^
|
|
755
|
+
# ```
|
|
726
756
|
#
|
|
727
757
|
# : () -> Prism::node
|
|
728
758
|
def right: () -> Prism::node
|
|
@@ -733,8 +763,10 @@ module Prism
|
|
|
733
763
|
#
|
|
734
764
|
# The Location of the `and` keyword or the `&&` operator.
|
|
735
765
|
#
|
|
736
|
-
#
|
|
737
|
-
#
|
|
766
|
+
# ```rb
|
|
767
|
+
# left and right
|
|
768
|
+
# ^^^
|
|
769
|
+
# ```
|
|
738
770
|
#
|
|
739
771
|
# : () -> Location
|
|
740
772
|
def operator_loc: () -> Location
|
|
@@ -760,8 +792,10 @@ module Prism
|
|
|
760
792
|
|
|
761
793
|
# Represents a set of arguments to a method or a keyword.
|
|
762
794
|
#
|
|
763
|
-
#
|
|
764
|
-
#
|
|
795
|
+
# ```rb
|
|
796
|
+
# return foo, bar, baz
|
|
797
|
+
# ^^^^^^^^^^^^^
|
|
798
|
+
# ```
|
|
765
799
|
class ArgumentsNode < Node
|
|
766
800
|
@arguments: Array[Prism::node]
|
|
767
801
|
|
|
@@ -853,8 +887,10 @@ module Prism
|
|
|
853
887
|
#
|
|
854
888
|
# The list of arguments, if present. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
855
889
|
#
|
|
856
|
-
#
|
|
857
|
-
#
|
|
890
|
+
# ```rb
|
|
891
|
+
# foo(bar, baz)
|
|
892
|
+
# ^^^^^^^^
|
|
893
|
+
# ```
|
|
858
894
|
#
|
|
859
895
|
# : () -> Array[Prism::node]
|
|
860
896
|
def arguments: () -> Array[Prism::node]
|
|
@@ -865,8 +901,10 @@ module Prism
|
|
|
865
901
|
|
|
866
902
|
# Represents an array literal. This can be a regular array using brackets or a special array using % like %w or %i.
|
|
867
903
|
#
|
|
868
|
-
#
|
|
869
|
-
#
|
|
904
|
+
# ```rb
|
|
905
|
+
# [1, 2, 3]
|
|
906
|
+
# ^^^^^^^^^
|
|
907
|
+
# ```
|
|
870
908
|
class ArrayNode < Node
|
|
871
909
|
@closing_loc: Location?
|
|
872
910
|
|
|
@@ -947,10 +985,12 @@ module Prism
|
|
|
947
985
|
#
|
|
948
986
|
# Represents the optional source Location for the opening token.
|
|
949
987
|
#
|
|
950
|
-
#
|
|
951
|
-
#
|
|
952
|
-
#
|
|
953
|
-
#
|
|
988
|
+
# ```rb
|
|
989
|
+
# [1,2,3] # "["
|
|
990
|
+
# %w[foo bar baz] # "%w["
|
|
991
|
+
# %I(apple orange banana) # "%I("
|
|
992
|
+
# foo = 1, 2, 3 # nil
|
|
993
|
+
# ```
|
|
954
994
|
#
|
|
955
995
|
# : () -> Location?
|
|
956
996
|
def opening_loc: () -> Location?
|
|
@@ -968,10 +1008,12 @@ module Prism
|
|
|
968
1008
|
#
|
|
969
1009
|
# Represents the optional source Location for the closing token.
|
|
970
1010
|
#
|
|
971
|
-
#
|
|
972
|
-
#
|
|
973
|
-
#
|
|
974
|
-
#
|
|
1011
|
+
# ```rb
|
|
1012
|
+
# [1,2,3] # "]"
|
|
1013
|
+
# %w[foo bar baz] # "]"
|
|
1014
|
+
# %I(apple orange banana) # ")"
|
|
1015
|
+
# foo = 1, 2, 3 # nil
|
|
1016
|
+
# ```
|
|
975
1017
|
#
|
|
976
1018
|
# : () -> Location?
|
|
977
1019
|
def closing_loc: () -> Location?
|
|
@@ -1005,20 +1047,22 @@ module Prism
|
|
|
1005
1047
|
|
|
1006
1048
|
# Represents an array pattern in pattern matching.
|
|
1007
1049
|
#
|
|
1008
|
-
#
|
|
1009
|
-
#
|
|
1050
|
+
# ```rb
|
|
1051
|
+
# foo in 1, 2
|
|
1052
|
+
# ^^^^
|
|
1010
1053
|
#
|
|
1011
|
-
#
|
|
1012
|
-
#
|
|
1054
|
+
# foo in [1, 2]
|
|
1055
|
+
# ^^^^^^
|
|
1013
1056
|
#
|
|
1014
|
-
#
|
|
1015
|
-
#
|
|
1057
|
+
# foo in *bar
|
|
1058
|
+
# ^^^^
|
|
1016
1059
|
#
|
|
1017
|
-
#
|
|
1018
|
-
#
|
|
1060
|
+
# foo in Bar[]
|
|
1061
|
+
# ^^^^^
|
|
1019
1062
|
#
|
|
1020
|
-
#
|
|
1021
|
-
#
|
|
1063
|
+
# foo in Bar[1, 2, 3]
|
|
1064
|
+
# ^^^^^^^^^^^^
|
|
1065
|
+
# ```
|
|
1022
1066
|
class ArrayPatternNode < Node
|
|
1023
1067
|
@closing_loc: Location?
|
|
1024
1068
|
|
|
@@ -1090,14 +1134,16 @@ module Prism
|
|
|
1090
1134
|
#
|
|
1091
1135
|
# Represents the optional constant preceding the Array
|
|
1092
1136
|
#
|
|
1093
|
-
#
|
|
1094
|
-
#
|
|
1137
|
+
# ```rb
|
|
1138
|
+
# foo in Bar[]
|
|
1139
|
+
# ^^^
|
|
1095
1140
|
#
|
|
1096
|
-
#
|
|
1097
|
-
#
|
|
1141
|
+
# foo in Bar[1, 2, 3]
|
|
1142
|
+
# ^^^
|
|
1098
1143
|
#
|
|
1099
|
-
#
|
|
1100
|
-
#
|
|
1144
|
+
# foo in Bar::Baz[1, 2, 3]
|
|
1145
|
+
# ^^^^^^^^
|
|
1146
|
+
# ```
|
|
1101
1147
|
#
|
|
1102
1148
|
# : () -> (ConstantPathNode | ConstantReadNode)?
|
|
1103
1149
|
def constant: () -> (ConstantPathNode | ConstantReadNode)?
|
|
@@ -1107,8 +1153,10 @@ module Prism
|
|
|
1107
1153
|
#
|
|
1108
1154
|
# Represents the required elements of the array pattern.
|
|
1109
1155
|
#
|
|
1110
|
-
#
|
|
1111
|
-
#
|
|
1156
|
+
# ```rb
|
|
1157
|
+
# foo in [1, 2]
|
|
1158
|
+
# ^ ^
|
|
1159
|
+
# ```
|
|
1112
1160
|
#
|
|
1113
1161
|
# : () -> Array[Prism::node]
|
|
1114
1162
|
def requireds: () -> Array[Prism::node]
|
|
@@ -1118,8 +1166,10 @@ module Prism
|
|
|
1118
1166
|
#
|
|
1119
1167
|
# Represents the rest element of the array pattern.
|
|
1120
1168
|
#
|
|
1121
|
-
#
|
|
1122
|
-
#
|
|
1169
|
+
# ```rb
|
|
1170
|
+
# foo in *bar
|
|
1171
|
+
# ^^^^
|
|
1172
|
+
# ```
|
|
1123
1173
|
#
|
|
1124
1174
|
# : () -> (ImplicitRestNode | SplatNode)?
|
|
1125
1175
|
def rest: () -> (ImplicitRestNode | SplatNode)?
|
|
@@ -1129,8 +1179,10 @@ module Prism
|
|
|
1129
1179
|
#
|
|
1130
1180
|
# Represents the elements after the rest element of the array pattern.
|
|
1131
1181
|
#
|
|
1132
|
-
#
|
|
1133
|
-
#
|
|
1182
|
+
# ```rb
|
|
1183
|
+
# foo in *bar, baz
|
|
1184
|
+
# ^^^
|
|
1185
|
+
# ```
|
|
1134
1186
|
#
|
|
1135
1187
|
# : () -> Array[Prism::node]
|
|
1136
1188
|
def posts: () -> Array[Prism::node]
|
|
@@ -1141,8 +1193,10 @@ module Prism
|
|
|
1141
1193
|
#
|
|
1142
1194
|
# Represents the opening Location of the array pattern.
|
|
1143
1195
|
#
|
|
1144
|
-
#
|
|
1145
|
-
#
|
|
1196
|
+
# ```rb
|
|
1197
|
+
# foo in [1, 2]
|
|
1198
|
+
# ^
|
|
1199
|
+
# ```
|
|
1146
1200
|
#
|
|
1147
1201
|
# : () -> Location?
|
|
1148
1202
|
def opening_loc: () -> Location?
|
|
@@ -1160,8 +1214,10 @@ module Prism
|
|
|
1160
1214
|
#
|
|
1161
1215
|
# Represents the closing Location of the array pattern.
|
|
1162
1216
|
#
|
|
1163
|
-
#
|
|
1164
|
-
#
|
|
1217
|
+
# ```rb
|
|
1218
|
+
# foo in [1, 2]
|
|
1219
|
+
# ^
|
|
1220
|
+
# ```
|
|
1165
1221
|
#
|
|
1166
1222
|
# : () -> Location?
|
|
1167
1223
|
def closing_loc: () -> Location?
|
|
@@ -1195,8 +1251,10 @@ module Prism
|
|
|
1195
1251
|
|
|
1196
1252
|
# Represents a hash key/value pair.
|
|
1197
1253
|
#
|
|
1198
|
-
#
|
|
1199
|
-
#
|
|
1254
|
+
# ```rb
|
|
1255
|
+
# { a => b }
|
|
1256
|
+
# ^^^^^^
|
|
1257
|
+
# ```
|
|
1200
1258
|
class AssocNode < Node
|
|
1201
1259
|
@operator_loc: Location?
|
|
1202
1260
|
|
|
@@ -1262,14 +1320,16 @@ module Prism
|
|
|
1262
1320
|
#
|
|
1263
1321
|
# The key of the association. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
1264
1322
|
#
|
|
1265
|
-
#
|
|
1266
|
-
#
|
|
1323
|
+
# ```rb
|
|
1324
|
+
# { a: b }
|
|
1325
|
+
# ^
|
|
1267
1326
|
#
|
|
1268
|
-
#
|
|
1269
|
-
#
|
|
1327
|
+
# { foo => bar }
|
|
1328
|
+
# ^^^
|
|
1270
1329
|
#
|
|
1271
|
-
#
|
|
1272
|
-
#
|
|
1330
|
+
# { def a; end => 1 }
|
|
1331
|
+
# ^^^^^^^^^^
|
|
1332
|
+
# ```
|
|
1273
1333
|
#
|
|
1274
1334
|
# : () -> Prism::node
|
|
1275
1335
|
def key: () -> Prism::node
|
|
@@ -1279,11 +1339,13 @@ module Prism
|
|
|
1279
1339
|
#
|
|
1280
1340
|
# The value of the association, if present. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
1281
1341
|
#
|
|
1282
|
-
#
|
|
1283
|
-
#
|
|
1342
|
+
# ```rb
|
|
1343
|
+
# { foo => bar }
|
|
1344
|
+
# ^^^
|
|
1284
1345
|
#
|
|
1285
|
-
#
|
|
1286
|
-
#
|
|
1346
|
+
# { x: 1 }
|
|
1347
|
+
# ^
|
|
1348
|
+
# ```
|
|
1287
1349
|
#
|
|
1288
1350
|
# : () -> Prism::node
|
|
1289
1351
|
def value: () -> Prism::node
|
|
@@ -1294,8 +1356,10 @@ module Prism
|
|
|
1294
1356
|
#
|
|
1295
1357
|
# The Location of the `=>` operator, if present.
|
|
1296
1358
|
#
|
|
1297
|
-
#
|
|
1298
|
-
#
|
|
1359
|
+
# ```rb
|
|
1360
|
+
# { foo => bar }
|
|
1361
|
+
# ^^
|
|
1362
|
+
# ```
|
|
1299
1363
|
#
|
|
1300
1364
|
# : () -> Location?
|
|
1301
1365
|
def operator_loc: () -> Location?
|
|
@@ -1321,8 +1385,10 @@ module Prism
|
|
|
1321
1385
|
|
|
1322
1386
|
# Represents a splat in a hash literal.
|
|
1323
1387
|
#
|
|
1324
|
-
#
|
|
1325
|
-
#
|
|
1388
|
+
# ```rb
|
|
1389
|
+
# { **foo }
|
|
1390
|
+
# ^^^^^
|
|
1391
|
+
# ```
|
|
1326
1392
|
class AssocSplatNode < Node
|
|
1327
1393
|
@operator_loc: Location
|
|
1328
1394
|
|
|
@@ -1386,8 +1452,10 @@ module Prism
|
|
|
1386
1452
|
#
|
|
1387
1453
|
# The value to be splatted, if present. Will be missing when keyword rest argument forwarding is used.
|
|
1388
1454
|
#
|
|
1389
|
-
#
|
|
1390
|
-
#
|
|
1455
|
+
# ```rb
|
|
1456
|
+
# { **foo }
|
|
1457
|
+
# ^^^
|
|
1458
|
+
# ```
|
|
1391
1459
|
#
|
|
1392
1460
|
# : () -> Prism::node?
|
|
1393
1461
|
def value: () -> Prism::node?
|
|
@@ -1398,8 +1466,10 @@ module Prism
|
|
|
1398
1466
|
#
|
|
1399
1467
|
# The Location of the `**` operator.
|
|
1400
1468
|
#
|
|
1401
|
-
#
|
|
1402
|
-
#
|
|
1469
|
+
# ```rb
|
|
1470
|
+
# { **x }
|
|
1471
|
+
# ^^
|
|
1472
|
+
# ```
|
|
1403
1473
|
#
|
|
1404
1474
|
# : () -> Location
|
|
1405
1475
|
def operator_loc: () -> Location
|
|
@@ -1425,8 +1495,10 @@ module Prism
|
|
|
1425
1495
|
|
|
1426
1496
|
# Represents reading a reference to a field in the previous match.
|
|
1427
1497
|
#
|
|
1428
|
-
#
|
|
1429
|
-
#
|
|
1498
|
+
# ```rb
|
|
1499
|
+
# $'
|
|
1500
|
+
# ^^
|
|
1501
|
+
# ```
|
|
1430
1502
|
class BackReferenceReadNode < Node
|
|
1431
1503
|
@name: Symbol
|
|
1432
1504
|
|
|
@@ -1488,9 +1560,11 @@ module Prism
|
|
|
1488
1560
|
#
|
|
1489
1561
|
# The name of the back-reference variable, including the leading `$`.
|
|
1490
1562
|
#
|
|
1491
|
-
#
|
|
1563
|
+
# ```rb
|
|
1564
|
+
# $& # name `:$&`
|
|
1492
1565
|
#
|
|
1493
|
-
#
|
|
1566
|
+
# $+ # name `:$+`
|
|
1567
|
+
# ```
|
|
1494
1568
|
#
|
|
1495
1569
|
# : () -> Symbol
|
|
1496
1570
|
def name: () -> Symbol
|
|
@@ -1501,10 +1575,12 @@ module Prism
|
|
|
1501
1575
|
|
|
1502
1576
|
# Represents a begin statement.
|
|
1503
1577
|
#
|
|
1504
|
-
#
|
|
1505
|
-
#
|
|
1506
|
-
#
|
|
1507
|
-
#
|
|
1578
|
+
# ```rb
|
|
1579
|
+
# begin
|
|
1580
|
+
# foo
|
|
1581
|
+
# end
|
|
1582
|
+
# ^^^^^
|
|
1583
|
+
# ```
|
|
1508
1584
|
class BeginNode < Node
|
|
1509
1585
|
@end_keyword_loc: Location?
|
|
1510
1586
|
|
|
@@ -1577,8 +1653,10 @@ module Prism
|
|
|
1577
1653
|
#
|
|
1578
1654
|
# Represents the Location of the `begin` keyword.
|
|
1579
1655
|
#
|
|
1580
|
-
#
|
|
1581
|
-
#
|
|
1656
|
+
# ```rb
|
|
1657
|
+
# begin x end
|
|
1658
|
+
# ^^^^^
|
|
1659
|
+
# ```
|
|
1582
1660
|
#
|
|
1583
1661
|
# : () -> Location?
|
|
1584
1662
|
def begin_keyword_loc: () -> Location?
|
|
@@ -1595,8 +1673,10 @@ module Prism
|
|
|
1595
1673
|
#
|
|
1596
1674
|
# Represents the statements within the begin block.
|
|
1597
1675
|
#
|
|
1598
|
-
#
|
|
1599
|
-
#
|
|
1676
|
+
# ```rb
|
|
1677
|
+
# begin x end
|
|
1678
|
+
# ^
|
|
1679
|
+
# ```
|
|
1600
1680
|
#
|
|
1601
1681
|
# : () -> StatementsNode?
|
|
1602
1682
|
def statements: () -> StatementsNode?
|
|
@@ -1606,8 +1686,10 @@ module Prism
|
|
|
1606
1686
|
#
|
|
1607
1687
|
# Represents the rescue clause within the begin block.
|
|
1608
1688
|
#
|
|
1609
|
-
#
|
|
1610
|
-
#
|
|
1689
|
+
# ```rb
|
|
1690
|
+
# begin x; rescue y; end
|
|
1691
|
+
# ^^^^^^^^
|
|
1692
|
+
# ```
|
|
1611
1693
|
#
|
|
1612
1694
|
# : () -> RescueNode?
|
|
1613
1695
|
def rescue_clause: () -> RescueNode?
|
|
@@ -1617,8 +1699,10 @@ module Prism
|
|
|
1617
1699
|
#
|
|
1618
1700
|
# Represents the else clause within the begin block.
|
|
1619
1701
|
#
|
|
1620
|
-
#
|
|
1621
|
-
#
|
|
1702
|
+
# ```rb
|
|
1703
|
+
# begin x; rescue y; else z; end
|
|
1704
|
+
# ^^^^^^^^^^^
|
|
1705
|
+
# ```
|
|
1622
1706
|
#
|
|
1623
1707
|
# : () -> ElseNode?
|
|
1624
1708
|
def else_clause: () -> ElseNode?
|
|
@@ -1628,8 +1712,10 @@ module Prism
|
|
|
1628
1712
|
#
|
|
1629
1713
|
# Represents the ensure clause within the begin block.
|
|
1630
1714
|
#
|
|
1631
|
-
#
|
|
1632
|
-
#
|
|
1715
|
+
# ```rb
|
|
1716
|
+
# begin x; ensure y; end
|
|
1717
|
+
# ^^^^^^^^
|
|
1718
|
+
# ```
|
|
1633
1719
|
#
|
|
1634
1720
|
# : () -> EnsureNode?
|
|
1635
1721
|
def ensure_clause: () -> EnsureNode?
|
|
@@ -1640,8 +1726,10 @@ module Prism
|
|
|
1640
1726
|
#
|
|
1641
1727
|
# Represents the Location of the `end` keyword.
|
|
1642
1728
|
#
|
|
1643
|
-
#
|
|
1644
|
-
#
|
|
1729
|
+
# ```rb
|
|
1730
|
+
# begin x end
|
|
1731
|
+
# ^^^
|
|
1732
|
+
# ```
|
|
1645
1733
|
#
|
|
1646
1734
|
# : () -> Location?
|
|
1647
1735
|
def end_keyword_loc: () -> Location?
|
|
@@ -1675,8 +1763,10 @@ module Prism
|
|
|
1675
1763
|
|
|
1676
1764
|
# Represents a block argument using `&`.
|
|
1677
1765
|
#
|
|
1678
|
-
#
|
|
1679
|
-
#
|
|
1766
|
+
# ```rb
|
|
1767
|
+
# bar(&args)
|
|
1768
|
+
# ^^^^^
|
|
1769
|
+
# ```
|
|
1680
1770
|
class BlockArgumentNode < Node
|
|
1681
1771
|
@operator_loc: Location
|
|
1682
1772
|
|
|
@@ -1740,8 +1830,10 @@ module Prism
|
|
|
1740
1830
|
#
|
|
1741
1831
|
# The expression that is being passed as a block argument. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
1742
1832
|
#
|
|
1743
|
-
#
|
|
1744
|
-
#
|
|
1833
|
+
# ```rb
|
|
1834
|
+
# foo(&args)
|
|
1835
|
+
# ^^^^
|
|
1836
|
+
# ```
|
|
1745
1837
|
#
|
|
1746
1838
|
# : () -> Prism::node?
|
|
1747
1839
|
def expression: () -> Prism::node?
|
|
@@ -1752,8 +1844,10 @@ module Prism
|
|
|
1752
1844
|
#
|
|
1753
1845
|
# Represents the Location of the `&` operator.
|
|
1754
1846
|
#
|
|
1755
|
-
#
|
|
1756
|
-
#
|
|
1847
|
+
# ```rb
|
|
1848
|
+
# foo(&args)
|
|
1849
|
+
# ^
|
|
1850
|
+
# ```
|
|
1757
1851
|
#
|
|
1758
1852
|
# : () -> Location
|
|
1759
1853
|
def operator_loc: () -> Location
|
|
@@ -1779,8 +1873,10 @@ module Prism
|
|
|
1779
1873
|
|
|
1780
1874
|
# Represents a block local variable.
|
|
1781
1875
|
#
|
|
1782
|
-
#
|
|
1783
|
-
#
|
|
1876
|
+
# ```rb
|
|
1877
|
+
# a { |; b| }
|
|
1878
|
+
# ^
|
|
1879
|
+
# ```
|
|
1784
1880
|
class BlockLocalVariableNode < Node
|
|
1785
1881
|
@name: Symbol
|
|
1786
1882
|
|
|
@@ -1848,8 +1944,10 @@ module Prism
|
|
|
1848
1944
|
#
|
|
1849
1945
|
# The name of the block local variable.
|
|
1850
1946
|
#
|
|
1851
|
-
#
|
|
1852
|
-
#
|
|
1947
|
+
# ```rb
|
|
1948
|
+
# a { |; b| } # name `:b`
|
|
1949
|
+
# ^
|
|
1950
|
+
# ```
|
|
1853
1951
|
#
|
|
1854
1952
|
# : () -> Symbol
|
|
1855
1953
|
def name: () -> Symbol
|
|
@@ -1860,8 +1958,10 @@ module Prism
|
|
|
1860
1958
|
|
|
1861
1959
|
# Represents a block of ruby code.
|
|
1862
1960
|
#
|
|
1863
|
-
#
|
|
1864
|
-
#
|
|
1961
|
+
# ```rb
|
|
1962
|
+
# [1, 2, 3].each { |i| puts x }
|
|
1963
|
+
# ^^^^^^^^^^^^^^
|
|
1964
|
+
# ```
|
|
1865
1965
|
class BlockNode < Node
|
|
1866
1966
|
@closing_loc: Location
|
|
1867
1967
|
|
|
@@ -1931,8 +2031,10 @@ module Prism
|
|
|
1931
2031
|
#
|
|
1932
2032
|
# The local variables declared in the block.
|
|
1933
2033
|
#
|
|
1934
|
-
#
|
|
1935
|
-
#
|
|
2034
|
+
# ```rb
|
|
2035
|
+
# [1, 2, 3].each { |i| puts x } # locals: [:i]
|
|
2036
|
+
# ^
|
|
2037
|
+
# ```
|
|
1936
2038
|
#
|
|
1937
2039
|
# : () -> Array[Symbol]
|
|
1938
2040
|
def locals: () -> Array[Symbol]
|
|
@@ -1942,12 +2044,14 @@ module Prism
|
|
|
1942
2044
|
#
|
|
1943
2045
|
# The parameters of the block.
|
|
1944
2046
|
#
|
|
1945
|
-
#
|
|
1946
|
-
#
|
|
1947
|
-
#
|
|
1948
|
-
#
|
|
1949
|
-
#
|
|
1950
|
-
#
|
|
2047
|
+
# ```rb
|
|
2048
|
+
# [1, 2, 3].each { |i| puts x }
|
|
2049
|
+
# ^^^
|
|
2050
|
+
# [1, 2, 3].each { puts _1 }
|
|
2051
|
+
# ^^^^^^^^^^^
|
|
2052
|
+
# [1, 2, 3].each { puts it }
|
|
2053
|
+
# ^^^^^^^^^^^
|
|
2054
|
+
# ```
|
|
1951
2055
|
#
|
|
1952
2056
|
# : () -> (BlockParametersNode | NumberedParametersNode | ItParametersNode)?
|
|
1953
2057
|
def parameters: () -> (BlockParametersNode | NumberedParametersNode | ItParametersNode)?
|
|
@@ -1957,8 +2061,10 @@ module Prism
|
|
|
1957
2061
|
#
|
|
1958
2062
|
# The body of the block.
|
|
1959
2063
|
#
|
|
1960
|
-
#
|
|
1961
|
-
#
|
|
2064
|
+
# ```rb
|
|
2065
|
+
# [1, 2, 3].each { |i| puts x }
|
|
2066
|
+
# ^^^^^^
|
|
2067
|
+
# ```
|
|
1962
2068
|
#
|
|
1963
2069
|
# : () -> (StatementsNode | BeginNode)?
|
|
1964
2070
|
def body: () -> (StatementsNode | BeginNode)?
|
|
@@ -1969,8 +2075,10 @@ module Prism
|
|
|
1969
2075
|
#
|
|
1970
2076
|
# Represents the Location of the opening `{` or `do`.
|
|
1971
2077
|
#
|
|
1972
|
-
#
|
|
1973
|
-
#
|
|
2078
|
+
# ```rb
|
|
2079
|
+
# [1, 2, 3].each { |i| puts x }
|
|
2080
|
+
# ^
|
|
2081
|
+
# ```
|
|
1974
2082
|
#
|
|
1975
2083
|
# : () -> Location
|
|
1976
2084
|
def opening_loc: () -> Location
|
|
@@ -1988,8 +2096,10 @@ module Prism
|
|
|
1988
2096
|
#
|
|
1989
2097
|
# Represents the Location of the closing `}` or `end`.
|
|
1990
2098
|
#
|
|
1991
|
-
#
|
|
1992
|
-
#
|
|
2099
|
+
# ```rb
|
|
2100
|
+
# [1, 2, 3].each { |i| puts x }
|
|
2101
|
+
# ^
|
|
2102
|
+
# ```
|
|
1993
2103
|
#
|
|
1994
2104
|
# : () -> Location
|
|
1995
2105
|
def closing_loc: () -> Location
|
|
@@ -2023,9 +2133,11 @@ module Prism
|
|
|
2023
2133
|
|
|
2024
2134
|
# Represents a block parameter of a method, block, or lambda definition.
|
|
2025
2135
|
#
|
|
2026
|
-
#
|
|
2027
|
-
#
|
|
2028
|
-
#
|
|
2136
|
+
# ```rb
|
|
2137
|
+
# def a(&b)
|
|
2138
|
+
# ^^
|
|
2139
|
+
# end
|
|
2140
|
+
# ```
|
|
2029
2141
|
class BlockParameterNode < Node
|
|
2030
2142
|
@operator_loc: Location
|
|
2031
2143
|
|
|
@@ -2097,9 +2209,11 @@ module Prism
|
|
|
2097
2209
|
#
|
|
2098
2210
|
# The name of the block parameter.
|
|
2099
2211
|
#
|
|
2100
|
-
#
|
|
2101
|
-
#
|
|
2102
|
-
#
|
|
2212
|
+
# ```rb
|
|
2213
|
+
# def a(&b) # name `:b`
|
|
2214
|
+
# ^
|
|
2215
|
+
# end
|
|
2216
|
+
# ```
|
|
2103
2217
|
#
|
|
2104
2218
|
# : () -> Symbol?
|
|
2105
2219
|
def name: () -> Symbol?
|
|
@@ -2110,8 +2224,10 @@ module Prism
|
|
|
2110
2224
|
#
|
|
2111
2225
|
# Represents the Location of the block parameter name.
|
|
2112
2226
|
#
|
|
2113
|
-
#
|
|
2114
|
-
#
|
|
2227
|
+
# ```rb
|
|
2228
|
+
# def a(&b)
|
|
2229
|
+
# ^
|
|
2230
|
+
# ```
|
|
2115
2231
|
#
|
|
2116
2232
|
# : () -> Location?
|
|
2117
2233
|
def name_loc: () -> Location?
|
|
@@ -2129,9 +2245,11 @@ module Prism
|
|
|
2129
2245
|
#
|
|
2130
2246
|
# Represents the Location of the `&` operator.
|
|
2131
2247
|
#
|
|
2132
|
-
#
|
|
2133
|
-
#
|
|
2134
|
-
#
|
|
2248
|
+
# ```rb
|
|
2249
|
+
# def a(&b)
|
|
2250
|
+
# ^
|
|
2251
|
+
# end
|
|
2252
|
+
# ```
|
|
2135
2253
|
#
|
|
2136
2254
|
# : () -> Location
|
|
2137
2255
|
def operator_loc: () -> Location
|
|
@@ -2157,12 +2275,14 @@ module Prism
|
|
|
2157
2275
|
|
|
2158
2276
|
# Represents a block's parameters declaration.
|
|
2159
2277
|
#
|
|
2160
|
-
#
|
|
2161
|
-
#
|
|
2278
|
+
# ```rb
|
|
2279
|
+
# -> (a, b = 1; local) { }
|
|
2280
|
+
# ^^^^^^^^^^^^^^^^^
|
|
2162
2281
|
#
|
|
2163
|
-
#
|
|
2164
|
-
#
|
|
2165
|
-
#
|
|
2282
|
+
# foo do |a, b = 1; local|
|
|
2283
|
+
# ^^^^^^^^^^^^^^^^^
|
|
2284
|
+
# end
|
|
2285
|
+
# ```
|
|
2166
2286
|
class BlockParametersNode < Node
|
|
2167
2287
|
@closing_loc: Location?
|
|
2168
2288
|
|
|
@@ -2230,12 +2350,14 @@ module Prism
|
|
|
2230
2350
|
#
|
|
2231
2351
|
# Represents the parameters of the block.
|
|
2232
2352
|
#
|
|
2233
|
-
#
|
|
2234
|
-
#
|
|
2353
|
+
# ```rb
|
|
2354
|
+
# -> (a, b = 1; local) { }
|
|
2355
|
+
# ^^^^^^^^
|
|
2235
2356
|
#
|
|
2236
|
-
#
|
|
2237
|
-
#
|
|
2238
|
-
#
|
|
2357
|
+
# foo do |a, b = 1; local|
|
|
2358
|
+
# ^^^^^^^^
|
|
2359
|
+
# end
|
|
2360
|
+
# ```
|
|
2239
2361
|
#
|
|
2240
2362
|
# : () -> ParametersNode?
|
|
2241
2363
|
def parameters: () -> ParametersNode?
|
|
@@ -2245,12 +2367,14 @@ module Prism
|
|
|
2245
2367
|
#
|
|
2246
2368
|
# Represents the local variables of the block.
|
|
2247
2369
|
#
|
|
2248
|
-
#
|
|
2249
|
-
#
|
|
2370
|
+
# ```rb
|
|
2371
|
+
# -> (a, b = 1; local) { }
|
|
2372
|
+
# ^^^^^
|
|
2250
2373
|
#
|
|
2251
|
-
#
|
|
2252
|
-
#
|
|
2253
|
-
#
|
|
2374
|
+
# foo do |a, b = 1; local|
|
|
2375
|
+
# ^^^^^
|
|
2376
|
+
# end
|
|
2377
|
+
# ```
|
|
2254
2378
|
#
|
|
2255
2379
|
# : () -> Array[BlockLocalVariableNode]
|
|
2256
2380
|
def locals: () -> Array[BlockLocalVariableNode]
|
|
@@ -2261,12 +2385,14 @@ module Prism
|
|
|
2261
2385
|
#
|
|
2262
2386
|
# Represents the opening Location of the block parameters.
|
|
2263
2387
|
#
|
|
2264
|
-
#
|
|
2265
|
-
#
|
|
2388
|
+
# ```rb
|
|
2389
|
+
# -> (a, b = 1; local) { }
|
|
2390
|
+
# ^
|
|
2266
2391
|
#
|
|
2267
|
-
#
|
|
2268
|
-
#
|
|
2269
|
-
#
|
|
2392
|
+
# foo do |a, b = 1; local|
|
|
2393
|
+
# ^
|
|
2394
|
+
# end
|
|
2395
|
+
# ```
|
|
2270
2396
|
#
|
|
2271
2397
|
# : () -> Location?
|
|
2272
2398
|
def opening_loc: () -> Location?
|
|
@@ -2284,12 +2410,14 @@ module Prism
|
|
|
2284
2410
|
#
|
|
2285
2411
|
# Represents the closing Location of the block parameters.
|
|
2286
2412
|
#
|
|
2287
|
-
#
|
|
2288
|
-
#
|
|
2413
|
+
# ```rb
|
|
2414
|
+
# -> (a, b = 1; local) { }
|
|
2415
|
+
# ^
|
|
2289
2416
|
#
|
|
2290
|
-
#
|
|
2291
|
-
#
|
|
2292
|
-
#
|
|
2417
|
+
# foo do |a, b = 1; local|
|
|
2418
|
+
# ^
|
|
2419
|
+
# end
|
|
2420
|
+
# ```
|
|
2293
2421
|
#
|
|
2294
2422
|
# : () -> Location?
|
|
2295
2423
|
def closing_loc: () -> Location?
|
|
@@ -2323,8 +2451,10 @@ module Prism
|
|
|
2323
2451
|
|
|
2324
2452
|
# Represents the use of the `break` keyword.
|
|
2325
2453
|
#
|
|
2326
|
-
#
|
|
2327
|
-
#
|
|
2454
|
+
# ```rb
|
|
2455
|
+
# break foo
|
|
2456
|
+
# ^^^^^^^^^
|
|
2457
|
+
# ```
|
|
2328
2458
|
class BreakNode < Node
|
|
2329
2459
|
@keyword_loc: Location
|
|
2330
2460
|
|
|
@@ -2388,8 +2518,10 @@ module Prism
|
|
|
2388
2518
|
#
|
|
2389
2519
|
# The arguments to the break statement, if present. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
2390
2520
|
#
|
|
2391
|
-
#
|
|
2392
|
-
#
|
|
2521
|
+
# ```rb
|
|
2522
|
+
# break foo
|
|
2523
|
+
# ^^^
|
|
2524
|
+
# ```
|
|
2393
2525
|
#
|
|
2394
2526
|
# : () -> ArgumentsNode?
|
|
2395
2527
|
def arguments: () -> ArgumentsNode?
|
|
@@ -2400,8 +2532,10 @@ module Prism
|
|
|
2400
2532
|
#
|
|
2401
2533
|
# The Location of the `break` keyword.
|
|
2402
2534
|
#
|
|
2403
|
-
#
|
|
2404
|
-
#
|
|
2535
|
+
# ```rb
|
|
2536
|
+
# break foo
|
|
2537
|
+
# ^^^^^
|
|
2538
|
+
# ```
|
|
2405
2539
|
#
|
|
2406
2540
|
# : () -> Location
|
|
2407
2541
|
def keyword_loc: () -> Location
|
|
@@ -2427,8 +2561,10 @@ module Prism
|
|
|
2427
2561
|
|
|
2428
2562
|
# Represents the use of the `&&=` operator on a call.
|
|
2429
2563
|
#
|
|
2430
|
-
#
|
|
2431
|
-
#
|
|
2564
|
+
# ```rb
|
|
2565
|
+
# foo.bar &&= value
|
|
2566
|
+
# ^^^^^^^^^^^^^^^^^
|
|
2567
|
+
# ```
|
|
2432
2568
|
class CallAndWriteNode < Node
|
|
2433
2569
|
@value: Prism::node
|
|
2434
2570
|
|
|
@@ -2526,8 +2662,10 @@ module Prism
|
|
|
2526
2662
|
#
|
|
2527
2663
|
# The object that the method is being called on. This can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
2528
2664
|
#
|
|
2529
|
-
#
|
|
2530
|
-
#
|
|
2665
|
+
# ```rb
|
|
2666
|
+
# foo.bar &&= value
|
|
2667
|
+
# ^^^
|
|
2668
|
+
# ```
|
|
2531
2669
|
#
|
|
2532
2670
|
# : () -> Prism::node?
|
|
2533
2671
|
def receiver: () -> Prism::node?
|
|
@@ -2538,8 +2676,10 @@ module Prism
|
|
|
2538
2676
|
#
|
|
2539
2677
|
# Represents the Location of the call operator.
|
|
2540
2678
|
#
|
|
2541
|
-
#
|
|
2542
|
-
#
|
|
2679
|
+
# ```rb
|
|
2680
|
+
# foo.bar &&= value
|
|
2681
|
+
# ^
|
|
2682
|
+
# ```
|
|
2543
2683
|
#
|
|
2544
2684
|
# : () -> Location?
|
|
2545
2685
|
def call_operator_loc: () -> Location?
|
|
@@ -2557,8 +2697,10 @@ module Prism
|
|
|
2557
2697
|
#
|
|
2558
2698
|
# Represents the Location of the message.
|
|
2559
2699
|
#
|
|
2560
|
-
#
|
|
2561
|
-
#
|
|
2700
|
+
# ```rb
|
|
2701
|
+
# foo.bar &&= value
|
|
2702
|
+
# ^^^
|
|
2703
|
+
# ```
|
|
2562
2704
|
#
|
|
2563
2705
|
# : () -> Location?
|
|
2564
2706
|
def message_loc: () -> Location?
|
|
@@ -2575,8 +2717,10 @@ module Prism
|
|
|
2575
2717
|
#
|
|
2576
2718
|
# Represents the name of the method being called.
|
|
2577
2719
|
#
|
|
2578
|
-
#
|
|
2579
|
-
#
|
|
2720
|
+
# ```rb
|
|
2721
|
+
# foo.bar &&= value # read_name `:bar`
|
|
2722
|
+
# ^^^
|
|
2723
|
+
# ```
|
|
2580
2724
|
#
|
|
2581
2725
|
# : () -> Symbol
|
|
2582
2726
|
def read_name: () -> Symbol
|
|
@@ -2586,8 +2730,10 @@ module Prism
|
|
|
2586
2730
|
#
|
|
2587
2731
|
# Represents the name of the method being written to.
|
|
2588
2732
|
#
|
|
2589
|
-
#
|
|
2590
|
-
#
|
|
2733
|
+
# ```rb
|
|
2734
|
+
# foo.bar &&= value # write_name `:bar=`
|
|
2735
|
+
# ^^^
|
|
2736
|
+
# ```
|
|
2591
2737
|
#
|
|
2592
2738
|
# : () -> Symbol
|
|
2593
2739
|
def write_name: () -> Symbol
|
|
@@ -2598,8 +2744,10 @@ module Prism
|
|
|
2598
2744
|
#
|
|
2599
2745
|
# Represents the Location of the operator.
|
|
2600
2746
|
#
|
|
2601
|
-
#
|
|
2602
|
-
#
|
|
2747
|
+
# ```rb
|
|
2748
|
+
# foo.bar &&= value
|
|
2749
|
+
# ^^^
|
|
2750
|
+
# ```
|
|
2603
2751
|
#
|
|
2604
2752
|
# : () -> Location
|
|
2605
2753
|
def operator_loc: () -> Location
|
|
@@ -2616,8 +2764,10 @@ module Prism
|
|
|
2616
2764
|
#
|
|
2617
2765
|
# Represents the value being assigned.
|
|
2618
2766
|
#
|
|
2619
|
-
#
|
|
2620
|
-
#
|
|
2767
|
+
# ```rb
|
|
2768
|
+
# foo.bar &&= value
|
|
2769
|
+
# ^^^^^
|
|
2770
|
+
# ```
|
|
2621
2771
|
#
|
|
2622
2772
|
# : () -> Prism::node
|
|
2623
2773
|
def value: () -> Prism::node
|
|
@@ -2652,23 +2802,25 @@ module Prism
|
|
|
2652
2802
|
|
|
2653
2803
|
# Represents a method call, in all of the various forms that can take.
|
|
2654
2804
|
#
|
|
2655
|
-
#
|
|
2656
|
-
#
|
|
2805
|
+
# ```rb
|
|
2806
|
+
# foo
|
|
2807
|
+
# ^^^
|
|
2657
2808
|
#
|
|
2658
|
-
#
|
|
2659
|
-
#
|
|
2809
|
+
# foo()
|
|
2810
|
+
# ^^^^^
|
|
2660
2811
|
#
|
|
2661
|
-
#
|
|
2662
|
-
#
|
|
2812
|
+
# +foo
|
|
2813
|
+
# ^^^^
|
|
2663
2814
|
#
|
|
2664
|
-
#
|
|
2665
|
-
#
|
|
2815
|
+
# foo + bar
|
|
2816
|
+
# ^^^^^^^^^
|
|
2666
2817
|
#
|
|
2667
|
-
#
|
|
2668
|
-
#
|
|
2818
|
+
# foo.bar
|
|
2819
|
+
# ^^^^^^^
|
|
2669
2820
|
#
|
|
2670
|
-
#
|
|
2671
|
-
#
|
|
2821
|
+
# foo&.bar
|
|
2822
|
+
# ^^^^^^^^
|
|
2823
|
+
# ```
|
|
2672
2824
|
class CallNode < Node
|
|
2673
2825
|
@block: (BlockNode | BlockArgumentNode)?
|
|
2674
2826
|
|
|
@@ -2770,14 +2922,16 @@ module Prism
|
|
|
2770
2922
|
#
|
|
2771
2923
|
# The object that the method is being called on. This can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
2772
2924
|
#
|
|
2773
|
-
#
|
|
2774
|
-
#
|
|
2925
|
+
# ```rb
|
|
2926
|
+
# foo.bar
|
|
2927
|
+
# ^^^
|
|
2775
2928
|
#
|
|
2776
|
-
#
|
|
2777
|
-
#
|
|
2929
|
+
# +foo
|
|
2930
|
+
# ^^^
|
|
2778
2931
|
#
|
|
2779
|
-
#
|
|
2780
|
-
#
|
|
2932
|
+
# foo + bar
|
|
2933
|
+
# ^^^
|
|
2934
|
+
# ```
|
|
2781
2935
|
#
|
|
2782
2936
|
# : () -> Prism::node?
|
|
2783
2937
|
def receiver: () -> Prism::node?
|
|
@@ -2788,11 +2942,13 @@ module Prism
|
|
|
2788
2942
|
#
|
|
2789
2943
|
# Represents the Location of the call operator.
|
|
2790
2944
|
#
|
|
2791
|
-
#
|
|
2792
|
-
#
|
|
2945
|
+
# ```rb
|
|
2946
|
+
# foo.bar
|
|
2947
|
+
# ^
|
|
2793
2948
|
#
|
|
2794
|
-
#
|
|
2795
|
-
#
|
|
2949
|
+
# foo&.bar
|
|
2950
|
+
# ^^
|
|
2951
|
+
# ```
|
|
2796
2952
|
#
|
|
2797
2953
|
# : () -> Location?
|
|
2798
2954
|
def call_operator_loc: () -> Location?
|
|
@@ -2809,8 +2965,10 @@ module Prism
|
|
|
2809
2965
|
#
|
|
2810
2966
|
# Represents the name of the method being called.
|
|
2811
2967
|
#
|
|
2812
|
-
#
|
|
2813
|
-
#
|
|
2968
|
+
# ```rb
|
|
2969
|
+
# foo.bar # name `:foo`
|
|
2970
|
+
# ^^^
|
|
2971
|
+
# ```
|
|
2814
2972
|
#
|
|
2815
2973
|
# : () -> Symbol
|
|
2816
2974
|
def name: () -> Symbol
|
|
@@ -2821,8 +2979,10 @@ module Prism
|
|
|
2821
2979
|
#
|
|
2822
2980
|
# Represents the Location of the message.
|
|
2823
2981
|
#
|
|
2824
|
-
#
|
|
2825
|
-
#
|
|
2982
|
+
# ```rb
|
|
2983
|
+
# foo.bar
|
|
2984
|
+
# ^^^
|
|
2985
|
+
# ```
|
|
2826
2986
|
#
|
|
2827
2987
|
# : () -> Location?
|
|
2828
2988
|
def message_loc: () -> Location?
|
|
@@ -2840,8 +3000,10 @@ module Prism
|
|
|
2840
3000
|
#
|
|
2841
3001
|
# Represents the Location of the left parenthesis.
|
|
2842
3002
|
#
|
|
2843
|
-
#
|
|
2844
|
-
#
|
|
3003
|
+
# ```rb
|
|
3004
|
+
# foo(bar)
|
|
3005
|
+
# ^
|
|
3006
|
+
# ```
|
|
2845
3007
|
#
|
|
2846
3008
|
# : () -> Location?
|
|
2847
3009
|
def opening_loc: () -> Location?
|
|
@@ -2858,8 +3020,10 @@ module Prism
|
|
|
2858
3020
|
#
|
|
2859
3021
|
# Represents the arguments to the method call. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
2860
3022
|
#
|
|
2861
|
-
#
|
|
2862
|
-
#
|
|
3023
|
+
# ```rb
|
|
3024
|
+
# foo(bar)
|
|
3025
|
+
# ^^^
|
|
3026
|
+
# ```
|
|
2863
3027
|
#
|
|
2864
3028
|
# : () -> ArgumentsNode?
|
|
2865
3029
|
def arguments: () -> ArgumentsNode?
|
|
@@ -2870,8 +3034,10 @@ module Prism
|
|
|
2870
3034
|
#
|
|
2871
3035
|
# Represents the Location of the right parenthesis.
|
|
2872
3036
|
#
|
|
2873
|
-
#
|
|
2874
|
-
#
|
|
3037
|
+
# ```rb
|
|
3038
|
+
# foo(bar)
|
|
3039
|
+
# ^
|
|
3040
|
+
# ```
|
|
2875
3041
|
#
|
|
2876
3042
|
# : () -> Location?
|
|
2877
3043
|
def closing_loc: () -> Location?
|
|
@@ -2889,11 +3055,13 @@ module Prism
|
|
|
2889
3055
|
#
|
|
2890
3056
|
# Represents the Location of the equal sign, in the case that this is an attribute write.
|
|
2891
3057
|
#
|
|
2892
|
-
#
|
|
2893
|
-
#
|
|
3058
|
+
# ```rb
|
|
3059
|
+
# foo.bar = value
|
|
3060
|
+
# ^
|
|
2894
3061
|
#
|
|
2895
|
-
#
|
|
2896
|
-
#
|
|
3062
|
+
# foo[bar] = value
|
|
3063
|
+
# ^
|
|
3064
|
+
# ```
|
|
2897
3065
|
#
|
|
2898
3066
|
# : () -> Location?
|
|
2899
3067
|
def equal_loc: () -> Location?
|
|
@@ -2910,8 +3078,10 @@ module Prism
|
|
|
2910
3078
|
#
|
|
2911
3079
|
# Represents the block that is being passed to the method.
|
|
2912
3080
|
#
|
|
2913
|
-
#
|
|
2914
|
-
#
|
|
3081
|
+
# ```rb
|
|
3082
|
+
# foo { |a| a }
|
|
3083
|
+
# ^^^^^^^^^
|
|
3084
|
+
# ```
|
|
2915
3085
|
#
|
|
2916
3086
|
# : () -> (BlockNode | BlockArgumentNode)?
|
|
2917
3087
|
def block: () -> (BlockNode | BlockArgumentNode)?
|
|
@@ -2962,8 +3132,10 @@ module Prism
|
|
|
2962
3132
|
|
|
2963
3133
|
# Represents the use of an assignment operator on a call.
|
|
2964
3134
|
#
|
|
2965
|
-
#
|
|
2966
|
-
#
|
|
3135
|
+
# ```rb
|
|
3136
|
+
# foo.bar += baz
|
|
3137
|
+
# ^^^^^^^^^^^^^^
|
|
3138
|
+
# ```
|
|
2967
3139
|
class CallOperatorWriteNode < Node
|
|
2968
3140
|
@value: Prism::node
|
|
2969
3141
|
|
|
@@ -3063,8 +3235,10 @@ module Prism
|
|
|
3063
3235
|
#
|
|
3064
3236
|
# The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
3065
3237
|
#
|
|
3066
|
-
#
|
|
3067
|
-
#
|
|
3238
|
+
# ```rb
|
|
3239
|
+
# foo.bar += value
|
|
3240
|
+
# ^^^
|
|
3241
|
+
# ```
|
|
3068
3242
|
#
|
|
3069
3243
|
# : () -> Prism::node?
|
|
3070
3244
|
def receiver: () -> Prism::node?
|
|
@@ -3075,8 +3249,10 @@ module Prism
|
|
|
3075
3249
|
#
|
|
3076
3250
|
# Represents the Location of the call operator.
|
|
3077
3251
|
#
|
|
3078
|
-
#
|
|
3079
|
-
#
|
|
3252
|
+
# ```rb
|
|
3253
|
+
# foo.bar += value
|
|
3254
|
+
# ^
|
|
3255
|
+
# ```
|
|
3080
3256
|
#
|
|
3081
3257
|
# : () -> Location?
|
|
3082
3258
|
def call_operator_loc: () -> Location?
|
|
@@ -3094,8 +3270,10 @@ module Prism
|
|
|
3094
3270
|
#
|
|
3095
3271
|
# Represents the Location of the message.
|
|
3096
3272
|
#
|
|
3097
|
-
#
|
|
3098
|
-
#
|
|
3273
|
+
# ```rb
|
|
3274
|
+
# foo.bar += value
|
|
3275
|
+
# ^^^
|
|
3276
|
+
# ```
|
|
3099
3277
|
#
|
|
3100
3278
|
# : () -> Location?
|
|
3101
3279
|
def message_loc: () -> Location?
|
|
@@ -3112,8 +3290,10 @@ module Prism
|
|
|
3112
3290
|
#
|
|
3113
3291
|
# Represents the name of the method being called.
|
|
3114
3292
|
#
|
|
3115
|
-
#
|
|
3116
|
-
#
|
|
3293
|
+
# ```rb
|
|
3294
|
+
# foo.bar += value # read_name `:bar`
|
|
3295
|
+
# ^^^
|
|
3296
|
+
# ```
|
|
3117
3297
|
#
|
|
3118
3298
|
# : () -> Symbol
|
|
3119
3299
|
def read_name: () -> Symbol
|
|
@@ -3123,8 +3303,10 @@ module Prism
|
|
|
3123
3303
|
#
|
|
3124
3304
|
# Represents the name of the method being written to.
|
|
3125
3305
|
#
|
|
3126
|
-
#
|
|
3127
|
-
#
|
|
3306
|
+
# ```rb
|
|
3307
|
+
# foo.bar += value # write_name `:bar=`
|
|
3308
|
+
# ^^^
|
|
3309
|
+
# ```
|
|
3128
3310
|
#
|
|
3129
3311
|
# : () -> Symbol
|
|
3130
3312
|
def write_name: () -> Symbol
|
|
@@ -3134,8 +3316,10 @@ module Prism
|
|
|
3134
3316
|
#
|
|
3135
3317
|
# Represents the binary operator being used.
|
|
3136
3318
|
#
|
|
3137
|
-
#
|
|
3138
|
-
#
|
|
3319
|
+
# ```rb
|
|
3320
|
+
# foo.bar += value # binary_operator `:+`
|
|
3321
|
+
# ^
|
|
3322
|
+
# ```
|
|
3139
3323
|
#
|
|
3140
3324
|
# : () -> Symbol
|
|
3141
3325
|
def binary_operator: () -> Symbol
|
|
@@ -3146,8 +3330,10 @@ module Prism
|
|
|
3146
3330
|
#
|
|
3147
3331
|
# Represents the Location of the binary operator.
|
|
3148
3332
|
#
|
|
3149
|
-
#
|
|
3150
|
-
#
|
|
3333
|
+
# ```rb
|
|
3334
|
+
# foo.bar += value
|
|
3335
|
+
# ^^
|
|
3336
|
+
# ```
|
|
3151
3337
|
#
|
|
3152
3338
|
# : () -> Location
|
|
3153
3339
|
def binary_operator_loc: () -> Location
|
|
@@ -3164,8 +3350,10 @@ module Prism
|
|
|
3164
3350
|
#
|
|
3165
3351
|
# Represents the value being assigned.
|
|
3166
3352
|
#
|
|
3167
|
-
#
|
|
3168
|
-
#
|
|
3353
|
+
# ```rb
|
|
3354
|
+
# foo.bar += value
|
|
3355
|
+
# ^^^^^
|
|
3356
|
+
# ```
|
|
3169
3357
|
#
|
|
3170
3358
|
# : () -> Prism::node
|
|
3171
3359
|
def value: () -> Prism::node
|
|
@@ -3192,8 +3380,10 @@ module Prism
|
|
|
3192
3380
|
|
|
3193
3381
|
# Represents the use of the `||=` operator on a call.
|
|
3194
3382
|
#
|
|
3195
|
-
#
|
|
3196
|
-
#
|
|
3383
|
+
# ```rb
|
|
3384
|
+
# foo.bar ||= value
|
|
3385
|
+
# ^^^^^^^^^^^^^^^^^
|
|
3386
|
+
# ```
|
|
3197
3387
|
class CallOrWriteNode < Node
|
|
3198
3388
|
@value: Prism::node
|
|
3199
3389
|
|
|
@@ -3291,8 +3481,10 @@ module Prism
|
|
|
3291
3481
|
#
|
|
3292
3482
|
# The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
3293
3483
|
#
|
|
3294
|
-
#
|
|
3295
|
-
#
|
|
3484
|
+
# ```rb
|
|
3485
|
+
# foo.bar ||= value
|
|
3486
|
+
# ^^^
|
|
3487
|
+
# ```
|
|
3296
3488
|
#
|
|
3297
3489
|
# : () -> Prism::node?
|
|
3298
3490
|
def receiver: () -> Prism::node?
|
|
@@ -3303,8 +3495,10 @@ module Prism
|
|
|
3303
3495
|
#
|
|
3304
3496
|
# Represents the Location of the call operator.
|
|
3305
3497
|
#
|
|
3306
|
-
#
|
|
3307
|
-
#
|
|
3498
|
+
# ```rb
|
|
3499
|
+
# foo.bar ||= value
|
|
3500
|
+
# ^
|
|
3501
|
+
# ```
|
|
3308
3502
|
#
|
|
3309
3503
|
# : () -> Location?
|
|
3310
3504
|
def call_operator_loc: () -> Location?
|
|
@@ -3322,8 +3516,10 @@ module Prism
|
|
|
3322
3516
|
#
|
|
3323
3517
|
# Represents the Location of the message.
|
|
3324
3518
|
#
|
|
3325
|
-
#
|
|
3326
|
-
#
|
|
3519
|
+
# ```rb
|
|
3520
|
+
# foo.bar ||= value
|
|
3521
|
+
# ^^^
|
|
3522
|
+
# ```
|
|
3327
3523
|
#
|
|
3328
3524
|
# : () -> Location?
|
|
3329
3525
|
def message_loc: () -> Location?
|
|
@@ -3340,8 +3536,10 @@ module Prism
|
|
|
3340
3536
|
#
|
|
3341
3537
|
# Represents the name of the method being called.
|
|
3342
3538
|
#
|
|
3343
|
-
#
|
|
3344
|
-
#
|
|
3539
|
+
# ```rb
|
|
3540
|
+
# foo.bar ||= value # read_name `:bar`
|
|
3541
|
+
# ^^^
|
|
3542
|
+
# ```
|
|
3345
3543
|
#
|
|
3346
3544
|
# : () -> Symbol
|
|
3347
3545
|
def read_name: () -> Symbol
|
|
@@ -3351,8 +3549,10 @@ module Prism
|
|
|
3351
3549
|
#
|
|
3352
3550
|
# Represents the name of the method being written to.
|
|
3353
3551
|
#
|
|
3354
|
-
#
|
|
3355
|
-
#
|
|
3552
|
+
# ```rb
|
|
3553
|
+
# foo.bar ||= value # write_name `:bar=`
|
|
3554
|
+
# ^^^
|
|
3555
|
+
# ```
|
|
3356
3556
|
#
|
|
3357
3557
|
# : () -> Symbol
|
|
3358
3558
|
def write_name: () -> Symbol
|
|
@@ -3363,8 +3563,10 @@ module Prism
|
|
|
3363
3563
|
#
|
|
3364
3564
|
# Represents the Location of the operator.
|
|
3365
3565
|
#
|
|
3366
|
-
#
|
|
3367
|
-
#
|
|
3566
|
+
# ```rb
|
|
3567
|
+
# foo.bar ||= value
|
|
3568
|
+
# ^^^
|
|
3569
|
+
# ```
|
|
3368
3570
|
#
|
|
3369
3571
|
# : () -> Location
|
|
3370
3572
|
def operator_loc: () -> Location
|
|
@@ -3381,8 +3583,10 @@ module Prism
|
|
|
3381
3583
|
#
|
|
3382
3584
|
# Represents the value being assigned.
|
|
3383
3585
|
#
|
|
3384
|
-
#
|
|
3385
|
-
#
|
|
3586
|
+
# ```rb
|
|
3587
|
+
# foo.bar ||= value
|
|
3588
|
+
# ^^^^^
|
|
3589
|
+
# ```
|
|
3386
3590
|
#
|
|
3387
3591
|
# : () -> Prism::node
|
|
3388
3592
|
def value: () -> Prism::node
|
|
@@ -3417,16 +3621,18 @@ module Prism
|
|
|
3417
3621
|
|
|
3418
3622
|
# Represents assigning to a method call.
|
|
3419
3623
|
#
|
|
3420
|
-
#
|
|
3421
|
-
#
|
|
3624
|
+
# ```rb
|
|
3625
|
+
# foo.bar, = 1
|
|
3626
|
+
# ^^^^^^^
|
|
3422
3627
|
#
|
|
3423
|
-
#
|
|
3424
|
-
#
|
|
3425
|
-
#
|
|
3426
|
-
#
|
|
3628
|
+
# begin
|
|
3629
|
+
# rescue => foo.bar
|
|
3630
|
+
# ^^^^^^^
|
|
3631
|
+
# end
|
|
3427
3632
|
#
|
|
3428
|
-
#
|
|
3429
|
-
#
|
|
3633
|
+
# for foo.bar in baz do end
|
|
3634
|
+
# ^^^^^^^
|
|
3635
|
+
# ```
|
|
3430
3636
|
class CallTargetNode < Node
|
|
3431
3637
|
@message_loc: Location
|
|
3432
3638
|
|
|
@@ -3518,8 +3724,10 @@ module Prism
|
|
|
3518
3724
|
#
|
|
3519
3725
|
# The object that the method is being called on. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
3520
3726
|
#
|
|
3521
|
-
#
|
|
3522
|
-
#
|
|
3727
|
+
# ```rb
|
|
3728
|
+
# foo.bar = 1
|
|
3729
|
+
# ^^^
|
|
3730
|
+
# ```
|
|
3523
3731
|
#
|
|
3524
3732
|
# : () -> Prism::node
|
|
3525
3733
|
def receiver: () -> Prism::node
|
|
@@ -3530,8 +3738,10 @@ module Prism
|
|
|
3530
3738
|
#
|
|
3531
3739
|
# Represents the Location of the call operator.
|
|
3532
3740
|
#
|
|
3533
|
-
#
|
|
3534
|
-
#
|
|
3741
|
+
# ```rb
|
|
3742
|
+
# foo.bar = 1
|
|
3743
|
+
# ^
|
|
3744
|
+
# ```
|
|
3535
3745
|
#
|
|
3536
3746
|
# : () -> Location
|
|
3537
3747
|
def call_operator_loc: () -> Location
|
|
@@ -3548,8 +3758,10 @@ module Prism
|
|
|
3548
3758
|
#
|
|
3549
3759
|
# Represents the name of the method being called.
|
|
3550
3760
|
#
|
|
3551
|
-
#
|
|
3552
|
-
#
|
|
3761
|
+
# ```rb
|
|
3762
|
+
# foo.bar = 1 # name `:foo`
|
|
3763
|
+
# ^^^
|
|
3764
|
+
# ```
|
|
3553
3765
|
#
|
|
3554
3766
|
# : () -> Symbol
|
|
3555
3767
|
def name: () -> Symbol
|
|
@@ -3560,8 +3772,10 @@ module Prism
|
|
|
3560
3772
|
#
|
|
3561
3773
|
# Represents the Location of the message.
|
|
3562
3774
|
#
|
|
3563
|
-
#
|
|
3564
|
-
#
|
|
3775
|
+
# ```rb
|
|
3776
|
+
# foo.bar = 1
|
|
3777
|
+
# ^^^
|
|
3778
|
+
# ```
|
|
3565
3779
|
#
|
|
3566
3780
|
# : () -> Location
|
|
3567
3781
|
def message_loc: () -> Location
|
|
@@ -3595,8 +3809,10 @@ module Prism
|
|
|
3595
3809
|
|
|
3596
3810
|
# Represents assigning to a local variable in pattern matching.
|
|
3597
3811
|
#
|
|
3598
|
-
#
|
|
3599
|
-
#
|
|
3812
|
+
# ```rb
|
|
3813
|
+
# foo => [bar => baz]
|
|
3814
|
+
# ^^^^^^^^^^
|
|
3815
|
+
# ```
|
|
3600
3816
|
class CapturePatternNode < Node
|
|
3601
3817
|
@operator_loc: Location
|
|
3602
3818
|
|
|
@@ -3662,8 +3878,10 @@ module Prism
|
|
|
3662
3878
|
#
|
|
3663
3879
|
# Represents the value to capture.
|
|
3664
3880
|
#
|
|
3665
|
-
#
|
|
3666
|
-
#
|
|
3881
|
+
# ```rb
|
|
3882
|
+
# foo => bar
|
|
3883
|
+
# ^^^
|
|
3884
|
+
# ```
|
|
3667
3885
|
#
|
|
3668
3886
|
# : () -> Prism::node
|
|
3669
3887
|
def value: () -> Prism::node
|
|
@@ -3673,8 +3891,10 @@ module Prism
|
|
|
3673
3891
|
#
|
|
3674
3892
|
# Represents the target of the capture.
|
|
3675
3893
|
#
|
|
3676
|
-
#
|
|
3677
|
-
#
|
|
3894
|
+
# ```rb
|
|
3895
|
+
# foo => bar
|
|
3896
|
+
# ^^^
|
|
3897
|
+
# ```
|
|
3678
3898
|
#
|
|
3679
3899
|
# : () -> LocalVariableTargetNode
|
|
3680
3900
|
def target: () -> LocalVariableTargetNode
|
|
@@ -3685,8 +3905,10 @@ module Prism
|
|
|
3685
3905
|
#
|
|
3686
3906
|
# Represents the Location of the `=>` operator.
|
|
3687
3907
|
#
|
|
3688
|
-
#
|
|
3689
|
-
#
|
|
3908
|
+
# ```rb
|
|
3909
|
+
# foo => bar
|
|
3910
|
+
# ^^
|
|
3911
|
+
# ```
|
|
3690
3912
|
#
|
|
3691
3913
|
# : () -> Location
|
|
3692
3914
|
def operator_loc: () -> Location
|
|
@@ -3712,10 +3934,12 @@ module Prism
|
|
|
3712
3934
|
|
|
3713
3935
|
# Represents the use of a case statement for pattern matching.
|
|
3714
3936
|
#
|
|
3715
|
-
#
|
|
3716
|
-
#
|
|
3717
|
-
#
|
|
3718
|
-
#
|
|
3937
|
+
# ```rb
|
|
3938
|
+
# case true
|
|
3939
|
+
# in false
|
|
3940
|
+
# end
|
|
3941
|
+
# ^^^^^^^^^
|
|
3942
|
+
# ```
|
|
3719
3943
|
class CaseMatchNode < Node
|
|
3720
3944
|
@end_keyword_loc: Location
|
|
3721
3945
|
|
|
@@ -3785,8 +4009,10 @@ module Prism
|
|
|
3785
4009
|
#
|
|
3786
4010
|
# Represents the predicate of the case match. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
3787
4011
|
#
|
|
3788
|
-
#
|
|
3789
|
-
#
|
|
4012
|
+
# ```rb
|
|
4013
|
+
# case true; in false; end
|
|
4014
|
+
# ^^^^
|
|
4015
|
+
# ```
|
|
3790
4016
|
#
|
|
3791
4017
|
# : () -> Prism::node?
|
|
3792
4018
|
def predicate: () -> Prism::node?
|
|
@@ -3796,8 +4022,10 @@ module Prism
|
|
|
3796
4022
|
#
|
|
3797
4023
|
# Represents the conditions of the case match.
|
|
3798
4024
|
#
|
|
3799
|
-
#
|
|
3800
|
-
#
|
|
4025
|
+
# ```rb
|
|
4026
|
+
# case true; in false; end
|
|
4027
|
+
# ^^^^^^^^
|
|
4028
|
+
# ```
|
|
3801
4029
|
#
|
|
3802
4030
|
# : () -> Array[InNode]
|
|
3803
4031
|
def conditions: () -> Array[InNode]
|
|
@@ -3807,8 +4035,10 @@ module Prism
|
|
|
3807
4035
|
#
|
|
3808
4036
|
# Represents the else clause of the case match.
|
|
3809
4037
|
#
|
|
3810
|
-
#
|
|
3811
|
-
#
|
|
4038
|
+
# ```rb
|
|
4039
|
+
# case true; in false; else; end
|
|
4040
|
+
# ^^^^^^^^^
|
|
4041
|
+
# ```
|
|
3812
4042
|
#
|
|
3813
4043
|
# : () -> ElseNode?
|
|
3814
4044
|
def else_clause: () -> ElseNode?
|
|
@@ -3819,8 +4049,10 @@ module Prism
|
|
|
3819
4049
|
#
|
|
3820
4050
|
# Represents the Location of the `case` keyword.
|
|
3821
4051
|
#
|
|
3822
|
-
#
|
|
3823
|
-
#
|
|
4052
|
+
# ```rb
|
|
4053
|
+
# case true; in false; end
|
|
4054
|
+
# ^^^^
|
|
4055
|
+
# ```
|
|
3824
4056
|
#
|
|
3825
4057
|
# : () -> Location
|
|
3826
4058
|
def case_keyword_loc: () -> Location
|
|
@@ -3838,8 +4070,10 @@ module Prism
|
|
|
3838
4070
|
#
|
|
3839
4071
|
# Represents the Location of the `end` keyword.
|
|
3840
4072
|
#
|
|
3841
|
-
#
|
|
3842
|
-
#
|
|
4073
|
+
# ```rb
|
|
4074
|
+
# case true; in false; end
|
|
4075
|
+
# ^^^
|
|
4076
|
+
# ```
|
|
3843
4077
|
#
|
|
3844
4078
|
# : () -> Location
|
|
3845
4079
|
def end_keyword_loc: () -> Location
|
|
@@ -3873,10 +4107,12 @@ module Prism
|
|
|
3873
4107
|
|
|
3874
4108
|
# Represents the use of a case statement.
|
|
3875
4109
|
#
|
|
3876
|
-
#
|
|
3877
|
-
#
|
|
3878
|
-
#
|
|
3879
|
-
#
|
|
4110
|
+
# ```rb
|
|
4111
|
+
# case true
|
|
4112
|
+
# when false
|
|
4113
|
+
# end
|
|
4114
|
+
# ^^^^^^^^^^
|
|
4115
|
+
# ```
|
|
3880
4116
|
class CaseNode < Node
|
|
3881
4117
|
@end_keyword_loc: Location
|
|
3882
4118
|
|
|
@@ -3946,8 +4182,10 @@ module Prism
|
|
|
3946
4182
|
#
|
|
3947
4183
|
# Represents the predicate of the case statement. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
3948
4184
|
#
|
|
3949
|
-
#
|
|
3950
|
-
#
|
|
4185
|
+
# ```rb
|
|
4186
|
+
# case true; when false; end
|
|
4187
|
+
# ^^^^
|
|
4188
|
+
# ```
|
|
3951
4189
|
#
|
|
3952
4190
|
# : () -> Prism::node?
|
|
3953
4191
|
def predicate: () -> Prism::node?
|
|
@@ -3957,8 +4195,10 @@ module Prism
|
|
|
3957
4195
|
#
|
|
3958
4196
|
# Represents the conditions of the case statement.
|
|
3959
4197
|
#
|
|
3960
|
-
#
|
|
3961
|
-
#
|
|
4198
|
+
# ```rb
|
|
4199
|
+
# case true; when false; end
|
|
4200
|
+
# ^^^^^^^^^^
|
|
4201
|
+
# ```
|
|
3962
4202
|
#
|
|
3963
4203
|
# : () -> Array[WhenNode]
|
|
3964
4204
|
def conditions: () -> Array[WhenNode]
|
|
@@ -3968,8 +4208,10 @@ module Prism
|
|
|
3968
4208
|
#
|
|
3969
4209
|
# Represents the else clause of the case statement.
|
|
3970
4210
|
#
|
|
3971
|
-
#
|
|
3972
|
-
#
|
|
4211
|
+
# ```rb
|
|
4212
|
+
# case true; when false; else; end
|
|
4213
|
+
# ^^^^^^^^^
|
|
4214
|
+
# ```
|
|
3973
4215
|
#
|
|
3974
4216
|
# : () -> ElseNode?
|
|
3975
4217
|
def else_clause: () -> ElseNode?
|
|
@@ -3980,8 +4222,10 @@ module Prism
|
|
|
3980
4222
|
#
|
|
3981
4223
|
# Represents the Location of the `case` keyword.
|
|
3982
4224
|
#
|
|
3983
|
-
#
|
|
3984
|
-
#
|
|
4225
|
+
# ```rb
|
|
4226
|
+
# case true; when false; end
|
|
4227
|
+
# ^^^^
|
|
4228
|
+
# ```
|
|
3985
4229
|
#
|
|
3986
4230
|
# : () -> Location
|
|
3987
4231
|
def case_keyword_loc: () -> Location
|
|
@@ -3999,8 +4243,10 @@ module Prism
|
|
|
3999
4243
|
#
|
|
4000
4244
|
# Represents the Location of the `end` keyword.
|
|
4001
4245
|
#
|
|
4002
|
-
#
|
|
4003
|
-
#
|
|
4246
|
+
# ```rb
|
|
4247
|
+
# case true; when false; end
|
|
4248
|
+
# ^^^
|
|
4249
|
+
# ```
|
|
4004
4250
|
#
|
|
4005
4251
|
# : () -> Location
|
|
4006
4252
|
def end_keyword_loc: () -> Location
|
|
@@ -4034,8 +4280,10 @@ module Prism
|
|
|
4034
4280
|
|
|
4035
4281
|
# Represents a class declaration involving the `class` keyword.
|
|
4036
4282
|
#
|
|
4037
|
-
#
|
|
4038
|
-
#
|
|
4283
|
+
# ```rb
|
|
4284
|
+
# class Foo end
|
|
4285
|
+
# ^^^^^^^^^^^^^
|
|
4286
|
+
# ```
|
|
4039
4287
|
class ClassNode < Node
|
|
4040
4288
|
@name: Symbol
|
|
4041
4289
|
|
|
@@ -4120,8 +4368,10 @@ module Prism
|
|
|
4120
4368
|
#
|
|
4121
4369
|
# Represents the Location of the `class` keyword.
|
|
4122
4370
|
#
|
|
4123
|
-
#
|
|
4124
|
-
#
|
|
4371
|
+
# ```rb
|
|
4372
|
+
# class Foo end
|
|
4373
|
+
# ^^^^^
|
|
4374
|
+
# ```
|
|
4125
4375
|
#
|
|
4126
4376
|
# : () -> Location
|
|
4127
4377
|
def class_keyword_loc: () -> Location
|
|
@@ -4147,8 +4397,10 @@ module Prism
|
|
|
4147
4397
|
#
|
|
4148
4398
|
# Represents the Location of the `<` operator.
|
|
4149
4399
|
#
|
|
4150
|
-
#
|
|
4151
|
-
#
|
|
4400
|
+
# ```rb
|
|
4401
|
+
# class Foo < Bar
|
|
4402
|
+
# ^
|
|
4403
|
+
# ```
|
|
4152
4404
|
#
|
|
4153
4405
|
# : () -> Location?
|
|
4154
4406
|
def inheritance_operator_loc: () -> Location?
|
|
@@ -4165,8 +4417,10 @@ module Prism
|
|
|
4165
4417
|
#
|
|
4166
4418
|
# Represents the superclass of the class.
|
|
4167
4419
|
#
|
|
4168
|
-
#
|
|
4169
|
-
#
|
|
4420
|
+
# ```rb
|
|
4421
|
+
# class Foo < Bar
|
|
4422
|
+
# ^^^
|
|
4423
|
+
# ```
|
|
4170
4424
|
#
|
|
4171
4425
|
# : () -> Prism::node?
|
|
4172
4426
|
def superclass: () -> Prism::node?
|
|
@@ -4176,8 +4430,10 @@ module Prism
|
|
|
4176
4430
|
#
|
|
4177
4431
|
# Represents the body of the class.
|
|
4178
4432
|
#
|
|
4179
|
-
#
|
|
4180
|
-
#
|
|
4433
|
+
# ```rb
|
|
4434
|
+
# class Foo; bar; end
|
|
4435
|
+
# ^^^
|
|
4436
|
+
# ```
|
|
4181
4437
|
#
|
|
4182
4438
|
# : () -> (StatementsNode | BeginNode)?
|
|
4183
4439
|
def body: () -> (StatementsNode | BeginNode)?
|
|
@@ -4188,8 +4444,10 @@ module Prism
|
|
|
4188
4444
|
#
|
|
4189
4445
|
# Represents the Location of the `end` keyword.
|
|
4190
4446
|
#
|
|
4191
|
-
#
|
|
4192
|
-
#
|
|
4447
|
+
# ```rb
|
|
4448
|
+
# class Foo end
|
|
4449
|
+
# ^^^
|
|
4450
|
+
# ```
|
|
4193
4451
|
#
|
|
4194
4452
|
# : () -> Location
|
|
4195
4453
|
def end_keyword_loc: () -> Location
|
|
@@ -4206,7 +4464,9 @@ module Prism
|
|
|
4206
4464
|
#
|
|
4207
4465
|
# The name of the class.
|
|
4208
4466
|
#
|
|
4209
|
-
#
|
|
4467
|
+
# ```rb
|
|
4468
|
+
# class Foo end # name `:Foo`
|
|
4469
|
+
# ```
|
|
4210
4470
|
#
|
|
4211
4471
|
# : () -> Symbol
|
|
4212
4472
|
def name: () -> Symbol
|
|
@@ -4241,8 +4501,10 @@ module Prism
|
|
|
4241
4501
|
|
|
4242
4502
|
# Represents the use of the `&&=` operator for assignment to a class variable.
|
|
4243
4503
|
#
|
|
4244
|
-
#
|
|
4245
|
-
#
|
|
4504
|
+
# ```rb
|
|
4505
|
+
# @@target &&= value
|
|
4506
|
+
# ^^^^^^^^^^^^^^^^^^
|
|
4507
|
+
# ```
|
|
4246
4508
|
class ClassVariableAndWriteNode < Node
|
|
4247
4509
|
@value: Prism::node
|
|
4248
4510
|
|
|
@@ -4310,8 +4572,10 @@ module Prism
|
|
|
4310
4572
|
#
|
|
4311
4573
|
# The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
|
4312
4574
|
#
|
|
4313
|
-
#
|
|
4314
|
-
#
|
|
4575
|
+
# ```rb
|
|
4576
|
+
# @@target &&= value # name `:@@target`
|
|
4577
|
+
# ^^^^^^^^
|
|
4578
|
+
# ```
|
|
4315
4579
|
#
|
|
4316
4580
|
# : () -> Symbol
|
|
4317
4581
|
def name: () -> Symbol
|
|
@@ -4322,8 +4586,10 @@ module Prism
|
|
|
4322
4586
|
#
|
|
4323
4587
|
# Represents the Location of the variable name.
|
|
4324
4588
|
#
|
|
4325
|
-
#
|
|
4326
|
-
#
|
|
4589
|
+
# ```rb
|
|
4590
|
+
# @@target &&= value
|
|
4591
|
+
# ^^^^^^^^
|
|
4592
|
+
# ```
|
|
4327
4593
|
#
|
|
4328
4594
|
# : () -> Location
|
|
4329
4595
|
def name_loc: () -> Location
|
|
@@ -4341,8 +4607,10 @@ module Prism
|
|
|
4341
4607
|
#
|
|
4342
4608
|
# Represents the Location of the `&&=` operator.
|
|
4343
4609
|
#
|
|
4344
|
-
#
|
|
4345
|
-
#
|
|
4610
|
+
# ```rb
|
|
4611
|
+
# @@target &&= value
|
|
4612
|
+
# ^^^
|
|
4613
|
+
# ```
|
|
4346
4614
|
#
|
|
4347
4615
|
# : () -> Location
|
|
4348
4616
|
def operator_loc: () -> Location
|
|
@@ -4359,8 +4627,10 @@ module Prism
|
|
|
4359
4627
|
#
|
|
4360
4628
|
# Represents the value being assigned. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
4361
4629
|
#
|
|
4362
|
-
#
|
|
4363
|
-
#
|
|
4630
|
+
# ```rb
|
|
4631
|
+
# @@target &&= value
|
|
4632
|
+
# ^^^^^
|
|
4633
|
+
# ```
|
|
4364
4634
|
#
|
|
4365
4635
|
# : () -> Prism::node
|
|
4366
4636
|
def value: () -> Prism::node
|
|
@@ -4379,8 +4649,10 @@ module Prism
|
|
|
4379
4649
|
|
|
4380
4650
|
# Represents assigning to a class variable using an operator that isn't `=`.
|
|
4381
4651
|
#
|
|
4382
|
-
#
|
|
4383
|
-
#
|
|
4652
|
+
# ```rb
|
|
4653
|
+
# @@target += value
|
|
4654
|
+
# ^^^^^^^^^^^^^^^^^
|
|
4655
|
+
# ```
|
|
4384
4656
|
class ClassVariableOperatorWriteNode < Node
|
|
4385
4657
|
@binary_operator: Symbol
|
|
4386
4658
|
|
|
@@ -4507,8 +4779,10 @@ module Prism
|
|
|
4507
4779
|
|
|
4508
4780
|
# Represents the use of the `||=` operator for assignment to a class variable.
|
|
4509
4781
|
#
|
|
4510
|
-
#
|
|
4511
|
-
#
|
|
4782
|
+
# ```rb
|
|
4783
|
+
# @@target ||= value
|
|
4784
|
+
# ^^^^^^^^^^^^^^^^^^
|
|
4785
|
+
# ```
|
|
4512
4786
|
class ClassVariableOrWriteNode < Node
|
|
4513
4787
|
@value: Prism::node
|
|
4514
4788
|
|
|
@@ -4633,8 +4907,10 @@ module Prism
|
|
|
4633
4907
|
|
|
4634
4908
|
# Represents referencing a class variable.
|
|
4635
4909
|
#
|
|
4636
|
-
#
|
|
4637
|
-
#
|
|
4910
|
+
# ```rb
|
|
4911
|
+
# @@foo
|
|
4912
|
+
# ^^^^^
|
|
4913
|
+
# ```
|
|
4638
4914
|
class ClassVariableReadNode < Node
|
|
4639
4915
|
@name: Symbol
|
|
4640
4916
|
|
|
@@ -4696,9 +4972,11 @@ module Prism
|
|
|
4696
4972
|
#
|
|
4697
4973
|
# The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
|
4698
4974
|
#
|
|
4699
|
-
#
|
|
4975
|
+
# ```rb
|
|
4976
|
+
# @@abc # name `:@@abc`
|
|
4700
4977
|
#
|
|
4701
|
-
#
|
|
4978
|
+
# @@_test # name `:@@_test`
|
|
4979
|
+
# ```
|
|
4702
4980
|
#
|
|
4703
4981
|
# : () -> Symbol
|
|
4704
4982
|
def name: () -> Symbol
|
|
@@ -4709,8 +4987,10 @@ module Prism
|
|
|
4709
4987
|
|
|
4710
4988
|
# Represents writing to a class variable in a context that doesn't have an explicit value.
|
|
4711
4989
|
#
|
|
4712
|
-
#
|
|
4713
|
-
#
|
|
4990
|
+
# ```rb
|
|
4991
|
+
# @@foo, @@bar = baz
|
|
4992
|
+
# ^^^^^ ^^^^^
|
|
4993
|
+
# ```
|
|
4714
4994
|
class ClassVariableTargetNode < Node
|
|
4715
4995
|
@name: Symbol
|
|
4716
4996
|
|
|
@@ -4781,8 +5061,10 @@ module Prism
|
|
|
4781
5061
|
|
|
4782
5062
|
# Represents writing to a class variable.
|
|
4783
5063
|
#
|
|
4784
|
-
#
|
|
4785
|
-
#
|
|
5064
|
+
# ```rb
|
|
5065
|
+
# @@foo = 1
|
|
5066
|
+
# ^^^^^^^^^
|
|
5067
|
+
# ```
|
|
4786
5068
|
class ClassVariableWriteNode < Node
|
|
4787
5069
|
@operator_loc: Location
|
|
4788
5070
|
|
|
@@ -4850,9 +5132,11 @@ module Prism
|
|
|
4850
5132
|
#
|
|
4851
5133
|
# The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
|
4852
5134
|
#
|
|
4853
|
-
#
|
|
5135
|
+
# ```rb
|
|
5136
|
+
# @@abc = 123 # name `@@abc`
|
|
4854
5137
|
#
|
|
4855
|
-
#
|
|
5138
|
+
# @@_test = :test # name `@@_test`
|
|
5139
|
+
# ```
|
|
4856
5140
|
#
|
|
4857
5141
|
# : () -> Symbol
|
|
4858
5142
|
def name: () -> Symbol
|
|
@@ -4863,8 +5147,10 @@ module Prism
|
|
|
4863
5147
|
#
|
|
4864
5148
|
# The Location of the variable name.
|
|
4865
5149
|
#
|
|
4866
|
-
#
|
|
4867
|
-
#
|
|
5150
|
+
# ```rb
|
|
5151
|
+
# @@foo = :bar
|
|
5152
|
+
# ^^^^^
|
|
5153
|
+
# ```
|
|
4868
5154
|
#
|
|
4869
5155
|
# : () -> Location
|
|
4870
5156
|
def name_loc: () -> Location
|
|
@@ -4881,11 +5167,13 @@ module Prism
|
|
|
4881
5167
|
#
|
|
4882
5168
|
# The value to write to the class variable. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
4883
5169
|
#
|
|
4884
|
-
#
|
|
4885
|
-
#
|
|
5170
|
+
# ```rb
|
|
5171
|
+
# @@foo = :bar
|
|
5172
|
+
# ^^^^
|
|
4886
5173
|
#
|
|
4887
|
-
#
|
|
4888
|
-
#
|
|
5174
|
+
# @@_xyz = 123
|
|
5175
|
+
# ^^^
|
|
5176
|
+
# ```
|
|
4889
5177
|
#
|
|
4890
5178
|
# : () -> Prism::node
|
|
4891
5179
|
def value: () -> Prism::node
|
|
@@ -4896,8 +5184,10 @@ module Prism
|
|
|
4896
5184
|
#
|
|
4897
5185
|
# The Location of the `=` operator.
|
|
4898
5186
|
#
|
|
4899
|
-
#
|
|
4900
|
-
#
|
|
5187
|
+
# ```rb
|
|
5188
|
+
# @@foo = :bar
|
|
5189
|
+
# ^
|
|
5190
|
+
# ```
|
|
4901
5191
|
#
|
|
4902
5192
|
# : () -> Location
|
|
4903
5193
|
def operator_loc: () -> Location
|
|
@@ -4923,8 +5213,10 @@ module Prism
|
|
|
4923
5213
|
|
|
4924
5214
|
# Represents the use of the `&&=` operator for assignment to a constant.
|
|
4925
5215
|
#
|
|
4926
|
-
#
|
|
4927
|
-
#
|
|
5216
|
+
# ```rb
|
|
5217
|
+
# Target &&= value
|
|
5218
|
+
# ^^^^^^^^^^^^^^^^
|
|
5219
|
+
# ```
|
|
4928
5220
|
class ConstantAndWriteNode < Node
|
|
4929
5221
|
@value: Prism::node
|
|
4930
5222
|
|
|
@@ -5049,8 +5341,10 @@ module Prism
|
|
|
5049
5341
|
|
|
5050
5342
|
# Represents assigning to a constant using an operator that isn't `=`.
|
|
5051
5343
|
#
|
|
5052
|
-
#
|
|
5053
|
-
#
|
|
5344
|
+
# ```rb
|
|
5345
|
+
# Target += value
|
|
5346
|
+
# ^^^^^^^^^^^^^^^
|
|
5347
|
+
# ```
|
|
5054
5348
|
class ConstantOperatorWriteNode < Node
|
|
5055
5349
|
@binary_operator: Symbol
|
|
5056
5350
|
|
|
@@ -5177,8 +5471,10 @@ module Prism
|
|
|
5177
5471
|
|
|
5178
5472
|
# Represents the use of the `||=` operator for assignment to a constant.
|
|
5179
5473
|
#
|
|
5180
|
-
#
|
|
5181
|
-
#
|
|
5474
|
+
# ```rb
|
|
5475
|
+
# Target ||= value
|
|
5476
|
+
# ^^^^^^^^^^^^^^^^
|
|
5477
|
+
# ```
|
|
5182
5478
|
class ConstantOrWriteNode < Node
|
|
5183
5479
|
@value: Prism::node
|
|
5184
5480
|
|
|
@@ -5303,8 +5599,10 @@ module Prism
|
|
|
5303
5599
|
|
|
5304
5600
|
# Represents the use of the `&&=` operator for assignment to a constant path.
|
|
5305
5601
|
#
|
|
5306
|
-
#
|
|
5307
|
-
#
|
|
5602
|
+
# ```rb
|
|
5603
|
+
# Parent::Child &&= value
|
|
5604
|
+
# ^^^^^^^^^^^^^^^^^^^^^^^
|
|
5605
|
+
# ```
|
|
5308
5606
|
class ConstantPathAndWriteNode < Node
|
|
5309
5607
|
@value: Prism::node
|
|
5310
5608
|
|
|
@@ -5411,8 +5709,10 @@ module Prism
|
|
|
5411
5709
|
|
|
5412
5710
|
# Represents accessing a constant through a path of `::` operators.
|
|
5413
5711
|
#
|
|
5414
|
-
#
|
|
5415
|
-
#
|
|
5712
|
+
# ```rb
|
|
5713
|
+
# Foo::Bar
|
|
5714
|
+
# ^^^^^^^^
|
|
5715
|
+
# ```
|
|
5416
5716
|
class ConstantPathNode < Node
|
|
5417
5717
|
@name_loc: Location
|
|
5418
5718
|
|
|
@@ -5480,14 +5780,16 @@ module Prism
|
|
|
5480
5780
|
#
|
|
5481
5781
|
# The left-hand node of the path, if present. It can be `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). It will be `nil` when the constant lookup is at the root of the module tree.
|
|
5482
5782
|
#
|
|
5483
|
-
#
|
|
5484
|
-
#
|
|
5783
|
+
# ```rb
|
|
5784
|
+
# Foo::Bar
|
|
5785
|
+
# ^^^
|
|
5485
5786
|
#
|
|
5486
|
-
#
|
|
5487
|
-
#
|
|
5787
|
+
# self::Test
|
|
5788
|
+
# ^^^^
|
|
5488
5789
|
#
|
|
5489
|
-
#
|
|
5490
|
-
#
|
|
5790
|
+
# a.b::C
|
|
5791
|
+
# ^^^
|
|
5792
|
+
# ```
|
|
5491
5793
|
#
|
|
5492
5794
|
# : () -> Prism::node?
|
|
5493
5795
|
def parent: () -> Prism::node?
|
|
@@ -5506,11 +5808,13 @@ module Prism
|
|
|
5506
5808
|
#
|
|
5507
5809
|
# The Location of the `::` delimiter.
|
|
5508
5810
|
#
|
|
5509
|
-
#
|
|
5510
|
-
#
|
|
5811
|
+
# ```rb
|
|
5812
|
+
# ::Foo
|
|
5813
|
+
# ^^
|
|
5511
5814
|
#
|
|
5512
|
-
#
|
|
5513
|
-
#
|
|
5815
|
+
# One::Two
|
|
5816
|
+
# ^^
|
|
5817
|
+
# ```
|
|
5514
5818
|
#
|
|
5515
5819
|
# : () -> Location
|
|
5516
5820
|
def delimiter_loc: () -> Location
|
|
@@ -5528,11 +5832,13 @@ module Prism
|
|
|
5528
5832
|
#
|
|
5529
5833
|
# The Location of the name of the constant.
|
|
5530
5834
|
#
|
|
5531
|
-
#
|
|
5532
|
-
#
|
|
5835
|
+
# ```rb
|
|
5836
|
+
# ::Foo
|
|
5837
|
+
# ^^^
|
|
5533
5838
|
#
|
|
5534
|
-
#
|
|
5535
|
-
#
|
|
5839
|
+
# One::Two
|
|
5840
|
+
# ^^^
|
|
5841
|
+
# ```
|
|
5536
5842
|
#
|
|
5537
5843
|
# : () -> Location
|
|
5538
5844
|
def name_loc: () -> Location
|
|
@@ -5558,8 +5864,10 @@ module Prism
|
|
|
5558
5864
|
|
|
5559
5865
|
# Represents assigning to a constant path using an operator that isn't `=`.
|
|
5560
5866
|
#
|
|
5561
|
-
#
|
|
5562
|
-
#
|
|
5867
|
+
# ```rb
|
|
5868
|
+
# Parent::Child += value
|
|
5869
|
+
# ^^^^^^^^^^^^^^^^^^^^^^
|
|
5870
|
+
# ```
|
|
5563
5871
|
class ConstantPathOperatorWriteNode < Node
|
|
5564
5872
|
@binary_operator: Symbol
|
|
5565
5873
|
|
|
@@ -5668,8 +5976,10 @@ module Prism
|
|
|
5668
5976
|
|
|
5669
5977
|
# Represents the use of the `||=` operator for assignment to a constant path.
|
|
5670
5978
|
#
|
|
5671
|
-
#
|
|
5672
|
-
#
|
|
5979
|
+
# ```rb
|
|
5980
|
+
# Parent::Child ||= value
|
|
5981
|
+
# ^^^^^^^^^^^^^^^^^^^^^^^
|
|
5982
|
+
# ```
|
|
5673
5983
|
class ConstantPathOrWriteNode < Node
|
|
5674
5984
|
@value: Prism::node
|
|
5675
5985
|
|
|
@@ -5776,8 +6086,10 @@ module Prism
|
|
|
5776
6086
|
|
|
5777
6087
|
# Represents writing to a constant path in a context that doesn't have an explicit value.
|
|
5778
6088
|
#
|
|
5779
|
-
#
|
|
5780
|
-
#
|
|
6089
|
+
# ```rb
|
|
6090
|
+
# Foo::Foo, Bar::Bar = baz
|
|
6091
|
+
# ^^^^^^^^ ^^^^^^^^
|
|
6092
|
+
# ```
|
|
5781
6093
|
class ConstantPathTargetNode < Node
|
|
5782
6094
|
@name_loc: Location
|
|
5783
6095
|
|
|
@@ -5902,14 +6214,16 @@ module Prism
|
|
|
5902
6214
|
|
|
5903
6215
|
# Represents writing to a constant path.
|
|
5904
6216
|
#
|
|
5905
|
-
#
|
|
5906
|
-
#
|
|
6217
|
+
# ```rb
|
|
6218
|
+
# ::Foo = 1
|
|
6219
|
+
# ^^^^^^^^^
|
|
5907
6220
|
#
|
|
5908
|
-
#
|
|
5909
|
-
#
|
|
6221
|
+
# Foo::Bar = 1
|
|
6222
|
+
# ^^^^^^^^^^^^
|
|
5910
6223
|
#
|
|
5911
|
-
#
|
|
5912
|
-
#
|
|
6224
|
+
# ::Foo::Bar = 1
|
|
6225
|
+
# ^^^^^^^^^^^^^^
|
|
6226
|
+
# ```
|
|
5913
6227
|
class ConstantPathWriteNode < Node
|
|
5914
6228
|
@value: Prism::node
|
|
5915
6229
|
|
|
@@ -5975,11 +6289,13 @@ module Prism
|
|
|
5975
6289
|
#
|
|
5976
6290
|
# A node representing the constant path being written to.
|
|
5977
6291
|
#
|
|
5978
|
-
#
|
|
5979
|
-
#
|
|
6292
|
+
# ```rb
|
|
6293
|
+
# Foo::Bar = 1
|
|
6294
|
+
# ^^^^^^^^
|
|
5980
6295
|
#
|
|
5981
|
-
#
|
|
5982
|
-
#
|
|
6296
|
+
# ::Foo = :abc
|
|
6297
|
+
# ^^^^^
|
|
6298
|
+
# ```
|
|
5983
6299
|
#
|
|
5984
6300
|
# : () -> ConstantPathNode
|
|
5985
6301
|
def target: () -> ConstantPathNode
|
|
@@ -5990,8 +6306,10 @@ module Prism
|
|
|
5990
6306
|
#
|
|
5991
6307
|
# The Location of the `=` operator.
|
|
5992
6308
|
#
|
|
5993
|
-
#
|
|
5994
|
-
#
|
|
6309
|
+
# ```rb
|
|
6310
|
+
# ::ABC = 123
|
|
6311
|
+
# ^
|
|
6312
|
+
# ```
|
|
5995
6313
|
#
|
|
5996
6314
|
# : () -> Location
|
|
5997
6315
|
def operator_loc: () -> Location
|
|
@@ -6008,8 +6326,10 @@ module Prism
|
|
|
6008
6326
|
#
|
|
6009
6327
|
# The value to write to the constant path. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
6010
6328
|
#
|
|
6011
|
-
#
|
|
6012
|
-
#
|
|
6329
|
+
# ```rb
|
|
6330
|
+
# FOO::BAR = :abc
|
|
6331
|
+
# ^^^^
|
|
6332
|
+
# ```
|
|
6013
6333
|
#
|
|
6014
6334
|
# : () -> Prism::node
|
|
6015
6335
|
def value: () -> Prism::node
|
|
@@ -6028,8 +6348,10 @@ module Prism
|
|
|
6028
6348
|
|
|
6029
6349
|
# Represents referencing a constant.
|
|
6030
6350
|
#
|
|
6031
|
-
#
|
|
6032
|
-
#
|
|
6351
|
+
# ```rb
|
|
6352
|
+
# Foo
|
|
6353
|
+
# ^^^
|
|
6354
|
+
# ```
|
|
6033
6355
|
class ConstantReadNode < Node
|
|
6034
6356
|
@name: Symbol
|
|
6035
6357
|
|
|
@@ -6091,9 +6413,11 @@ module Prism
|
|
|
6091
6413
|
#
|
|
6092
6414
|
# The name of the [constant](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#constants).
|
|
6093
6415
|
#
|
|
6094
|
-
#
|
|
6416
|
+
# ```rb
|
|
6417
|
+
# X # name `:X`
|
|
6095
6418
|
#
|
|
6096
|
-
#
|
|
6419
|
+
# SOME_CONSTANT # name `:SOME_CONSTANT`
|
|
6420
|
+
# ```
|
|
6097
6421
|
#
|
|
6098
6422
|
# : () -> Symbol
|
|
6099
6423
|
def name: () -> Symbol
|
|
@@ -6104,8 +6428,10 @@ module Prism
|
|
|
6104
6428
|
|
|
6105
6429
|
# Represents writing to a constant in a context that doesn't have an explicit value.
|
|
6106
6430
|
#
|
|
6107
|
-
#
|
|
6108
|
-
#
|
|
6431
|
+
# ```rb
|
|
6432
|
+
# Foo, Bar = baz
|
|
6433
|
+
# ^^^ ^^^
|
|
6434
|
+
# ```
|
|
6109
6435
|
class ConstantTargetNode < Node
|
|
6110
6436
|
@name: Symbol
|
|
6111
6437
|
|
|
@@ -6176,8 +6502,10 @@ module Prism
|
|
|
6176
6502
|
|
|
6177
6503
|
# Represents writing to a constant.
|
|
6178
6504
|
#
|
|
6179
|
-
#
|
|
6180
|
-
#
|
|
6505
|
+
# ```rb
|
|
6506
|
+
# Foo = 1
|
|
6507
|
+
# ^^^^^^^
|
|
6508
|
+
# ```
|
|
6181
6509
|
class ConstantWriteNode < Node
|
|
6182
6510
|
@operator_loc: Location
|
|
6183
6511
|
|
|
@@ -6245,9 +6573,11 @@ module Prism
|
|
|
6245
6573
|
#
|
|
6246
6574
|
# The name of the [constant](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#constants).
|
|
6247
6575
|
#
|
|
6248
|
-
#
|
|
6576
|
+
# ```rb
|
|
6577
|
+
# Foo = :bar # name `:Foo`
|
|
6249
6578
|
#
|
|
6250
|
-
#
|
|
6579
|
+
# XYZ = 1 # name `:XYZ`
|
|
6580
|
+
# ```
|
|
6251
6581
|
#
|
|
6252
6582
|
# : () -> Symbol
|
|
6253
6583
|
def name: () -> Symbol
|
|
@@ -6258,8 +6588,10 @@ module Prism
|
|
|
6258
6588
|
#
|
|
6259
6589
|
# The Location of the constant name.
|
|
6260
6590
|
#
|
|
6261
|
-
#
|
|
6262
|
-
#
|
|
6591
|
+
# ```rb
|
|
6592
|
+
# FOO = 1
|
|
6593
|
+
# ^^^
|
|
6594
|
+
# ```
|
|
6263
6595
|
#
|
|
6264
6596
|
# : () -> Location
|
|
6265
6597
|
def name_loc: () -> Location
|
|
@@ -6276,11 +6608,13 @@ module Prism
|
|
|
6276
6608
|
#
|
|
6277
6609
|
# The value to write to the constant. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
6278
6610
|
#
|
|
6279
|
-
#
|
|
6280
|
-
#
|
|
6611
|
+
# ```rb
|
|
6612
|
+
# FOO = :bar
|
|
6613
|
+
# ^^^^
|
|
6281
6614
|
#
|
|
6282
|
-
#
|
|
6283
|
-
#
|
|
6615
|
+
# MyClass = Class.new
|
|
6616
|
+
# ^^^^^^^^^
|
|
6617
|
+
# ```
|
|
6284
6618
|
#
|
|
6285
6619
|
# : () -> Prism::node
|
|
6286
6620
|
def value: () -> Prism::node
|
|
@@ -6291,8 +6625,10 @@ module Prism
|
|
|
6291
6625
|
#
|
|
6292
6626
|
# The Location of the `=` operator.
|
|
6293
6627
|
#
|
|
6294
|
-
#
|
|
6295
|
-
#
|
|
6628
|
+
# ```rb
|
|
6629
|
+
# FOO = :bar
|
|
6630
|
+
# ^
|
|
6631
|
+
# ```
|
|
6296
6632
|
#
|
|
6297
6633
|
# : () -> Location
|
|
6298
6634
|
def operator_loc: () -> Location
|
|
@@ -6318,9 +6654,11 @@ module Prism
|
|
|
6318
6654
|
|
|
6319
6655
|
# Represents a method definition.
|
|
6320
6656
|
#
|
|
6321
|
-
#
|
|
6322
|
-
#
|
|
6323
|
-
#
|
|
6657
|
+
# ```rb
|
|
6658
|
+
# def method
|
|
6659
|
+
# end
|
|
6660
|
+
# ^^^^^^^^^^
|
|
6661
|
+
# ```
|
|
6324
6662
|
class DefNode < Node
|
|
6325
6663
|
@end_keyword_loc: Location?
|
|
6326
6664
|
|
|
@@ -6605,8 +6943,10 @@ module Prism
|
|
|
6605
6943
|
|
|
6606
6944
|
# Represents the use of the `defined?` keyword.
|
|
6607
6945
|
#
|
|
6608
|
-
#
|
|
6609
|
-
#
|
|
6946
|
+
# ```rb
|
|
6947
|
+
# defined?(a)
|
|
6948
|
+
# ^^^^^^^^^^^
|
|
6949
|
+
# ```
|
|
6610
6950
|
class DefinedNode < Node
|
|
6611
6951
|
@keyword_loc: Location
|
|
6612
6952
|
|
|
@@ -6755,8 +7095,10 @@ module Prism
|
|
|
6755
7095
|
|
|
6756
7096
|
# Represents an `else` clause in a `case`, `if`, or `unless` statement.
|
|
6757
7097
|
#
|
|
6758
|
-
#
|
|
6759
|
-
#
|
|
7098
|
+
# ```rb
|
|
7099
|
+
# if a then b else c end
|
|
7100
|
+
# ^^^^^^^^^^
|
|
7101
|
+
# ```
|
|
6760
7102
|
class ElseNode < Node
|
|
6761
7103
|
@end_keyword_loc: Location?
|
|
6762
7104
|
|
|
@@ -6879,8 +7221,10 @@ module Prism
|
|
|
6879
7221
|
|
|
6880
7222
|
# Represents an interpolated set of statements.
|
|
6881
7223
|
#
|
|
6882
|
-
#
|
|
6883
|
-
#
|
|
7224
|
+
# ```rb
|
|
7225
|
+
# "foo #{bar}"
|
|
7226
|
+
# ^^^^^^
|
|
7227
|
+
# ```
|
|
6884
7228
|
class EmbeddedStatementsNode < Node
|
|
6885
7229
|
@closing_loc: Location
|
|
6886
7230
|
|
|
@@ -7003,8 +7347,10 @@ module Prism
|
|
|
7003
7347
|
|
|
7004
7348
|
# Represents an interpolated variable.
|
|
7005
7349
|
#
|
|
7006
|
-
#
|
|
7007
|
-
#
|
|
7350
|
+
# ```rb
|
|
7351
|
+
# "foo #@bar"
|
|
7352
|
+
# ^^^^^
|
|
7353
|
+
# ```
|
|
7008
7354
|
class EmbeddedVariableNode < Node
|
|
7009
7355
|
@variable: InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode
|
|
7010
7356
|
|
|
@@ -7101,12 +7447,14 @@ module Prism
|
|
|
7101
7447
|
|
|
7102
7448
|
# Represents an `ensure` clause in a `begin` statement.
|
|
7103
7449
|
#
|
|
7104
|
-
#
|
|
7105
|
-
#
|
|
7106
|
-
#
|
|
7107
|
-
#
|
|
7108
|
-
#
|
|
7109
|
-
#
|
|
7450
|
+
# ```rb
|
|
7451
|
+
# begin
|
|
7452
|
+
# foo
|
|
7453
|
+
# ensure
|
|
7454
|
+
# ^^^^^^
|
|
7455
|
+
# bar
|
|
7456
|
+
# end
|
|
7457
|
+
# ```
|
|
7110
7458
|
class EnsureNode < Node
|
|
7111
7459
|
@end_keyword_loc: Location
|
|
7112
7460
|
|
|
@@ -7298,8 +7646,10 @@ module Prism
|
|
|
7298
7646
|
|
|
7299
7647
|
# Represents the use of the literal `false` keyword.
|
|
7300
7648
|
#
|
|
7301
|
-
#
|
|
7302
|
-
#
|
|
7649
|
+
# ```rb
|
|
7650
|
+
# false
|
|
7651
|
+
# ^^^^^
|
|
7652
|
+
# ```
|
|
7303
7653
|
class FalseNode < Node
|
|
7304
7654
|
# Initialize a new FalseNode node.
|
|
7305
7655
|
#
|
|
@@ -7360,17 +7710,19 @@ module Prism
|
|
|
7360
7710
|
|
|
7361
7711
|
# Represents a find pattern in pattern matching.
|
|
7362
7712
|
#
|
|
7363
|
-
#
|
|
7364
|
-
#
|
|
7713
|
+
# ```rb
|
|
7714
|
+
# foo in *bar, baz, *qux
|
|
7715
|
+
# ^^^^^^^^^^^^^^^
|
|
7365
7716
|
#
|
|
7366
|
-
#
|
|
7367
|
-
#
|
|
7717
|
+
# foo in [*bar, baz, *qux]
|
|
7718
|
+
# ^^^^^^^^^^^^^^^^^
|
|
7368
7719
|
#
|
|
7369
|
-
#
|
|
7370
|
-
#
|
|
7720
|
+
# foo in Foo(*bar, baz, *qux)
|
|
7721
|
+
# ^^^^^^^^^^^^^^^^^^^^
|
|
7371
7722
|
#
|
|
7372
|
-
#
|
|
7373
|
-
#
|
|
7723
|
+
# foo => *bar, baz, *qux
|
|
7724
|
+
# ^^^^^^^^^^^^^^^
|
|
7725
|
+
# ```
|
|
7374
7726
|
class FindPatternNode < Node
|
|
7375
7727
|
@closing_loc: Location?
|
|
7376
7728
|
|
|
@@ -7442,8 +7794,10 @@ module Prism
|
|
|
7442
7794
|
#
|
|
7443
7795
|
# Represents the optional constant preceding the pattern
|
|
7444
7796
|
#
|
|
7445
|
-
#
|
|
7446
|
-
#
|
|
7797
|
+
# ```rb
|
|
7798
|
+
# foo in Foo(*bar, baz, *qux)
|
|
7799
|
+
# ^^^
|
|
7800
|
+
# ```
|
|
7447
7801
|
#
|
|
7448
7802
|
# : () -> (ConstantPathNode | ConstantReadNode)?
|
|
7449
7803
|
def constant: () -> (ConstantPathNode | ConstantReadNode)?
|
|
@@ -7453,11 +7807,13 @@ module Prism
|
|
|
7453
7807
|
#
|
|
7454
7808
|
# Represents the first wildcard node in the pattern.
|
|
7455
7809
|
#
|
|
7456
|
-
#
|
|
7457
|
-
#
|
|
7810
|
+
# ```rb
|
|
7811
|
+
# foo in *bar, baz, *qux
|
|
7812
|
+
# ^^^^
|
|
7458
7813
|
#
|
|
7459
|
-
#
|
|
7460
|
-
#
|
|
7814
|
+
# foo in Foo(*bar, baz, *qux)
|
|
7815
|
+
# ^^^^
|
|
7816
|
+
# ```
|
|
7461
7817
|
#
|
|
7462
7818
|
# : () -> SplatNode
|
|
7463
7819
|
def left: () -> SplatNode
|
|
@@ -7467,11 +7823,13 @@ module Prism
|
|
|
7467
7823
|
#
|
|
7468
7824
|
# Represents the nodes in between the wildcards.
|
|
7469
7825
|
#
|
|
7470
|
-
#
|
|
7471
|
-
#
|
|
7826
|
+
# ```rb
|
|
7827
|
+
# foo in *bar, baz, *qux
|
|
7828
|
+
# ^^^
|
|
7472
7829
|
#
|
|
7473
|
-
#
|
|
7474
|
-
#
|
|
7830
|
+
# foo in Foo(*bar, baz, 1, *qux)
|
|
7831
|
+
# ^^^^^^
|
|
7832
|
+
# ```
|
|
7475
7833
|
#
|
|
7476
7834
|
# : () -> Array[Prism::node]
|
|
7477
7835
|
def requireds: () -> Array[Prism::node]
|
|
@@ -7481,11 +7839,13 @@ module Prism
|
|
|
7481
7839
|
#
|
|
7482
7840
|
# Represents the second wildcard node in the pattern.
|
|
7483
7841
|
#
|
|
7484
|
-
#
|
|
7485
|
-
#
|
|
7842
|
+
# ```rb
|
|
7843
|
+
# foo in *bar, baz, *qux
|
|
7844
|
+
# ^^^^
|
|
7486
7845
|
#
|
|
7487
|
-
#
|
|
7488
|
-
#
|
|
7846
|
+
# foo in Foo(*bar, baz, *qux)
|
|
7847
|
+
# ^^^^
|
|
7848
|
+
# ```
|
|
7489
7849
|
#
|
|
7490
7850
|
# : () -> SplatNode
|
|
7491
7851
|
def right: () -> SplatNode
|
|
@@ -7496,11 +7856,13 @@ module Prism
|
|
|
7496
7856
|
#
|
|
7497
7857
|
# The Location of the opening brace.
|
|
7498
7858
|
#
|
|
7499
|
-
#
|
|
7500
|
-
#
|
|
7859
|
+
# ```rb
|
|
7860
|
+
# foo in [*bar, baz, *qux]
|
|
7861
|
+
# ^
|
|
7501
7862
|
#
|
|
7502
|
-
#
|
|
7503
|
-
#
|
|
7863
|
+
# foo in Foo(*bar, baz, *qux)
|
|
7864
|
+
# ^
|
|
7865
|
+
# ```
|
|
7504
7866
|
#
|
|
7505
7867
|
# : () -> Location?
|
|
7506
7868
|
def opening_loc: () -> Location?
|
|
@@ -7518,11 +7880,13 @@ module Prism
|
|
|
7518
7880
|
#
|
|
7519
7881
|
# The Location of the closing brace.
|
|
7520
7882
|
#
|
|
7521
|
-
#
|
|
7522
|
-
#
|
|
7883
|
+
# ```rb
|
|
7884
|
+
# foo in [*bar, baz, *qux]
|
|
7885
|
+
# ^
|
|
7523
7886
|
#
|
|
7524
|
-
#
|
|
7525
|
-
#
|
|
7887
|
+
# foo in Foo(*bar, baz, *qux)
|
|
7888
|
+
# ^
|
|
7889
|
+
# ```
|
|
7526
7890
|
#
|
|
7527
7891
|
# : () -> Location?
|
|
7528
7892
|
def closing_loc: () -> Location?
|
|
@@ -7556,8 +7920,10 @@ module Prism
|
|
|
7556
7920
|
|
|
7557
7921
|
# Represents the use of the `..` or `...` operators to create flip flops.
|
|
7558
7922
|
#
|
|
7559
|
-
#
|
|
7560
|
-
#
|
|
7923
|
+
# ```rb
|
|
7924
|
+
# baz if foo .. bar
|
|
7925
|
+
# ^^^^^^^^^^
|
|
7926
|
+
# ```
|
|
7561
7927
|
class FlipFlopNode < Node
|
|
7562
7928
|
@operator_loc: Location
|
|
7563
7929
|
|
|
@@ -7670,8 +8036,10 @@ module Prism
|
|
|
7670
8036
|
|
|
7671
8037
|
# Represents a floating point number literal.
|
|
7672
8038
|
#
|
|
7673
|
-
#
|
|
7674
|
-
#
|
|
8039
|
+
# ```rb
|
|
8040
|
+
# 1.0
|
|
8041
|
+
# ^^^
|
|
8042
|
+
# ```
|
|
7675
8043
|
class FloatNode < Node
|
|
7676
8044
|
@value: Float
|
|
7677
8045
|
|
|
@@ -7742,8 +8110,10 @@ module Prism
|
|
|
7742
8110
|
|
|
7743
8111
|
# Represents the use of the `for` keyword.
|
|
7744
8112
|
#
|
|
7745
|
-
#
|
|
7746
|
-
#
|
|
8113
|
+
# ```rb
|
|
8114
|
+
# for i in a end
|
|
8115
|
+
# ^^^^^^^^^^^^^^
|
|
8116
|
+
# ```
|
|
7747
8117
|
class ForNode < Node
|
|
7748
8118
|
@end_keyword_loc: Location
|
|
7749
8119
|
|
|
@@ -7817,8 +8187,10 @@ module Prism
|
|
|
7817
8187
|
#
|
|
7818
8188
|
# The index expression for `for` loops.
|
|
7819
8189
|
#
|
|
7820
|
-
#
|
|
7821
|
-
#
|
|
8190
|
+
# ```rb
|
|
8191
|
+
# for i in a end
|
|
8192
|
+
# ^
|
|
8193
|
+
# ```
|
|
7822
8194
|
#
|
|
7823
8195
|
# : () -> (LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode)
|
|
7824
8196
|
def index: () -> (LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode)
|
|
@@ -7828,8 +8200,10 @@ module Prism
|
|
|
7828
8200
|
#
|
|
7829
8201
|
# The collection to iterate over.
|
|
7830
8202
|
#
|
|
7831
|
-
#
|
|
7832
|
-
#
|
|
8203
|
+
# ```rb
|
|
8204
|
+
# for i in a end
|
|
8205
|
+
# ^
|
|
8206
|
+
# ```
|
|
7833
8207
|
#
|
|
7834
8208
|
# : () -> Prism::node
|
|
7835
8209
|
def collection: () -> Prism::node
|
|
@@ -7839,10 +8213,12 @@ module Prism
|
|
|
7839
8213
|
#
|
|
7840
8214
|
# Represents the body of statements to execute for each iteration of the loop.
|
|
7841
8215
|
#
|
|
7842
|
-
#
|
|
7843
|
-
#
|
|
7844
|
-
#
|
|
7845
|
-
#
|
|
8216
|
+
# ```rb
|
|
8217
|
+
# for i in a
|
|
8218
|
+
# foo(i)
|
|
8219
|
+
# ^^^^^^
|
|
8220
|
+
# end
|
|
8221
|
+
# ```
|
|
7846
8222
|
#
|
|
7847
8223
|
# : () -> StatementsNode?
|
|
7848
8224
|
def statements: () -> StatementsNode?
|
|
@@ -7853,8 +8229,10 @@ module Prism
|
|
|
7853
8229
|
#
|
|
7854
8230
|
# The Location of the `for` keyword.
|
|
7855
8231
|
#
|
|
7856
|
-
#
|
|
7857
|
-
#
|
|
8232
|
+
# ```rb
|
|
8233
|
+
# for i in a end
|
|
8234
|
+
# ^^^
|
|
8235
|
+
# ```
|
|
7858
8236
|
#
|
|
7859
8237
|
# : () -> Location
|
|
7860
8238
|
def for_keyword_loc: () -> Location
|
|
@@ -7872,8 +8250,10 @@ module Prism
|
|
|
7872
8250
|
#
|
|
7873
8251
|
# The Location of the `in` keyword.
|
|
7874
8252
|
#
|
|
7875
|
-
#
|
|
7876
|
-
#
|
|
8253
|
+
# ```rb
|
|
8254
|
+
# for i in a end
|
|
8255
|
+
# ^^
|
|
8256
|
+
# ```
|
|
7877
8257
|
#
|
|
7878
8258
|
# : () -> Location
|
|
7879
8259
|
def in_keyword_loc: () -> Location
|
|
@@ -7891,8 +8271,10 @@ module Prism
|
|
|
7891
8271
|
#
|
|
7892
8272
|
# The Location of the `do` keyword, if present.
|
|
7893
8273
|
#
|
|
7894
|
-
#
|
|
7895
|
-
#
|
|
8274
|
+
# ```rb
|
|
8275
|
+
# for i in a do end
|
|
8276
|
+
# ^^
|
|
8277
|
+
# ```
|
|
7896
8278
|
#
|
|
7897
8279
|
# : () -> Location?
|
|
7898
8280
|
def do_keyword_loc: () -> Location?
|
|
@@ -7910,8 +8292,10 @@ module Prism
|
|
|
7910
8292
|
#
|
|
7911
8293
|
# The Location of the `end` keyword.
|
|
7912
8294
|
#
|
|
7913
|
-
#
|
|
7914
|
-
#
|
|
8295
|
+
# ```rb
|
|
8296
|
+
# for i in a end
|
|
8297
|
+
# ^^^
|
|
8298
|
+
# ```
|
|
7915
8299
|
#
|
|
7916
8300
|
# : () -> Location
|
|
7917
8301
|
def end_keyword_loc: () -> Location
|
|
@@ -7961,10 +8345,12 @@ module Prism
|
|
|
7961
8345
|
|
|
7962
8346
|
# Represents forwarding all arguments to this method to another method.
|
|
7963
8347
|
#
|
|
7964
|
-
#
|
|
7965
|
-
#
|
|
7966
|
-
#
|
|
7967
|
-
#
|
|
8348
|
+
# ```rb
|
|
8349
|
+
# def foo(...)
|
|
8350
|
+
# bar(...)
|
|
8351
|
+
# ^^^
|
|
8352
|
+
# end
|
|
8353
|
+
# ```
|
|
7968
8354
|
class ForwardingArgumentsNode < Node
|
|
7969
8355
|
# Initialize a new ForwardingArgumentsNode node.
|
|
7970
8356
|
#
|
|
@@ -8025,9 +8411,11 @@ module Prism
|
|
|
8025
8411
|
|
|
8026
8412
|
# Represents the use of the forwarding parameter in a method, block, or lambda declaration.
|
|
8027
8413
|
#
|
|
8028
|
-
#
|
|
8029
|
-
#
|
|
8030
|
-
#
|
|
8414
|
+
# ```rb
|
|
8415
|
+
# def foo(...)
|
|
8416
|
+
# ^^^
|
|
8417
|
+
# end
|
|
8418
|
+
# ```
|
|
8031
8419
|
class ForwardingParameterNode < Node
|
|
8032
8420
|
# Initialize a new ForwardingParameterNode node.
|
|
8033
8421
|
#
|
|
@@ -8088,12 +8476,14 @@ module Prism
|
|
|
8088
8476
|
|
|
8089
8477
|
# Represents the use of the `super` keyword without parentheses or arguments, but which might have a block.
|
|
8090
8478
|
#
|
|
8091
|
-
#
|
|
8092
|
-
#
|
|
8479
|
+
# ```rb
|
|
8480
|
+
# super
|
|
8481
|
+
# ^^^^^
|
|
8093
8482
|
#
|
|
8094
|
-
#
|
|
8095
|
-
#
|
|
8483
|
+
# super { 123 }
|
|
8484
|
+
# ^^^^^^^^^^^^^
|
|
8096
8485
|
#
|
|
8486
|
+
# ```
|
|
8097
8487
|
# If it has any other arguments, it would be a `SuperNode` instead.
|
|
8098
8488
|
class ForwardingSuperNode < Node
|
|
8099
8489
|
@block: BlockNode?
|
|
@@ -8195,8 +8585,10 @@ module Prism
|
|
|
8195
8585
|
|
|
8196
8586
|
# Represents the use of the `&&=` operator for assignment to a global variable.
|
|
8197
8587
|
#
|
|
8198
|
-
#
|
|
8199
|
-
#
|
|
8588
|
+
# ```rb
|
|
8589
|
+
# $target &&= value
|
|
8590
|
+
# ^^^^^^^^^^^^^^^^^
|
|
8591
|
+
# ```
|
|
8200
8592
|
class GlobalVariableAndWriteNode < Node
|
|
8201
8593
|
@value: Prism::node
|
|
8202
8594
|
|
|
@@ -8321,8 +8713,10 @@ module Prism
|
|
|
8321
8713
|
|
|
8322
8714
|
# Represents assigning to a global variable using an operator that isn't `=`.
|
|
8323
8715
|
#
|
|
8324
|
-
#
|
|
8325
|
-
#
|
|
8716
|
+
# ```rb
|
|
8717
|
+
# $target += value
|
|
8718
|
+
# ^^^^^^^^^^^^^^^^
|
|
8719
|
+
# ```
|
|
8326
8720
|
class GlobalVariableOperatorWriteNode < Node
|
|
8327
8721
|
@binary_operator: Symbol
|
|
8328
8722
|
|
|
@@ -8449,8 +8843,10 @@ module Prism
|
|
|
8449
8843
|
|
|
8450
8844
|
# Represents the use of the `||=` operator for assignment to a global variable.
|
|
8451
8845
|
#
|
|
8452
|
-
#
|
|
8453
|
-
#
|
|
8846
|
+
# ```rb
|
|
8847
|
+
# $target ||= value
|
|
8848
|
+
# ^^^^^^^^^^^^^^^^^
|
|
8849
|
+
# ```
|
|
8454
8850
|
class GlobalVariableOrWriteNode < Node
|
|
8455
8851
|
@value: Prism::node
|
|
8456
8852
|
|
|
@@ -8575,8 +8971,10 @@ module Prism
|
|
|
8575
8971
|
|
|
8576
8972
|
# Represents referencing a global variable.
|
|
8577
8973
|
#
|
|
8578
|
-
#
|
|
8579
|
-
#
|
|
8974
|
+
# ```rb
|
|
8975
|
+
# $foo
|
|
8976
|
+
# ^^^^
|
|
8977
|
+
# ```
|
|
8580
8978
|
class GlobalVariableReadNode < Node
|
|
8581
8979
|
@name: Symbol
|
|
8582
8980
|
|
|
@@ -8638,9 +9036,11 @@ module Prism
|
|
|
8638
9036
|
#
|
|
8639
9037
|
# The name of the global variable, which is a `$` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifier). Alternatively, it can be one of the special global variables designated by a symbol.
|
|
8640
9038
|
#
|
|
8641
|
-
#
|
|
9039
|
+
# ```rb
|
|
9040
|
+
# $foo # name `:$foo`
|
|
8642
9041
|
#
|
|
8643
|
-
#
|
|
9042
|
+
# $_Test # name `:$_Test`
|
|
9043
|
+
# ```
|
|
8644
9044
|
#
|
|
8645
9045
|
# : () -> Symbol
|
|
8646
9046
|
def name: () -> Symbol
|
|
@@ -8651,8 +9051,10 @@ module Prism
|
|
|
8651
9051
|
|
|
8652
9052
|
# Represents writing to a global variable in a context that doesn't have an explicit value.
|
|
8653
9053
|
#
|
|
8654
|
-
#
|
|
8655
|
-
#
|
|
9054
|
+
# ```rb
|
|
9055
|
+
# $foo, $bar = baz
|
|
9056
|
+
# ^^^^ ^^^^
|
|
9057
|
+
# ```
|
|
8656
9058
|
class GlobalVariableTargetNode < Node
|
|
8657
9059
|
@name: Symbol
|
|
8658
9060
|
|
|
@@ -8723,8 +9125,10 @@ module Prism
|
|
|
8723
9125
|
|
|
8724
9126
|
# Represents writing to a global variable.
|
|
8725
9127
|
#
|
|
8726
|
-
#
|
|
8727
|
-
#
|
|
9128
|
+
# ```rb
|
|
9129
|
+
# $foo = 1
|
|
9130
|
+
# ^^^^^^^^
|
|
9131
|
+
# ```
|
|
8728
9132
|
class GlobalVariableWriteNode < Node
|
|
8729
9133
|
@operator_loc: Location
|
|
8730
9134
|
|
|
@@ -8792,9 +9196,11 @@ module Prism
|
|
|
8792
9196
|
#
|
|
8793
9197
|
# The name of the global variable, which is a `$` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifier). Alternatively, it can be one of the special global variables designated by a symbol.
|
|
8794
9198
|
#
|
|
8795
|
-
#
|
|
9199
|
+
# ```rb
|
|
9200
|
+
# $foo = :bar # name `:$foo`
|
|
8796
9201
|
#
|
|
8797
|
-
#
|
|
9202
|
+
# $_Test = 123 # name `:$_Test`
|
|
9203
|
+
# ```
|
|
8798
9204
|
#
|
|
8799
9205
|
# : () -> Symbol
|
|
8800
9206
|
def name: () -> Symbol
|
|
@@ -8805,8 +9211,10 @@ module Prism
|
|
|
8805
9211
|
#
|
|
8806
9212
|
# The Location of the global variable's name.
|
|
8807
9213
|
#
|
|
8808
|
-
#
|
|
8809
|
-
#
|
|
9214
|
+
# ```rb
|
|
9215
|
+
# $foo = :bar
|
|
9216
|
+
# ^^^^
|
|
9217
|
+
# ```
|
|
8810
9218
|
#
|
|
8811
9219
|
# : () -> Location
|
|
8812
9220
|
def name_loc: () -> Location
|
|
@@ -8823,11 +9231,13 @@ module Prism
|
|
|
8823
9231
|
#
|
|
8824
9232
|
# The value to write to the global variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
8825
9233
|
#
|
|
8826
|
-
#
|
|
8827
|
-
#
|
|
9234
|
+
# ```rb
|
|
9235
|
+
# $foo = :bar
|
|
9236
|
+
# ^^^^
|
|
8828
9237
|
#
|
|
8829
|
-
#
|
|
8830
|
-
#
|
|
9238
|
+
# $-xyz = 123
|
|
9239
|
+
# ^^^
|
|
9240
|
+
# ```
|
|
8831
9241
|
#
|
|
8832
9242
|
# : () -> Prism::node
|
|
8833
9243
|
def value: () -> Prism::node
|
|
@@ -8838,8 +9248,10 @@ module Prism
|
|
|
8838
9248
|
#
|
|
8839
9249
|
# The Location of the `=` operator.
|
|
8840
9250
|
#
|
|
8841
|
-
#
|
|
8842
|
-
#
|
|
9251
|
+
# ```rb
|
|
9252
|
+
# $foo = :bar
|
|
9253
|
+
# ^
|
|
9254
|
+
# ```
|
|
8843
9255
|
#
|
|
8844
9256
|
# : () -> Location
|
|
8845
9257
|
def operator_loc: () -> Location
|
|
@@ -8865,8 +9277,10 @@ module Prism
|
|
|
8865
9277
|
|
|
8866
9278
|
# Represents a hash literal.
|
|
8867
9279
|
#
|
|
8868
|
-
#
|
|
8869
|
-
#
|
|
9280
|
+
# ```rb
|
|
9281
|
+
# { a => b }
|
|
9282
|
+
# ^^^^^^^^^^
|
|
9283
|
+
# ```
|
|
8870
9284
|
class HashNode < Node
|
|
8871
9285
|
@closing_loc: Location
|
|
8872
9286
|
|
|
@@ -8933,8 +9347,10 @@ module Prism
|
|
|
8933
9347
|
#
|
|
8934
9348
|
# The Location of the opening brace.
|
|
8935
9349
|
#
|
|
8936
|
-
#
|
|
8937
|
-
#
|
|
9350
|
+
# ```rb
|
|
9351
|
+
# { a => b }
|
|
9352
|
+
# ^
|
|
9353
|
+
# ```
|
|
8938
9354
|
#
|
|
8939
9355
|
# : () -> Location
|
|
8940
9356
|
def opening_loc: () -> Location
|
|
@@ -8951,11 +9367,13 @@ module Prism
|
|
|
8951
9367
|
#
|
|
8952
9368
|
# The elements of the hash. These can be either `AssocNode`s or `AssocSplatNode`s.
|
|
8953
9369
|
#
|
|
8954
|
-
#
|
|
8955
|
-
#
|
|
9370
|
+
# ```rb
|
|
9371
|
+
# { a: b }
|
|
9372
|
+
# ^^^^
|
|
8956
9373
|
#
|
|
8957
|
-
#
|
|
8958
|
-
#
|
|
9374
|
+
# { **foo }
|
|
9375
|
+
# ^^^^^
|
|
9376
|
+
# ```
|
|
8959
9377
|
#
|
|
8960
9378
|
# : () -> Array[AssocNode | AssocSplatNode]
|
|
8961
9379
|
def elements: () -> Array[AssocNode | AssocSplatNode]
|
|
@@ -8966,8 +9384,10 @@ module Prism
|
|
|
8966
9384
|
#
|
|
8967
9385
|
# The Location of the closing brace.
|
|
8968
9386
|
#
|
|
8969
|
-
#
|
|
8970
|
-
#
|
|
9387
|
+
# ```rb
|
|
9388
|
+
# { a => b }
|
|
9389
|
+
# ^
|
|
9390
|
+
# ```
|
|
8971
9391
|
#
|
|
8972
9392
|
# : () -> Location
|
|
8973
9393
|
def closing_loc: () -> Location
|
|
@@ -9001,17 +9421,19 @@ module Prism
|
|
|
9001
9421
|
|
|
9002
9422
|
# Represents a hash pattern in pattern matching.
|
|
9003
9423
|
#
|
|
9004
|
-
#
|
|
9005
|
-
#
|
|
9424
|
+
# ```rb
|
|
9425
|
+
# foo => { a: 1, b: 2 }
|
|
9426
|
+
# ^^^^^^^^^^^^^^
|
|
9006
9427
|
#
|
|
9007
|
-
#
|
|
9008
|
-
#
|
|
9428
|
+
# foo => { a: 1, b: 2, **c }
|
|
9429
|
+
# ^^^^^^^^^^^^^^^^^^^
|
|
9009
9430
|
#
|
|
9010
|
-
#
|
|
9011
|
-
#
|
|
9431
|
+
# foo => Bar[a: 1, b: 2]
|
|
9432
|
+
# ^^^^^^^^^^^^^^^
|
|
9012
9433
|
#
|
|
9013
|
-
#
|
|
9014
|
-
#
|
|
9434
|
+
# foo in { a: 1, b: 2 }
|
|
9435
|
+
# ^^^^^^^^^^^^^^
|
|
9436
|
+
# ```
|
|
9015
9437
|
class HashPatternNode < Node
|
|
9016
9438
|
@closing_loc: Location?
|
|
9017
9439
|
|
|
@@ -9081,11 +9503,13 @@ module Prism
|
|
|
9081
9503
|
#
|
|
9082
9504
|
# Represents the optional constant preceding the Hash.
|
|
9083
9505
|
#
|
|
9084
|
-
#
|
|
9085
|
-
#
|
|
9506
|
+
# ```rb
|
|
9507
|
+
# foo => Bar[a: 1, b: 2]
|
|
9508
|
+
# ^^^
|
|
9086
9509
|
#
|
|
9087
|
-
#
|
|
9088
|
-
#
|
|
9510
|
+
# foo => Bar::Baz[a: 1, b: 2]
|
|
9511
|
+
# ^^^^^^^^
|
|
9512
|
+
# ```
|
|
9089
9513
|
#
|
|
9090
9514
|
# : () -> (ConstantPathNode | ConstantReadNode)?
|
|
9091
9515
|
def constant: () -> (ConstantPathNode | ConstantReadNode)?
|
|
@@ -9095,8 +9519,10 @@ module Prism
|
|
|
9095
9519
|
#
|
|
9096
9520
|
# Represents the explicit named hash keys and values.
|
|
9097
9521
|
#
|
|
9098
|
-
#
|
|
9099
|
-
#
|
|
9522
|
+
# ```rb
|
|
9523
|
+
# foo => { a: 1, b:, ** }
|
|
9524
|
+
# ^^^^^^^^
|
|
9525
|
+
# ```
|
|
9100
9526
|
#
|
|
9101
9527
|
# : () -> Array[AssocNode]
|
|
9102
9528
|
def elements: () -> Array[AssocNode]
|
|
@@ -9106,14 +9532,16 @@ module Prism
|
|
|
9106
9532
|
#
|
|
9107
9533
|
# Represents the rest of the Hash keys and values. This can be named, unnamed, or explicitly forbidden via `**nil`, this last one results in a `NoKeywordsParameterNode`.
|
|
9108
9534
|
#
|
|
9109
|
-
#
|
|
9110
|
-
#
|
|
9535
|
+
# ```rb
|
|
9536
|
+
# foo => { a: 1, b:, **c }
|
|
9537
|
+
# ^^^
|
|
9111
9538
|
#
|
|
9112
|
-
#
|
|
9113
|
-
#
|
|
9539
|
+
# foo => { a: 1, b:, ** }
|
|
9540
|
+
# ^^
|
|
9114
9541
|
#
|
|
9115
|
-
#
|
|
9116
|
-
#
|
|
9542
|
+
# foo => { a: 1, b:, **nil }
|
|
9543
|
+
# ^^^^^
|
|
9544
|
+
# ```
|
|
9117
9545
|
#
|
|
9118
9546
|
# : () -> (AssocSplatNode | NoKeywordsParameterNode)?
|
|
9119
9547
|
def rest: () -> (AssocSplatNode | NoKeywordsParameterNode)?
|
|
@@ -9124,11 +9552,13 @@ module Prism
|
|
|
9124
9552
|
#
|
|
9125
9553
|
# The Location of the opening brace.
|
|
9126
9554
|
#
|
|
9127
|
-
#
|
|
9128
|
-
#
|
|
9555
|
+
# ```rb
|
|
9556
|
+
# foo => { a: 1 }
|
|
9557
|
+
# ^
|
|
9129
9558
|
#
|
|
9130
|
-
#
|
|
9131
|
-
#
|
|
9559
|
+
# foo => Bar[a: 1]
|
|
9560
|
+
# ^
|
|
9561
|
+
# ```
|
|
9132
9562
|
#
|
|
9133
9563
|
# : () -> Location?
|
|
9134
9564
|
def opening_loc: () -> Location?
|
|
@@ -9146,11 +9576,13 @@ module Prism
|
|
|
9146
9576
|
#
|
|
9147
9577
|
# The Location of the closing brace.
|
|
9148
9578
|
#
|
|
9149
|
-
#
|
|
9150
|
-
#
|
|
9579
|
+
# ```rb
|
|
9580
|
+
# foo => { a: 1 }
|
|
9581
|
+
# ^
|
|
9151
9582
|
#
|
|
9152
|
-
#
|
|
9153
|
-
#
|
|
9583
|
+
# foo => Bar[a: 1]
|
|
9584
|
+
# ^
|
|
9585
|
+
# ```
|
|
9154
9586
|
#
|
|
9155
9587
|
# : () -> Location?
|
|
9156
9588
|
def closing_loc: () -> Location?
|
|
@@ -9184,14 +9616,16 @@ module Prism
|
|
|
9184
9616
|
|
|
9185
9617
|
# Represents the use of the `if` keyword, either in the block form or the modifier form, or a ternary expression.
|
|
9186
9618
|
#
|
|
9187
|
-
#
|
|
9188
|
-
#
|
|
9619
|
+
# ```rb
|
|
9620
|
+
# bar if foo
|
|
9621
|
+
# ^^^^^^^^^^
|
|
9189
9622
|
#
|
|
9190
|
-
#
|
|
9191
|
-
#
|
|
9623
|
+
# if foo then bar end
|
|
9624
|
+
# ^^^^^^^^^^^^^^^^^^^
|
|
9192
9625
|
#
|
|
9193
|
-
#
|
|
9194
|
-
#
|
|
9626
|
+
# foo ? bar : baz
|
|
9627
|
+
# ^^^^^^^^^^^^^^^
|
|
9628
|
+
# ```
|
|
9195
9629
|
class IfNode < Node
|
|
9196
9630
|
@end_keyword_loc: Location?
|
|
9197
9631
|
|
|
@@ -9264,9 +9698,11 @@ module Prism
|
|
|
9264
9698
|
#
|
|
9265
9699
|
# The Location of the `if` keyword if present.
|
|
9266
9700
|
#
|
|
9267
|
-
#
|
|
9268
|
-
#
|
|
9701
|
+
# ```rb
|
|
9702
|
+
# bar if foo
|
|
9703
|
+
# ^^
|
|
9269
9704
|
#
|
|
9705
|
+
# ```
|
|
9270
9706
|
# The `if_keyword_loc` field will be `nil` when the `IfNode` represents a ternary expression.
|
|
9271
9707
|
#
|
|
9272
9708
|
# : () -> Location?
|
|
@@ -9284,16 +9720,18 @@ module Prism
|
|
|
9284
9720
|
#
|
|
9285
9721
|
# The node for the condition the `IfNode` is testing.
|
|
9286
9722
|
#
|
|
9287
|
-
#
|
|
9288
|
-
#
|
|
9289
|
-
#
|
|
9290
|
-
#
|
|
9723
|
+
# ```rb
|
|
9724
|
+
# if foo
|
|
9725
|
+
# ^^^
|
|
9726
|
+
# bar
|
|
9727
|
+
# end
|
|
9291
9728
|
#
|
|
9292
|
-
#
|
|
9293
|
-
#
|
|
9729
|
+
# bar if foo
|
|
9730
|
+
# ^^^
|
|
9294
9731
|
#
|
|
9295
|
-
#
|
|
9296
|
-
#
|
|
9732
|
+
# foo ? bar : baz
|
|
9733
|
+
# ^^^
|
|
9734
|
+
# ```
|
|
9297
9735
|
#
|
|
9298
9736
|
# : () -> Prism::node
|
|
9299
9737
|
def predicate: () -> Prism::node
|
|
@@ -9304,11 +9742,13 @@ module Prism
|
|
|
9304
9742
|
#
|
|
9305
9743
|
# The Location of the `then` keyword (if present) or the `?` in a ternary expression, `nil` otherwise.
|
|
9306
9744
|
#
|
|
9307
|
-
#
|
|
9308
|
-
#
|
|
9745
|
+
# ```rb
|
|
9746
|
+
# if foo then bar end
|
|
9747
|
+
# ^^^^
|
|
9309
9748
|
#
|
|
9310
|
-
#
|
|
9311
|
-
#
|
|
9749
|
+
# a ? b : c
|
|
9750
|
+
# ^
|
|
9751
|
+
# ```
|
|
9312
9752
|
#
|
|
9313
9753
|
# : () -> Location?
|
|
9314
9754
|
def then_keyword_loc: () -> Location?
|
|
@@ -9325,12 +9765,14 @@ module Prism
|
|
|
9325
9765
|
#
|
|
9326
9766
|
# Represents the body of statements that will be executed when the predicate is evaluated as truthy. Will be `nil` when no body is provided.
|
|
9327
9767
|
#
|
|
9328
|
-
#
|
|
9329
|
-
#
|
|
9330
|
-
#
|
|
9331
|
-
#
|
|
9332
|
-
#
|
|
9333
|
-
#
|
|
9768
|
+
# ```rb
|
|
9769
|
+
# if foo
|
|
9770
|
+
# bar
|
|
9771
|
+
# ^^^
|
|
9772
|
+
# baz
|
|
9773
|
+
# ^^^
|
|
9774
|
+
# end
|
|
9775
|
+
# ```
|
|
9334
9776
|
#
|
|
9335
9777
|
# : () -> StatementsNode?
|
|
9336
9778
|
def statements: () -> StatementsNode?
|
|
@@ -9340,17 +9782,19 @@ module Prism
|
|
|
9340
9782
|
#
|
|
9341
9783
|
# Represents an `ElseNode` or an `IfNode` when there is an `else` or an `elsif` in the `if` statement.
|
|
9342
9784
|
#
|
|
9343
|
-
#
|
|
9344
|
-
#
|
|
9345
|
-
#
|
|
9346
|
-
#
|
|
9347
|
-
#
|
|
9348
|
-
#
|
|
9349
|
-
#
|
|
9350
|
-
#
|
|
9785
|
+
# ```rb
|
|
9786
|
+
# if foo
|
|
9787
|
+
# bar
|
|
9788
|
+
# elsif baz
|
|
9789
|
+
# ^^^^^^^^^
|
|
9790
|
+
# qux
|
|
9791
|
+
# ^^^
|
|
9792
|
+
# end
|
|
9793
|
+
# ^^^
|
|
9351
9794
|
#
|
|
9352
|
-
#
|
|
9353
|
-
#
|
|
9795
|
+
# if foo then bar else baz end
|
|
9796
|
+
# ^^^^^^^^^^^^
|
|
9797
|
+
# ```
|
|
9354
9798
|
#
|
|
9355
9799
|
# : () -> (ElseNode | IfNode)?
|
|
9356
9800
|
def subsequent: () -> (ElseNode | IfNode)?
|
|
@@ -9361,10 +9805,12 @@ module Prism
|
|
|
9361
9805
|
#
|
|
9362
9806
|
# The Location of the `end` keyword if present, `nil` otherwise.
|
|
9363
9807
|
#
|
|
9364
|
-
#
|
|
9365
|
-
#
|
|
9366
|
-
#
|
|
9367
|
-
#
|
|
9808
|
+
# ```rb
|
|
9809
|
+
# if foo
|
|
9810
|
+
# bar
|
|
9811
|
+
# end
|
|
9812
|
+
# ^^^
|
|
9813
|
+
# ```
|
|
9368
9814
|
#
|
|
9369
9815
|
# : () -> Location?
|
|
9370
9816
|
def end_keyword_loc: () -> Location?
|
|
@@ -9406,8 +9852,10 @@ module Prism
|
|
|
9406
9852
|
|
|
9407
9853
|
# Represents an imaginary number literal.
|
|
9408
9854
|
#
|
|
9409
|
-
#
|
|
9410
|
-
#
|
|
9855
|
+
# ```rb
|
|
9856
|
+
# 1.0i
|
|
9857
|
+
# ^^^^
|
|
9858
|
+
# ```
|
|
9411
9859
|
class ImaginaryNode < Node
|
|
9412
9860
|
@numeric: FloatNode | IntegerNode | RationalNode
|
|
9413
9861
|
|
|
@@ -9478,14 +9926,16 @@ module Prism
|
|
|
9478
9926
|
|
|
9479
9927
|
# Represents a node that is implicitly being added to the tree but doesn't correspond directly to a node in the source.
|
|
9480
9928
|
#
|
|
9481
|
-
#
|
|
9482
|
-
#
|
|
9929
|
+
# ```rb
|
|
9930
|
+
# { foo: }
|
|
9931
|
+
# ^^^^
|
|
9483
9932
|
#
|
|
9484
|
-
#
|
|
9485
|
-
#
|
|
9933
|
+
# { Foo: }
|
|
9934
|
+
# ^^^^
|
|
9486
9935
|
#
|
|
9487
|
-
#
|
|
9488
|
-
#
|
|
9936
|
+
# foo in { bar: }
|
|
9937
|
+
# ^^^^
|
|
9938
|
+
# ```
|
|
9489
9939
|
class ImplicitNode < Node
|
|
9490
9940
|
@value: LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode
|
|
9491
9941
|
|
|
@@ -9556,17 +10006,19 @@ module Prism
|
|
|
9556
10006
|
|
|
9557
10007
|
# Represents using a trailing comma to indicate an implicit rest parameter.
|
|
9558
10008
|
#
|
|
9559
|
-
#
|
|
9560
|
-
#
|
|
9561
|
-
#
|
|
9562
|
-
# foo in [bar,]
|
|
9563
|
-
# ^
|
|
10009
|
+
# ```rb
|
|
10010
|
+
# foo { |bar,| }
|
|
10011
|
+
# ^
|
|
9564
10012
|
#
|
|
9565
|
-
#
|
|
10013
|
+
# foo in [bar,]
|
|
9566
10014
|
# ^
|
|
9567
10015
|
#
|
|
9568
|
-
#
|
|
10016
|
+
# for foo, in bar do end
|
|
9569
10017
|
# ^
|
|
10018
|
+
#
|
|
10019
|
+
# foo, = bar
|
|
10020
|
+
# ^
|
|
10021
|
+
# ```
|
|
9570
10022
|
class ImplicitRestNode < Node
|
|
9571
10023
|
# Initialize a new ImplicitRestNode node.
|
|
9572
10024
|
#
|
|
@@ -9627,8 +10079,10 @@ module Prism
|
|
|
9627
10079
|
|
|
9628
10080
|
# Represents the use of the `in` keyword in a case statement.
|
|
9629
10081
|
#
|
|
9630
|
-
#
|
|
9631
|
-
#
|
|
10082
|
+
# ```rb
|
|
10083
|
+
# case a; in b then c end
|
|
10084
|
+
# ^^^^^^^^^^^
|
|
10085
|
+
# ```
|
|
9632
10086
|
class InNode < Node
|
|
9633
10087
|
@then_keyword_loc: Location?
|
|
9634
10088
|
|
|
@@ -9761,8 +10215,10 @@ module Prism
|
|
|
9761
10215
|
|
|
9762
10216
|
# Represents the use of the `&&=` operator on a call to the `[]` method.
|
|
9763
10217
|
#
|
|
9764
|
-
#
|
|
9765
|
-
#
|
|
10218
|
+
# ```rb
|
|
10219
|
+
# foo.bar[baz] &&= value
|
|
10220
|
+
# ^^^^^^^^^^^^^^^^^^^^^^
|
|
10221
|
+
# ```
|
|
9766
10222
|
class IndexAndWriteNode < Node
|
|
9767
10223
|
@value: Prism::node
|
|
9768
10224
|
|
|
@@ -9991,8 +10447,10 @@ module Prism
|
|
|
9991
10447
|
|
|
9992
10448
|
# Represents the use of an assignment operator on a call to `[]`.
|
|
9993
10449
|
#
|
|
9994
|
-
#
|
|
9995
|
-
#
|
|
10450
|
+
# ```rb
|
|
10451
|
+
# foo.bar[baz] += value
|
|
10452
|
+
# ^^^^^^^^^^^^^^^^^^^^^
|
|
10453
|
+
# ```
|
|
9996
10454
|
class IndexOperatorWriteNode < Node
|
|
9997
10455
|
@value: Prism::node
|
|
9998
10456
|
|
|
@@ -10223,8 +10681,10 @@ module Prism
|
|
|
10223
10681
|
|
|
10224
10682
|
# Represents the use of the `||=` operator on a call to `[]`.
|
|
10225
10683
|
#
|
|
10226
|
-
#
|
|
10227
|
-
#
|
|
10684
|
+
# ```rb
|
|
10685
|
+
# foo.bar[baz] ||= value
|
|
10686
|
+
# ^^^^^^^^^^^^^^^^^^^^^^
|
|
10687
|
+
# ```
|
|
10228
10688
|
class IndexOrWriteNode < Node
|
|
10229
10689
|
@value: Prism::node
|
|
10230
10690
|
|
|
@@ -10453,16 +10913,18 @@ module Prism
|
|
|
10453
10913
|
|
|
10454
10914
|
# Represents assigning to an index.
|
|
10455
10915
|
#
|
|
10456
|
-
#
|
|
10457
|
-
#
|
|
10916
|
+
# ```rb
|
|
10917
|
+
# foo[bar], = 1
|
|
10918
|
+
# ^^^^^^^^
|
|
10458
10919
|
#
|
|
10459
|
-
#
|
|
10460
|
-
#
|
|
10461
|
-
#
|
|
10462
|
-
#
|
|
10920
|
+
# begin
|
|
10921
|
+
# rescue => foo[bar]
|
|
10922
|
+
# ^^^^^^^^
|
|
10923
|
+
# end
|
|
10463
10924
|
#
|
|
10464
|
-
#
|
|
10465
|
-
#
|
|
10925
|
+
# for foo[bar] in baz do end
|
|
10926
|
+
# ^^^^^^^^
|
|
10927
|
+
# ```
|
|
10466
10928
|
class IndexTargetNode < Node
|
|
10467
10929
|
@block: BlockArgumentNode?
|
|
10468
10930
|
|
|
@@ -10629,8 +11091,10 @@ module Prism
|
|
|
10629
11091
|
|
|
10630
11092
|
# Represents the use of the `&&=` operator for assignment to an instance variable.
|
|
10631
11093
|
#
|
|
10632
|
-
#
|
|
10633
|
-
#
|
|
11094
|
+
# ```rb
|
|
11095
|
+
# @target &&= value
|
|
11096
|
+
# ^^^^^^^^^^^^^^^^^
|
|
11097
|
+
# ```
|
|
10634
11098
|
class InstanceVariableAndWriteNode < Node
|
|
10635
11099
|
@value: Prism::node
|
|
10636
11100
|
|
|
@@ -10755,8 +11219,10 @@ module Prism
|
|
|
10755
11219
|
|
|
10756
11220
|
# Represents assigning to an instance variable using an operator that isn't `=`.
|
|
10757
11221
|
#
|
|
10758
|
-
#
|
|
10759
|
-
#
|
|
11222
|
+
# ```rb
|
|
11223
|
+
# @target += value
|
|
11224
|
+
# ^^^^^^^^^^^^^^^^
|
|
11225
|
+
# ```
|
|
10760
11226
|
class InstanceVariableOperatorWriteNode < Node
|
|
10761
11227
|
@binary_operator: Symbol
|
|
10762
11228
|
|
|
@@ -10883,8 +11349,10 @@ module Prism
|
|
|
10883
11349
|
|
|
10884
11350
|
# Represents the use of the `||=` operator for assignment to an instance variable.
|
|
10885
11351
|
#
|
|
10886
|
-
#
|
|
10887
|
-
#
|
|
11352
|
+
# ```rb
|
|
11353
|
+
# @target ||= value
|
|
11354
|
+
# ^^^^^^^^^^^^^^^^^
|
|
11355
|
+
# ```
|
|
10888
11356
|
class InstanceVariableOrWriteNode < Node
|
|
10889
11357
|
@value: Prism::node
|
|
10890
11358
|
|
|
@@ -11009,8 +11477,10 @@ module Prism
|
|
|
11009
11477
|
|
|
11010
11478
|
# Represents referencing an instance variable.
|
|
11011
11479
|
#
|
|
11012
|
-
#
|
|
11013
|
-
#
|
|
11480
|
+
# ```rb
|
|
11481
|
+
# @foo
|
|
11482
|
+
# ^^^^
|
|
11483
|
+
# ```
|
|
11014
11484
|
class InstanceVariableReadNode < Node
|
|
11015
11485
|
@name: Symbol
|
|
11016
11486
|
|
|
@@ -11072,9 +11542,11 @@ module Prism
|
|
|
11072
11542
|
#
|
|
11073
11543
|
# The name of the instance variable, which is a `@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
|
11074
11544
|
#
|
|
11075
|
-
#
|
|
11545
|
+
# ```rb
|
|
11546
|
+
# @x # name `:@x`
|
|
11076
11547
|
#
|
|
11077
|
-
#
|
|
11548
|
+
# @_test # name `:@_test`
|
|
11549
|
+
# ```
|
|
11078
11550
|
#
|
|
11079
11551
|
# : () -> Symbol
|
|
11080
11552
|
def name: () -> Symbol
|
|
@@ -11085,8 +11557,10 @@ module Prism
|
|
|
11085
11557
|
|
|
11086
11558
|
# Represents writing to an instance variable in a context that doesn't have an explicit value.
|
|
11087
11559
|
#
|
|
11088
|
-
#
|
|
11089
|
-
#
|
|
11560
|
+
# ```rb
|
|
11561
|
+
# @foo, @bar = baz
|
|
11562
|
+
# ^^^^ ^^^^
|
|
11563
|
+
# ```
|
|
11090
11564
|
class InstanceVariableTargetNode < Node
|
|
11091
11565
|
@name: Symbol
|
|
11092
11566
|
|
|
@@ -11157,8 +11631,10 @@ module Prism
|
|
|
11157
11631
|
|
|
11158
11632
|
# Represents writing to an instance variable.
|
|
11159
11633
|
#
|
|
11160
|
-
#
|
|
11161
|
-
#
|
|
11634
|
+
# ```rb
|
|
11635
|
+
# @foo = 1
|
|
11636
|
+
# ^^^^^^^^
|
|
11637
|
+
# ```
|
|
11162
11638
|
class InstanceVariableWriteNode < Node
|
|
11163
11639
|
@operator_loc: Location
|
|
11164
11640
|
|
|
@@ -11226,9 +11702,11 @@ module Prism
|
|
|
11226
11702
|
#
|
|
11227
11703
|
# The name of the instance variable, which is a `@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
|
11228
11704
|
#
|
|
11229
|
-
#
|
|
11705
|
+
# ```rb
|
|
11706
|
+
# @x = :y # name `:@x`
|
|
11230
11707
|
#
|
|
11231
|
-
#
|
|
11708
|
+
# @_foo = "bar" # name `@_foo`
|
|
11709
|
+
# ```
|
|
11232
11710
|
#
|
|
11233
11711
|
# : () -> Symbol
|
|
11234
11712
|
def name: () -> Symbol
|
|
@@ -11239,8 +11717,10 @@ module Prism
|
|
|
11239
11717
|
#
|
|
11240
11718
|
# The Location of the variable name.
|
|
11241
11719
|
#
|
|
11242
|
-
#
|
|
11243
|
-
#
|
|
11720
|
+
# ```rb
|
|
11721
|
+
# @_x = 1
|
|
11722
|
+
# ^^^
|
|
11723
|
+
# ```
|
|
11244
11724
|
#
|
|
11245
11725
|
# : () -> Location
|
|
11246
11726
|
def name_loc: () -> Location
|
|
@@ -11257,11 +11737,13 @@ module Prism
|
|
|
11257
11737
|
#
|
|
11258
11738
|
# The value to write to the instance variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
11259
11739
|
#
|
|
11260
|
-
#
|
|
11261
|
-
#
|
|
11740
|
+
# ```rb
|
|
11741
|
+
# @foo = :bar
|
|
11742
|
+
# ^^^^
|
|
11262
11743
|
#
|
|
11263
|
-
#
|
|
11264
|
-
#
|
|
11744
|
+
# @_x = 1234
|
|
11745
|
+
# ^^^^
|
|
11746
|
+
# ```
|
|
11265
11747
|
#
|
|
11266
11748
|
# : () -> Prism::node
|
|
11267
11749
|
def value: () -> Prism::node
|
|
@@ -11272,8 +11754,10 @@ module Prism
|
|
|
11272
11754
|
#
|
|
11273
11755
|
# The Location of the `=` operator.
|
|
11274
11756
|
#
|
|
11275
|
-
#
|
|
11276
|
-
#
|
|
11757
|
+
# ```rb
|
|
11758
|
+
# @x = y
|
|
11759
|
+
# ^
|
|
11760
|
+
# ```
|
|
11277
11761
|
#
|
|
11278
11762
|
# : () -> Location
|
|
11279
11763
|
def operator_loc: () -> Location
|
|
@@ -11299,8 +11783,10 @@ module Prism
|
|
|
11299
11783
|
|
|
11300
11784
|
# Represents an integer number literal.
|
|
11301
11785
|
#
|
|
11302
|
-
#
|
|
11303
|
-
#
|
|
11786
|
+
# ```rb
|
|
11787
|
+
# 1
|
|
11788
|
+
# ^
|
|
11789
|
+
# ```
|
|
11304
11790
|
class IntegerNode < Node
|
|
11305
11791
|
@value: Integer
|
|
11306
11792
|
|
|
@@ -11395,8 +11881,10 @@ module Prism
|
|
|
11395
11881
|
|
|
11396
11882
|
# Represents a regular expression literal that contains interpolation that is being used in the predicate of a conditional to implicitly match against the last line read by an IO object.
|
|
11397
11883
|
#
|
|
11398
|
-
#
|
|
11399
|
-
#
|
|
11884
|
+
# ```rb
|
|
11885
|
+
# if /foo #{bar} baz/ then end
|
|
11886
|
+
# ^^^^^^^^^^^^^^^^
|
|
11887
|
+
# ```
|
|
11400
11888
|
class InterpolatedMatchLastLineNode < Node
|
|
11401
11889
|
@closing_loc: Location
|
|
11402
11890
|
|
|
@@ -11585,8 +12073,10 @@ module Prism
|
|
|
11585
12073
|
|
|
11586
12074
|
# Represents a regular expression literal that contains interpolation.
|
|
11587
12075
|
#
|
|
11588
|
-
#
|
|
11589
|
-
#
|
|
12076
|
+
# ```rb
|
|
12077
|
+
# /foo #{bar} baz/
|
|
12078
|
+
# ^^^^^^^^^^^^^^^^
|
|
12079
|
+
# ```
|
|
11590
12080
|
class InterpolatedRegularExpressionNode < Node
|
|
11591
12081
|
@closing_loc: Location
|
|
11592
12082
|
|
|
@@ -11775,8 +12265,10 @@ module Prism
|
|
|
11775
12265
|
|
|
11776
12266
|
# Represents a string literal that contains interpolation.
|
|
11777
12267
|
#
|
|
11778
|
-
#
|
|
11779
|
-
#
|
|
12268
|
+
# ```rb
|
|
12269
|
+
# "foo #{bar} baz"
|
|
12270
|
+
# ^^^^^^^^^^^^^^^^
|
|
12271
|
+
# ```
|
|
11780
12272
|
class InterpolatedStringNode < Node
|
|
11781
12273
|
@closing_loc: Location?
|
|
11782
12274
|
|
|
@@ -11911,8 +12403,10 @@ module Prism
|
|
|
11911
12403
|
|
|
11912
12404
|
# Represents a symbol literal that contains interpolation.
|
|
11913
12405
|
#
|
|
11914
|
-
#
|
|
11915
|
-
#
|
|
12406
|
+
# ```rb
|
|
12407
|
+
# :"foo #{bar} baz"
|
|
12408
|
+
# ^^^^^^^^^^^^^^^^^
|
|
12409
|
+
# ```
|
|
11916
12410
|
class InterpolatedSymbolNode < Node
|
|
11917
12411
|
@closing_loc: Location?
|
|
11918
12412
|
|
|
@@ -12035,8 +12529,10 @@ module Prism
|
|
|
12035
12529
|
|
|
12036
12530
|
# Represents an xstring literal that contains interpolation.
|
|
12037
12531
|
#
|
|
12038
|
-
#
|
|
12039
|
-
#
|
|
12532
|
+
# ```rb
|
|
12533
|
+
# `foo #{bar} baz`
|
|
12534
|
+
# ^^^^^^^^^^^^^^^^
|
|
12535
|
+
# ```
|
|
12040
12536
|
class InterpolatedXStringNode < Node
|
|
12041
12537
|
@closing_loc: Location
|
|
12042
12538
|
|
|
@@ -12159,8 +12655,10 @@ module Prism
|
|
|
12159
12655
|
|
|
12160
12656
|
# Represents reading from the implicit `it` local variable.
|
|
12161
12657
|
#
|
|
12162
|
-
#
|
|
12163
|
-
#
|
|
12658
|
+
# ```rb
|
|
12659
|
+
# -> { it }
|
|
12660
|
+
# ^^
|
|
12661
|
+
# ```
|
|
12164
12662
|
class ItLocalVariableReadNode < Node
|
|
12165
12663
|
# Initialize a new ItLocalVariableReadNode node.
|
|
12166
12664
|
#
|
|
@@ -12221,8 +12719,10 @@ module Prism
|
|
|
12221
12719
|
|
|
12222
12720
|
# Represents an implicit set of parameters through the use of the `it` keyword within a block or lambda.
|
|
12223
12721
|
#
|
|
12224
|
-
#
|
|
12225
|
-
#
|
|
12722
|
+
# ```rb
|
|
12723
|
+
# -> { it + it }
|
|
12724
|
+
# ^^^^^^^^^^^^^^
|
|
12725
|
+
# ```
|
|
12226
12726
|
class ItParametersNode < Node
|
|
12227
12727
|
# Initialize a new ItParametersNode node.
|
|
12228
12728
|
#
|
|
@@ -12283,8 +12783,10 @@ module Prism
|
|
|
12283
12783
|
|
|
12284
12784
|
# Represents a hash literal without opening and closing braces.
|
|
12285
12785
|
#
|
|
12286
|
-
#
|
|
12287
|
-
#
|
|
12786
|
+
# ```rb
|
|
12787
|
+
# foo(a: b)
|
|
12788
|
+
# ^^^^
|
|
12789
|
+
# ```
|
|
12288
12790
|
class KeywordHashNode < Node
|
|
12289
12791
|
@elements: Array[AssocNode | AssocSplatNode]
|
|
12290
12792
|
|
|
@@ -12361,9 +12863,11 @@ module Prism
|
|
|
12361
12863
|
|
|
12362
12864
|
# Represents a keyword rest parameter to a method, block, or lambda definition.
|
|
12363
12865
|
#
|
|
12364
|
-
#
|
|
12365
|
-
#
|
|
12366
|
-
#
|
|
12866
|
+
# ```rb
|
|
12867
|
+
# def a(**b)
|
|
12868
|
+
# ^^^
|
|
12869
|
+
# end
|
|
12870
|
+
# ```
|
|
12367
12871
|
class KeywordRestParameterNode < Node
|
|
12368
12872
|
@operator_loc: Location
|
|
12369
12873
|
|
|
@@ -12484,8 +12988,10 @@ module Prism
|
|
|
12484
12988
|
|
|
12485
12989
|
# Represents using a lambda literal (not the lambda method call).
|
|
12486
12990
|
#
|
|
12487
|
-
#
|
|
12488
|
-
#
|
|
12991
|
+
# ```rb
|
|
12992
|
+
# ->(value) { value * 2 }
|
|
12993
|
+
# ^^^^^^^^^^^^^^^^^^^^^^^
|
|
12994
|
+
# ```
|
|
12489
12995
|
class LambdaNode < Node
|
|
12490
12996
|
@body: (StatementsNode | BeginNode)?
|
|
12491
12997
|
|
|
@@ -12654,8 +13160,10 @@ module Prism
|
|
|
12654
13160
|
|
|
12655
13161
|
# Represents the use of the `&&=` operator for assignment to a local variable.
|
|
12656
13162
|
#
|
|
12657
|
-
#
|
|
12658
|
-
#
|
|
13163
|
+
# ```rb
|
|
13164
|
+
# target &&= value
|
|
13165
|
+
# ^^^^^^^^^^^^^^^^
|
|
13166
|
+
# ```
|
|
12659
13167
|
class LocalVariableAndWriteNode < Node
|
|
12660
13168
|
@depth: Integer
|
|
12661
13169
|
|
|
@@ -12790,8 +13298,10 @@ module Prism
|
|
|
12790
13298
|
|
|
12791
13299
|
# Represents assigning to a local variable using an operator that isn't `=`.
|
|
12792
13300
|
#
|
|
12793
|
-
#
|
|
12794
|
-
#
|
|
13301
|
+
# ```rb
|
|
13302
|
+
# target += value
|
|
13303
|
+
# ^^^^^^^^^^^^^^^
|
|
13304
|
+
# ```
|
|
12795
13305
|
class LocalVariableOperatorWriteNode < Node
|
|
12796
13306
|
@depth: Integer
|
|
12797
13307
|
|
|
@@ -12928,8 +13438,10 @@ module Prism
|
|
|
12928
13438
|
|
|
12929
13439
|
# Represents the use of the `||=` operator for assignment to a local variable.
|
|
12930
13440
|
#
|
|
12931
|
-
#
|
|
12932
|
-
#
|
|
13441
|
+
# ```rb
|
|
13442
|
+
# target ||= value
|
|
13443
|
+
# ^^^^^^^^^^^^^^^^
|
|
13444
|
+
# ```
|
|
12933
13445
|
class LocalVariableOrWriteNode < Node
|
|
12934
13446
|
@depth: Integer
|
|
12935
13447
|
|
|
@@ -13064,8 +13576,10 @@ module Prism
|
|
|
13064
13576
|
|
|
13065
13577
|
# Represents reading a local variable. Note that this requires that a local variable of the same name has already been written to in the same scope, otherwise it is parsed as a method call.
|
|
13066
13578
|
#
|
|
13067
|
-
#
|
|
13068
|
-
#
|
|
13579
|
+
# ```rb
|
|
13580
|
+
# foo
|
|
13581
|
+
# ^^^
|
|
13582
|
+
# ```
|
|
13069
13583
|
class LocalVariableReadNode < Node
|
|
13070
13584
|
@name: Symbol
|
|
13071
13585
|
|
|
@@ -13129,13 +13643,17 @@ module Prism
|
|
|
13129
13643
|
#
|
|
13130
13644
|
# The name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
|
13131
13645
|
#
|
|
13132
|
-
#
|
|
13646
|
+
# ```rb
|
|
13647
|
+
# x # name `:x`
|
|
13133
13648
|
#
|
|
13134
|
-
#
|
|
13649
|
+
# _Test # name `:_Test`
|
|
13135
13650
|
#
|
|
13651
|
+
# ```
|
|
13136
13652
|
# Note that this can also be an underscore followed by a number for the default block parameters.
|
|
13137
13653
|
#
|
|
13138
|
-
#
|
|
13654
|
+
# ```rb
|
|
13655
|
+
# _1 # name `:_1`
|
|
13656
|
+
# ```
|
|
13139
13657
|
#
|
|
13140
13658
|
# : () -> Symbol
|
|
13141
13659
|
def name: () -> Symbol
|
|
@@ -13145,10 +13663,12 @@ module Prism
|
|
|
13145
13663
|
#
|
|
13146
13664
|
# The number of visible scopes that should be searched to find the origin of this local variable.
|
|
13147
13665
|
#
|
|
13148
|
-
#
|
|
13666
|
+
# ```rb
|
|
13667
|
+
# foo = 1; foo # depth 0
|
|
13149
13668
|
#
|
|
13150
|
-
#
|
|
13669
|
+
# bar = 2; tap { bar } # depth 1
|
|
13151
13670
|
#
|
|
13671
|
+
# ```
|
|
13152
13672
|
# The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md).
|
|
13153
13673
|
#
|
|
13154
13674
|
# : () -> Integer
|
|
@@ -13160,11 +13680,13 @@ module Prism
|
|
|
13160
13680
|
|
|
13161
13681
|
# Represents writing to a local variable in a context that doesn't have an explicit value.
|
|
13162
13682
|
#
|
|
13163
|
-
#
|
|
13164
|
-
#
|
|
13683
|
+
# ```rb
|
|
13684
|
+
# foo, bar = baz
|
|
13685
|
+
# ^^^ ^^^
|
|
13165
13686
|
#
|
|
13166
|
-
#
|
|
13167
|
-
#
|
|
13687
|
+
# foo => baz
|
|
13688
|
+
# ^^^
|
|
13689
|
+
# ```
|
|
13168
13690
|
class LocalVariableTargetNode < Node
|
|
13169
13691
|
@name: Symbol
|
|
13170
13692
|
|
|
@@ -13245,8 +13767,10 @@ module Prism
|
|
|
13245
13767
|
|
|
13246
13768
|
# Represents writing to a local variable.
|
|
13247
13769
|
#
|
|
13248
|
-
#
|
|
13249
|
-
#
|
|
13770
|
+
# ```rb
|
|
13771
|
+
# foo = 1
|
|
13772
|
+
# ^^^^^^^
|
|
13773
|
+
# ```
|
|
13250
13774
|
class LocalVariableWriteNode < Node
|
|
13251
13775
|
@operator_loc: Location
|
|
13252
13776
|
|
|
@@ -13316,9 +13840,11 @@ module Prism
|
|
|
13316
13840
|
#
|
|
13317
13841
|
# The name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
|
13318
13842
|
#
|
|
13319
|
-
#
|
|
13843
|
+
# ```rb
|
|
13844
|
+
# foo = :bar # name `:foo`
|
|
13320
13845
|
#
|
|
13321
|
-
#
|
|
13846
|
+
# abc = 123 # name `:abc`
|
|
13847
|
+
# ```
|
|
13322
13848
|
#
|
|
13323
13849
|
# : () -> Symbol
|
|
13324
13850
|
def name: () -> Symbol
|
|
@@ -13328,10 +13854,12 @@ module Prism
|
|
|
13328
13854
|
#
|
|
13329
13855
|
# The number of semantic scopes we have to traverse to find the declaration of this variable.
|
|
13330
13856
|
#
|
|
13331
|
-
#
|
|
13857
|
+
# ```rb
|
|
13858
|
+
# foo = 1 # depth 0
|
|
13332
13859
|
#
|
|
13333
|
-
#
|
|
13860
|
+
# tap { foo = 1 } # depth 1
|
|
13334
13861
|
#
|
|
13862
|
+
# ```
|
|
13335
13863
|
# The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md).
|
|
13336
13864
|
#
|
|
13337
13865
|
# : () -> Integer
|
|
@@ -13343,8 +13871,10 @@ module Prism
|
|
|
13343
13871
|
#
|
|
13344
13872
|
# The Location of the variable name.
|
|
13345
13873
|
#
|
|
13346
|
-
#
|
|
13347
|
-
#
|
|
13874
|
+
# ```rb
|
|
13875
|
+
# foo = :bar
|
|
13876
|
+
# ^^^
|
|
13877
|
+
# ```
|
|
13348
13878
|
#
|
|
13349
13879
|
# : () -> Location
|
|
13350
13880
|
def name_loc: () -> Location
|
|
@@ -13361,15 +13891,19 @@ module Prism
|
|
|
13361
13891
|
#
|
|
13362
13892
|
# The value to write to the local variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
13363
13893
|
#
|
|
13364
|
-
#
|
|
13365
|
-
#
|
|
13894
|
+
# ```rb
|
|
13895
|
+
# foo = :bar
|
|
13896
|
+
# ^^^^
|
|
13366
13897
|
#
|
|
13367
|
-
#
|
|
13368
|
-
#
|
|
13898
|
+
# abc = 1234
|
|
13899
|
+
# ^^^^
|
|
13369
13900
|
#
|
|
13901
|
+
# ```
|
|
13370
13902
|
# Note that since the name of a local variable is known before the value is parsed, it is valid for a local variable to appear within the value of its own write.
|
|
13371
13903
|
#
|
|
13372
|
-
#
|
|
13904
|
+
# ```rb
|
|
13905
|
+
# foo = foo
|
|
13906
|
+
# ```
|
|
13373
13907
|
#
|
|
13374
13908
|
# : () -> Prism::node
|
|
13375
13909
|
def value: () -> Prism::node
|
|
@@ -13380,8 +13914,10 @@ module Prism
|
|
|
13380
13914
|
#
|
|
13381
13915
|
# The Location of the `=` operator.
|
|
13382
13916
|
#
|
|
13383
|
-
#
|
|
13384
|
-
#
|
|
13917
|
+
# ```rb
|
|
13918
|
+
# x = :y
|
|
13919
|
+
# ^
|
|
13920
|
+
# ```
|
|
13385
13921
|
#
|
|
13386
13922
|
# : () -> Location
|
|
13387
13923
|
def operator_loc: () -> Location
|
|
@@ -13407,8 +13943,10 @@ module Prism
|
|
|
13407
13943
|
|
|
13408
13944
|
# Represents a regular expression literal used in the predicate of a conditional to implicitly match against the last line read by an IO object.
|
|
13409
13945
|
#
|
|
13410
|
-
#
|
|
13411
|
-
#
|
|
13946
|
+
# ```rb
|
|
13947
|
+
# if /foo/i then end
|
|
13948
|
+
# ^^^^^^
|
|
13949
|
+
# ```
|
|
13412
13950
|
class MatchLastLineNode < Node
|
|
13413
13951
|
@unescaped: String
|
|
13414
13952
|
|
|
@@ -13623,8 +14161,10 @@ module Prism
|
|
|
13623
14161
|
|
|
13624
14162
|
# Represents the use of the modifier `in` operator.
|
|
13625
14163
|
#
|
|
13626
|
-
#
|
|
13627
|
-
#
|
|
14164
|
+
# ```rb
|
|
14165
|
+
# foo in bar
|
|
14166
|
+
# ^^^^^^^^^^
|
|
14167
|
+
# ```
|
|
13628
14168
|
class MatchPredicateNode < Node
|
|
13629
14169
|
@keyword_loc: Location
|
|
13630
14170
|
|
|
@@ -13731,8 +14271,10 @@ module Prism
|
|
|
13731
14271
|
|
|
13732
14272
|
# Represents the use of the `=>` operator.
|
|
13733
14273
|
#
|
|
13734
|
-
#
|
|
13735
|
-
#
|
|
14274
|
+
# ```rb
|
|
14275
|
+
# foo => bar
|
|
14276
|
+
# ^^^^^^^^^^
|
|
14277
|
+
# ```
|
|
13736
14278
|
class MatchRequiredNode < Node
|
|
13737
14279
|
@operator_loc: Location
|
|
13738
14280
|
|
|
@@ -13798,8 +14340,10 @@ module Prism
|
|
|
13798
14340
|
#
|
|
13799
14341
|
# Represents the left-hand side of the operator.
|
|
13800
14342
|
#
|
|
13801
|
-
#
|
|
13802
|
-
#
|
|
14343
|
+
# ```rb
|
|
14344
|
+
# foo => bar
|
|
14345
|
+
# ^^^
|
|
14346
|
+
# ```
|
|
13803
14347
|
#
|
|
13804
14348
|
# : () -> Prism::node
|
|
13805
14349
|
def value: () -> Prism::node
|
|
@@ -13811,45 +14355,59 @@ module Prism
|
|
|
13811
14355
|
#
|
|
13812
14356
|
# Anything that looks like a local variable name (including `_`) will result in a `LocalVariableTargetNode`.
|
|
13813
14357
|
#
|
|
13814
|
-
#
|
|
13815
|
-
#
|
|
14358
|
+
# ```rb
|
|
14359
|
+
# foo => a # This is equivalent to writing `a = foo`
|
|
14360
|
+
# ^
|
|
13816
14361
|
#
|
|
14362
|
+
# ```
|
|
13817
14363
|
# Using an explicit `Array` or combining expressions with `,` will result in a `ArrayPatternNode`. This can be preceded by a constant.
|
|
13818
14364
|
#
|
|
13819
|
-
#
|
|
13820
|
-
#
|
|
14365
|
+
# ```rb
|
|
14366
|
+
# foo => [a]
|
|
14367
|
+
# ^^^
|
|
13821
14368
|
#
|
|
13822
|
-
#
|
|
13823
|
-
#
|
|
14369
|
+
# foo => a, b
|
|
14370
|
+
# ^^^^
|
|
13824
14371
|
#
|
|
13825
|
-
#
|
|
13826
|
-
#
|
|
14372
|
+
# foo => Bar[a, b]
|
|
14373
|
+
# ^^^^^^^^^
|
|
13827
14374
|
#
|
|
14375
|
+
# ```
|
|
13828
14376
|
# If the array pattern contains at least two wildcard matches, a `FindPatternNode` is created instead.
|
|
13829
14377
|
#
|
|
13830
|
-
#
|
|
13831
|
-
#
|
|
14378
|
+
# ```rb
|
|
14379
|
+
# foo => *, 1, *a
|
|
14380
|
+
# ^^^^^
|
|
13832
14381
|
#
|
|
14382
|
+
# ```
|
|
13833
14383
|
# Using an explicit `Hash` or a constant with square brackets and hash keys in the square brackets will result in a `HashPatternNode`.
|
|
13834
14384
|
#
|
|
13835
|
-
#
|
|
14385
|
+
# ```rb
|
|
14386
|
+
# foo => { a: 1, b: }
|
|
13836
14387
|
#
|
|
13837
|
-
#
|
|
14388
|
+
# foo => Bar[a: 1, b:]
|
|
13838
14389
|
#
|
|
13839
|
-
#
|
|
14390
|
+
# foo => Bar[**]
|
|
13840
14391
|
#
|
|
14392
|
+
# ```
|
|
13841
14393
|
# To use any variable that needs run time evaluation, pinning is required. This results in a `PinnedVariableNode`
|
|
13842
14394
|
#
|
|
13843
|
-
#
|
|
13844
|
-
#
|
|
14395
|
+
# ```rb
|
|
14396
|
+
# foo => ^a
|
|
14397
|
+
# ^^
|
|
13845
14398
|
#
|
|
14399
|
+
# ```
|
|
13846
14400
|
# Similar, any expression can be used with pinning. This results in a `PinnedExpressionNode`.
|
|
13847
14401
|
#
|
|
13848
|
-
#
|
|
14402
|
+
# ```rb
|
|
14403
|
+
# foo => ^(a + 1)
|
|
13849
14404
|
#
|
|
14405
|
+
# ```
|
|
13850
14406
|
# Anything else will result in the regular node for that expression, for example a `ConstantReadNode`.
|
|
13851
14407
|
#
|
|
13852
|
-
#
|
|
14408
|
+
# ```rb
|
|
14409
|
+
# foo => CONST
|
|
14410
|
+
# ```
|
|
13853
14411
|
#
|
|
13854
14412
|
# : () -> Prism::node
|
|
13855
14413
|
def pattern: () -> Prism::node
|
|
@@ -13860,8 +14418,10 @@ module Prism
|
|
|
13860
14418
|
#
|
|
13861
14419
|
# The Location of the operator.
|
|
13862
14420
|
#
|
|
13863
|
-
#
|
|
13864
|
-
#
|
|
14421
|
+
# ```rb
|
|
14422
|
+
# foo => bar
|
|
14423
|
+
# ^^
|
|
14424
|
+
# ```
|
|
13865
14425
|
#
|
|
13866
14426
|
# : () -> Location
|
|
13867
14427
|
def operator_loc: () -> Location
|
|
@@ -13887,8 +14447,10 @@ module Prism
|
|
|
13887
14447
|
|
|
13888
14448
|
# Represents writing local variables using a regular expression match with named capture groups.
|
|
13889
14449
|
#
|
|
13890
|
-
#
|
|
13891
|
-
#
|
|
14450
|
+
# ```rb
|
|
14451
|
+
# /(?<foo>bar)/ =~ baz
|
|
14452
|
+
# ^^^^^^^^^^^^^^^^^^^^
|
|
14453
|
+
# ```
|
|
13892
14454
|
class MatchWriteNode < Node
|
|
13893
14455
|
@call: CallNode
|
|
13894
14456
|
|
|
@@ -13969,8 +14531,10 @@ module Prism
|
|
|
13969
14531
|
|
|
13970
14532
|
# Represents a module declaration involving the `module` keyword.
|
|
13971
14533
|
#
|
|
13972
|
-
#
|
|
13973
|
-
#
|
|
14534
|
+
# ```rb
|
|
14535
|
+
# module Foo end
|
|
14536
|
+
# ^^^^^^^^^^^^^^
|
|
14537
|
+
# ```
|
|
13974
14538
|
class ModuleNode < Node
|
|
13975
14539
|
@name: Symbol
|
|
13976
14540
|
|
|
@@ -14123,13 +14687,17 @@ module Prism
|
|
|
14123
14687
|
|
|
14124
14688
|
# Represents a multi-target expression.
|
|
14125
14689
|
#
|
|
14126
|
-
#
|
|
14127
|
-
#
|
|
14690
|
+
# ```rb
|
|
14691
|
+
# a, (b, c) = 1, 2, 3
|
|
14692
|
+
# ^^^^^^
|
|
14128
14693
|
#
|
|
14694
|
+
# ```
|
|
14129
14695
|
# This can be a part of `MultiWriteNode` as above, or the target of a `for` loop
|
|
14130
14696
|
#
|
|
14131
|
-
#
|
|
14132
|
-
#
|
|
14697
|
+
# ```rb
|
|
14698
|
+
# for a, b in [[1, 2], [3, 4]]
|
|
14699
|
+
# ^^^^
|
|
14700
|
+
# ```
|
|
14133
14701
|
class MultiTargetNode < Node
|
|
14134
14702
|
@rparen_loc: Location?
|
|
14135
14703
|
|
|
@@ -14199,13 +14767,17 @@ module Prism
|
|
|
14199
14767
|
#
|
|
14200
14768
|
# Represents the targets expressions before a splat node.
|
|
14201
14769
|
#
|
|
14202
|
-
#
|
|
14203
|
-
#
|
|
14770
|
+
# ```rb
|
|
14771
|
+
# a, (b, c, *) = 1, 2, 3, 4, 5
|
|
14772
|
+
# ^^^^
|
|
14204
14773
|
#
|
|
14774
|
+
# ```
|
|
14205
14775
|
# The splat node can be absent, in that case all target expressions are in the left field.
|
|
14206
14776
|
#
|
|
14207
|
-
#
|
|
14208
|
-
#
|
|
14777
|
+
# ```rb
|
|
14778
|
+
# a, (b, c) = 1, 2, 3, 4, 5
|
|
14779
|
+
# ^^^^
|
|
14780
|
+
# ```
|
|
14209
14781
|
#
|
|
14210
14782
|
# : () -> Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode]
|
|
14211
14783
|
def lefts: () -> Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode]
|
|
@@ -14215,18 +14787,24 @@ module Prism
|
|
|
14215
14787
|
#
|
|
14216
14788
|
# Represents a splat node in the target expression.
|
|
14217
14789
|
#
|
|
14218
|
-
#
|
|
14219
|
-
#
|
|
14790
|
+
# ```rb
|
|
14791
|
+
# a, (b, *c) = 1, 2, 3, 4
|
|
14792
|
+
# ^^
|
|
14220
14793
|
#
|
|
14794
|
+
# ```
|
|
14221
14795
|
# The variable can be empty, this results in a `SplatNode` with a `nil` expression field.
|
|
14222
14796
|
#
|
|
14223
|
-
#
|
|
14224
|
-
#
|
|
14797
|
+
# ```rb
|
|
14798
|
+
# a, (b, *) = 1, 2, 3, 4
|
|
14799
|
+
# ^
|
|
14225
14800
|
#
|
|
14801
|
+
# ```
|
|
14226
14802
|
# If the `*` is omitted, this field will contain an `ImplicitRestNode`
|
|
14227
14803
|
#
|
|
14228
|
-
#
|
|
14229
|
-
#
|
|
14804
|
+
# ```rb
|
|
14805
|
+
# a, (b,) = 1, 2, 3, 4
|
|
14806
|
+
# ^
|
|
14807
|
+
# ```
|
|
14230
14808
|
#
|
|
14231
14809
|
# : () -> (ImplicitRestNode | SplatNode)?
|
|
14232
14810
|
def rest: () -> (ImplicitRestNode | SplatNode)?
|
|
@@ -14236,8 +14814,10 @@ module Prism
|
|
|
14236
14814
|
#
|
|
14237
14815
|
# Represents the targets expressions after a splat node.
|
|
14238
14816
|
#
|
|
14239
|
-
#
|
|
14240
|
-
#
|
|
14817
|
+
# ```rb
|
|
14818
|
+
# a, (*, b, c) = 1, 2, 3, 4, 5
|
|
14819
|
+
# ^^^^
|
|
14820
|
+
# ```
|
|
14241
14821
|
#
|
|
14242
14822
|
# : () -> Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode]
|
|
14243
14823
|
def rights: () -> Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode]
|
|
@@ -14248,8 +14828,10 @@ module Prism
|
|
|
14248
14828
|
#
|
|
14249
14829
|
# The Location of the opening parenthesis.
|
|
14250
14830
|
#
|
|
14251
|
-
#
|
|
14252
|
-
#
|
|
14831
|
+
# ```rb
|
|
14832
|
+
# a, (b, c) = 1, 2, 3
|
|
14833
|
+
# ^
|
|
14834
|
+
# ```
|
|
14253
14835
|
#
|
|
14254
14836
|
# : () -> Location?
|
|
14255
14837
|
def lparen_loc: () -> Location?
|
|
@@ -14267,8 +14849,10 @@ module Prism
|
|
|
14267
14849
|
#
|
|
14268
14850
|
# The Location of the closing parenthesis.
|
|
14269
14851
|
#
|
|
14270
|
-
#
|
|
14271
|
-
#
|
|
14852
|
+
# ```rb
|
|
14853
|
+
# a, (b, c) = 1, 2, 3
|
|
14854
|
+
# ^
|
|
14855
|
+
# ```
|
|
14272
14856
|
#
|
|
14273
14857
|
# : () -> Location?
|
|
14274
14858
|
def rparen_loc: () -> Location?
|
|
@@ -14302,8 +14886,10 @@ module Prism
|
|
|
14302
14886
|
|
|
14303
14887
|
# Represents a write to a multi-target expression.
|
|
14304
14888
|
#
|
|
14305
|
-
#
|
|
14306
|
-
#
|
|
14889
|
+
# ```rb
|
|
14890
|
+
# a, b, c = 1, 2, 3
|
|
14891
|
+
# ^^^^^^^^^^^^^^^^^
|
|
14892
|
+
# ```
|
|
14307
14893
|
class MultiWriteNode < Node
|
|
14308
14894
|
@value: Prism::node
|
|
14309
14895
|
|
|
@@ -14377,13 +14963,17 @@ module Prism
|
|
|
14377
14963
|
#
|
|
14378
14964
|
# Represents the targets expressions before a splat node.
|
|
14379
14965
|
#
|
|
14380
|
-
#
|
|
14381
|
-
#
|
|
14966
|
+
# ```rb
|
|
14967
|
+
# a, b, * = 1, 2, 3, 4, 5
|
|
14968
|
+
# ^^^^
|
|
14382
14969
|
#
|
|
14970
|
+
# ```
|
|
14383
14971
|
# The splat node can be absent, in that case all target expressions are in the left field.
|
|
14384
14972
|
#
|
|
14385
|
-
#
|
|
14386
|
-
#
|
|
14973
|
+
# ```rb
|
|
14974
|
+
# a, b, c = 1, 2, 3, 4, 5
|
|
14975
|
+
# ^^^^^^^
|
|
14976
|
+
# ```
|
|
14387
14977
|
#
|
|
14388
14978
|
# : () -> Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode]
|
|
14389
14979
|
def lefts: () -> Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode]
|
|
@@ -14393,18 +14983,24 @@ module Prism
|
|
|
14393
14983
|
#
|
|
14394
14984
|
# Represents a splat node in the target expression.
|
|
14395
14985
|
#
|
|
14396
|
-
#
|
|
14397
|
-
#
|
|
14986
|
+
# ```rb
|
|
14987
|
+
# a, b, *c = 1, 2, 3, 4
|
|
14988
|
+
# ^^
|
|
14398
14989
|
#
|
|
14990
|
+
# ```
|
|
14399
14991
|
# The variable can be empty, this results in a `SplatNode` with a `nil` expression field.
|
|
14400
14992
|
#
|
|
14401
|
-
#
|
|
14402
|
-
#
|
|
14993
|
+
# ```rb
|
|
14994
|
+
# a, b, * = 1, 2, 3, 4
|
|
14995
|
+
# ^
|
|
14403
14996
|
#
|
|
14997
|
+
# ```
|
|
14404
14998
|
# If the `*` is omitted, this field will contain an `ImplicitRestNode`
|
|
14405
14999
|
#
|
|
14406
|
-
#
|
|
14407
|
-
#
|
|
15000
|
+
# ```rb
|
|
15001
|
+
# a, b, = 1, 2, 3, 4
|
|
15002
|
+
# ^
|
|
15003
|
+
# ```
|
|
14408
15004
|
#
|
|
14409
15005
|
# : () -> (ImplicitRestNode | SplatNode)?
|
|
14410
15006
|
def rest: () -> (ImplicitRestNode | SplatNode)?
|
|
@@ -14414,8 +15010,10 @@ module Prism
|
|
|
14414
15010
|
#
|
|
14415
15011
|
# Represents the targets expressions after a splat node.
|
|
14416
15012
|
#
|
|
14417
|
-
#
|
|
14418
|
-
#
|
|
15013
|
+
# ```rb
|
|
15014
|
+
# a, *, b, c = 1, 2, 3, 4, 5
|
|
15015
|
+
# ^^^^
|
|
15016
|
+
# ```
|
|
14419
15017
|
#
|
|
14420
15018
|
# : () -> Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode]
|
|
14421
15019
|
def rights: () -> Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode]
|
|
@@ -14426,8 +15024,10 @@ module Prism
|
|
|
14426
15024
|
#
|
|
14427
15025
|
# The Location of the opening parenthesis.
|
|
14428
15026
|
#
|
|
14429
|
-
#
|
|
14430
|
-
#
|
|
15027
|
+
# ```rb
|
|
15028
|
+
# (a, b, c) = 1, 2, 3
|
|
15029
|
+
# ^
|
|
15030
|
+
# ```
|
|
14431
15031
|
#
|
|
14432
15032
|
# : () -> Location?
|
|
14433
15033
|
def lparen_loc: () -> Location?
|
|
@@ -14445,8 +15045,10 @@ module Prism
|
|
|
14445
15045
|
#
|
|
14446
15046
|
# The Location of the closing parenthesis.
|
|
14447
15047
|
#
|
|
14448
|
-
#
|
|
14449
|
-
#
|
|
15048
|
+
# ```rb
|
|
15049
|
+
# (a, b, c) = 1, 2, 3
|
|
15050
|
+
# ^
|
|
15051
|
+
# ```
|
|
14450
15052
|
#
|
|
14451
15053
|
# : () -> Location?
|
|
14452
15054
|
def rparen_loc: () -> Location?
|
|
@@ -14464,8 +15066,10 @@ module Prism
|
|
|
14464
15066
|
#
|
|
14465
15067
|
# The Location of the operator.
|
|
14466
15068
|
#
|
|
14467
|
-
#
|
|
14468
|
-
#
|
|
15069
|
+
# ```rb
|
|
15070
|
+
# a, b, c = 1, 2, 3
|
|
15071
|
+
# ^
|
|
15072
|
+
# ```
|
|
14469
15073
|
#
|
|
14470
15074
|
# : () -> Location
|
|
14471
15075
|
def operator_loc: () -> Location
|
|
@@ -14482,8 +15086,10 @@ module Prism
|
|
|
14482
15086
|
#
|
|
14483
15087
|
# The value to write to the targets. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
14484
15088
|
#
|
|
14485
|
-
#
|
|
14486
|
-
#
|
|
15089
|
+
# ```rb
|
|
15090
|
+
# a, b, c = 1, 2, 3
|
|
15091
|
+
# ^^^^^^^
|
|
15092
|
+
# ```
|
|
14487
15093
|
#
|
|
14488
15094
|
# : () -> Prism::node
|
|
14489
15095
|
def value: () -> Prism::node
|
|
@@ -14518,8 +15124,10 @@ module Prism
|
|
|
14518
15124
|
|
|
14519
15125
|
# Represents the use of the `next` keyword.
|
|
14520
15126
|
#
|
|
14521
|
-
#
|
|
14522
|
-
#
|
|
15127
|
+
# ```rb
|
|
15128
|
+
# next 1
|
|
15129
|
+
# ^^^^^^
|
|
15130
|
+
# ```
|
|
14523
15131
|
class NextNode < Node
|
|
14524
15132
|
@keyword_loc: Location
|
|
14525
15133
|
|
|
@@ -14616,8 +15224,10 @@ module Prism
|
|
|
14616
15224
|
|
|
14617
15225
|
# Represents the use of the `nil` keyword.
|
|
14618
15226
|
#
|
|
14619
|
-
#
|
|
14620
|
-
#
|
|
15227
|
+
# ```rb
|
|
15228
|
+
# nil
|
|
15229
|
+
# ^^^
|
|
15230
|
+
# ```
|
|
14621
15231
|
class NilNode < Node
|
|
14622
15232
|
# Initialize a new NilNode node.
|
|
14623
15233
|
#
|
|
@@ -14678,9 +15288,11 @@ module Prism
|
|
|
14678
15288
|
|
|
14679
15289
|
# Represents the use of `&nil` inside method arguments.
|
|
14680
15290
|
#
|
|
14681
|
-
#
|
|
14682
|
-
#
|
|
14683
|
-
#
|
|
15291
|
+
# ```rb
|
|
15292
|
+
# def a(&nil)
|
|
15293
|
+
# ^^^^
|
|
15294
|
+
# end
|
|
15295
|
+
# ```
|
|
14684
15296
|
class NoBlockParameterNode < Node
|
|
14685
15297
|
@keyword_loc: Location
|
|
14686
15298
|
|
|
@@ -14793,9 +15405,11 @@ module Prism
|
|
|
14793
15405
|
|
|
14794
15406
|
# Represents the use of `**nil` inside method arguments.
|
|
14795
15407
|
#
|
|
14796
|
-
#
|
|
14797
|
-
#
|
|
14798
|
-
#
|
|
15408
|
+
# ```rb
|
|
15409
|
+
# def a(**nil)
|
|
15410
|
+
# ^^^^^
|
|
15411
|
+
# end
|
|
15412
|
+
# ```
|
|
14799
15413
|
class NoKeywordsParameterNode < Node
|
|
14800
15414
|
@keyword_loc: Location
|
|
14801
15415
|
|
|
@@ -14908,8 +15522,10 @@ module Prism
|
|
|
14908
15522
|
|
|
14909
15523
|
# Represents an implicit set of parameters through the use of numbered parameters within a block or lambda.
|
|
14910
15524
|
#
|
|
14911
|
-
#
|
|
14912
|
-
#
|
|
15525
|
+
# ```rb
|
|
15526
|
+
# -> { _1 + _2 }
|
|
15527
|
+
# ^^^^^^^^^^^^^^
|
|
15528
|
+
# ```
|
|
14913
15529
|
class NumberedParametersNode < Node
|
|
14914
15530
|
@maximum: Integer
|
|
14915
15531
|
|
|
@@ -14980,8 +15596,10 @@ module Prism
|
|
|
14980
15596
|
|
|
14981
15597
|
# Represents reading a numbered reference to a capture in the previous match.
|
|
14982
15598
|
#
|
|
14983
|
-
#
|
|
14984
|
-
#
|
|
15599
|
+
# ```rb
|
|
15600
|
+
# $1
|
|
15601
|
+
# ^^
|
|
15602
|
+
# ```
|
|
14985
15603
|
class NumberedReferenceReadNode < Node
|
|
14986
15604
|
@number: Integer
|
|
14987
15605
|
|
|
@@ -15043,11 +15661,13 @@ module Prism
|
|
|
15043
15661
|
#
|
|
15044
15662
|
# The (1-indexed, from the left) number of the capture group. Numbered references that are too large result in this value being `0`.
|
|
15045
15663
|
#
|
|
15046
|
-
#
|
|
15664
|
+
# ```rb
|
|
15665
|
+
# $1 # number `1`
|
|
15047
15666
|
#
|
|
15048
|
-
#
|
|
15667
|
+
# $5432 # number `5432`
|
|
15049
15668
|
#
|
|
15050
|
-
#
|
|
15669
|
+
# $4294967296 # number `0`
|
|
15670
|
+
# ```
|
|
15051
15671
|
#
|
|
15052
15672
|
# : () -> Integer
|
|
15053
15673
|
def number: () -> Integer
|
|
@@ -15058,9 +15678,11 @@ module Prism
|
|
|
15058
15678
|
|
|
15059
15679
|
# Represents an optional keyword parameter to a method, block, or lambda definition.
|
|
15060
15680
|
#
|
|
15061
|
-
#
|
|
15062
|
-
#
|
|
15063
|
-
#
|
|
15681
|
+
# ```rb
|
|
15682
|
+
# def a(b: 1)
|
|
15683
|
+
# ^^^^
|
|
15684
|
+
# end
|
|
15685
|
+
# ```
|
|
15064
15686
|
class OptionalKeywordParameterNode < Node
|
|
15065
15687
|
@value: Prism::node
|
|
15066
15688
|
|
|
@@ -15165,9 +15787,11 @@ module Prism
|
|
|
15165
15787
|
|
|
15166
15788
|
# Represents an optional parameter to a method, block, or lambda definition.
|
|
15167
15789
|
#
|
|
15168
|
-
#
|
|
15169
|
-
#
|
|
15170
|
-
#
|
|
15790
|
+
# ```rb
|
|
15791
|
+
# def a(b = 1)
|
|
15792
|
+
# ^^^^^
|
|
15793
|
+
# end
|
|
15794
|
+
# ```
|
|
15171
15795
|
class OptionalParameterNode < Node
|
|
15172
15796
|
@value: Prism::node
|
|
15173
15797
|
|
|
@@ -15298,8 +15922,10 @@ module Prism
|
|
|
15298
15922
|
|
|
15299
15923
|
# Represents the use of the `||` operator or the `or` keyword.
|
|
15300
15924
|
#
|
|
15301
|
-
#
|
|
15302
|
-
#
|
|
15925
|
+
# ```rb
|
|
15926
|
+
# left or right
|
|
15927
|
+
# ^^^^^^^^^^^^^
|
|
15928
|
+
# ```
|
|
15303
15929
|
class OrNode < Node
|
|
15304
15930
|
@operator_loc: Location
|
|
15305
15931
|
|
|
@@ -15365,11 +15991,13 @@ module Prism
|
|
|
15365
15991
|
#
|
|
15366
15992
|
# Represents the left side of the expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
15367
15993
|
#
|
|
15368
|
-
#
|
|
15369
|
-
#
|
|
15994
|
+
# ```rb
|
|
15995
|
+
# left or right
|
|
15996
|
+
# ^^^^
|
|
15370
15997
|
#
|
|
15371
|
-
#
|
|
15372
|
-
#
|
|
15998
|
+
# 1 || 2
|
|
15999
|
+
# ^
|
|
16000
|
+
# ```
|
|
15373
16001
|
#
|
|
15374
16002
|
# : () -> Prism::node
|
|
15375
16003
|
def left: () -> Prism::node
|
|
@@ -15379,11 +16007,13 @@ module Prism
|
|
|
15379
16007
|
#
|
|
15380
16008
|
# Represents the right side of the expression.
|
|
15381
16009
|
#
|
|
15382
|
-
#
|
|
15383
|
-
#
|
|
16010
|
+
# ```rb
|
|
16011
|
+
# left || right
|
|
16012
|
+
# ^^^^^
|
|
15384
16013
|
#
|
|
15385
|
-
#
|
|
15386
|
-
#
|
|
16014
|
+
# 1 or 2
|
|
16015
|
+
# ^
|
|
16016
|
+
# ```
|
|
15387
16017
|
#
|
|
15388
16018
|
# : () -> Prism::node
|
|
15389
16019
|
def right: () -> Prism::node
|
|
@@ -15394,8 +16024,10 @@ module Prism
|
|
|
15394
16024
|
#
|
|
15395
16025
|
# The Location of the `or` keyword or the `||` operator.
|
|
15396
16026
|
#
|
|
15397
|
-
#
|
|
15398
|
-
#
|
|
16027
|
+
# ```rb
|
|
16028
|
+
# left or right
|
|
16029
|
+
# ^^
|
|
16030
|
+
# ```
|
|
15399
16031
|
#
|
|
15400
16032
|
# : () -> Location
|
|
15401
16033
|
def operator_loc: () -> Location
|
|
@@ -15421,9 +16053,11 @@ module Prism
|
|
|
15421
16053
|
|
|
15422
16054
|
# Represents the list of parameters on a method, block, or lambda definition.
|
|
15423
16055
|
#
|
|
15424
|
-
#
|
|
15425
|
-
#
|
|
15426
|
-
#
|
|
16056
|
+
# ```rb
|
|
16057
|
+
# def a(b, c, d)
|
|
16058
|
+
# ^^^^^^^
|
|
16059
|
+
# end
|
|
16060
|
+
# ```
|
|
15427
16061
|
class ParametersNode < Node
|
|
15428
16062
|
@block: (BlockParameterNode | NoBlockParameterNode)?
|
|
15429
16063
|
|
|
@@ -15554,8 +16188,10 @@ module Prism
|
|
|
15554
16188
|
|
|
15555
16189
|
# Represents a parenthesized expression
|
|
15556
16190
|
#
|
|
15557
|
-
#
|
|
15558
|
-
#
|
|
16191
|
+
# ```rb
|
|
16192
|
+
# (10 + 34)
|
|
16193
|
+
# ^^^^^^^^^
|
|
16194
|
+
# ```
|
|
15559
16195
|
class ParenthesesNode < Node
|
|
15560
16196
|
@closing_loc: Location
|
|
15561
16197
|
|
|
@@ -15684,8 +16320,10 @@ module Prism
|
|
|
15684
16320
|
|
|
15685
16321
|
# Represents the use of the `^` operator for pinning an expression in a pattern matching expression.
|
|
15686
16322
|
#
|
|
15687
|
-
#
|
|
15688
|
-
#
|
|
16323
|
+
# ```rb
|
|
16324
|
+
# foo in ^(bar)
|
|
16325
|
+
# ^^^^^^
|
|
16326
|
+
# ```
|
|
15689
16327
|
class PinnedExpressionNode < Node
|
|
15690
16328
|
@rparen_loc: Location
|
|
15691
16329
|
|
|
@@ -15753,8 +16391,10 @@ module Prism
|
|
|
15753
16391
|
#
|
|
15754
16392
|
# The expression used in the pinned expression
|
|
15755
16393
|
#
|
|
15756
|
-
#
|
|
15757
|
-
#
|
|
16394
|
+
# ```rb
|
|
16395
|
+
# foo in ^(bar)
|
|
16396
|
+
# ^^^
|
|
16397
|
+
# ```
|
|
15758
16398
|
#
|
|
15759
16399
|
# : () -> Prism::node
|
|
15760
16400
|
def expression: () -> Prism::node
|
|
@@ -15765,8 +16405,10 @@ module Prism
|
|
|
15765
16405
|
#
|
|
15766
16406
|
# The Location of the `^` operator
|
|
15767
16407
|
#
|
|
15768
|
-
#
|
|
15769
|
-
#
|
|
16408
|
+
# ```rb
|
|
16409
|
+
# foo in ^(bar)
|
|
16410
|
+
# ^
|
|
16411
|
+
# ```
|
|
15770
16412
|
#
|
|
15771
16413
|
# : () -> Location
|
|
15772
16414
|
def operator_loc: () -> Location
|
|
@@ -15784,8 +16426,10 @@ module Prism
|
|
|
15784
16426
|
#
|
|
15785
16427
|
# The Location of the opening parenthesis.
|
|
15786
16428
|
#
|
|
15787
|
-
#
|
|
15788
|
-
#
|
|
16429
|
+
# ```rb
|
|
16430
|
+
# foo in ^(bar)
|
|
16431
|
+
# ^
|
|
16432
|
+
# ```
|
|
15789
16433
|
#
|
|
15790
16434
|
# : () -> Location
|
|
15791
16435
|
def lparen_loc: () -> Location
|
|
@@ -15803,8 +16447,10 @@ module Prism
|
|
|
15803
16447
|
#
|
|
15804
16448
|
# The Location of the closing parenthesis.
|
|
15805
16449
|
#
|
|
15806
|
-
#
|
|
15807
|
-
#
|
|
16450
|
+
# ```rb
|
|
16451
|
+
# foo in ^(bar)
|
|
16452
|
+
# ^
|
|
16453
|
+
# ```
|
|
15808
16454
|
#
|
|
15809
16455
|
# : () -> Location
|
|
15810
16456
|
def rparen_loc: () -> Location
|
|
@@ -15846,8 +16492,10 @@ module Prism
|
|
|
15846
16492
|
|
|
15847
16493
|
# Represents the use of the `^` operator for pinning a variable in a pattern matching expression.
|
|
15848
16494
|
#
|
|
15849
|
-
#
|
|
15850
|
-
#
|
|
16495
|
+
# ```rb
|
|
16496
|
+
# foo in ^bar
|
|
16497
|
+
# ^^^^
|
|
16498
|
+
# ```
|
|
15851
16499
|
class PinnedVariableNode < Node
|
|
15852
16500
|
@operator_loc: Location
|
|
15853
16501
|
|
|
@@ -15911,8 +16559,10 @@ module Prism
|
|
|
15911
16559
|
#
|
|
15912
16560
|
# The variable used in the pinned expression
|
|
15913
16561
|
#
|
|
15914
|
-
#
|
|
15915
|
-
#
|
|
16562
|
+
# ```rb
|
|
16563
|
+
# foo in ^bar
|
|
16564
|
+
# ^^^
|
|
16565
|
+
# ```
|
|
15916
16566
|
#
|
|
15917
16567
|
# : () -> (LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode)
|
|
15918
16568
|
def variable: () -> (LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode)
|
|
@@ -15923,8 +16573,10 @@ module Prism
|
|
|
15923
16573
|
#
|
|
15924
16574
|
# The Location of the `^` operator
|
|
15925
16575
|
#
|
|
15926
|
-
#
|
|
15927
|
-
#
|
|
16576
|
+
# ```rb
|
|
16577
|
+
# foo in ^bar
|
|
16578
|
+
# ^
|
|
16579
|
+
# ```
|
|
15928
16580
|
#
|
|
15929
16581
|
# : () -> Location
|
|
15930
16582
|
def operator_loc: () -> Location
|
|
@@ -15950,8 +16602,10 @@ module Prism
|
|
|
15950
16602
|
|
|
15951
16603
|
# Represents the use of the `END` keyword.
|
|
15952
16604
|
#
|
|
15953
|
-
#
|
|
15954
|
-
#
|
|
16605
|
+
# ```rb
|
|
16606
|
+
# END { foo }
|
|
16607
|
+
# ^^^^^^^^^^^
|
|
16608
|
+
# ```
|
|
15955
16609
|
class PostExecutionNode < Node
|
|
15956
16610
|
@closing_loc: Location
|
|
15957
16611
|
|
|
@@ -16100,8 +16754,10 @@ module Prism
|
|
|
16100
16754
|
|
|
16101
16755
|
# Represents the use of the `BEGIN` keyword.
|
|
16102
16756
|
#
|
|
16103
|
-
#
|
|
16104
|
-
#
|
|
16757
|
+
# ```rb
|
|
16758
|
+
# BEGIN { foo }
|
|
16759
|
+
# ^^^^^^^^^^^^^
|
|
16760
|
+
# ```
|
|
16105
16761
|
class PreExecutionNode < Node
|
|
16106
16762
|
@closing_loc: Location
|
|
16107
16763
|
|
|
@@ -16329,11 +16985,13 @@ module Prism
|
|
|
16329
16985
|
|
|
16330
16986
|
# Represents the use of the `..` or `...` operators.
|
|
16331
16987
|
#
|
|
16332
|
-
#
|
|
16333
|
-
#
|
|
16988
|
+
# ```rb
|
|
16989
|
+
# 1..2
|
|
16990
|
+
# ^^^^
|
|
16334
16991
|
#
|
|
16335
|
-
#
|
|
16336
|
-
#
|
|
16992
|
+
# c if a =~ /left/ ... b =~ /right/
|
|
16993
|
+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
16994
|
+
# ```
|
|
16337
16995
|
class RangeNode < Node
|
|
16338
16996
|
@operator_loc: Location
|
|
16339
16997
|
|
|
@@ -16405,11 +17063,13 @@ module Prism
|
|
|
16405
17063
|
#
|
|
16406
17064
|
# The left-hand side of the range, if present. It can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
16407
17065
|
#
|
|
16408
|
-
#
|
|
16409
|
-
#
|
|
17066
|
+
# ```rb
|
|
17067
|
+
# 1...
|
|
17068
|
+
# ^
|
|
16410
17069
|
#
|
|
16411
|
-
#
|
|
16412
|
-
#
|
|
17070
|
+
# hello...goodbye
|
|
17071
|
+
# ^^^^^
|
|
17072
|
+
# ```
|
|
16413
17073
|
#
|
|
16414
17074
|
# : () -> Prism::node?
|
|
16415
17075
|
def left: () -> Prism::node?
|
|
@@ -16419,11 +17079,13 @@ module Prism
|
|
|
16419
17079
|
#
|
|
16420
17080
|
# The right-hand side of the range, if present. It can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
16421
17081
|
#
|
|
16422
|
-
#
|
|
16423
|
-
#
|
|
17082
|
+
# ```rb
|
|
17083
|
+
# ..5
|
|
17084
|
+
# ^
|
|
16424
17085
|
#
|
|
16425
|
-
#
|
|
16426
|
-
#
|
|
17086
|
+
# 1...foo
|
|
17087
|
+
# ^^^
|
|
17088
|
+
# ```
|
|
16427
17089
|
# If neither right-hand or left-hand side was included, this will be an ErrorRecoveryNode.
|
|
16428
17090
|
#
|
|
16429
17091
|
# : () -> Prism::node?
|
|
@@ -16459,8 +17121,10 @@ module Prism
|
|
|
16459
17121
|
|
|
16460
17122
|
# Represents a rational number literal.
|
|
16461
17123
|
#
|
|
16462
|
-
#
|
|
16463
|
-
#
|
|
17124
|
+
# ```rb
|
|
17125
|
+
# 1.0r
|
|
17126
|
+
# ^^^^
|
|
17127
|
+
# ```
|
|
16464
17128
|
class RationalNode < Node
|
|
16465
17129
|
@denominator: Integer
|
|
16466
17130
|
|
|
@@ -16548,7 +17212,9 @@ module Prism
|
|
|
16548
17212
|
#
|
|
16549
17213
|
# The numerator of the rational number.
|
|
16550
17214
|
#
|
|
16551
|
-
#
|
|
17215
|
+
# ```rb
|
|
17216
|
+
# 1.5r # numerator 3
|
|
17217
|
+
# ```
|
|
16552
17218
|
#
|
|
16553
17219
|
# : () -> Integer
|
|
16554
17220
|
def numerator: () -> Integer
|
|
@@ -16558,7 +17224,9 @@ module Prism
|
|
|
16558
17224
|
#
|
|
16559
17225
|
# The denominator of the rational number.
|
|
16560
17226
|
#
|
|
16561
|
-
#
|
|
17227
|
+
# ```rb
|
|
17228
|
+
# 1.5r # denominator 2
|
|
17229
|
+
# ```
|
|
16562
17230
|
#
|
|
16563
17231
|
# : () -> Integer
|
|
16564
17232
|
def denominator: () -> Integer
|
|
@@ -16569,8 +17237,10 @@ module Prism
|
|
|
16569
17237
|
|
|
16570
17238
|
# Represents the use of the `redo` keyword.
|
|
16571
17239
|
#
|
|
16572
|
-
#
|
|
16573
|
-
#
|
|
17240
|
+
# ```rb
|
|
17241
|
+
# redo
|
|
17242
|
+
# ^^^^
|
|
17243
|
+
# ```
|
|
16574
17244
|
class RedoNode < Node
|
|
16575
17245
|
# Initialize a new RedoNode node.
|
|
16576
17246
|
#
|
|
@@ -16631,8 +17301,10 @@ module Prism
|
|
|
16631
17301
|
|
|
16632
17302
|
# Represents a regular expression literal with no interpolation.
|
|
16633
17303
|
#
|
|
16634
|
-
#
|
|
16635
|
-
#
|
|
17304
|
+
# ```rb
|
|
17305
|
+
# /foo/i
|
|
17306
|
+
# ^^^^^^
|
|
17307
|
+
# ```
|
|
16636
17308
|
class RegularExpressionNode < Node
|
|
16637
17309
|
@unescaped: String
|
|
16638
17310
|
|
|
@@ -16847,9 +17519,11 @@ module Prism
|
|
|
16847
17519
|
|
|
16848
17520
|
# Represents a required keyword parameter to a method, block, or lambda definition.
|
|
16849
17521
|
#
|
|
16850
|
-
#
|
|
16851
|
-
#
|
|
16852
|
-
#
|
|
17522
|
+
# ```rb
|
|
17523
|
+
# def a(b: )
|
|
17524
|
+
# ^^
|
|
17525
|
+
# end
|
|
17526
|
+
# ```
|
|
16853
17527
|
class RequiredKeywordParameterNode < Node
|
|
16854
17528
|
@name_loc: Location
|
|
16855
17529
|
|
|
@@ -16944,9 +17618,11 @@ module Prism
|
|
|
16944
17618
|
|
|
16945
17619
|
# Represents a required parameter to a method, block, or lambda definition.
|
|
16946
17620
|
#
|
|
16947
|
-
#
|
|
16948
|
-
#
|
|
16949
|
-
#
|
|
17621
|
+
# ```rb
|
|
17622
|
+
# def a(b)
|
|
17623
|
+
# ^
|
|
17624
|
+
# end
|
|
17625
|
+
# ```
|
|
16950
17626
|
class RequiredParameterNode < Node
|
|
16951
17627
|
@name: Symbol
|
|
16952
17628
|
|
|
@@ -17023,8 +17699,10 @@ module Prism
|
|
|
17023
17699
|
|
|
17024
17700
|
# Represents an expression modified with a rescue.
|
|
17025
17701
|
#
|
|
17026
|
-
#
|
|
17027
|
-
#
|
|
17702
|
+
# ```rb
|
|
17703
|
+
# foo rescue nil
|
|
17704
|
+
# ^^^^^^^^^^^^^^
|
|
17705
|
+
# ```
|
|
17028
17706
|
class RescueModifierNode < Node
|
|
17029
17707
|
@rescue_expression: Prism::node
|
|
17030
17708
|
|
|
@@ -17131,12 +17809,14 @@ module Prism
|
|
|
17131
17809
|
|
|
17132
17810
|
# Represents a rescue statement.
|
|
17133
17811
|
#
|
|
17134
|
-
#
|
|
17135
|
-
#
|
|
17136
|
-
#
|
|
17137
|
-
#
|
|
17138
|
-
#
|
|
17812
|
+
# ```rb
|
|
17813
|
+
# begin
|
|
17814
|
+
# rescue Foo, *splat, Bar => ex
|
|
17815
|
+
# foo
|
|
17816
|
+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
17817
|
+
# end
|
|
17139
17818
|
#
|
|
17819
|
+
# ```
|
|
17140
17820
|
# `Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `reference` field.
|
|
17141
17821
|
class RescueNode < Node
|
|
17142
17822
|
@subsequent: RescueNode?
|
|
@@ -17316,9 +17996,11 @@ module Prism
|
|
|
17316
17996
|
|
|
17317
17997
|
# Represents a rest parameter to a method, block, or lambda definition.
|
|
17318
17998
|
#
|
|
17319
|
-
#
|
|
17320
|
-
#
|
|
17321
|
-
#
|
|
17999
|
+
# ```rb
|
|
18000
|
+
# def a(*b)
|
|
18001
|
+
# ^^
|
|
18002
|
+
# end
|
|
18003
|
+
# ```
|
|
17322
18004
|
class RestParameterNode < Node
|
|
17323
18005
|
@operator_loc: Location
|
|
17324
18006
|
|
|
@@ -17439,8 +18121,10 @@ module Prism
|
|
|
17439
18121
|
|
|
17440
18122
|
# Represents the use of the `retry` keyword.
|
|
17441
18123
|
#
|
|
17442
|
-
#
|
|
17443
|
-
#
|
|
18124
|
+
# ```rb
|
|
18125
|
+
# retry
|
|
18126
|
+
# ^^^^^
|
|
18127
|
+
# ```
|
|
17444
18128
|
class RetryNode < Node
|
|
17445
18129
|
# Initialize a new RetryNode node.
|
|
17446
18130
|
#
|
|
@@ -17501,8 +18185,10 @@ module Prism
|
|
|
17501
18185
|
|
|
17502
18186
|
# Represents the use of the `return` keyword.
|
|
17503
18187
|
#
|
|
17504
|
-
#
|
|
17505
|
-
#
|
|
18188
|
+
# ```rb
|
|
18189
|
+
# return 1
|
|
18190
|
+
# ^^^^^^^^
|
|
18191
|
+
# ```
|
|
17506
18192
|
class ReturnNode < Node
|
|
17507
18193
|
@arguments: ArgumentsNode?
|
|
17508
18194
|
|
|
@@ -17599,8 +18285,10 @@ module Prism
|
|
|
17599
18285
|
|
|
17600
18286
|
# Represents the `self` keyword.
|
|
17601
18287
|
#
|
|
17602
|
-
#
|
|
17603
|
-
#
|
|
18288
|
+
# ```rb
|
|
18289
|
+
# self
|
|
18290
|
+
# ^^^^
|
|
18291
|
+
# ```
|
|
17604
18292
|
class SelfNode < Node
|
|
17605
18293
|
# Initialize a new SelfNode node.
|
|
17606
18294
|
#
|
|
@@ -17661,9 +18349,11 @@ module Prism
|
|
|
17661
18349
|
|
|
17662
18350
|
# This node wraps a constant write to indicate that when the value is written, it should have its shareability state modified.
|
|
17663
18351
|
#
|
|
17664
|
-
#
|
|
17665
|
-
#
|
|
17666
|
-
#
|
|
18352
|
+
# ```rb
|
|
18353
|
+
# # shareable_constant_value: literal
|
|
18354
|
+
# C = { a: 1 }
|
|
18355
|
+
# ^^^^^^^^^^^^
|
|
18356
|
+
# ```
|
|
17667
18357
|
class ShareableConstantNode < Node
|
|
17668
18358
|
@write: ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode
|
|
17669
18359
|
|
|
@@ -17752,8 +18442,10 @@ module Prism
|
|
|
17752
18442
|
|
|
17753
18443
|
# Represents a singleton class declaration involving the `class` keyword.
|
|
17754
18444
|
#
|
|
17755
|
-
#
|
|
17756
|
-
#
|
|
18445
|
+
# ```rb
|
|
18446
|
+
# class << self end
|
|
18447
|
+
# ^^^^^^^^^^^^^^^^^
|
|
18448
|
+
# ```
|
|
17757
18449
|
class SingletonClassNode < Node
|
|
17758
18450
|
@end_keyword_loc: Location
|
|
17759
18451
|
|
|
@@ -17922,8 +18614,10 @@ module Prism
|
|
|
17922
18614
|
|
|
17923
18615
|
# Represents the use of the `__ENCODING__` keyword.
|
|
17924
18616
|
#
|
|
17925
|
-
#
|
|
17926
|
-
#
|
|
18617
|
+
# ```rb
|
|
18618
|
+
# __ENCODING__
|
|
18619
|
+
# ^^^^^^^^^^^^
|
|
18620
|
+
# ```
|
|
17927
18621
|
class SourceEncodingNode < Node
|
|
17928
18622
|
# Initialize a new SourceEncodingNode node.
|
|
17929
18623
|
#
|
|
@@ -17984,8 +18678,10 @@ module Prism
|
|
|
17984
18678
|
|
|
17985
18679
|
# Represents the use of the `__FILE__` keyword.
|
|
17986
18680
|
#
|
|
17987
|
-
#
|
|
17988
|
-
#
|
|
18681
|
+
# ```rb
|
|
18682
|
+
# __FILE__
|
|
18683
|
+
# ^^^^^^^^
|
|
18684
|
+
# ```
|
|
17989
18685
|
class SourceFileNode < Node
|
|
17990
18686
|
@filepath: String
|
|
17991
18687
|
|
|
@@ -18080,8 +18776,10 @@ module Prism
|
|
|
18080
18776
|
|
|
18081
18777
|
# Represents the use of the `__LINE__` keyword.
|
|
18082
18778
|
#
|
|
18083
|
-
#
|
|
18084
|
-
#
|
|
18779
|
+
# ```rb
|
|
18780
|
+
# __LINE__
|
|
18781
|
+
# ^^^^^^^^
|
|
18782
|
+
# ```
|
|
18085
18783
|
class SourceLineNode < Node
|
|
18086
18784
|
# Initialize a new SourceLineNode node.
|
|
18087
18785
|
#
|
|
@@ -18142,8 +18840,10 @@ module Prism
|
|
|
18142
18840
|
|
|
18143
18841
|
# Represents the use of the splat operator.
|
|
18144
18842
|
#
|
|
18145
|
-
#
|
|
18146
|
-
#
|
|
18843
|
+
# ```rb
|
|
18844
|
+
# [*a]
|
|
18845
|
+
# ^^
|
|
18846
|
+
# ```
|
|
18147
18847
|
class SplatNode < Node
|
|
18148
18848
|
@expression: Prism::node?
|
|
18149
18849
|
|
|
@@ -18240,8 +18940,10 @@ module Prism
|
|
|
18240
18940
|
|
|
18241
18941
|
# Represents a set of statements contained within some scope.
|
|
18242
18942
|
#
|
|
18243
|
-
#
|
|
18244
|
-
#
|
|
18943
|
+
# ```rb
|
|
18944
|
+
# foo; bar; baz
|
|
18945
|
+
# ^^^^^^^^^^^^^
|
|
18946
|
+
# ```
|
|
18245
18947
|
class StatementsNode < Node
|
|
18246
18948
|
@body: Array[Prism::node]
|
|
18247
18949
|
|
|
@@ -18312,14 +19014,16 @@ module Prism
|
|
|
18312
19014
|
|
|
18313
19015
|
# Represents a string literal, a string contained within a `%w` list, or plain string content within an interpolated string.
|
|
18314
19016
|
#
|
|
18315
|
-
#
|
|
18316
|
-
#
|
|
19017
|
+
# ```rb
|
|
19018
|
+
# "foo"
|
|
19019
|
+
# ^^^^^
|
|
18317
19020
|
#
|
|
18318
|
-
#
|
|
18319
|
-
#
|
|
19021
|
+
# %w[foo]
|
|
19022
|
+
# ^^^
|
|
18320
19023
|
#
|
|
18321
|
-
#
|
|
18322
|
-
#
|
|
19024
|
+
# "foo #{bar} baz"
|
|
19025
|
+
# ^^^^ ^^^^
|
|
19026
|
+
# ```
|
|
18323
19027
|
class StringNode < Node
|
|
18324
19028
|
@unescaped: String
|
|
18325
19029
|
|
|
@@ -18492,12 +19196,14 @@ module Prism
|
|
|
18492
19196
|
|
|
18493
19197
|
# Represents the use of the `super` keyword with parentheses or arguments.
|
|
18494
19198
|
#
|
|
18495
|
-
#
|
|
18496
|
-
#
|
|
19199
|
+
# ```rb
|
|
19200
|
+
# super()
|
|
19201
|
+
# ^^^^^^^
|
|
18497
19202
|
#
|
|
18498
|
-
#
|
|
18499
|
-
#
|
|
19203
|
+
# super foo, bar
|
|
19204
|
+
# ^^^^^^^^^^^^^^
|
|
18500
19205
|
#
|
|
19206
|
+
# ```
|
|
18501
19207
|
# If no arguments are provided (except for a block), it would be a `ForwardingSuperNode` instead.
|
|
18502
19208
|
class SuperNode < Node
|
|
18503
19209
|
@block: (BlockNode | BlockArgumentNode)?
|
|
@@ -18657,11 +19363,13 @@ module Prism
|
|
|
18657
19363
|
|
|
18658
19364
|
# Represents a symbol literal or a symbol contained within a `%i` list.
|
|
18659
19365
|
#
|
|
18660
|
-
#
|
|
18661
|
-
#
|
|
19366
|
+
# ```rb
|
|
19367
|
+
# :foo
|
|
19368
|
+
# ^^^^
|
|
18662
19369
|
#
|
|
18663
|
-
#
|
|
18664
|
-
#
|
|
19370
|
+
# %i[foo]
|
|
19371
|
+
# ^^^
|
|
19372
|
+
# ```
|
|
18665
19373
|
class SymbolNode < Node
|
|
18666
19374
|
@unescaped: String
|
|
18667
19375
|
|
|
@@ -18828,8 +19536,10 @@ module Prism
|
|
|
18828
19536
|
|
|
18829
19537
|
# Represents the use of the literal `true` keyword.
|
|
18830
19538
|
#
|
|
18831
|
-
#
|
|
18832
|
-
#
|
|
19539
|
+
# ```rb
|
|
19540
|
+
# true
|
|
19541
|
+
# ^^^^
|
|
19542
|
+
# ```
|
|
18833
19543
|
class TrueNode < Node
|
|
18834
19544
|
# Initialize a new TrueNode node.
|
|
18835
19545
|
#
|
|
@@ -18890,8 +19600,10 @@ module Prism
|
|
|
18890
19600
|
|
|
18891
19601
|
# Represents the use of the `undef` keyword.
|
|
18892
19602
|
#
|
|
18893
|
-
#
|
|
18894
|
-
#
|
|
19603
|
+
# ```rb
|
|
19604
|
+
# undef :foo, :bar, :baz
|
|
19605
|
+
# ^^^^^^^^^^^^^^^^^^^^^^
|
|
19606
|
+
# ```
|
|
18895
19607
|
class UndefNode < Node
|
|
18896
19608
|
@keyword_loc: Location
|
|
18897
19609
|
|
|
@@ -18988,11 +19700,13 @@ module Prism
|
|
|
18988
19700
|
|
|
18989
19701
|
# Represents the use of the `unless` keyword, either in the block form or the modifier form.
|
|
18990
19702
|
#
|
|
18991
|
-
#
|
|
18992
|
-
#
|
|
19703
|
+
# ```rb
|
|
19704
|
+
# bar unless foo
|
|
19705
|
+
# ^^^^^^^^^^^^^^
|
|
18993
19706
|
#
|
|
18994
|
-
#
|
|
18995
|
-
#
|
|
19707
|
+
# unless foo then bar end
|
|
19708
|
+
# ^^^^^^^^^^^^^^^^^^^^^^^
|
|
19709
|
+
# ```
|
|
18996
19710
|
class UnlessNode < Node
|
|
18997
19711
|
@end_keyword_loc: Location?
|
|
18998
19712
|
|
|
@@ -19065,11 +19779,13 @@ module Prism
|
|
|
19065
19779
|
#
|
|
19066
19780
|
# The Location of the `unless` keyword.
|
|
19067
19781
|
#
|
|
19068
|
-
#
|
|
19069
|
-
#
|
|
19782
|
+
# ```rb
|
|
19783
|
+
# unless cond then bar end
|
|
19784
|
+
# ^^^^^^
|
|
19070
19785
|
#
|
|
19071
|
-
#
|
|
19072
|
-
#
|
|
19786
|
+
# bar unless cond
|
|
19787
|
+
# ^^^^^^
|
|
19788
|
+
# ```
|
|
19073
19789
|
#
|
|
19074
19790
|
# : () -> Location
|
|
19075
19791
|
def unless_keyword_loc: () -> Location
|
|
@@ -19086,11 +19802,13 @@ module Prism
|
|
|
19086
19802
|
#
|
|
19087
19803
|
# The condition to be evaluated for the unless expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
|
19088
19804
|
#
|
|
19089
|
-
#
|
|
19090
|
-
#
|
|
19805
|
+
# ```rb
|
|
19806
|
+
# unless cond then bar end
|
|
19807
|
+
# ^^^^
|
|
19091
19808
|
#
|
|
19092
|
-
#
|
|
19093
|
-
#
|
|
19809
|
+
# bar unless cond
|
|
19810
|
+
# ^^^^
|
|
19811
|
+
# ```
|
|
19094
19812
|
#
|
|
19095
19813
|
# : () -> Prism::node
|
|
19096
19814
|
def predicate: () -> Prism::node
|
|
@@ -19101,8 +19819,10 @@ module Prism
|
|
|
19101
19819
|
#
|
|
19102
19820
|
# The Location of the `then` keyword, if present.
|
|
19103
19821
|
#
|
|
19104
|
-
#
|
|
19105
|
-
#
|
|
19822
|
+
# ```rb
|
|
19823
|
+
# unless cond then bar end
|
|
19824
|
+
# ^^^^
|
|
19825
|
+
# ```
|
|
19106
19826
|
#
|
|
19107
19827
|
# : () -> Location?
|
|
19108
19828
|
def then_keyword_loc: () -> Location?
|
|
@@ -19120,8 +19840,10 @@ module Prism
|
|
|
19120
19840
|
# The body of statements that will executed if the unless condition is
|
|
19121
19841
|
# falsey. Will be `nil` if no body is provided.
|
|
19122
19842
|
#
|
|
19123
|
-
#
|
|
19124
|
-
#
|
|
19843
|
+
# ```rb
|
|
19844
|
+
# unless cond then bar end
|
|
19845
|
+
# ^^^
|
|
19846
|
+
# ```
|
|
19125
19847
|
#
|
|
19126
19848
|
# : () -> StatementsNode?
|
|
19127
19849
|
def statements: () -> StatementsNode?
|
|
@@ -19131,8 +19853,10 @@ module Prism
|
|
|
19131
19853
|
#
|
|
19132
19854
|
# The else clause of the unless expression, if present.
|
|
19133
19855
|
#
|
|
19134
|
-
#
|
|
19135
|
-
#
|
|
19856
|
+
# ```rb
|
|
19857
|
+
# unless cond then bar else baz end
|
|
19858
|
+
# ^^^^^^^^^^^^
|
|
19859
|
+
# ```
|
|
19136
19860
|
#
|
|
19137
19861
|
# : () -> ElseNode?
|
|
19138
19862
|
def else_clause: () -> ElseNode?
|
|
@@ -19143,8 +19867,10 @@ module Prism
|
|
|
19143
19867
|
#
|
|
19144
19868
|
# The Location of the `end` keyword, if present.
|
|
19145
19869
|
#
|
|
19146
|
-
#
|
|
19147
|
-
#
|
|
19870
|
+
# ```rb
|
|
19871
|
+
# unless cond then bar end
|
|
19872
|
+
# ^^^
|
|
19873
|
+
# ```
|
|
19148
19874
|
#
|
|
19149
19875
|
# : () -> Location?
|
|
19150
19876
|
def end_keyword_loc: () -> Location?
|
|
@@ -19186,11 +19912,13 @@ module Prism
|
|
|
19186
19912
|
|
|
19187
19913
|
# Represents the use of the `until` keyword, either in the block form or the modifier form.
|
|
19188
19914
|
#
|
|
19189
|
-
#
|
|
19190
|
-
#
|
|
19915
|
+
# ```rb
|
|
19916
|
+
# bar until foo
|
|
19917
|
+
# ^^^^^^^^^^^^^
|
|
19191
19918
|
#
|
|
19192
|
-
#
|
|
19193
|
-
#
|
|
19919
|
+
# until foo do bar end
|
|
19920
|
+
# ^^^^^^^^^^^^^^^^^^^^
|
|
19921
|
+
# ```
|
|
19194
19922
|
class UntilNode < Node
|
|
19195
19923
|
@statements: StatementsNode?
|
|
19196
19924
|
|
|
@@ -19355,10 +20083,12 @@ module Prism
|
|
|
19355
20083
|
|
|
19356
20084
|
# Represents the use of the `when` keyword within a case statement.
|
|
19357
20085
|
#
|
|
19358
|
-
#
|
|
19359
|
-
#
|
|
19360
|
-
#
|
|
19361
|
-
#
|
|
20086
|
+
# ```rb
|
|
20087
|
+
# case true
|
|
20088
|
+
# when true
|
|
20089
|
+
# ^^^^^^^^^
|
|
20090
|
+
# end
|
|
20091
|
+
# ```
|
|
19362
20092
|
class WhenNode < Node
|
|
19363
20093
|
@statements: StatementsNode?
|
|
19364
20094
|
|
|
@@ -19491,11 +20221,13 @@ module Prism
|
|
|
19491
20221
|
|
|
19492
20222
|
# Represents the use of the `while` keyword, either in the block form or the modifier form.
|
|
19493
20223
|
#
|
|
19494
|
-
#
|
|
19495
|
-
#
|
|
20224
|
+
# ```rb
|
|
20225
|
+
# bar while foo
|
|
20226
|
+
# ^^^^^^^^^^^^^
|
|
19496
20227
|
#
|
|
19497
|
-
#
|
|
19498
|
-
#
|
|
20228
|
+
# while foo do bar end
|
|
20229
|
+
# ^^^^^^^^^^^^^^^^^^^^
|
|
20230
|
+
# ```
|
|
19499
20231
|
class WhileNode < Node
|
|
19500
20232
|
@statements: StatementsNode?
|
|
19501
20233
|
|
|
@@ -19660,8 +20392,10 @@ module Prism
|
|
|
19660
20392
|
|
|
19661
20393
|
# Represents an xstring literal with no interpolation.
|
|
19662
20394
|
#
|
|
19663
|
-
#
|
|
19664
|
-
#
|
|
20395
|
+
# ```rb
|
|
20396
|
+
# `foo`
|
|
20397
|
+
# ^^^^^
|
|
20398
|
+
# ```
|
|
19665
20399
|
class XStringNode < Node
|
|
19666
20400
|
@unescaped: String
|
|
19667
20401
|
|
|
@@ -19822,8 +20556,10 @@ module Prism
|
|
|
19822
20556
|
|
|
19823
20557
|
# Represents the use of the `yield` keyword.
|
|
19824
20558
|
#
|
|
19825
|
-
#
|
|
19826
|
-
#
|
|
20559
|
+
# ```rb
|
|
20560
|
+
# yield 1
|
|
20561
|
+
# ^^^^^^^
|
|
20562
|
+
# ```
|
|
19827
20563
|
class YieldNode < Node
|
|
19828
20564
|
@rparen_loc: Location?
|
|
19829
20565
|
|