prism 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/config.yml CHANGED
@@ -15,7 +15,6 @@ errors:
15
15
  - ARGUMENT_FORMAL_GLOBAL
16
16
  - ARGUMENT_FORMAL_IVAR
17
17
  - ARGUMENT_FORWARDING_UNBOUND
18
- - ARGUMENT_IN
19
18
  - ARGUMENT_NO_FORWARDING_AMPERSAND
20
19
  - ARGUMENT_NO_FORWARDING_ELLIPSES
21
20
  - ARGUMENT_NO_FORWARDING_STAR
@@ -99,6 +98,7 @@ errors:
99
98
  - EXPECT_EXPRESSION_AFTER_SPLAT
100
99
  - EXPECT_EXPRESSION_AFTER_SPLAT_HASH
101
100
  - EXPECT_EXPRESSION_AFTER_STAR
101
+ - EXPECT_FOR_DELIMITER
102
102
  - EXPECT_IDENT_REQ_PARAMETER
103
103
  - EXPECT_IN_DELIMITER
104
104
  - EXPECT_LPAREN_REQ_PARAMETER
@@ -107,6 +107,7 @@ errors:
107
107
  - EXPECT_RPAREN
108
108
  - EXPECT_RPAREN_AFTER_MULTI
109
109
  - EXPECT_RPAREN_REQ_PARAMETER
110
+ - EXPECT_SINGLETON_CLASS_DELIMITER
110
111
  - EXPECT_STRING_CONTENT
111
112
  - EXPECT_WHEN_DELIMITER
112
113
  - EXPRESSION_BARE_HASH
@@ -185,7 +186,9 @@ errors:
185
186
  - MODULE_TERM
186
187
  - MULTI_ASSIGN_MULTI_SPLATS
187
188
  - MULTI_ASSIGN_UNEXPECTED_REST
189
+ - NESTING_TOO_DEEP
188
190
  - NO_LOCAL_VARIABLE
191
+ - NON_ASSOCIATIVE_OPERATOR
189
192
  - NOT_EXPRESSION
190
193
  - NUMBER_LITERAL_UNDERSCORE
191
194
  - NUMBERED_PARAMETER_INNER_BLOCK
@@ -271,6 +274,7 @@ errors:
271
274
  - UNEXPECTED_BLOCK_ARGUMENT
272
275
  - UNEXPECTED_INDEX_BLOCK
273
276
  - UNEXPECTED_INDEX_KEYWORDS
277
+ - UNEXPECTED_LABEL
274
278
  - UNEXPECTED_MULTI_WRITE
275
279
  - UNEXPECTED_RANGE_OPERATOR
276
280
  - UNEXPECTED_SAFE_NAVIGATION
@@ -647,12 +651,16 @@ tokens:
647
651
  flags:
648
652
  - name: ArgumentsNodeFlags
649
653
  values:
654
+ - name: CONTAINS_FORWARDING
655
+ comment: "if the arguments contain forwarding"
650
656
  - name: CONTAINS_KEYWORDS
651
- comment: "if arguments contain keywords"
657
+ comment: "if the arguments contain keywords"
652
658
  - name: CONTAINS_KEYWORD_SPLAT
653
- comment: "if arguments contain keyword splat"
659
+ comment: "if the arguments contain a keyword splat"
654
660
  - name: CONTAINS_SPLAT
655
- comment: "if arguments contain splat"
661
+ comment: "if the arguments contain a splat"
662
+ - name: CONTAINS_MULTIPLE_SPLATS
663
+ comment: "if the arguments contain multiple splats"
656
664
  comment: Flags for arguments nodes.
657
665
  - name: ArrayNodeFlags
658
666
  values:
@@ -789,8 +797,8 @@ nodes:
789
797
  - GlobalVariableReadNode
790
798
  - BackReferenceReadNode
791
799
  - NumberedReferenceReadNode
792
- - SymbolNode # On parsing error of `alias $a b`
793
- - MissingNode # On parsing error of `alias $a 42`
800
+ - on error: SymbolNode # alias $a b
801
+ - on error: MissingNode # alias $a 42
794
802
  comment: |
795
803
  Represents the old name of the global variable that can be used before aliasing.
796
804
 
@@ -815,13 +823,35 @@ nodes:
815
823
  kind:
816
824
  - SymbolNode
817
825
  - InterpolatedSymbolNode
826
+ comment: |
827
+ Represents the new name of the method that will be aliased.
828
+
829
+ alias foo bar
830
+ ^^^
831
+
832
+ alias :foo :bar
833
+ ^^^^
834
+
835
+ alias :"#{foo}" :"#{bar}"
836
+ ^^^^^^^^^
818
837
  - name: old_name
819
838
  type: node
820
839
  kind:
821
840
  - SymbolNode
822
841
  - InterpolatedSymbolNode
823
- - GlobalVariableReadNode # On parsing error of `alias a $b`
824
- - MissingNode # On parsing error of `alias a 42`
842
+ - on error: GlobalVariableReadNode # alias a $b
843
+ - on error: MissingNode # alias a 42
844
+ comment: |
845
+ Represents the old name of the method that will be aliased.
846
+
847
+ alias foo bar
848
+ ^^^
849
+
850
+ alias :foo :bar
851
+ ^^^^
852
+
853
+ alias :"#{foo}" :"#{bar}"
854
+ ^^^^^^^^^
825
855
  - name: keyword_loc
826
856
  type: location
827
857
  comment: |
@@ -833,10 +863,27 @@ nodes:
833
863
  fields:
834
864
  - name: left
835
865
  type: node
866
+ kind: pattern expression
867
+ comment: |
868
+ Represents the left side of the expression.
869
+
870
+ foo => bar | baz
871
+ ^^^
836
872
  - name: right
837
873
  type: node
874
+ kind: pattern expression
875
+ comment: |
876
+ Represents the right side of the expression.
877
+
878
+ foo => bar | baz
879
+ ^^^
838
880
  - name: operator_loc
839
881
  type: location
882
+ comment: |
883
+ Represents the alternation operator location.
884
+
885
+ foo => bar | baz
886
+ ^
840
887
  comment: |
841
888
  Represents an alternation pattern in pattern matching.
842
889
 
@@ -846,6 +893,7 @@ nodes:
846
893
  fields:
847
894
  - name: left
848
895
  type: node
896
+ kind: non-void expression
849
897
  comment: |
850
898
  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).
851
899
 
@@ -856,8 +904,9 @@ nodes:
856
904
  ^
857
905
  - name: right
858
906
  type: node
907
+ kind: Node
859
908
  comment: |
860
- Represents the right 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).
909
+ Represents the right side of the expression.
861
910
 
862
911
  left && right
863
912
  ^^^^^
@@ -881,6 +930,7 @@ nodes:
881
930
  fields:
882
931
  - name: arguments
883
932
  type: node[]
933
+ kind: non-void expression
884
934
  comment: |
885
935
  Represents a set of arguments to a method or a keyword.
886
936
 
@@ -891,6 +941,7 @@ nodes:
891
941
  fields:
892
942
  - name: elements
893
943
  type: node[]
944
+ kind: non-void expression
894
945
  comment: Represent the list of zero or more [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression) within the array.
895
946
  - name: opening_loc
896
947
  type: location?
@@ -919,12 +970,18 @@ nodes:
919
970
  fields:
920
971
  - name: constant
921
972
  type: node?
973
+ kind:
974
+ - ConstantReadNode
975
+ - ConstantPathNode
922
976
  - name: requireds
923
977
  type: node[]
978
+ kind: pattern expression
924
979
  - name: rest
925
980
  type: node?
981
+ kind: pattern expression
926
982
  - name: posts
927
983
  type: node[]
984
+ kind: pattern expression
928
985
  - name: opening_loc
929
986
  type: location?
930
987
  - name: closing_loc
@@ -950,6 +1007,7 @@ nodes:
950
1007
  fields:
951
1008
  - name: key
952
1009
  type: node
1010
+ kind: non-void expression
953
1011
  comment: |
954
1012
  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).
955
1013
 
@@ -963,6 +1021,7 @@ nodes:
963
1021
  ^^^^^^^^^^
964
1022
  - name: value
965
1023
  type: node
1024
+ kind: non-void expression
966
1025
  comment: |
967
1026
  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).
968
1027
 
@@ -987,6 +1046,7 @@ nodes:
987
1046
  fields:
988
1047
  - name: value
989
1048
  type: node?
1049
+ kind: non-void expression
990
1050
  comment: |
991
1051
  The value to be splatted, if present. Will be missing when keyword rest argument forwarding is used.
992
1052
 
@@ -1049,6 +1109,7 @@ nodes:
1049
1109
  fields:
1050
1110
  - name: expression
1051
1111
  type: node?
1112
+ kind: non-void expression
1052
1113
  - name: operator_loc
1053
1114
  type: location
1054
1115
  comment: |
@@ -1153,6 +1214,7 @@ nodes:
1153
1214
  fields:
1154
1215
  - name: receiver
1155
1216
  type: node?
1217
+ kind: non-void expression
1156
1218
  - name: call_operator_loc
1157
1219
  type: location?
1158
1220
  - name: message_loc
@@ -1165,6 +1227,7 @@ nodes:
1165
1227
  type: location
1166
1228
  - name: value
1167
1229
  type: node
1230
+ kind: non-void expression
1168
1231
  comment: |
1169
1232
  Represents the use of the `&&=` operator on a call.
1170
1233
 
@@ -1175,6 +1238,7 @@ nodes:
1175
1238
  fields:
1176
1239
  - name: receiver
1177
1240
  type: node?
1241
+ kind: non-void expression
1178
1242
  comment: |
1179
1243
  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).
1180
1244
 
@@ -1201,6 +1265,9 @@ nodes:
1201
1265
  type: location?
1202
1266
  - name: block
1203
1267
  type: node?
1268
+ kind:
1269
+ - BlockNode
1270
+ - BlockArgumentNode
1204
1271
  comment: |
1205
1272
  Represents a method call, in all of the various forms that can take.
1206
1273
 
@@ -1226,6 +1293,7 @@ nodes:
1226
1293
  fields:
1227
1294
  - name: receiver
1228
1295
  type: node?
1296
+ kind: non-void expression
1229
1297
  - name: call_operator_loc
1230
1298
  type: location?
1231
1299
  - name: message_loc
@@ -1240,6 +1308,7 @@ nodes:
1240
1308
  type: location
1241
1309
  - name: value
1242
1310
  type: node
1311
+ kind: non-void expression
1243
1312
  comment: |
1244
1313
  Represents the use of an assignment operator on a call.
1245
1314
 
@@ -1250,6 +1319,7 @@ nodes:
1250
1319
  fields:
1251
1320
  - name: receiver
1252
1321
  type: node?
1322
+ kind: non-void expression
1253
1323
  - name: call_operator_loc
1254
1324
  type: location?
1255
1325
  - name: message_loc
@@ -1262,6 +1332,7 @@ nodes:
1262
1332
  type: location
1263
1333
  - name: value
1264
1334
  type: node
1335
+ kind: non-void expression
1265
1336
  comment: |
1266
1337
  Represents the use of the `||=` operator on a call.
1267
1338
 
@@ -1272,6 +1343,7 @@ nodes:
1272
1343
  fields:
1273
1344
  - name: receiver
1274
1345
  type: node
1346
+ kind: non-void expression
1275
1347
  - name: call_operator_loc
1276
1348
  type: location
1277
1349
  - name: name
@@ -1295,8 +1367,10 @@ nodes:
1295
1367
  fields:
1296
1368
  - name: value
1297
1369
  type: node
1370
+ kind: pattern expression
1298
1371
  - name: target
1299
1372
  type: node
1373
+ kind: LocalVariableTargetNode
1300
1374
  - name: operator_loc
1301
1375
  type: location
1302
1376
  comment: |
@@ -1308,8 +1382,10 @@ nodes:
1308
1382
  fields:
1309
1383
  - name: predicate
1310
1384
  type: node?
1385
+ kind: non-void expression
1311
1386
  - name: conditions
1312
1387
  type: node[]
1388
+ kind: InNode
1313
1389
  - name: else_clause
1314
1390
  type: node?
1315
1391
  kind: ElseNode
@@ -1328,8 +1404,10 @@ nodes:
1328
1404
  fields:
1329
1405
  - name: predicate
1330
1406
  type: node?
1407
+ kind: non-void expression
1331
1408
  - name: conditions
1332
1409
  type: node[]
1410
+ kind: WhenNode
1333
1411
  - name: else_clause
1334
1412
  type: node?
1335
1413
  kind: ElseNode
@@ -1352,12 +1430,20 @@ nodes:
1352
1430
  type: location
1353
1431
  - name: constant_path
1354
1432
  type: node
1433
+ kind:
1434
+ - ConstantReadNode
1435
+ - ConstantPathNode
1436
+ - on error: CallNode # class 0.X end
1355
1437
  - name: inheritance_operator_loc
1356
1438
  type: location?
1357
1439
  - name: superclass
1358
1440
  type: node?
1441
+ kind: non-void expression
1359
1442
  - name: body
1360
1443
  type: node?
1444
+ kind:
1445
+ - StatementsNode
1446
+ - BeginNode
1361
1447
  - name: end_keyword_loc
1362
1448
  type: location
1363
1449
  - name: name
@@ -1377,6 +1463,7 @@ nodes:
1377
1463
  type: location
1378
1464
  - name: value
1379
1465
  type: node
1466
+ kind: non-void expression
1380
1467
  comment: |
1381
1468
  Represents the use of the `&&=` operator for assignment to a class variable.
1382
1469
 
@@ -1392,6 +1479,7 @@ nodes:
1392
1479
  type: location
1393
1480
  - name: value
1394
1481
  type: node
1482
+ kind: non-void expression
1395
1483
  - name: binary_operator
1396
1484
  type: constant
1397
1485
  comment: |
@@ -1409,6 +1497,7 @@ nodes:
1409
1497
  type: location
1410
1498
  - name: value
1411
1499
  type: node
1500
+ kind: non-void expression
1412
1501
  comment: |
1413
1502
  Represents the use of the `||=` operator for assignment to a class variable.
1414
1503
 
@@ -1457,6 +1546,7 @@ nodes:
1457
1546
  ^^^^^
1458
1547
  - name: value
1459
1548
  type: node
1549
+ kind: non-void expression
1460
1550
  comment: |
1461
1551
  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).
1462
1552
 
@@ -1487,6 +1577,7 @@ nodes:
1487
1577
  type: location
1488
1578
  - name: value
1489
1579
  type: node
1580
+ kind: non-void expression
1490
1581
  comment: |
1491
1582
  Represents the use of the `&&=` operator for assignment to a constant.
1492
1583
 
@@ -1502,6 +1593,7 @@ nodes:
1502
1593
  type: location
1503
1594
  - name: value
1504
1595
  type: node
1596
+ kind: non-void expression
1505
1597
  - name: binary_operator
1506
1598
  type: constant
1507
1599
  comment: |
@@ -1519,6 +1611,7 @@ nodes:
1519
1611
  type: location
1520
1612
  - name: value
1521
1613
  type: node
1614
+ kind: non-void expression
1522
1615
  comment: |
1523
1616
  Represents the use of the `||=` operator for assignment to a constant.
1524
1617
 
@@ -1533,6 +1626,7 @@ nodes:
1533
1626
  type: location
1534
1627
  - name: value
1535
1628
  type: node
1629
+ kind: non-void expression
1536
1630
  comment: |
1537
1631
  Represents the use of the `&&=` operator for assignment to a constant path.
1538
1632
 
@@ -1542,6 +1636,7 @@ nodes:
1542
1636
  fields:
1543
1637
  - name: parent
1544
1638
  type: node?
1639
+ kind: non-void expression
1545
1640
  comment: |
1546
1641
  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.
1547
1642
 
@@ -1590,6 +1685,7 @@ nodes:
1590
1685
  type: location
1591
1686
  - name: value
1592
1687
  type: node
1688
+ kind: non-void expression
1593
1689
  - name: binary_operator
1594
1690
  type: constant
1595
1691
  comment: |
@@ -1606,6 +1702,7 @@ nodes:
1606
1702
  type: location
1607
1703
  - name: value
1608
1704
  type: node
1705
+ kind: non-void expression
1609
1706
  comment: |
1610
1707
  Represents the use of the `||=` operator for assignment to a constant path.
1611
1708
 
@@ -1615,6 +1712,7 @@ nodes:
1615
1712
  fields:
1616
1713
  - name: parent
1617
1714
  type: node?
1715
+ kind: non-void expression
1618
1716
  - name: name
1619
1717
  type: constant?
1620
1718
  - name: delimiter_loc
@@ -1648,6 +1746,7 @@ nodes:
1648
1746
  ^
1649
1747
  - name: value
1650
1748
  type: node
1749
+ kind: non-void expression
1651
1750
  comment: |
1652
1751
  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).
1653
1752
 
@@ -1707,6 +1806,7 @@ nodes:
1707
1806
  ^^^
1708
1807
  - name: value
1709
1808
  type: node
1809
+ kind: non-void expression
1710
1810
  comment: |
1711
1811
  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).
1712
1812
 
@@ -1735,11 +1835,15 @@ nodes:
1735
1835
  type: location
1736
1836
  - name: receiver
1737
1837
  type: node?
1838
+ kind: non-void expression
1738
1839
  - name: parameters
1739
1840
  type: node?
1740
1841
  kind: ParametersNode
1741
1842
  - name: body
1742
1843
  type: node?
1844
+ kind:
1845
+ - StatementsNode
1846
+ - BeginNode
1743
1847
  - name: locals
1744
1848
  type: constant[]
1745
1849
  - name: def_keyword_loc
@@ -1766,6 +1870,7 @@ nodes:
1766
1870
  type: location?
1767
1871
  - name: value
1768
1872
  type: node
1873
+ kind: Node # More than non-void expression as defined?(return) is allowed, yet defined?(BEGIN{}) is SyntaxError
1769
1874
  - name: rparen_loc
1770
1875
  type: location?
1771
1876
  - name: keyword_loc
@@ -1809,6 +1914,12 @@ nodes:
1809
1914
  type: location
1810
1915
  - name: variable
1811
1916
  type: node
1917
+ kind:
1918
+ - InstanceVariableReadNode
1919
+ - ClassVariableReadNode
1920
+ - GlobalVariableReadNode
1921
+ - BackReferenceReadNode
1922
+ - NumberedReferenceReadNode
1812
1923
  comment: |
1813
1924
  Represents an interpolated variable.
1814
1925
 
@@ -1842,12 +1953,20 @@ nodes:
1842
1953
  fields:
1843
1954
  - name: constant
1844
1955
  type: node?
1956
+ kind:
1957
+ - ConstantReadNode
1958
+ - ConstantPathNode
1845
1959
  - name: left
1846
1960
  type: node
1961
+ kind: SplatNode
1847
1962
  - name: requireds
1848
1963
  type: node[]
1964
+ kind: pattern expression
1849
1965
  - name: right
1850
1966
  type: node
1967
+ kind:
1968
+ - SplatNode
1969
+ - on error: MissingNode
1851
1970
  - name: opening_loc
1852
1971
  type: location?
1853
1972
  - name: closing_loc
@@ -1868,8 +1987,10 @@ nodes:
1868
1987
  fields:
1869
1988
  - name: left
1870
1989
  type: node?
1990
+ kind: non-void expression
1871
1991
  - name: right
1872
1992
  type: node?
1993
+ kind: non-void expression
1873
1994
  - name: operator_loc
1874
1995
  type: location
1875
1996
  comment: |
@@ -1891,6 +2012,19 @@ nodes:
1891
2012
  fields:
1892
2013
  - name: index
1893
2014
  type: node
2015
+ kind:
2016
+ - LocalVariableTargetNode
2017
+ - InstanceVariableTargetNode
2018
+ - ClassVariableTargetNode
2019
+ - GlobalVariableTargetNode
2020
+ - ConstantTargetNode
2021
+ - ConstantPathTargetNode
2022
+ - CallTargetNode
2023
+ - IndexTargetNode
2024
+ - MultiTargetNode
2025
+ - on error: BackReferenceReadNode # for $& in a end
2026
+ - on error: NumberedReferenceReadNode # for $1 in a end
2027
+ - on error: MissingNode # for in 1..10; end
1894
2028
  comment: |
1895
2029
  The index expression for `for` loops.
1896
2030
 
@@ -1898,6 +2032,7 @@ nodes:
1898
2032
  ^
1899
2033
  - name: collection
1900
2034
  type: node
2035
+ kind: non-void expression
1901
2036
  comment: |
1902
2037
  The collection to iterate over.
1903
2038
 
@@ -1981,6 +2116,7 @@ nodes:
1981
2116
  type: location
1982
2117
  - name: value
1983
2118
  type: node
2119
+ kind: non-void expression
1984
2120
  comment: |
1985
2121
  Represents the use of the `&&=` operator for assignment to a global variable.
1986
2122
 
@@ -1996,6 +2132,7 @@ nodes:
1996
2132
  type: location
1997
2133
  - name: value
1998
2134
  type: node
2135
+ kind: non-void expression
1999
2136
  - name: binary_operator
2000
2137
  type: constant
2001
2138
  comment: |
@@ -2013,6 +2150,7 @@ nodes:
2013
2150
  type: location
2014
2151
  - name: value
2015
2152
  type: node
2153
+ kind: non-void expression
2016
2154
  comment: |
2017
2155
  Represents the use of the `||=` operator for assignment to a global variable.
2018
2156
 
@@ -2061,6 +2199,7 @@ nodes:
2061
2199
  ^^^^
2062
2200
  - name: value
2063
2201
  type: node
2202
+ kind: non-void expression
2064
2203
  comment: |
2065
2204
  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).
2066
2205
 
@@ -2119,6 +2258,9 @@ nodes:
2119
2258
  fields:
2120
2259
  - name: constant
2121
2260
  type: node?
2261
+ kind:
2262
+ - ConstantReadNode
2263
+ - ConstantPathNode
2122
2264
  - name: elements
2123
2265
  type: node[]
2124
2266
  kind: AssocNode
@@ -2152,6 +2294,7 @@ nodes:
2152
2294
  The `if_keyword_loc` field will be `nil` when the `IfNode` represents a ternary expression.
2153
2295
  - name: predicate
2154
2296
  type: node
2297
+ kind: non-void expression
2155
2298
  comment: |
2156
2299
  The node for the condition the `IfNode` is testing.
2157
2300
 
@@ -2244,6 +2387,11 @@ nodes:
2244
2387
  fields:
2245
2388
  - name: value
2246
2389
  type: node
2390
+ kind:
2391
+ - LocalVariableReadNode
2392
+ - CallNode
2393
+ - ConstantReadNode
2394
+ - LocalVariableTargetNode
2247
2395
  comment: |
2248
2396
  Represents a node that is implicitly being added to the tree but doesn't correspond directly to a node in the source.
2249
2397
 
@@ -2274,6 +2422,7 @@ nodes:
2274
2422
  fields:
2275
2423
  - name: pattern
2276
2424
  type: node
2425
+ kind: pattern expression
2277
2426
  - name: statements
2278
2427
  type: node?
2279
2428
  kind: StatementsNode
@@ -2291,6 +2440,7 @@ nodes:
2291
2440
  fields:
2292
2441
  - name: receiver
2293
2442
  type: node?
2443
+ kind: non-void expression
2294
2444
  - name: call_operator_loc
2295
2445
  type: location?
2296
2446
  - name: opening_loc
@@ -2302,10 +2452,12 @@ nodes:
2302
2452
  type: location
2303
2453
  - name: block
2304
2454
  type: node?
2455
+ kind: BlockArgumentNode # foo[&b] &&= value, only valid on Ruby < 3.4
2305
2456
  - name: operator_loc
2306
2457
  type: location
2307
2458
  - name: value
2308
2459
  type: node
2460
+ kind: non-void expression
2309
2461
  comment: |
2310
2462
  Represents the use of the `&&=` operator on a call to the `[]` method.
2311
2463
 
@@ -2316,6 +2468,7 @@ nodes:
2316
2468
  fields:
2317
2469
  - name: receiver
2318
2470
  type: node?
2471
+ kind: non-void expression
2319
2472
  - name: call_operator_loc
2320
2473
  type: location?
2321
2474
  - name: opening_loc
@@ -2327,12 +2480,14 @@ nodes:
2327
2480
  type: location
2328
2481
  - name: block
2329
2482
  type: node?
2483
+ kind: BlockArgumentNode # foo[&b] += value, only valid on Ruby < 3.4
2330
2484
  - name: binary_operator
2331
2485
  type: constant
2332
2486
  - name: binary_operator_loc
2333
2487
  type: location
2334
2488
  - name: value
2335
2489
  type: node
2490
+ kind: non-void expression
2336
2491
  comment: |
2337
2492
  Represents the use of an assignment operator on a call to `[]`.
2338
2493
 
@@ -2343,6 +2498,7 @@ nodes:
2343
2498
  fields:
2344
2499
  - name: receiver
2345
2500
  type: node?
2501
+ kind: non-void expression
2346
2502
  - name: call_operator_loc
2347
2503
  type: location?
2348
2504
  - name: opening_loc
@@ -2354,10 +2510,12 @@ nodes:
2354
2510
  type: location
2355
2511
  - name: block
2356
2512
  type: node?
2513
+ kind: BlockArgumentNode # foo[&b] ||= value, only valid on Ruby < 3.4
2357
2514
  - name: operator_loc
2358
2515
  type: location
2359
2516
  - name: value
2360
2517
  type: node
2518
+ kind: non-void expression
2361
2519
  comment: |
2362
2520
  Represents the use of the `||=` operator on a call to `[]`.
2363
2521
 
@@ -2368,6 +2526,7 @@ nodes:
2368
2526
  fields:
2369
2527
  - name: receiver
2370
2528
  type: node
2529
+ kind: non-void expression
2371
2530
  - name: opening_loc
2372
2531
  type: location
2373
2532
  - name: arguments
@@ -2377,6 +2536,7 @@ nodes:
2377
2536
  type: location
2378
2537
  - name: block
2379
2538
  type: node?
2539
+ kind: BlockArgumentNode # foo[&b], = 1, only valid on Ruby < 3.4
2380
2540
  comment: |
2381
2541
  Represents assigning to an index.
2382
2542
 
@@ -2400,6 +2560,7 @@ nodes:
2400
2560
  type: location
2401
2561
  - name: value
2402
2562
  type: node
2563
+ kind: non-void expression
2403
2564
  comment: |
2404
2565
  Represents the use of the `&&=` operator for assignment to an instance variable.
2405
2566
 
@@ -2415,6 +2576,7 @@ nodes:
2415
2576
  type: location
2416
2577
  - name: value
2417
2578
  type: node
2579
+ kind: non-void expression
2418
2580
  - name: binary_operator
2419
2581
  type: constant
2420
2582
  comment: |
@@ -2432,6 +2594,7 @@ nodes:
2432
2594
  type: location
2433
2595
  - name: value
2434
2596
  type: node
2597
+ kind: non-void expression
2435
2598
  comment: |
2436
2599
  Represents the use of the `||=` operator for assignment to an instance variable.
2437
2600
 
@@ -2480,6 +2643,7 @@ nodes:
2480
2643
  ^^^
2481
2644
  - name: value
2482
2645
  type: node
2646
+ kind: non-void expression
2483
2647
  comment: |
2484
2648
  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).
2485
2649
 
@@ -2657,8 +2821,15 @@ nodes:
2657
2821
  type: location
2658
2822
  - name: parameters
2659
2823
  type: node?
2824
+ kind:
2825
+ - BlockParametersNode
2826
+ - NumberedParametersNode
2827
+ - ItParametersNode
2660
2828
  - name: body
2661
2829
  type: node?
2830
+ kind:
2831
+ - StatementsNode
2832
+ - BeginNode
2662
2833
  comment: |
2663
2834
  Represents using a lambda literal (not the lambda method call).
2664
2835
 
@@ -2672,6 +2843,7 @@ nodes:
2672
2843
  type: location
2673
2844
  - name: value
2674
2845
  type: node
2846
+ kind: non-void expression
2675
2847
  - name: name
2676
2848
  type: constant
2677
2849
  - name: depth
@@ -2689,6 +2861,7 @@ nodes:
2689
2861
  type: location
2690
2862
  - name: value
2691
2863
  type: node
2864
+ kind: non-void expression
2692
2865
  - name: name
2693
2866
  type: constant
2694
2867
  - name: binary_operator
@@ -2708,6 +2881,7 @@ nodes:
2708
2881
  type: location
2709
2882
  - name: value
2710
2883
  type: node
2884
+ kind: non-void expression
2711
2885
  - name: name
2712
2886
  type: constant
2713
2887
  - name: depth
@@ -2787,6 +2961,7 @@ nodes:
2787
2961
  ^^^
2788
2962
  - name: value
2789
2963
  type: node
2964
+ kind: non-void expression
2790
2965
  comment: |
2791
2966
  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).
2792
2967
 
@@ -2831,8 +3006,10 @@ nodes:
2831
3006
  fields:
2832
3007
  - name: value
2833
3008
  type: node
3009
+ kind: non-void expression
2834
3010
  - name: pattern
2835
3011
  type: node
3012
+ kind: pattern expression
2836
3013
  - name: operator_loc
2837
3014
  type: location
2838
3015
  comment: |
@@ -2844,8 +3021,10 @@ nodes:
2844
3021
  fields:
2845
3022
  - name: value
2846
3023
  type: node
3024
+ kind: non-void expression
2847
3025
  - name: pattern
2848
3026
  type: node
3027
+ kind: pattern expression
2849
3028
  - name: operator_loc
2850
3029
  type: location
2851
3030
  comment: |
@@ -2877,8 +3056,15 @@ nodes:
2877
3056
  type: location
2878
3057
  - name: constant_path
2879
3058
  type: node
3059
+ kind:
3060
+ - ConstantReadNode
3061
+ - ConstantPathNode
3062
+ - on error: MissingNode # module Parent module end
2880
3063
  - name: body
2881
3064
  type: node?
3065
+ kind:
3066
+ - StatementsNode
3067
+ - BeginNode
2882
3068
  - name: end_keyword_loc
2883
3069
  type: location
2884
3070
  - name: name
@@ -2902,9 +3088,9 @@ nodes:
2902
3088
  - CallTargetNode
2903
3089
  - IndexTargetNode
2904
3090
  - MultiTargetNode
2905
- - RequiredParameterNode
2906
- - BackReferenceReadNode # On parsing error of `$',`
2907
- - NumberedReferenceReadNode # On parsing error of `$1,`
3091
+ - RequiredParameterNode # def m((a,b)); end
3092
+ - on error: BackReferenceReadNode # a, (b, $&) = z
3093
+ - on error: NumberedReferenceReadNode # a, (b, $1) = z
2908
3094
  comment: |
2909
3095
  Represents the targets expressions before a splat node.
2910
3096
 
@@ -2931,7 +3117,7 @@ nodes:
2931
3117
  a, (b, *) = 1, 2, 3, 4
2932
3118
  ^
2933
3119
 
2934
- If the `*` is omitted, the field will containt an `ImplicitRestNode`
3120
+ If the `*` is omitted, this field will contain an `ImplicitRestNode`
2935
3121
 
2936
3122
  a, (b,) = 1, 2, 3, 4
2937
3123
  ^
@@ -2947,8 +3133,9 @@ nodes:
2947
3133
  - CallTargetNode
2948
3134
  - IndexTargetNode
2949
3135
  - MultiTargetNode
2950
- - RequiredParameterNode
2951
- - BackReferenceReadNode # On parsing error of `*,$'`
3136
+ - RequiredParameterNode # def m((*,b)); end
3137
+ - on error: BackReferenceReadNode # a, (*, $&) = z
3138
+ - on error: NumberedReferenceReadNode # a, (*, $1) = z
2952
3139
  comment: |
2953
3140
  Represents the targets expressions after a splat node.
2954
3141
 
@@ -2992,6 +3179,8 @@ nodes:
2992
3179
  - CallTargetNode
2993
3180
  - IndexTargetNode
2994
3181
  - MultiTargetNode
3182
+ - on error: BackReferenceReadNode # $&, = z
3183
+ - on error: NumberedReferenceReadNode # $1, = z
2995
3184
  comment: |
2996
3185
  Represents the targets expressions before a splat node.
2997
3186
 
@@ -3018,7 +3207,7 @@ nodes:
3018
3207
  a, b, * = 1, 2, 3, 4
3019
3208
  ^
3020
3209
 
3021
- If the `*` is omitted, the field will containt an `ImplicitRestNode`
3210
+ If the `*` is omitted, this field will contain an `ImplicitRestNode`
3022
3211
 
3023
3212
  a, b, = 1, 2, 3, 4
3024
3213
  ^
@@ -3034,6 +3223,8 @@ nodes:
3034
3223
  - CallTargetNode
3035
3224
  - IndexTargetNode
3036
3225
  - MultiTargetNode
3226
+ - on error: BackReferenceReadNode # *, $& = z
3227
+ - on error: NumberedReferenceReadNode # *, $1 = z
3037
3228
  comment: |
3038
3229
  Represents the targets expressions after a splat node.
3039
3230
 
@@ -3062,6 +3253,7 @@ nodes:
3062
3253
  ^
3063
3254
  - name: value
3064
3255
  type: node
3256
+ kind: non-void expression
3065
3257
  comment: |
3066
3258
  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).
3067
3259
 
@@ -3137,6 +3329,7 @@ nodes:
3137
3329
  type: location
3138
3330
  - name: value
3139
3331
  type: node
3332
+ kind: non-void expression
3140
3333
  comment: |
3141
3334
  Represents an optional keyword parameter to a method, block, or lambda definition.
3142
3335
 
@@ -3154,6 +3347,7 @@ nodes:
3154
3347
  type: location
3155
3348
  - name: value
3156
3349
  type: node
3350
+ kind: non-void expression
3157
3351
  comment: |
3158
3352
  Represents an optional parameter to a method, block, or lambda definition.
3159
3353
 
@@ -3164,6 +3358,7 @@ nodes:
3164
3358
  fields:
3165
3359
  - name: left
3166
3360
  type: node
3361
+ kind: non-void expression
3167
3362
  comment: |
3168
3363
  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).
3169
3364
 
@@ -3174,8 +3369,9 @@ nodes:
3174
3369
  ^
3175
3370
  - name: right
3176
3371
  type: node
3372
+ kind: Node
3177
3373
  comment: |
3178
- Represents the right 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).
3374
+ Represents the right side of the expression.
3179
3375
 
3180
3376
  left || right
3181
3377
  ^^^^^
@@ -3215,10 +3411,10 @@ nodes:
3215
3411
  - RequiredParameterNode
3216
3412
  - MultiTargetNode
3217
3413
  # On parsing error of `f(**kwargs, ...)` or `f(**nil, ...)`, the keyword_rest value is moved here:
3218
- - KeywordRestParameterNode
3219
- - NoKeywordsParameterNode
3414
+ - on error: KeywordRestParameterNode
3415
+ - on error: NoKeywordsParameterNode
3220
3416
  # On parsing error of `f(..., ...)`, the first forwarding parameter is moved here:
3221
- - ForwardingParameterNode
3417
+ - on error: ForwardingParameterNode
3222
3418
  - name: keywords
3223
3419
  type: node[]
3224
3420
  kind:
@@ -3243,6 +3439,7 @@ nodes:
3243
3439
  fields:
3244
3440
  - name: body
3245
3441
  type: node?
3442
+ kind: non-void expression # Usually a StatementsNode but not always e.g. `1 in (..10)`
3246
3443
  - name: opening_loc
3247
3444
  type: location
3248
3445
  - name: closing_loc
@@ -3257,6 +3454,7 @@ nodes:
3257
3454
  fields:
3258
3455
  - name: expression
3259
3456
  type: node
3457
+ kind: non-void expression
3260
3458
  - name: operator_loc
3261
3459
  type: location
3262
3460
  - name: lparen_loc
@@ -3272,6 +3470,15 @@ nodes:
3272
3470
  fields:
3273
3471
  - name: variable
3274
3472
  type: node
3473
+ kind:
3474
+ - LocalVariableReadNode
3475
+ - InstanceVariableReadNode
3476
+ - ClassVariableReadNode
3477
+ - GlobalVariableReadNode # foo in ^$a
3478
+ - BackReferenceReadNode # foo in ^$&
3479
+ - NumberedReferenceReadNode # foo in ^$1
3480
+ - ItLocalVariableReadNode # proc { 1 in ^it }
3481
+ - on error: MissingNode # foo in ^Bar
3275
3482
  - name: operator_loc
3276
3483
  type: location
3277
3484
  comment: |
@@ -3324,6 +3531,7 @@ nodes:
3324
3531
  fields:
3325
3532
  - name: left
3326
3533
  type: node?
3534
+ kind: non-void expression
3327
3535
  comment: |
3328
3536
  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).
3329
3537
 
@@ -3334,6 +3542,7 @@ nodes:
3334
3542
  ^^^^^
3335
3543
  - name: right
3336
3544
  type: node?
3545
+ kind: non-void expression
3337
3546
  comment: |
3338
3547
  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).
3339
3548
 
@@ -3425,10 +3634,12 @@ nodes:
3425
3634
  fields:
3426
3635
  - name: expression
3427
3636
  type: node
3637
+ kind: Node
3428
3638
  - name: keyword_loc
3429
3639
  type: location
3430
3640
  - name: rescue_expression
3431
3641
  type: node
3642
+ kind: Node
3432
3643
  newline: expression
3433
3644
  comment: |
3434
3645
  Represents an expression modified with a rescue.
@@ -3441,10 +3652,23 @@ nodes:
3441
3652
  type: location
3442
3653
  - name: exceptions
3443
3654
  type: node[]
3655
+ kind: non-void expression
3444
3656
  - name: operator_loc
3445
3657
  type: location?
3446
3658
  - name: reference
3447
3659
  type: node?
3660
+ kind:
3661
+ - LocalVariableTargetNode
3662
+ - InstanceVariableTargetNode
3663
+ - ClassVariableTargetNode
3664
+ - GlobalVariableTargetNode
3665
+ - ConstantTargetNode
3666
+ - ConstantPathTargetNode
3667
+ - CallTargetNode
3668
+ - IndexTargetNode
3669
+ - on error: BackReferenceReadNode # => begin; rescue => $&; end
3670
+ - on error: NumberedReferenceReadNode # => begin; rescue => $1; end
3671
+ - on error: MissingNode # begin; rescue =>; end
3448
3672
  - name: statements
3449
3673
  type: node?
3450
3674
  kind: StatementsNode
@@ -3531,8 +3755,12 @@ nodes:
3531
3755
  type: location
3532
3756
  - name: expression
3533
3757
  type: node
3758
+ kind: non-void expression
3534
3759
  - name: body
3535
3760
  type: node?
3761
+ kind:
3762
+ - StatementsNode
3763
+ - BeginNode
3536
3764
  - name: end_keyword_loc
3537
3765
  type: location
3538
3766
  comment: |
@@ -3569,6 +3797,7 @@ nodes:
3569
3797
  type: location
3570
3798
  - name: expression
3571
3799
  type: node?
3800
+ kind: non-void expression
3572
3801
  comment: |
3573
3802
  Represents the use of the splat operator.
3574
3803
 
@@ -3578,6 +3807,7 @@ nodes:
3578
3807
  fields:
3579
3808
  - name: body
3580
3809
  type: node[]
3810
+ kind: Node
3581
3811
  comment: |
3582
3812
  Represents a set of statements contained within some scope.
3583
3813
 
@@ -3618,6 +3848,9 @@ nodes:
3618
3848
  type: location?
3619
3849
  - name: block
3620
3850
  type: node?
3851
+ kind:
3852
+ - BlockNode
3853
+ - BlockArgumentNode
3621
3854
  comment: |
3622
3855
  Represents the use of the `super` keyword with parentheses or arguments.
3623
3856
 
@@ -3679,6 +3912,7 @@ nodes:
3679
3912
  ^^^^^^
3680
3913
  - name: predicate
3681
3914
  type: node
3915
+ kind: non-void expression
3682
3916
  comment: |
3683
3917
  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).
3684
3918
 
@@ -3736,6 +3970,7 @@ nodes:
3736
3970
  type: location?
3737
3971
  - name: predicate
3738
3972
  type: node
3973
+ kind: non-void expression
3739
3974
  - name: statements
3740
3975
  type: node?
3741
3976
  kind: StatementsNode
@@ -3754,6 +3989,7 @@ nodes:
3754
3989
  type: location
3755
3990
  - name: conditions
3756
3991
  type: node[]
3992
+ kind: non-void expression
3757
3993
  - name: then_keyword_loc
3758
3994
  type: location?
3759
3995
  - name: statements
@@ -3775,6 +4011,7 @@ nodes:
3775
4011
  type: location?
3776
4012
  - name: predicate
3777
4013
  type: node
4014
+ kind: non-void expression
3778
4015
  - name: statements
3779
4016
  type: node?
3780
4017
  kind: StatementsNode