prism 0.30.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -1
  3. data/README.md +3 -1
  4. data/config.yml +185 -126
  5. data/docs/serialization.md +3 -0
  6. data/ext/prism/api_node.c +2843 -2085
  7. data/ext/prism/extconf.rb +1 -1
  8. data/ext/prism/extension.c +35 -25
  9. data/ext/prism/extension.h +2 -2
  10. data/include/prism/ast.h +1048 -69
  11. data/include/prism/defines.h +9 -0
  12. data/include/prism/diagnostic.h +11 -3
  13. data/include/prism/options.h +55 -1
  14. data/include/prism/parser.h +27 -3
  15. data/include/prism/regexp.h +2 -1
  16. data/include/prism/util/pm_integer.h +6 -6
  17. data/include/prism/util/pm_newline_list.h +11 -0
  18. data/include/prism/util/pm_string.h +1 -0
  19. data/include/prism/version.h +3 -3
  20. data/lib/prism/desugar_compiler.rb +111 -74
  21. data/lib/prism/dispatcher.rb +2 -1
  22. data/lib/prism/dot_visitor.rb +21 -31
  23. data/lib/prism/dsl.rb +656 -471
  24. data/lib/prism/ffi.rb +3 -0
  25. data/lib/prism/inspect_visitor.rb +285 -57
  26. data/lib/prism/mutation_compiler.rb +5 -5
  27. data/lib/prism/node.rb +2282 -4754
  28. data/lib/prism/node_ext.rb +72 -11
  29. data/lib/prism/parse_result/errors.rb +65 -0
  30. data/lib/prism/parse_result/newlines.rb +28 -28
  31. data/lib/prism/parse_result.rb +25 -2
  32. data/lib/prism/reflection.rb +7 -7
  33. data/lib/prism/serialize.rb +468 -610
  34. data/lib/prism/translation/parser/compiler.rb +18 -18
  35. data/lib/prism/translation/parser/lexer.rb +1 -1
  36. data/lib/prism/translation/parser.rb +3 -3
  37. data/lib/prism/translation/ripper.rb +14 -14
  38. data/lib/prism/translation/ruby_parser.rb +43 -7
  39. data/prism.gemspec +3 -1
  40. data/rbi/prism/dsl.rbi +521 -0
  41. data/rbi/prism/node.rbi +1456 -5616
  42. data/rbi/prism.rbi +16 -16
  43. data/sig/prism/dsl.rbs +189 -305
  44. data/sig/prism/node.rbs +702 -603
  45. data/sig/prism/parse_result.rbs +2 -0
  46. data/src/diagnostic.c +22 -6
  47. data/src/node.c +277 -284
  48. data/src/options.c +18 -0
  49. data/src/prettyprint.c +99 -108
  50. data/src/prism.c +1282 -760
  51. data/src/regexp.c +72 -4
  52. data/src/serialize.c +165 -50
  53. data/src/token_type.c +2 -2
  54. data/src/util/pm_integer.c +14 -14
  55. data/src/util/pm_newline_list.c +29 -0
  56. data/src/util/pm_string.c +9 -5
  57. metadata +4 -2
data/include/prism/ast.h CHANGED
@@ -1,10 +1,10 @@
1
- /******************************************************************************/
1
+ /*----------------------------------------------------------------------------*/
2
2
  /* This file is generated by the templates/template.rb script and should not */
3
3
  /* be modified manually. See */
4
4
  /* templates/include/prism/ast.h.erb */
5
5
  /* if you are looking to modify the */
6
6
  /* template */
7
- /******************************************************************************/
7
+ /*----------------------------------------------------------------------------*/
8
8
 
9
9
  /**
10
10
  * @file ast.h
@@ -1043,11 +1043,8 @@ typedef uint16_t pm_node_flags_t;
1043
1043
  * We store the flags enum in every node in the tree. Some flags are common to
1044
1044
  * all nodes (the ones listed below). Others are specific to certain node types.
1045
1045
  */
1046
- #define PM_NODE_FLAG_BITS (sizeof(pm_node_flags_t) * 8)
1047
-
1048
- static const pm_node_flags_t PM_NODE_FLAG_NEWLINE = (1 << (PM_NODE_FLAG_BITS - 1));
1049
- static const pm_node_flags_t PM_NODE_FLAG_STATIC_LITERAL = (1 << (PM_NODE_FLAG_BITS - 2));
1050
- static const pm_node_flags_t PM_NODE_FLAG_COMMON_MASK = (1 << (PM_NODE_FLAG_BITS - 1)) | (1 << (PM_NODE_FLAG_BITS - 2));
1046
+ static const pm_node_flags_t PM_NODE_FLAG_NEWLINE = 0x1;
1047
+ static const pm_node_flags_t PM_NODE_FLAG_STATIC_LITERAL = 0x2;
1051
1048
 
1052
1049
  /**
1053
1050
  * Cast the type to an enum to allow the compiler to provide exhaustiveness
@@ -1082,6 +1079,12 @@ typedef struct pm_node {
1082
1079
  */
1083
1080
  pm_node_flags_t flags;
1084
1081
 
1082
+ /**
1083
+ * The unique identifier for this node, which is deterministic based on the
1084
+ * source. It is used to identify unique nodes across parses.
1085
+ */
1086
+ uint32_t node_id;
1087
+
1085
1088
  /**
1086
1089
  * This is the location of the node in the source. It's a range of bytes
1087
1090
  * containing a start and an end.
@@ -1092,6 +1095,11 @@ typedef struct pm_node {
1092
1095
  /**
1093
1096
  * AliasGlobalVariableNode
1094
1097
  *
1098
+ * Represents the use of the `alias` keyword to alias a global variable.
1099
+ *
1100
+ * alias $foo $bar
1101
+ * ^^^^^^^^^^^^^^^
1102
+ *
1095
1103
  * Type: PM_ALIAS_GLOBAL_VARIABLE_NODE
1096
1104
  *
1097
1105
  * @extends pm_node_t
@@ -1103,7 +1111,7 @@ typedef struct pm_alias_global_variable_node {
1103
1111
  /**
1104
1112
  * AliasGlobalVariableNode#new_name
1105
1113
  *
1106
- * Represents the new name of the global variable that can be used after aliasing. This can be either a global variable, a back reference, or a numbered reference.
1114
+ * Represents the new name of the global variable that can be used after aliasing.
1107
1115
  *
1108
1116
  * alias $foo $bar
1109
1117
  * ^^^^
@@ -1113,7 +1121,7 @@ typedef struct pm_alias_global_variable_node {
1113
1121
  /**
1114
1122
  * AliasGlobalVariableNode#old_name
1115
1123
  *
1116
- * Represents the old name of the global variable that could be used before aliasing. This can be either a global variable, a back reference, or a numbered reference.
1124
+ * Represents the old name of the global variable that can be used before aliasing.
1117
1125
  *
1118
1126
  * alias $foo $bar
1119
1127
  * ^^^^
@@ -1134,6 +1142,11 @@ typedef struct pm_alias_global_variable_node {
1134
1142
  /**
1135
1143
  * AliasMethodNode
1136
1144
  *
1145
+ * Represents the use of the `alias` keyword to alias a method.
1146
+ *
1147
+ * alias foo bar
1148
+ * ^^^^^^^^^^^^^
1149
+ *
1137
1150
  * Type: PM_ALIAS_METHOD_NODE
1138
1151
  *
1139
1152
  * @extends pm_node_t
@@ -1161,6 +1174,11 @@ typedef struct pm_alias_method_node {
1161
1174
  /**
1162
1175
  * AlternationPatternNode
1163
1176
  *
1177
+ * Represents an alternation pattern in pattern matching.
1178
+ *
1179
+ * foo => bar | baz
1180
+ * ^^^^^^^^^
1181
+ *
1164
1182
  * Type: PM_ALTERNATION_PATTERN_NODE
1165
1183
  *
1166
1184
  * @extends pm_node_t
@@ -1188,6 +1206,11 @@ typedef struct pm_alternation_pattern_node {
1188
1206
  /**
1189
1207
  * AndNode
1190
1208
  *
1209
+ * Represents the use of the `&&` operator or the `and` keyword.
1210
+ *
1211
+ * left and right
1212
+ * ^^^^^^^^^^^^^^
1213
+ *
1191
1214
  * Type: PM_AND_NODE
1192
1215
  *
1193
1216
  * @extends pm_node_t
@@ -1236,10 +1259,16 @@ typedef struct pm_and_node {
1236
1259
  /**
1237
1260
  * ArgumentsNode
1238
1261
  *
1262
+ * Represents a set of arguments to a method or a keyword.
1263
+ *
1264
+ * return foo, bar, baz
1265
+ * ^^^^^^^^^^^^^
1266
+ *
1239
1267
  * Type: PM_ARGUMENTS_NODE
1240
1268
  * Flags:
1241
1269
  * PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS
1242
1270
  * PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT
1271
+ * PM_ARGUMENTS_NODE_FLAGS_CONTAINS_SPLAT
1243
1272
  *
1244
1273
  * @extends pm_node_t
1245
1274
  */
@@ -1256,6 +1285,11 @@ typedef struct pm_arguments_node {
1256
1285
  /**
1257
1286
  * ArrayNode
1258
1287
  *
1288
+ * Represents an array literal. This can be a regular array using brackets or a special array using % like %w or %i.
1289
+ *
1290
+ * [1, 2, 3]
1291
+ * ^^^^^^^^^
1292
+ *
1259
1293
  * Type: PM_ARRAY_NODE
1260
1294
  * Flags:
1261
1295
  * PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT
@@ -1301,6 +1335,23 @@ typedef struct pm_array_node {
1301
1335
  /**
1302
1336
  * ArrayPatternNode
1303
1337
  *
1338
+ * Represents an array pattern in pattern matching.
1339
+ *
1340
+ * foo in 1, 2
1341
+ * ^^^^^^^^^^^
1342
+ *
1343
+ * foo in [1, 2]
1344
+ * ^^^^^^^^^^^^^
1345
+ *
1346
+ * foo in *1
1347
+ * ^^^^^^^^^
1348
+ *
1349
+ * foo in Bar[]
1350
+ * ^^^^^^^^^^^^
1351
+ *
1352
+ * foo in Bar[1, 2, 3]
1353
+ * ^^^^^^^^^^^^^^^^^^^
1354
+ *
1304
1355
  * Type: PM_ARRAY_PATTERN_NODE
1305
1356
  *
1306
1357
  * @extends pm_node_t
@@ -1343,6 +1394,11 @@ typedef struct pm_array_pattern_node {
1343
1394
  /**
1344
1395
  * AssocNode
1345
1396
  *
1397
+ * Represents a hash key/value pair.
1398
+ *
1399
+ * { a => b }
1400
+ * ^^^^^^
1401
+ *
1346
1402
  * Type: PM_ASSOC_NODE
1347
1403
  *
1348
1404
  * @extends pm_node_t
@@ -1394,6 +1450,11 @@ typedef struct pm_assoc_node {
1394
1450
  /**
1395
1451
  * AssocSplatNode
1396
1452
  *
1453
+ * Represents a splat in a hash literal.
1454
+ *
1455
+ * { **foo }
1456
+ * ^^^^^
1457
+ *
1397
1458
  * Type: PM_ASSOC_SPLAT_NODE
1398
1459
  *
1399
1460
  * @extends pm_node_t
@@ -1426,6 +1487,11 @@ typedef struct pm_assoc_splat_node {
1426
1487
  /**
1427
1488
  * BackReferenceReadNode
1428
1489
  *
1490
+ * Represents reading a reference to a field in the previous match.
1491
+ *
1492
+ * $'
1493
+ * ^^
1494
+ *
1429
1495
  * Type: PM_BACK_REFERENCE_READ_NODE
1430
1496
  *
1431
1497
  * @extends pm_node_t
@@ -1449,6 +1515,13 @@ typedef struct pm_back_reference_read_node {
1449
1515
  /**
1450
1516
  * BeginNode
1451
1517
  *
1518
+ * Represents a begin statement.
1519
+ *
1520
+ * begin
1521
+ * foo
1522
+ * end
1523
+ * ^^^^^
1524
+ *
1452
1525
  * Type: PM_BEGIN_NODE
1453
1526
  *
1454
1527
  * @extends pm_node_t
@@ -1491,6 +1564,11 @@ typedef struct pm_begin_node {
1491
1564
  /**
1492
1565
  * BlockArgumentNode
1493
1566
  *
1567
+ * Represents a block argument using `&`.
1568
+ *
1569
+ * bar(&args)
1570
+ * ^^^^^^^^^^
1571
+ *
1494
1572
  * Type: PM_BLOCK_ARGUMENT_NODE
1495
1573
  *
1496
1574
  * @extends pm_node_t
@@ -1513,6 +1591,11 @@ typedef struct pm_block_argument_node {
1513
1591
  /**
1514
1592
  * BlockLocalVariableNode
1515
1593
  *
1594
+ * Represents a block local variable.
1595
+ *
1596
+ * a { |; b| }
1597
+ * ^
1598
+ *
1516
1599
  * Type: PM_BLOCK_LOCAL_VARIABLE_NODE
1517
1600
  * Flags:
1518
1601
  * PM_PARAMETER_FLAGS_REPEATED_PARAMETER
@@ -1532,6 +1615,11 @@ typedef struct pm_block_local_variable_node {
1532
1615
  /**
1533
1616
  * BlockNode
1534
1617
  *
1618
+ * Represents a block of ruby code.
1619
+ *
1620
+ * [1, 2, 3].each { |i| puts x }
1621
+ * ^^^^^^^^^^^^^^
1622
+ *
1535
1623
  * Type: PM_BLOCK_NODE
1536
1624
  *
1537
1625
  * @extends pm_node_t
@@ -1569,6 +1657,12 @@ typedef struct pm_block_node {
1569
1657
  /**
1570
1658
  * BlockParameterNode
1571
1659
  *
1660
+ * Represents a block parameter of a method, block, or lambda definition.
1661
+ *
1662
+ * def a(&b)
1663
+ * ^^
1664
+ * end
1665
+ *
1572
1666
  * Type: PM_BLOCK_PARAMETER_NODE
1573
1667
  * Flags:
1574
1668
  * PM_PARAMETER_FLAGS_REPEATED_PARAMETER
@@ -1598,6 +1692,15 @@ typedef struct pm_block_parameter_node {
1598
1692
  /**
1599
1693
  * BlockParametersNode
1600
1694
  *
1695
+ * Represents a block's parameters declaration.
1696
+ *
1697
+ * -> (a, b = 1; local) { }
1698
+ * ^^^^^^^^^^^^^^^^^
1699
+ *
1700
+ * foo do |a, b = 1; local|
1701
+ * ^^^^^^^^^^^^^^^^^
1702
+ * end
1703
+ *
1601
1704
  * Type: PM_BLOCK_PARAMETERS_NODE
1602
1705
  *
1603
1706
  * @extends pm_node_t
@@ -1630,6 +1733,11 @@ typedef struct pm_block_parameters_node {
1630
1733
  /**
1631
1734
  * BreakNode
1632
1735
  *
1736
+ * Represents the use of the `break` keyword.
1737
+ *
1738
+ * break foo
1739
+ * ^^^^^^^^^
1740
+ *
1633
1741
  * Type: PM_BREAK_NODE
1634
1742
  *
1635
1743
  * @extends pm_node_t
@@ -1662,6 +1770,11 @@ typedef struct pm_break_node {
1662
1770
  /**
1663
1771
  * CallAndWriteNode
1664
1772
  *
1773
+ * Represents the use of the `&&=` operator on a call.
1774
+ *
1775
+ * foo.bar &&= value
1776
+ * ^^^^^^^^^^^^^^^^^
1777
+ *
1665
1778
  * Type: PM_CALL_AND_WRITE_NODE
1666
1779
  * Flags:
1667
1780
  * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
@@ -1714,6 +1827,26 @@ typedef struct pm_call_and_write_node {
1714
1827
  /**
1715
1828
  * CallNode
1716
1829
  *
1830
+ * Represents a method call, in all of the various forms that can take.
1831
+ *
1832
+ * foo
1833
+ * ^^^
1834
+ *
1835
+ * foo()
1836
+ * ^^^^^
1837
+ *
1838
+ * +foo
1839
+ * ^^^^
1840
+ *
1841
+ * foo + bar
1842
+ * ^^^^^^^^^
1843
+ *
1844
+ * foo.bar
1845
+ * ^^^^^^^
1846
+ *
1847
+ * foo&.bar
1848
+ * ^^^^^^^^
1849
+ *
1717
1850
  * Type: PM_CALL_NODE
1718
1851
  * Flags:
1719
1852
  * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
@@ -1782,6 +1915,11 @@ typedef struct pm_call_node {
1782
1915
  /**
1783
1916
  * CallOperatorWriteNode
1784
1917
  *
1918
+ * Represents the use of an assignment operator on a call.
1919
+ *
1920
+ * foo.bar += baz
1921
+ * ^^^^^^^^^^^^^^
1922
+ *
1785
1923
  * Type: PM_CALL_OPERATOR_WRITE_NODE
1786
1924
  * Flags:
1787
1925
  * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
@@ -1839,6 +1977,11 @@ typedef struct pm_call_operator_write_node {
1839
1977
  /**
1840
1978
  * CallOrWriteNode
1841
1979
  *
1980
+ * Represents the use of the `||=` operator on a call.
1981
+ *
1982
+ * foo.bar ||= value
1983
+ * ^^^^^^^^^^^^^^^^^
1984
+ *
1842
1985
  * Type: PM_CALL_OR_WRITE_NODE
1843
1986
  * Flags:
1844
1987
  * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
@@ -1891,6 +2034,19 @@ typedef struct pm_call_or_write_node {
1891
2034
  /**
1892
2035
  * CallTargetNode
1893
2036
  *
2037
+ * Represents assigning to a method call.
2038
+ *
2039
+ * foo.bar, = 1
2040
+ * ^^^^^^^
2041
+ *
2042
+ * begin
2043
+ * rescue => foo.bar
2044
+ * ^^^^^^^
2045
+ * end
2046
+ *
2047
+ * for foo.bar in baz do end
2048
+ * ^^^^^^^
2049
+ *
1894
2050
  * Type: PM_CALL_TARGET_NODE
1895
2051
  * Flags:
1896
2052
  * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
@@ -1928,6 +2084,11 @@ typedef struct pm_call_target_node {
1928
2084
  /**
1929
2085
  * CapturePatternNode
1930
2086
  *
2087
+ * Represents assigning to a local variable in pattern matching.
2088
+ *
2089
+ * foo => [bar => baz]
2090
+ * ^^^^^^^^^^^^
2091
+ *
1931
2092
  * Type: PM_CAPTURE_PATTERN_NODE
1932
2093
  *
1933
2094
  * @extends pm_node_t
@@ -1955,6 +2116,13 @@ typedef struct pm_capture_pattern_node {
1955
2116
  /**
1956
2117
  * CaseMatchNode
1957
2118
  *
2119
+ * Represents the use of a case statement for pattern matching.
2120
+ *
2121
+ * case true
2122
+ * in false
2123
+ * end
2124
+ * ^^^^^^^^^
2125
+ *
1958
2126
  * Type: PM_CASE_MATCH_NODE
1959
2127
  *
1960
2128
  * @extends pm_node_t
@@ -1974,9 +2142,9 @@ typedef struct pm_case_match_node {
1974
2142
  struct pm_node_list conditions;
1975
2143
 
1976
2144
  /**
1977
- * CaseMatchNode#consequent
2145
+ * CaseMatchNode#else_clause
1978
2146
  */
1979
- struct pm_else_node *consequent;
2147
+ struct pm_else_node *else_clause;
1980
2148
 
1981
2149
  /**
1982
2150
  * CaseMatchNode#case_keyword_loc
@@ -1992,6 +2160,13 @@ typedef struct pm_case_match_node {
1992
2160
  /**
1993
2161
  * CaseNode
1994
2162
  *
2163
+ * Represents the use of a case statement.
2164
+ *
2165
+ * case true
2166
+ * when false
2167
+ * end
2168
+ * ^^^^^^^^^^
2169
+ *
1995
2170
  * Type: PM_CASE_NODE
1996
2171
  *
1997
2172
  * @extends pm_node_t
@@ -2011,9 +2186,9 @@ typedef struct pm_case_node {
2011
2186
  struct pm_node_list conditions;
2012
2187
 
2013
2188
  /**
2014
- * CaseNode#consequent
2189
+ * CaseNode#else_clause
2015
2190
  */
2016
- struct pm_else_node *consequent;
2191
+ struct pm_else_node *else_clause;
2017
2192
 
2018
2193
  /**
2019
2194
  * CaseNode#case_keyword_loc
@@ -2029,6 +2204,11 @@ typedef struct pm_case_node {
2029
2204
  /**
2030
2205
  * ClassNode
2031
2206
  *
2207
+ * Represents a class declaration involving the `class` keyword.
2208
+ *
2209
+ * class Foo end
2210
+ * ^^^^^^^^^^^^^
2211
+ *
2032
2212
  * Type: PM_CLASS_NODE
2033
2213
  *
2034
2214
  * @extends pm_node_t
@@ -2081,6 +2261,11 @@ typedef struct pm_class_node {
2081
2261
  /**
2082
2262
  * ClassVariableAndWriteNode
2083
2263
  *
2264
+ * Represents the use of the `&&=` operator for assignment to a class variable.
2265
+ *
2266
+ * @@target &&= value
2267
+ * ^^^^^^^^^^^^^^^^^^
2268
+ *
2084
2269
  * Type: PM_CLASS_VARIABLE_AND_WRITE_NODE
2085
2270
  *
2086
2271
  * @extends pm_node_t
@@ -2113,6 +2298,11 @@ typedef struct pm_class_variable_and_write_node {
2113
2298
  /**
2114
2299
  * ClassVariableOperatorWriteNode
2115
2300
  *
2301
+ * Represents assigning to a class variable using an operator that isn't `=`.
2302
+ *
2303
+ * @@target += value
2304
+ * ^^^^^^^^^^^^^^^^^
2305
+ *
2116
2306
  * Type: PM_CLASS_VARIABLE_OPERATOR_WRITE_NODE
2117
2307
  *
2118
2308
  * @extends pm_node_t
@@ -2150,6 +2340,11 @@ typedef struct pm_class_variable_operator_write_node {
2150
2340
  /**
2151
2341
  * ClassVariableOrWriteNode
2152
2342
  *
2343
+ * Represents the use of the `||=` operator for assignment to a class variable.
2344
+ *
2345
+ * @@target ||= value
2346
+ * ^^^^^^^^^^^^^^^^^^
2347
+ *
2153
2348
  * Type: PM_CLASS_VARIABLE_OR_WRITE_NODE
2154
2349
  *
2155
2350
  * @extends pm_node_t
@@ -2182,6 +2377,11 @@ typedef struct pm_class_variable_or_write_node {
2182
2377
  /**
2183
2378
  * ClassVariableReadNode
2184
2379
  *
2380
+ * Represents referencing a class variable.
2381
+ *
2382
+ * @@foo
2383
+ * ^^^^^
2384
+ *
2185
2385
  * Type: PM_CLASS_VARIABLE_READ_NODE
2186
2386
  *
2187
2387
  * @extends pm_node_t
@@ -2205,6 +2405,11 @@ typedef struct pm_class_variable_read_node {
2205
2405
  /**
2206
2406
  * ClassVariableTargetNode
2207
2407
  *
2408
+ * Represents writing to a class variable in a context that doesn't have an explicit value.
2409
+ *
2410
+ * @@foo, @@bar = baz
2411
+ * ^^^^^ ^^^^^
2412
+ *
2208
2413
  * Type: PM_CLASS_VARIABLE_TARGET_NODE
2209
2414
  *
2210
2415
  * @extends pm_node_t
@@ -2222,6 +2427,11 @@ typedef struct pm_class_variable_target_node {
2222
2427
  /**
2223
2428
  * ClassVariableWriteNode
2224
2429
  *
2430
+ * Represents writing to a class variable.
2431
+ *
2432
+ * @@foo = 1
2433
+ * ^^^^^^^^^
2434
+ *
2225
2435
  * Type: PM_CLASS_VARIABLE_WRITE_NODE
2226
2436
  *
2227
2437
  * @extends pm_node_t
@@ -2278,6 +2488,11 @@ typedef struct pm_class_variable_write_node {
2278
2488
  /**
2279
2489
  * ConstantAndWriteNode
2280
2490
  *
2491
+ * Represents the use of the `&&=` operator for assignment to a constant.
2492
+ *
2493
+ * Target &&= value
2494
+ * ^^^^^^^^^^^^^^^^
2495
+ *
2281
2496
  * Type: PM_CONSTANT_AND_WRITE_NODE
2282
2497
  *
2283
2498
  * @extends pm_node_t
@@ -2310,6 +2525,11 @@ typedef struct pm_constant_and_write_node {
2310
2525
  /**
2311
2526
  * ConstantOperatorWriteNode
2312
2527
  *
2528
+ * Represents assigning to a constant using an operator that isn't `=`.
2529
+ *
2530
+ * Target += value
2531
+ * ^^^^^^^^^^^^^^^
2532
+ *
2313
2533
  * Type: PM_CONSTANT_OPERATOR_WRITE_NODE
2314
2534
  *
2315
2535
  * @extends pm_node_t
@@ -2347,6 +2567,11 @@ typedef struct pm_constant_operator_write_node {
2347
2567
  /**
2348
2568
  * ConstantOrWriteNode
2349
2569
  *
2570
+ * Represents the use of the `||=` operator for assignment to a constant.
2571
+ *
2572
+ * Target ||= value
2573
+ * ^^^^^^^^^^^^^^^^
2574
+ *
2350
2575
  * Type: PM_CONSTANT_OR_WRITE_NODE
2351
2576
  *
2352
2577
  * @extends pm_node_t
@@ -2379,6 +2604,11 @@ typedef struct pm_constant_or_write_node {
2379
2604
  /**
2380
2605
  * ConstantPathAndWriteNode
2381
2606
  *
2607
+ * Represents the use of the `&&=` operator for assignment to a constant path.
2608
+ *
2609
+ * Parent::Child &&= value
2610
+ * ^^^^^^^^^^^^^^^^^^^^^^^
2611
+ *
2382
2612
  * Type: PM_CONSTANT_PATH_AND_WRITE_NODE
2383
2613
  *
2384
2614
  * @extends pm_node_t
@@ -2406,6 +2636,11 @@ typedef struct pm_constant_path_and_write_node {
2406
2636
  /**
2407
2637
  * ConstantPathNode
2408
2638
  *
2639
+ * Represents accessing a constant through a path of `::` operators.
2640
+ *
2641
+ * Foo::Bar
2642
+ * ^^^^^^^^
2643
+ *
2409
2644
  * Type: PM_CONSTANT_PATH_NODE
2410
2645
  *
2411
2646
  * @extends pm_node_t
@@ -2467,6 +2702,11 @@ typedef struct pm_constant_path_node {
2467
2702
  /**
2468
2703
  * ConstantPathOperatorWriteNode
2469
2704
  *
2705
+ * Represents assigning to a constant path using an operator that isn't `=`.
2706
+ *
2707
+ * Parent::Child += value
2708
+ * ^^^^^^^^^^^^^^^^^^^^^^
2709
+ *
2470
2710
  * Type: PM_CONSTANT_PATH_OPERATOR_WRITE_NODE
2471
2711
  *
2472
2712
  * @extends pm_node_t
@@ -2499,6 +2739,11 @@ typedef struct pm_constant_path_operator_write_node {
2499
2739
  /**
2500
2740
  * ConstantPathOrWriteNode
2501
2741
  *
2742
+ * Represents the use of the `||=` operator for assignment to a constant path.
2743
+ *
2744
+ * Parent::Child ||= value
2745
+ * ^^^^^^^^^^^^^^^^^^^^^^^
2746
+ *
2502
2747
  * Type: PM_CONSTANT_PATH_OR_WRITE_NODE
2503
2748
  *
2504
2749
  * @extends pm_node_t
@@ -2526,6 +2771,11 @@ typedef struct pm_constant_path_or_write_node {
2526
2771
  /**
2527
2772
  * ConstantPathTargetNode
2528
2773
  *
2774
+ * Represents writing to a constant path in a context that doesn't have an explicit value.
2775
+ *
2776
+ * Foo::Foo, Bar::Bar = baz
2777
+ * ^^^^^^^^ ^^^^^^^^
2778
+ *
2529
2779
  * Type: PM_CONSTANT_PATH_TARGET_NODE
2530
2780
  *
2531
2781
  * @extends pm_node_t
@@ -2558,6 +2808,17 @@ typedef struct pm_constant_path_target_node {
2558
2808
  /**
2559
2809
  * ConstantPathWriteNode
2560
2810
  *
2811
+ * Represents writing to a constant path.
2812
+ *
2813
+ * ::Foo = 1
2814
+ * ^^^^^^^^^
2815
+ *
2816
+ * Foo::Bar = 1
2817
+ * ^^^^^^^^^^^^
2818
+ *
2819
+ * ::Foo::Bar = 1
2820
+ * ^^^^^^^^^^^^^^
2821
+ *
2561
2822
  * Type: PM_CONSTANT_PATH_WRITE_NODE
2562
2823
  *
2563
2824
  * @extends pm_node_t
@@ -2603,6 +2864,11 @@ typedef struct pm_constant_path_write_node {
2603
2864
  /**
2604
2865
  * ConstantReadNode
2605
2866
  *
2867
+ * Represents referencing a constant.
2868
+ *
2869
+ * Foo
2870
+ * ^^^
2871
+ *
2606
2872
  * Type: PM_CONSTANT_READ_NODE
2607
2873
  *
2608
2874
  * @extends pm_node_t
@@ -2626,6 +2892,11 @@ typedef struct pm_constant_read_node {
2626
2892
  /**
2627
2893
  * ConstantTargetNode
2628
2894
  *
2895
+ * Represents writing to a constant in a context that doesn't have an explicit value.
2896
+ *
2897
+ * Foo, Bar = baz
2898
+ * ^^^ ^^^
2899
+ *
2629
2900
  * Type: PM_CONSTANT_TARGET_NODE
2630
2901
  *
2631
2902
  * @extends pm_node_t
@@ -2643,6 +2914,11 @@ typedef struct pm_constant_target_node {
2643
2914
  /**
2644
2915
  * ConstantWriteNode
2645
2916
  *
2917
+ * Represents writing to a constant.
2918
+ *
2919
+ * Foo = 1
2920
+ * ^^^^^^^
2921
+ *
2646
2922
  * Type: PM_CONSTANT_WRITE_NODE
2647
2923
  *
2648
2924
  * @extends pm_node_t
@@ -2699,6 +2975,12 @@ typedef struct pm_constant_write_node {
2699
2975
  /**
2700
2976
  * DefNode
2701
2977
  *
2978
+ * Represents a method definition.
2979
+ *
2980
+ * def method
2981
+ * end
2982
+ * ^^^^^^^^^^
2983
+ *
2702
2984
  * Type: PM_DEF_NODE
2703
2985
  *
2704
2986
  * @extends pm_node_t
@@ -2771,6 +3053,11 @@ typedef struct pm_def_node {
2771
3053
  /**
2772
3054
  * DefinedNode
2773
3055
  *
3056
+ * Represents the use of the `defined?` keyword.
3057
+ *
3058
+ * defined?(a)
3059
+ * ^^^^^^^^^^^
3060
+ *
2774
3061
  * Type: PM_DEFINED_NODE
2775
3062
  *
2776
3063
  * @extends pm_node_t
@@ -2803,6 +3090,11 @@ typedef struct pm_defined_node {
2803
3090
  /**
2804
3091
  * ElseNode
2805
3092
  *
3093
+ * Represents an `else` clause in a `case`, `if`, or `unless` statement.
3094
+ *
3095
+ * if a then b else c end
3096
+ * ^^^^^^^^^^
3097
+ *
2806
3098
  * Type: PM_ELSE_NODE
2807
3099
  *
2808
3100
  * @extends pm_node_t
@@ -2830,6 +3122,11 @@ typedef struct pm_else_node {
2830
3122
  /**
2831
3123
  * EmbeddedStatementsNode
2832
3124
  *
3125
+ * Represents an interpolated set of statements.
3126
+ *
3127
+ * "foo #{bar}"
3128
+ * ^^^^^^
3129
+ *
2833
3130
  * Type: PM_EMBEDDED_STATEMENTS_NODE
2834
3131
  *
2835
3132
  * @extends pm_node_t
@@ -2857,6 +3154,11 @@ typedef struct pm_embedded_statements_node {
2857
3154
  /**
2858
3155
  * EmbeddedVariableNode
2859
3156
  *
3157
+ * Represents an interpolated variable.
3158
+ *
3159
+ * "foo #@bar"
3160
+ * ^^^^^
3161
+ *
2860
3162
  * Type: PM_EMBEDDED_VARIABLE_NODE
2861
3163
  *
2862
3164
  * @extends pm_node_t
@@ -2879,6 +3181,15 @@ typedef struct pm_embedded_variable_node {
2879
3181
  /**
2880
3182
  * EnsureNode
2881
3183
  *
3184
+ * Represents an `ensure` clause in a `begin` statement.
3185
+ *
3186
+ * begin
3187
+ * foo
3188
+ * ensure
3189
+ * ^^^^^^
3190
+ * bar
3191
+ * end
3192
+ *
2882
3193
  * Type: PM_ENSURE_NODE
2883
3194
  *
2884
3195
  * @extends pm_node_t
@@ -2906,6 +3217,11 @@ typedef struct pm_ensure_node {
2906
3217
  /**
2907
3218
  * FalseNode
2908
3219
  *
3220
+ * Represents the use of the literal `false` keyword.
3221
+ *
3222
+ * false
3223
+ * ^^^^^
3224
+ *
2909
3225
  * Type: PM_FALSE_NODE
2910
3226
  *
2911
3227
  * @extends pm_node_t
@@ -2918,6 +3234,17 @@ typedef struct pm_false_node {
2918
3234
  /**
2919
3235
  * FindPatternNode
2920
3236
  *
3237
+ * Represents a find pattern in pattern matching.
3238
+ *
3239
+ * foo in *bar, baz, *qux
3240
+ * ^^^^^^^^^^^^^^^
3241
+ *
3242
+ * foo in [*bar, baz, *qux]
3243
+ * ^^^^^^^^^^^^^^^^^
3244
+ *
3245
+ * foo in Foo(*bar, baz, *qux)
3246
+ * ^^^^^^^^^^^^^^^^^^^^
3247
+ *
2921
3248
  * Type: PM_FIND_PATTERN_NODE
2922
3249
  *
2923
3250
  * @extends pm_node_t
@@ -2960,6 +3287,11 @@ typedef struct pm_find_pattern_node {
2960
3287
  /**
2961
3288
  * FlipFlopNode
2962
3289
  *
3290
+ * Represents the use of the `..` or `...` operators to create flip flops.
3291
+ *
3292
+ * baz if foo .. bar
3293
+ * ^^^^^^^^^^
3294
+ *
2963
3295
  * Type: PM_FLIP_FLOP_NODE
2964
3296
  * Flags:
2965
3297
  * PM_RANGE_FLAGS_EXCLUDE_END
@@ -2989,6 +3321,11 @@ typedef struct pm_flip_flop_node {
2989
3321
  /**
2990
3322
  * FloatNode
2991
3323
  *
3324
+ * Represents a floating point number literal.
3325
+ *
3326
+ * 1.0
3327
+ * ^^^
3328
+ *
2992
3329
  * Type: PM_FLOAT_NODE
2993
3330
  *
2994
3331
  * @extends pm_node_t
@@ -3008,6 +3345,11 @@ typedef struct pm_float_node {
3008
3345
  /**
3009
3346
  * ForNode
3010
3347
  *
3348
+ * Represents the use of the `for` keyword.
3349
+ *
3350
+ * for i in a end
3351
+ * ^^^^^^^^^^^^^^
3352
+ *
3011
3353
  * Type: PM_FOR_NODE
3012
3354
  *
3013
3355
  * @extends pm_node_t
@@ -3092,6 +3434,13 @@ typedef struct pm_for_node {
3092
3434
  /**
3093
3435
  * ForwardingArgumentsNode
3094
3436
  *
3437
+ * Represents forwarding all arguments to this method to another method.
3438
+ *
3439
+ * def foo(...)
3440
+ * bar(...)
3441
+ * ^^^
3442
+ * end
3443
+ *
3095
3444
  * Type: PM_FORWARDING_ARGUMENTS_NODE
3096
3445
  *
3097
3446
  * @extends pm_node_t
@@ -3104,6 +3453,12 @@ typedef struct pm_forwarding_arguments_node {
3104
3453
  /**
3105
3454
  * ForwardingParameterNode
3106
3455
  *
3456
+ * Represents the use of the forwarding parameter in a method, block, or lambda declaration.
3457
+ *
3458
+ * def foo(...)
3459
+ * ^^^
3460
+ * end
3461
+ *
3107
3462
  * Type: PM_FORWARDING_PARAMETER_NODE
3108
3463
  *
3109
3464
  * @extends pm_node_t
@@ -3116,6 +3471,11 @@ typedef struct pm_forwarding_parameter_node {
3116
3471
  /**
3117
3472
  * ForwardingSuperNode
3118
3473
  *
3474
+ * Represents the use of the `super` keyword without parentheses or arguments.
3475
+ *
3476
+ * super
3477
+ * ^^^^^
3478
+ *
3119
3479
  * Type: PM_FORWARDING_SUPER_NODE
3120
3480
  *
3121
3481
  * @extends pm_node_t
@@ -3133,6 +3493,11 @@ typedef struct pm_forwarding_super_node {
3133
3493
  /**
3134
3494
  * GlobalVariableAndWriteNode
3135
3495
  *
3496
+ * Represents the use of the `&&=` operator for assignment to a global variable.
3497
+ *
3498
+ * $target &&= value
3499
+ * ^^^^^^^^^^^^^^^^^
3500
+ *
3136
3501
  * Type: PM_GLOBAL_VARIABLE_AND_WRITE_NODE
3137
3502
  *
3138
3503
  * @extends pm_node_t
@@ -3165,6 +3530,11 @@ typedef struct pm_global_variable_and_write_node {
3165
3530
  /**
3166
3531
  * GlobalVariableOperatorWriteNode
3167
3532
  *
3533
+ * Represents assigning to a global variable using an operator that isn't `=`.
3534
+ *
3535
+ * $target += value
3536
+ * ^^^^^^^^^^^^^^^^
3537
+ *
3168
3538
  * Type: PM_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE
3169
3539
  *
3170
3540
  * @extends pm_node_t
@@ -3202,6 +3572,11 @@ typedef struct pm_global_variable_operator_write_node {
3202
3572
  /**
3203
3573
  * GlobalVariableOrWriteNode
3204
3574
  *
3575
+ * Represents the use of the `||=` operator for assignment to a global variable.
3576
+ *
3577
+ * $target ||= value
3578
+ * ^^^^^^^^^^^^^^^^^
3579
+ *
3205
3580
  * Type: PM_GLOBAL_VARIABLE_OR_WRITE_NODE
3206
3581
  *
3207
3582
  * @extends pm_node_t
@@ -3234,6 +3609,11 @@ typedef struct pm_global_variable_or_write_node {
3234
3609
  /**
3235
3610
  * GlobalVariableReadNode
3236
3611
  *
3612
+ * Represents referencing a global variable.
3613
+ *
3614
+ * $foo
3615
+ * ^^^^
3616
+ *
3237
3617
  * Type: PM_GLOBAL_VARIABLE_READ_NODE
3238
3618
  *
3239
3619
  * @extends pm_node_t
@@ -3257,6 +3637,11 @@ typedef struct pm_global_variable_read_node {
3257
3637
  /**
3258
3638
  * GlobalVariableTargetNode
3259
3639
  *
3640
+ * Represents writing to a global variable in a context that doesn't have an explicit value.
3641
+ *
3642
+ * $foo, $bar = baz
3643
+ * ^^^^ ^^^^
3644
+ *
3260
3645
  * Type: PM_GLOBAL_VARIABLE_TARGET_NODE
3261
3646
  *
3262
3647
  * @extends pm_node_t
@@ -3274,6 +3659,11 @@ typedef struct pm_global_variable_target_node {
3274
3659
  /**
3275
3660
  * GlobalVariableWriteNode
3276
3661
  *
3662
+ * Represents writing to a global variable.
3663
+ *
3664
+ * $foo = 1
3665
+ * ^^^^^^^^
3666
+ *
3277
3667
  * Type: PM_GLOBAL_VARIABLE_WRITE_NODE
3278
3668
  *
3279
3669
  * @extends pm_node_t
@@ -3330,6 +3720,11 @@ typedef struct pm_global_variable_write_node {
3330
3720
  /**
3331
3721
  * HashNode
3332
3722
  *
3723
+ * Represents a hash literal.
3724
+ *
3725
+ * { a => b }
3726
+ * ^^^^^^^^^^
3727
+ *
3333
3728
  * Type: PM_HASH_NODE
3334
3729
  *
3335
3730
  * @extends pm_node_t
@@ -3375,6 +3770,14 @@ typedef struct pm_hash_node {
3375
3770
  /**
3376
3771
  * HashPatternNode
3377
3772
  *
3773
+ * Represents a hash pattern in pattern matching.
3774
+ *
3775
+ * foo => { a: 1, b: 2 }
3776
+ * ^^^^^^^^^^^^^^
3777
+ *
3778
+ * foo => { a: 1, b: 2, **c }
3779
+ * ^^^^^^^^^^^^^^^^^^^
3780
+ *
3378
3781
  * Type: PM_HASH_PATTERN_NODE
3379
3782
  *
3380
3783
  * @extends pm_node_t
@@ -3412,6 +3815,17 @@ typedef struct pm_hash_pattern_node {
3412
3815
  /**
3413
3816
  * IfNode
3414
3817
  *
3818
+ * Represents the use of the `if` keyword, either in the block form or the modifier form, or a ternary expression.
3819
+ *
3820
+ * bar if foo
3821
+ * ^^^^^^^^^^
3822
+ *
3823
+ * if foo then bar end
3824
+ * ^^^^^^^^^^^^^^^^^^^
3825
+ *
3826
+ * foo ? bar : baz
3827
+ * ^^^^^^^^^^^^^^^
3828
+ *
3415
3829
  * Type: PM_IF_NODE
3416
3830
  *
3417
3831
  * @extends pm_node_t
@@ -3478,7 +3892,7 @@ typedef struct pm_if_node {
3478
3892
  struct pm_statements_node *statements;
3479
3893
 
3480
3894
  /**
3481
- * IfNode#consequent
3895
+ * IfNode#subsequent
3482
3896
  *
3483
3897
  * Represents an `ElseNode` or an `IfNode` when there is an `else` or an `elsif` in the `if` statement.
3484
3898
  *
@@ -3494,7 +3908,7 @@ typedef struct pm_if_node {
3494
3908
  * if foo then bar else baz end
3495
3909
  * ^^^^^^^^^^^^
3496
3910
  */
3497
- struct pm_node *consequent;
3911
+ struct pm_node *subsequent;
3498
3912
 
3499
3913
  /**
3500
3914
  * IfNode#end_keyword_loc
@@ -3512,6 +3926,11 @@ typedef struct pm_if_node {
3512
3926
  /**
3513
3927
  * ImaginaryNode
3514
3928
  *
3929
+ * Represents an imaginary number literal.
3930
+ *
3931
+ * 1.0i
3932
+ * ^^^^
3933
+ *
3515
3934
  * Type: PM_IMAGINARY_NODE
3516
3935
  *
3517
3936
  * @extends pm_node_t
@@ -3529,6 +3948,17 @@ typedef struct pm_imaginary_node {
3529
3948
  /**
3530
3949
  * ImplicitNode
3531
3950
  *
3951
+ * Represents a node that is implicitly being added to the tree but doesn't correspond directly to a node in the source.
3952
+ *
3953
+ * { foo: }
3954
+ * ^^^^
3955
+ *
3956
+ * { Foo: }
3957
+ * ^^^^
3958
+ *
3959
+ * foo in { bar: }
3960
+ * ^^^^
3961
+ *
3532
3962
  * Type: PM_IMPLICIT_NODE
3533
3963
  *
3534
3964
  * @extends pm_node_t
@@ -3546,6 +3976,20 @@ typedef struct pm_implicit_node {
3546
3976
  /**
3547
3977
  * ImplicitRestNode
3548
3978
  *
3979
+ * Represents using a trailing comma to indicate an implicit rest parameter.
3980
+ *
3981
+ * foo { |bar,| }
3982
+ * ^
3983
+ *
3984
+ * foo in [bar,]
3985
+ * ^
3986
+ *
3987
+ * for foo, in bar do end
3988
+ * ^
3989
+ *
3990
+ * foo, = bar
3991
+ * ^
3992
+ *
3549
3993
  * Type: PM_IMPLICIT_REST_NODE
3550
3994
  *
3551
3995
  * @extends pm_node_t
@@ -3558,6 +4002,11 @@ typedef struct pm_implicit_rest_node {
3558
4002
  /**
3559
4003
  * InNode
3560
4004
  *
4005
+ * Represents the use of the `in` keyword in a case statement.
4006
+ *
4007
+ * case a; in b then c end
4008
+ * ^^^^^^^^^^^
4009
+ *
3561
4010
  * Type: PM_IN_NODE
3562
4011
  *
3563
4012
  * @extends pm_node_t
@@ -3590,6 +4039,11 @@ typedef struct pm_in_node {
3590
4039
  /**
3591
4040
  * IndexAndWriteNode
3592
4041
  *
4042
+ * Represents the use of the `&&=` operator on a call to the `[]` method.
4043
+ *
4044
+ * foo.bar[baz] &&= value
4045
+ * ^^^^^^^^^^^^^^^^^^^^^^
4046
+ *
3593
4047
  * Type: PM_INDEX_AND_WRITE_NODE
3594
4048
  * Flags:
3595
4049
  * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
@@ -3647,6 +4101,11 @@ typedef struct pm_index_and_write_node {
3647
4101
  /**
3648
4102
  * IndexOperatorWriteNode
3649
4103
  *
4104
+ * Represents the use of an assignment operator on a call to `[]`.
4105
+ *
4106
+ * foo.bar[baz] += value
4107
+ * ^^^^^^^^^^^^^^^^^^^^^
4108
+ *
3650
4109
  * Type: PM_INDEX_OPERATOR_WRITE_NODE
3651
4110
  * Flags:
3652
4111
  * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
@@ -3709,6 +4168,11 @@ typedef struct pm_index_operator_write_node {
3709
4168
  /**
3710
4169
  * IndexOrWriteNode
3711
4170
  *
4171
+ * Represents the use of the `||=` operator on a call to `[]`.
4172
+ *
4173
+ * foo.bar[baz] ||= value
4174
+ * ^^^^^^^^^^^^^^^^^^^^^^
4175
+ *
3712
4176
  * Type: PM_INDEX_OR_WRITE_NODE
3713
4177
  * Flags:
3714
4178
  * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
@@ -3766,6 +4230,19 @@ typedef struct pm_index_or_write_node {
3766
4230
  /**
3767
4231
  * IndexTargetNode
3768
4232
  *
4233
+ * Represents assigning to an index.
4234
+ *
4235
+ * foo[bar], = 1
4236
+ * ^^^^^^^^
4237
+ *
4238
+ * begin
4239
+ * rescue => foo[bar]
4240
+ * ^^^^^^^^
4241
+ * end
4242
+ *
4243
+ * for foo[bar] in baz do end
4244
+ * ^^^^^^^^
4245
+ *
3769
4246
  * Type: PM_INDEX_TARGET_NODE
3770
4247
  * Flags:
3771
4248
  * PM_CALL_NODE_FLAGS_SAFE_NAVIGATION
@@ -3808,6 +4285,11 @@ typedef struct pm_index_target_node {
3808
4285
  /**
3809
4286
  * InstanceVariableAndWriteNode
3810
4287
  *
4288
+ * Represents the use of the `&&=` operator for assignment to an instance variable.
4289
+ *
4290
+ * @target &&= value
4291
+ * ^^^^^^^^^^^^^^^^^
4292
+ *
3811
4293
  * Type: PM_INSTANCE_VARIABLE_AND_WRITE_NODE
3812
4294
  *
3813
4295
  * @extends pm_node_t
@@ -3840,6 +4322,11 @@ typedef struct pm_instance_variable_and_write_node {
3840
4322
  /**
3841
4323
  * InstanceVariableOperatorWriteNode
3842
4324
  *
4325
+ * Represents assigning to an instance variable using an operator that isn't `=`.
4326
+ *
4327
+ * @target += value
4328
+ * ^^^^^^^^^^^^^^^^
4329
+ *
3843
4330
  * Type: PM_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE
3844
4331
  *
3845
4332
  * @extends pm_node_t
@@ -3877,6 +4364,11 @@ typedef struct pm_instance_variable_operator_write_node {
3877
4364
  /**
3878
4365
  * InstanceVariableOrWriteNode
3879
4366
  *
4367
+ * Represents the use of the `||=` operator for assignment to an instance variable.
4368
+ *
4369
+ * @target ||= value
4370
+ * ^^^^^^^^^^^^^^^^^
4371
+ *
3880
4372
  * Type: PM_INSTANCE_VARIABLE_OR_WRITE_NODE
3881
4373
  *
3882
4374
  * @extends pm_node_t
@@ -3909,6 +4401,11 @@ typedef struct pm_instance_variable_or_write_node {
3909
4401
  /**
3910
4402
  * InstanceVariableReadNode
3911
4403
  *
4404
+ * Represents referencing an instance variable.
4405
+ *
4406
+ * @foo
4407
+ * ^^^^
4408
+ *
3912
4409
  * Type: PM_INSTANCE_VARIABLE_READ_NODE
3913
4410
  *
3914
4411
  * @extends pm_node_t
@@ -3932,6 +4429,11 @@ typedef struct pm_instance_variable_read_node {
3932
4429
  /**
3933
4430
  * InstanceVariableTargetNode
3934
4431
  *
4432
+ * Represents writing to an instance variable in a context that doesn't have an explicit value.
4433
+ *
4434
+ * @foo, @bar = baz
4435
+ * ^^^^ ^^^^
4436
+ *
3935
4437
  * Type: PM_INSTANCE_VARIABLE_TARGET_NODE
3936
4438
  *
3937
4439
  * @extends pm_node_t
@@ -3949,6 +4451,11 @@ typedef struct pm_instance_variable_target_node {
3949
4451
  /**
3950
4452
  * InstanceVariableWriteNode
3951
4453
  *
4454
+ * Represents writing to an instance variable.
4455
+ *
4456
+ * @foo = 1
4457
+ * ^^^^^^^^
4458
+ *
3952
4459
  * Type: PM_INSTANCE_VARIABLE_WRITE_NODE
3953
4460
  *
3954
4461
  * @extends pm_node_t
@@ -4005,6 +4512,11 @@ typedef struct pm_instance_variable_write_node {
4005
4512
  /**
4006
4513
  * IntegerNode
4007
4514
  *
4515
+ * Represents an integer number literal.
4516
+ *
4517
+ * 1
4518
+ * ^
4519
+ *
4008
4520
  * Type: PM_INTEGER_NODE
4009
4521
  * Flags:
4010
4522
  * PM_INTEGER_BASE_FLAGS_BINARY
@@ -4029,6 +4541,11 @@ typedef struct pm_integer_node {
4029
4541
  /**
4030
4542
  * InterpolatedMatchLastLineNode
4031
4543
  *
4544
+ * 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.
4545
+ *
4546
+ * if /foo #{bar} baz/ then end
4547
+ * ^^^^^^^^^^^^^^^^
4548
+ *
4032
4549
  * Type: PM_INTERPOLATED_MATCH_LAST_LINE_NODE
4033
4550
  * Flags:
4034
4551
  * PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE
@@ -4068,6 +4585,11 @@ typedef struct pm_interpolated_match_last_line_node {
4068
4585
  /**
4069
4586
  * InterpolatedRegularExpressionNode
4070
4587
  *
4588
+ * Represents a regular expression literal that contains interpolation.
4589
+ *
4590
+ * /foo #{bar} baz/
4591
+ * ^^^^^^^^^^^^^^^^
4592
+ *
4071
4593
  * Type: PM_INTERPOLATED_REGULAR_EXPRESSION_NODE
4072
4594
  * Flags:
4073
4595
  * PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE
@@ -4107,6 +4629,11 @@ typedef struct pm_interpolated_regular_expression_node {
4107
4629
  /**
4108
4630
  * InterpolatedStringNode
4109
4631
  *
4632
+ * Represents a string literal that contains interpolation.
4633
+ *
4634
+ * "foo #{bar} baz"
4635
+ * ^^^^^^^^^^^^^^^^
4636
+ *
4110
4637
  * Type: PM_INTERPOLATED_STRING_NODE
4111
4638
  * Flags:
4112
4639
  * PM_INTERPOLATED_STRING_NODE_FLAGS_FROZEN
@@ -4137,6 +4664,11 @@ typedef struct pm_interpolated_string_node {
4137
4664
  /**
4138
4665
  * InterpolatedSymbolNode
4139
4666
  *
4667
+ * Represents a symbol literal that contains interpolation.
4668
+ *
4669
+ * :"foo #{bar} baz"
4670
+ * ^^^^^^^^^^^^^^^^^
4671
+ *
4140
4672
  * Type: PM_INTERPOLATED_SYMBOL_NODE
4141
4673
  *
4142
4674
  * @extends pm_node_t
@@ -4164,6 +4696,11 @@ typedef struct pm_interpolated_symbol_node {
4164
4696
  /**
4165
4697
  * InterpolatedXStringNode
4166
4698
  *
4699
+ * Represents an xstring literal that contains interpolation.
4700
+ *
4701
+ * `foo #{bar} baz`
4702
+ * ^^^^^^^^^^^^^^^^
4703
+ *
4167
4704
  * Type: PM_INTERPOLATED_X_STRING_NODE
4168
4705
  *
4169
4706
  * @extends pm_node_t
@@ -4191,6 +4728,11 @@ typedef struct pm_interpolated_x_string_node {
4191
4728
  /**
4192
4729
  * ItLocalVariableReadNode
4193
4730
  *
4731
+ * Represents reading from the implicit `it` local variable.
4732
+ *
4733
+ * -> { it }
4734
+ * ^^
4735
+ *
4194
4736
  * Type: PM_IT_LOCAL_VARIABLE_READ_NODE
4195
4737
  *
4196
4738
  * @extends pm_node_t
@@ -4203,6 +4745,11 @@ typedef struct pm_it_local_variable_read_node {
4203
4745
  /**
4204
4746
  * ItParametersNode
4205
4747
  *
4748
+ * Represents an implicit set of parameters through the use of the `it` keyword within a block or lambda.
4749
+ *
4750
+ * -> { it + it }
4751
+ * ^^^^^^^^^^^^^^
4752
+ *
4206
4753
  * Type: PM_IT_PARAMETERS_NODE
4207
4754
  *
4208
4755
  * @extends pm_node_t
@@ -4215,6 +4762,11 @@ typedef struct pm_it_parameters_node {
4215
4762
  /**
4216
4763
  * KeywordHashNode
4217
4764
  *
4765
+ * Represents a hash literal without opening and closing braces.
4766
+ *
4767
+ * foo(a: b)
4768
+ * ^^^^
4769
+ *
4218
4770
  * Type: PM_KEYWORD_HASH_NODE
4219
4771
  * Flags:
4220
4772
  * PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS
@@ -4234,6 +4786,12 @@ typedef struct pm_keyword_hash_node {
4234
4786
  /**
4235
4787
  * KeywordRestParameterNode
4236
4788
  *
4789
+ * Represents a keyword rest parameter to a method, block, or lambda definition.
4790
+ *
4791
+ * def a(**b)
4792
+ * ^^^
4793
+ * end
4794
+ *
4237
4795
  * Type: PM_KEYWORD_REST_PARAMETER_NODE
4238
4796
  * Flags:
4239
4797
  * PM_PARAMETER_FLAGS_REPEATED_PARAMETER
@@ -4263,6 +4821,11 @@ typedef struct pm_keyword_rest_parameter_node {
4263
4821
  /**
4264
4822
  * LambdaNode
4265
4823
  *
4824
+ * Represents using a lambda literal (not the lambda method call).
4825
+ *
4826
+ * ->(value) { value * 2 }
4827
+ * ^^^^^^^^^^^^^^^^^^^^^^^
4828
+ *
4266
4829
  * Type: PM_LAMBDA_NODE
4267
4830
  *
4268
4831
  * @extends pm_node_t
@@ -4305,6 +4868,11 @@ typedef struct pm_lambda_node {
4305
4868
  /**
4306
4869
  * LocalVariableAndWriteNode
4307
4870
  *
4871
+ * Represents the use of the `&&=` operator for assignment to a local variable.
4872
+ *
4873
+ * target &&= value
4874
+ * ^^^^^^^^^^^^^^^^
4875
+ *
4308
4876
  * Type: PM_LOCAL_VARIABLE_AND_WRITE_NODE
4309
4877
  *
4310
4878
  * @extends pm_node_t
@@ -4342,6 +4910,11 @@ typedef struct pm_local_variable_and_write_node {
4342
4910
  /**
4343
4911
  * LocalVariableOperatorWriteNode
4344
4912
  *
4913
+ * Represents assigning to a local variable using an operator that isn't `=`.
4914
+ *
4915
+ * target += value
4916
+ * ^^^^^^^^^^^^^^^
4917
+ *
4345
4918
  * Type: PM_LOCAL_VARIABLE_OPERATOR_WRITE_NODE
4346
4919
  *
4347
4920
  * @extends pm_node_t
@@ -4384,6 +4957,11 @@ typedef struct pm_local_variable_operator_write_node {
4384
4957
  /**
4385
4958
  * LocalVariableOrWriteNode
4386
4959
  *
4960
+ * Represents the use of the `||=` operator for assignment to a local variable.
4961
+ *
4962
+ * target ||= value
4963
+ * ^^^^^^^^^^^^^^^^
4964
+ *
4387
4965
  * Type: PM_LOCAL_VARIABLE_OR_WRITE_NODE
4388
4966
  *
4389
4967
  * @extends pm_node_t
@@ -4421,6 +4999,11 @@ typedef struct pm_local_variable_or_write_node {
4421
4999
  /**
4422
5000
  * LocalVariableReadNode
4423
5001
  *
5002
+ * 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.
5003
+ *
5004
+ * foo
5005
+ * ^^^
5006
+ *
4424
5007
  * Type: PM_LOCAL_VARIABLE_READ_NODE
4425
5008
  *
4426
5009
  * @extends pm_node_t
@@ -4461,6 +5044,11 @@ typedef struct pm_local_variable_read_node {
4461
5044
  /**
4462
5045
  * LocalVariableTargetNode
4463
5046
  *
5047
+ * Represents writing to a local variable in a context that doesn't have an explicit value.
5048
+ *
5049
+ * foo, bar = baz
5050
+ * ^^^ ^^^
5051
+ *
4464
5052
  * Type: PM_LOCAL_VARIABLE_TARGET_NODE
4465
5053
  *
4466
5054
  * @extends pm_node_t
@@ -4483,6 +5071,11 @@ typedef struct pm_local_variable_target_node {
4483
5071
  /**
4484
5072
  * LocalVariableWriteNode
4485
5073
  *
5074
+ * Represents writing to a local variable.
5075
+ *
5076
+ * foo = 1
5077
+ * ^^^^^^^
5078
+ *
4486
5079
  * Type: PM_LOCAL_VARIABLE_WRITE_NODE
4487
5080
  *
4488
5081
  * @extends pm_node_t
@@ -4556,6 +5149,11 @@ typedef struct pm_local_variable_write_node {
4556
5149
  /**
4557
5150
  * MatchLastLineNode
4558
5151
  *
5152
+ * Represents a regular expression literal used in the predicate of a conditional to implicitly match against the last line read by an IO object.
5153
+ *
5154
+ * if /foo/i then end
5155
+ * ^^^^^^
5156
+ *
4559
5157
  * Type: PM_MATCH_LAST_LINE_NODE
4560
5158
  * Flags:
4561
5159
  * PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE
@@ -4600,6 +5198,11 @@ typedef struct pm_match_last_line_node {
4600
5198
  /**
4601
5199
  * MatchPredicateNode
4602
5200
  *
5201
+ * Represents the use of the modifier `in` operator.
5202
+ *
5203
+ * foo in bar
5204
+ * ^^^^^^^^^^
5205
+ *
4603
5206
  * Type: PM_MATCH_PREDICATE_NODE
4604
5207
  *
4605
5208
  * @extends pm_node_t
@@ -4627,6 +5230,11 @@ typedef struct pm_match_predicate_node {
4627
5230
  /**
4628
5231
  * MatchRequiredNode
4629
5232
  *
5233
+ * Represents the use of the `=>` operator.
5234
+ *
5235
+ * foo => bar
5236
+ * ^^^^^^^^^^
5237
+ *
4630
5238
  * Type: PM_MATCH_REQUIRED_NODE
4631
5239
  *
4632
5240
  * @extends pm_node_t
@@ -4654,6 +5262,11 @@ typedef struct pm_match_required_node {
4654
5262
  /**
4655
5263
  * MatchWriteNode
4656
5264
  *
5265
+ * Represents writing local variables using a regular expression match with named capture groups.
5266
+ *
5267
+ * /(?<foo>bar)/ =~ baz
5268
+ * ^^^^^^^^^^^^^^^^^^^^
5269
+ *
4657
5270
  * Type: PM_MATCH_WRITE_NODE
4658
5271
  *
4659
5272
  * @extends pm_node_t
@@ -4676,6 +5289,8 @@ typedef struct pm_match_write_node {
4676
5289
  /**
4677
5290
  * MissingNode
4678
5291
  *
5292
+ * Represents a node that is missing from the source and results in a syntax error.
5293
+ *
4679
5294
  * Type: PM_MISSING_NODE
4680
5295
  *
4681
5296
  * @extends pm_node_t
@@ -4688,6 +5303,11 @@ typedef struct pm_missing_node {
4688
5303
  /**
4689
5304
  * ModuleNode
4690
5305
  *
5306
+ * Represents a module declaration involving the `module` keyword.
5307
+ *
5308
+ * module Foo end
5309
+ * ^^^^^^^^^^^^^^
5310
+ *
4691
5311
  * Type: PM_MODULE_NODE
4692
5312
  *
4693
5313
  * @extends pm_node_t
@@ -4730,6 +5350,16 @@ typedef struct pm_module_node {
4730
5350
  /**
4731
5351
  * MultiTargetNode
4732
5352
  *
5353
+ * Represents a multi-target expression.
5354
+ *
5355
+ * a, (b, c) = 1, 2, 3
5356
+ * ^^^^^^
5357
+ *
5358
+ * This can be a part of `MultiWriteNode` as above, or the target of a `for` loop
5359
+ *
5360
+ * for a, b in [[1, 2], [3, 4]]
5361
+ * ^^^^
5362
+ *
4733
5363
  * Type: PM_MULTI_TARGET_NODE
4734
5364
  *
4735
5365
  * @extends pm_node_t
@@ -4740,26 +5370,66 @@ typedef struct pm_multi_target_node {
4740
5370
 
4741
5371
  /**
4742
5372
  * MultiTargetNode#lefts
5373
+ *
5374
+ * Represents the targets expressions before a splat node.
5375
+ *
5376
+ * a, (b, c, *) = 1, 2, 3, 4, 5
5377
+ * ^^^^
5378
+ *
5379
+ * The splat node can be absent, in that case all target expressions are in the left field.
5380
+ *
5381
+ * a, (b, c) = 1, 2, 3, 4, 5
5382
+ * ^^^^
4743
5383
  */
4744
5384
  struct pm_node_list lefts;
4745
5385
 
4746
5386
  /**
4747
5387
  * MultiTargetNode#rest
5388
+ *
5389
+ * Represents a splat node in the target expression.
5390
+ *
5391
+ * a, (b, *c) = 1, 2, 3, 4
5392
+ * ^^
5393
+ *
5394
+ * The variable can be empty, this results in a `SplatNode` with a `nil` expression field.
5395
+ *
5396
+ * a, (b, *) = 1, 2, 3, 4
5397
+ * ^
5398
+ *
5399
+ * If the `*` is omitted, the field will containt an `ImplicitRestNode`
5400
+ *
5401
+ * a, (b,) = 1, 2, 3, 4
5402
+ * ^
4748
5403
  */
4749
5404
  struct pm_node *rest;
4750
5405
 
4751
5406
  /**
4752
5407
  * MultiTargetNode#rights
5408
+ *
5409
+ * Represents the targets expressions after a splat node.
5410
+ *
5411
+ * a, (*, b, c) = 1, 2, 3, 4, 5
5412
+ * ^^^^
4753
5413
  */
4754
5414
  struct pm_node_list rights;
4755
5415
 
4756
5416
  /**
4757
5417
  * MultiTargetNode#lparen_loc
5418
+ *
5419
+ * The location of the opening parenthesis.
5420
+ *
5421
+ * a, (b, c) = 1, 2, 3
5422
+ * ^
4758
5423
  */
4759
5424
  pm_location_t lparen_loc;
4760
5425
 
4761
5426
  /**
4762
5427
  * MultiTargetNode#rparen_loc
5428
+ *
5429
+ * The location of the closing parenthesis.
5430
+ *
5431
+ * a, (b, c) = 1, 2, 3
5432
+ * ^
4763
5433
  */
4764
5434
  pm_location_t rparen_loc;
4765
5435
  } pm_multi_target_node_t;
@@ -4767,6 +5437,11 @@ typedef struct pm_multi_target_node {
4767
5437
  /**
4768
5438
  * MultiWriteNode
4769
5439
  *
5440
+ * Represents a write to a multi-target expression.
5441
+ *
5442
+ * a, b, c = 1, 2, 3
5443
+ * ^^^^^^^^^^^^^^^^^
5444
+ *
4770
5445
  * Type: PM_MULTI_WRITE_NODE
4771
5446
  *
4772
5447
  * @extends pm_node_t
@@ -4777,36 +5452,86 @@ typedef struct pm_multi_write_node {
4777
5452
 
4778
5453
  /**
4779
5454
  * MultiWriteNode#lefts
5455
+ *
5456
+ * Represents the targets expressions before a splat node.
5457
+ *
5458
+ * a, b, * = 1, 2, 3, 4, 5
5459
+ * ^^^^
5460
+ *
5461
+ * The splat node can be absent, in that case all target expressions are in the left field.
5462
+ *
5463
+ * a, b, c = 1, 2, 3, 4, 5
5464
+ * ^^^^^^^
4780
5465
  */
4781
5466
  struct pm_node_list lefts;
4782
5467
 
4783
5468
  /**
4784
5469
  * MultiWriteNode#rest
5470
+ *
5471
+ * Represents a splat node in the target expression.
5472
+ *
5473
+ * a, b, *c = 1, 2, 3, 4
5474
+ * ^^
5475
+ *
5476
+ * The variable can be empty, this results in a `SplatNode` with a `nil` expression field.
5477
+ *
5478
+ * a, b, * = 1, 2, 3, 4
5479
+ * ^
5480
+ *
5481
+ * If the `*` is omitted, the field will containt an `ImplicitRestNode`
5482
+ *
5483
+ * a, b, = 1, 2, 3, 4
5484
+ * ^
4785
5485
  */
4786
5486
  struct pm_node *rest;
4787
5487
 
4788
5488
  /**
4789
5489
  * MultiWriteNode#rights
5490
+ *
5491
+ * Represents the targets expressions after a splat node.
5492
+ *
5493
+ * a, *, b, c = 1, 2, 3, 4, 5
5494
+ * ^^^^
4790
5495
  */
4791
5496
  struct pm_node_list rights;
4792
5497
 
4793
5498
  /**
4794
5499
  * MultiWriteNode#lparen_loc
5500
+ *
5501
+ * The location of the opening parenthesis.
5502
+ *
5503
+ * (a, b, c) = 1, 2, 3
5504
+ * ^
4795
5505
  */
4796
5506
  pm_location_t lparen_loc;
4797
5507
 
4798
5508
  /**
4799
5509
  * MultiWriteNode#rparen_loc
5510
+ *
5511
+ * The location of the closing parenthesis.
5512
+ *
5513
+ * (a, b, c) = 1, 2, 3
5514
+ * ^
4800
5515
  */
4801
5516
  pm_location_t rparen_loc;
4802
5517
 
4803
5518
  /**
4804
5519
  * MultiWriteNode#operator_loc
5520
+ *
5521
+ * The location of the operator.
5522
+ *
5523
+ * a, b, c = 1, 2, 3
5524
+ * ^
4805
5525
  */
4806
5526
  pm_location_t operator_loc;
4807
5527
 
4808
5528
  /**
4809
5529
  * MultiWriteNode#value
5530
+ *
5531
+ * 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).
5532
+ *
5533
+ * a, b, c = 1, 2, 3
5534
+ * ^^^^^^^
4810
5535
  */
4811
5536
  struct pm_node *value;
4812
5537
  } pm_multi_write_node_t;
@@ -4814,6 +5539,11 @@ typedef struct pm_multi_write_node {
4814
5539
  /**
4815
5540
  * NextNode
4816
5541
  *
5542
+ * Represents the use of the `next` keyword.
5543
+ *
5544
+ * next 1
5545
+ * ^^^^^^
5546
+ *
4817
5547
  * Type: PM_NEXT_NODE
4818
5548
  *
4819
5549
  * @extends pm_node_t
@@ -4836,6 +5566,11 @@ typedef struct pm_next_node {
4836
5566
  /**
4837
5567
  * NilNode
4838
5568
  *
5569
+ * Represents the use of the `nil` keyword.
5570
+ *
5571
+ * nil
5572
+ * ^^^
5573
+ *
4839
5574
  * Type: PM_NIL_NODE
4840
5575
  *
4841
5576
  * @extends pm_node_t
@@ -4848,6 +5583,12 @@ typedef struct pm_nil_node {
4848
5583
  /**
4849
5584
  * NoKeywordsParameterNode
4850
5585
  *
5586
+ * Represents the use of `**nil` inside method arguments.
5587
+ *
5588
+ * def a(**nil)
5589
+ * ^^^^^
5590
+ * end
5591
+ *
4851
5592
  * Type: PM_NO_KEYWORDS_PARAMETER_NODE
4852
5593
  *
4853
5594
  * @extends pm_node_t
@@ -4870,6 +5611,11 @@ typedef struct pm_no_keywords_parameter_node {
4870
5611
  /**
4871
5612
  * NumberedParametersNode
4872
5613
  *
5614
+ * Represents an implicit set of parameters through the use of numbered parameters within a block or lambda.
5615
+ *
5616
+ * -> { _1 + _2 }
5617
+ * ^^^^^^^^^^^^^^
5618
+ *
4873
5619
  * Type: PM_NUMBERED_PARAMETERS_NODE
4874
5620
  *
4875
5621
  * @extends pm_node_t
@@ -4887,6 +5633,11 @@ typedef struct pm_numbered_parameters_node {
4887
5633
  /**
4888
5634
  * NumberedReferenceReadNode
4889
5635
  *
5636
+ * Represents reading a numbered reference to a capture in the previous match.
5637
+ *
5638
+ * $1
5639
+ * ^^
5640
+ *
4890
5641
  * Type: PM_NUMBERED_REFERENCE_READ_NODE
4891
5642
  *
4892
5643
  * @extends pm_node_t
@@ -4912,6 +5663,12 @@ typedef struct pm_numbered_reference_read_node {
4912
5663
  /**
4913
5664
  * OptionalKeywordParameterNode
4914
5665
  *
5666
+ * Represents an optional keyword parameter to a method, block, or lambda definition.
5667
+ *
5668
+ * def a(b: 1)
5669
+ * ^^^^
5670
+ * end
5671
+ *
4915
5672
  * Type: PM_OPTIONAL_KEYWORD_PARAMETER_NODE
4916
5673
  * Flags:
4917
5674
  * PM_PARAMETER_FLAGS_REPEATED_PARAMETER
@@ -4941,6 +5698,12 @@ typedef struct pm_optional_keyword_parameter_node {
4941
5698
  /**
4942
5699
  * OptionalParameterNode
4943
5700
  *
5701
+ * Represents an optional parameter to a method, block, or lambda definition.
5702
+ *
5703
+ * def a(b = 1)
5704
+ * ^^^^^
5705
+ * end
5706
+ *
4944
5707
  * Type: PM_OPTIONAL_PARAMETER_NODE
4945
5708
  * Flags:
4946
5709
  * PM_PARAMETER_FLAGS_REPEATED_PARAMETER
@@ -4975,6 +5738,11 @@ typedef struct pm_optional_parameter_node {
4975
5738
  /**
4976
5739
  * OrNode
4977
5740
  *
5741
+ * Represents the use of the `||` operator or the `or` keyword.
5742
+ *
5743
+ * left or right
5744
+ * ^^^^^^^^^^^^^
5745
+ *
4978
5746
  * Type: PM_OR_NODE
4979
5747
  *
4980
5748
  * @extends pm_node_t
@@ -5023,6 +5791,12 @@ typedef struct pm_or_node {
5023
5791
  /**
5024
5792
  * ParametersNode
5025
5793
  *
5794
+ * Represents the list of parameters on a method, block, or lambda definition.
5795
+ *
5796
+ * def a(b, c, d)
5797
+ * ^^^^^^^
5798
+ * end
5799
+ *
5026
5800
  * Type: PM_PARAMETERS_NODE
5027
5801
  *
5028
5802
  * @extends pm_node_t
@@ -5070,6 +5844,11 @@ typedef struct pm_parameters_node {
5070
5844
  /**
5071
5845
  * ParenthesesNode
5072
5846
  *
5847
+ * Represents a parenthesized expression
5848
+ *
5849
+ * (10 + 34)
5850
+ * ^^^^^^^^^
5851
+ *
5073
5852
  * Type: PM_PARENTHESES_NODE
5074
5853
  *
5075
5854
  * @extends pm_node_t
@@ -5097,6 +5876,11 @@ typedef struct pm_parentheses_node {
5097
5876
  /**
5098
5877
  * PinnedExpressionNode
5099
5878
  *
5879
+ * Represents the use of the `^` operator for pinning an expression in a pattern matching expression.
5880
+ *
5881
+ * foo in ^(bar)
5882
+ * ^^^^^^
5883
+ *
5100
5884
  * Type: PM_PINNED_EXPRESSION_NODE
5101
5885
  *
5102
5886
  * @extends pm_node_t
@@ -5129,6 +5913,11 @@ typedef struct pm_pinned_expression_node {
5129
5913
  /**
5130
5914
  * PinnedVariableNode
5131
5915
  *
5916
+ * Represents the use of the `^` operator for pinning a variable in a pattern matching expression.
5917
+ *
5918
+ * foo in ^bar
5919
+ * ^^^^
5920
+ *
5132
5921
  * Type: PM_PINNED_VARIABLE_NODE
5133
5922
  *
5134
5923
  * @extends pm_node_t
@@ -5151,6 +5940,11 @@ typedef struct pm_pinned_variable_node {
5151
5940
  /**
5152
5941
  * PostExecutionNode
5153
5942
  *
5943
+ * Represents the use of the `END` keyword.
5944
+ *
5945
+ * END { foo }
5946
+ * ^^^^^^^^^^^
5947
+ *
5154
5948
  * Type: PM_POST_EXECUTION_NODE
5155
5949
  *
5156
5950
  * @extends pm_node_t
@@ -5183,6 +5977,11 @@ typedef struct pm_post_execution_node {
5183
5977
  /**
5184
5978
  * PreExecutionNode
5185
5979
  *
5980
+ * Represents the use of the `BEGIN` keyword.
5981
+ *
5982
+ * BEGIN { foo }
5983
+ * ^^^^^^^^^^^^^
5984
+ *
5186
5985
  * Type: PM_PRE_EXECUTION_NODE
5187
5986
  *
5188
5987
  * @extends pm_node_t
@@ -5215,6 +6014,8 @@ typedef struct pm_pre_execution_node {
5215
6014
  /**
5216
6015
  * ProgramNode
5217
6016
  *
6017
+ * The top level node of any parse tree.
6018
+ *
5218
6019
  * Type: PM_PROGRAM_NODE
5219
6020
  *
5220
6021
  * @extends pm_node_t
@@ -5237,6 +6038,14 @@ typedef struct pm_program_node {
5237
6038
  /**
5238
6039
  * RangeNode
5239
6040
  *
6041
+ * Represents the use of the `..` or `...` operators.
6042
+ *
6043
+ * 1..2
6044
+ * ^^^^
6045
+ *
6046
+ * c if a =~ /left/ ... b =~ /right/
6047
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6048
+ *
5240
6049
  * Type: PM_RANGE_NODE
5241
6050
  * Flags:
5242
6051
  * PM_RANGE_FLAGS_EXCLUDE_END
@@ -5285,6 +6094,11 @@ typedef struct pm_range_node {
5285
6094
  /**
5286
6095
  * RationalNode
5287
6096
  *
6097
+ * Represents a rational number literal.
6098
+ *
6099
+ * 1.0r
6100
+ * ^^^^
6101
+ *
5288
6102
  * Type: PM_RATIONAL_NODE
5289
6103
  * Flags:
5290
6104
  * PM_INTEGER_BASE_FLAGS_BINARY
@@ -5320,6 +6134,11 @@ typedef struct pm_rational_node {
5320
6134
  /**
5321
6135
  * RedoNode
5322
6136
  *
6137
+ * Represents the use of the `redo` keyword.
6138
+ *
6139
+ * redo
6140
+ * ^^^^
6141
+ *
5323
6142
  * Type: PM_REDO_NODE
5324
6143
  *
5325
6144
  * @extends pm_node_t
@@ -5332,6 +6151,11 @@ typedef struct pm_redo_node {
5332
6151
  /**
5333
6152
  * RegularExpressionNode
5334
6153
  *
6154
+ * Represents a regular expression literal with no interpolation.
6155
+ *
6156
+ * /foo/i
6157
+ * ^^^^^^
6158
+ *
5335
6159
  * Type: PM_REGULAR_EXPRESSION_NODE
5336
6160
  * Flags:
5337
6161
  * PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE
@@ -5376,6 +6200,12 @@ typedef struct pm_regular_expression_node {
5376
6200
  /**
5377
6201
  * RequiredKeywordParameterNode
5378
6202
  *
6203
+ * Represents a required keyword parameter to a method, block, or lambda definition.
6204
+ *
6205
+ * def a(b: )
6206
+ * ^^
6207
+ * end
6208
+ *
5379
6209
  * Type: PM_REQUIRED_KEYWORD_PARAMETER_NODE
5380
6210
  * Flags:
5381
6211
  * PM_PARAMETER_FLAGS_REPEATED_PARAMETER
@@ -5400,6 +6230,12 @@ typedef struct pm_required_keyword_parameter_node {
5400
6230
  /**
5401
6231
  * RequiredParameterNode
5402
6232
  *
6233
+ * Represents a required parameter to a method, block, or lambda definition.
6234
+ *
6235
+ * def a(b)
6236
+ * ^
6237
+ * end
6238
+ *
5403
6239
  * Type: PM_REQUIRED_PARAMETER_NODE
5404
6240
  * Flags:
5405
6241
  * PM_PARAMETER_FLAGS_REPEATED_PARAMETER
@@ -5419,6 +6255,11 @@ typedef struct pm_required_parameter_node {
5419
6255
  /**
5420
6256
  * RescueModifierNode
5421
6257
  *
6258
+ * Represents an expression modified with a rescue.
6259
+ *
6260
+ * foo rescue nil
6261
+ * ^^^^^^^^^^^^^^
6262
+ *
5422
6263
  * Type: PM_RESCUE_MODIFIER_NODE
5423
6264
  *
5424
6265
  * @extends pm_node_t
@@ -5446,6 +6287,16 @@ typedef struct pm_rescue_modifier_node {
5446
6287
  /**
5447
6288
  * RescueNode
5448
6289
  *
6290
+ * Represents a rescue statement.
6291
+ *
6292
+ * begin
6293
+ * rescue Foo, *splat, Bar => ex
6294
+ * foo
6295
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6296
+ * end
6297
+ *
6298
+ * `Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `exception` field.
6299
+ *
5449
6300
  * Type: PM_RESCUE_NODE
5450
6301
  *
5451
6302
  * @extends pm_node_t
@@ -5480,14 +6331,20 @@ typedef struct pm_rescue_node {
5480
6331
  struct pm_statements_node *statements;
5481
6332
 
5482
6333
  /**
5483
- * RescueNode#consequent
6334
+ * RescueNode#subsequent
5484
6335
  */
5485
- struct pm_rescue_node *consequent;
6336
+ struct pm_rescue_node *subsequent;
5486
6337
  } pm_rescue_node_t;
5487
6338
 
5488
6339
  /**
5489
6340
  * RestParameterNode
5490
6341
  *
6342
+ * Represents a rest parameter to a method, block, or lambda definition.
6343
+ *
6344
+ * def a(*b)
6345
+ * ^^
6346
+ * end
6347
+ *
5491
6348
  * Type: PM_REST_PARAMETER_NODE
5492
6349
  * Flags:
5493
6350
  * PM_PARAMETER_FLAGS_REPEATED_PARAMETER
@@ -5517,6 +6374,11 @@ typedef struct pm_rest_parameter_node {
5517
6374
  /**
5518
6375
  * RetryNode
5519
6376
  *
6377
+ * Represents the use of the `retry` keyword.
6378
+ *
6379
+ * retry
6380
+ * ^^^^^
6381
+ *
5520
6382
  * Type: PM_RETRY_NODE
5521
6383
  *
5522
6384
  * @extends pm_node_t
@@ -5529,9 +6391,12 @@ typedef struct pm_retry_node {
5529
6391
  /**
5530
6392
  * ReturnNode
5531
6393
  *
6394
+ * Represents the use of the `return` keyword.
6395
+ *
6396
+ * return 1
6397
+ * ^^^^^^^^
6398
+ *
5532
6399
  * Type: PM_RETURN_NODE
5533
- * Flags:
5534
- * PM_RETURN_NODE_FLAGS_REDUNDANT
5535
6400
  *
5536
6401
  * @extends pm_node_t
5537
6402
  */
@@ -5553,6 +6418,11 @@ typedef struct pm_return_node {
5553
6418
  /**
5554
6419
  * SelfNode
5555
6420
  *
6421
+ * Represents the `self` keyword.
6422
+ *
6423
+ * self
6424
+ * ^^^^
6425
+ *
5556
6426
  * Type: PM_SELF_NODE
5557
6427
  *
5558
6428
  * @extends pm_node_t
@@ -5565,6 +6435,12 @@ typedef struct pm_self_node {
5565
6435
  /**
5566
6436
  * ShareableConstantNode
5567
6437
  *
6438
+ * This node wraps a constant write to indicate that when the value is written, it should have its shareability state modified.
6439
+ *
6440
+ * # shareable_constant_value: literal
6441
+ * C = { a: 1 }
6442
+ * ^^^^^^^^^^^^
6443
+ *
5568
6444
  * Type: PM_SHAREABLE_CONSTANT_NODE
5569
6445
  * Flags:
5570
6446
  * PM_SHAREABLE_CONSTANT_NODE_FLAGS_LITERAL
@@ -5588,6 +6464,11 @@ typedef struct pm_shareable_constant_node {
5588
6464
  /**
5589
6465
  * SingletonClassNode
5590
6466
  *
6467
+ * Represents a singleton class declaration involving the `class` keyword.
6468
+ *
6469
+ * class << self end
6470
+ * ^^^^^^^^^^^^^^^^^
6471
+ *
5591
6472
  * Type: PM_SINGLETON_CLASS_NODE
5592
6473
  *
5593
6474
  * @extends pm_node_t
@@ -5630,6 +6511,11 @@ typedef struct pm_singleton_class_node {
5630
6511
  /**
5631
6512
  * SourceEncodingNode
5632
6513
  *
6514
+ * Represents the use of the `__ENCODING__` keyword.
6515
+ *
6516
+ * __ENCODING__
6517
+ * ^^^^^^^^^^^^
6518
+ *
5633
6519
  * Type: PM_SOURCE_ENCODING_NODE
5634
6520
  *
5635
6521
  * @extends pm_node_t
@@ -5642,6 +6528,11 @@ typedef struct pm_source_encoding_node {
5642
6528
  /**
5643
6529
  * SourceFileNode
5644
6530
  *
6531
+ * Represents the use of the `__FILE__` keyword.
6532
+ *
6533
+ * __FILE__
6534
+ * ^^^^^^^^
6535
+ *
5645
6536
  * Type: PM_SOURCE_FILE_NODE
5646
6537
  * Flags:
5647
6538
  * PM_STRING_FLAGS_FORCED_UTF8_ENCODING
@@ -5666,6 +6557,11 @@ typedef struct pm_source_file_node {
5666
6557
  /**
5667
6558
  * SourceLineNode
5668
6559
  *
6560
+ * Represents the use of the `__LINE__` keyword.
6561
+ *
6562
+ * __LINE__
6563
+ * ^^^^^^^^
6564
+ *
5669
6565
  * Type: PM_SOURCE_LINE_NODE
5670
6566
  *
5671
6567
  * @extends pm_node_t
@@ -5678,6 +6574,11 @@ typedef struct pm_source_line_node {
5678
6574
  /**
5679
6575
  * SplatNode
5680
6576
  *
6577
+ * Represents the use of the splat operator.
6578
+ *
6579
+ * [*a]
6580
+ * ^^
6581
+ *
5681
6582
  * Type: PM_SPLAT_NODE
5682
6583
  *
5683
6584
  * @extends pm_node_t
@@ -5700,6 +6601,11 @@ typedef struct pm_splat_node {
5700
6601
  /**
5701
6602
  * StatementsNode
5702
6603
  *
6604
+ * Represents a set of statements contained within some scope.
6605
+ *
6606
+ * foo; bar; baz
6607
+ * ^^^^^^^^^^^^^
6608
+ *
5703
6609
  * Type: PM_STATEMENTS_NODE
5704
6610
  *
5705
6611
  * @extends pm_node_t
@@ -5717,6 +6623,17 @@ typedef struct pm_statements_node {
5717
6623
  /**
5718
6624
  * StringNode
5719
6625
  *
6626
+ * Represents a string literal, a string contained within a `%w` list, or plain string content within an interpolated string.
6627
+ *
6628
+ * "foo"
6629
+ * ^^^^^
6630
+ *
6631
+ * %w[foo]
6632
+ * ^^^
6633
+ *
6634
+ * "foo #{bar} baz"
6635
+ * ^^^^ ^^^^
6636
+ *
5720
6637
  * Type: PM_STRING_NODE
5721
6638
  * Flags:
5722
6639
  * PM_STRING_FLAGS_FORCED_UTF8_ENCODING
@@ -5754,6 +6671,14 @@ typedef struct pm_string_node {
5754
6671
  /**
5755
6672
  * SuperNode
5756
6673
  *
6674
+ * Represents the use of the `super` keyword with parentheses or arguments.
6675
+ *
6676
+ * super()
6677
+ * ^^^^^^^
6678
+ *
6679
+ * super foo, bar
6680
+ * ^^^^^^^^^^^^^^
6681
+ *
5757
6682
  * Type: PM_SUPER_NODE
5758
6683
  *
5759
6684
  * @extends pm_node_t
@@ -5791,6 +6716,14 @@ typedef struct pm_super_node {
5791
6716
  /**
5792
6717
  * SymbolNode
5793
6718
  *
6719
+ * Represents a symbol literal or a symbol contained within a `%i` list.
6720
+ *
6721
+ * :foo
6722
+ * ^^^^
6723
+ *
6724
+ * %i[foo]
6725
+ * ^^^
6726
+ *
5794
6727
  * Type: PM_SYMBOL_NODE
5795
6728
  * Flags:
5796
6729
  * PM_SYMBOL_FLAGS_FORCED_UTF8_ENCODING
@@ -5827,6 +6760,11 @@ typedef struct pm_symbol_node {
5827
6760
  /**
5828
6761
  * TrueNode
5829
6762
  *
6763
+ * Represents the use of the literal `true` keyword.
6764
+ *
6765
+ * true
6766
+ * ^^^^
6767
+ *
5830
6768
  * Type: PM_TRUE_NODE
5831
6769
  *
5832
6770
  * @extends pm_node_t
@@ -5839,6 +6777,11 @@ typedef struct pm_true_node {
5839
6777
  /**
5840
6778
  * UndefNode
5841
6779
  *
6780
+ * Represents the use of the `undef` keyword.
6781
+ *
6782
+ * undef :foo, :bar, :baz
6783
+ * ^^^^^^^^^^^^^^^^^^^^^^
6784
+ *
5842
6785
  * Type: PM_UNDEF_NODE
5843
6786
  *
5844
6787
  * @extends pm_node_t
@@ -5861,6 +6804,14 @@ typedef struct pm_undef_node {
5861
6804
  /**
5862
6805
  * UnlessNode
5863
6806
  *
6807
+ * Represents the use of the `unless` keyword, either in the block form or the modifier form.
6808
+ *
6809
+ * bar unless foo
6810
+ * ^^^^^^^^^^^^^^
6811
+ *
6812
+ * unless foo then bar end
6813
+ * ^^^^^^^^^^^^^^^^^^^^^^^
6814
+ *
5864
6815
  * Type: PM_UNLESS_NODE
5865
6816
  *
5866
6817
  * @extends pm_node_t
@@ -5917,14 +6868,14 @@ typedef struct pm_unless_node {
5917
6868
  struct pm_statements_node *statements;
5918
6869
 
5919
6870
  /**
5920
- * UnlessNode#consequent
6871
+ * UnlessNode#else_clause
5921
6872
  *
5922
6873
  * The else clause of the unless expression, if present.
5923
6874
  *
5924
6875
  * unless cond then bar else baz end
5925
6876
  * ^^^^^^^^
5926
6877
  */
5927
- struct pm_else_node *consequent;
6878
+ struct pm_else_node *else_clause;
5928
6879
 
5929
6880
  /**
5930
6881
  * UnlessNode#end_keyword_loc
@@ -5940,6 +6891,14 @@ typedef struct pm_unless_node {
5940
6891
  /**
5941
6892
  * UntilNode
5942
6893
  *
6894
+ * Represents the use of the `until` keyword, either in the block form or the modifier form.
6895
+ *
6896
+ * bar until foo
6897
+ * ^^^^^^^^^^^^^
6898
+ *
6899
+ * until foo do bar end
6900
+ * ^^^^^^^^^^^^^^^^^^^^
6901
+ *
5943
6902
  * Type: PM_UNTIL_NODE
5944
6903
  * Flags:
5945
6904
  * PM_LOOP_FLAGS_BEGIN_MODIFIER
@@ -5974,6 +6933,13 @@ typedef struct pm_until_node {
5974
6933
  /**
5975
6934
  * WhenNode
5976
6935
  *
6936
+ * Represents the use of the `when` keyword within a case statement.
6937
+ *
6938
+ * case true
6939
+ * when true
6940
+ * ^^^^^^^^^
6941
+ * end
6942
+ *
5977
6943
  * Type: PM_WHEN_NODE
5978
6944
  *
5979
6945
  * @extends pm_node_t
@@ -6006,6 +6972,14 @@ typedef struct pm_when_node {
6006
6972
  /**
6007
6973
  * WhileNode
6008
6974
  *
6975
+ * Represents the use of the `while` keyword, either in the block form or the modifier form.
6976
+ *
6977
+ * bar while foo
6978
+ * ^^^^^^^^^^^^^
6979
+ *
6980
+ * while foo do bar end
6981
+ * ^^^^^^^^^^^^^^^^^^^^
6982
+ *
6009
6983
  * Type: PM_WHILE_NODE
6010
6984
  * Flags:
6011
6985
  * PM_LOOP_FLAGS_BEGIN_MODIFIER
@@ -6040,6 +7014,11 @@ typedef struct pm_while_node {
6040
7014
  /**
6041
7015
  * XStringNode
6042
7016
  *
7017
+ * Represents an xstring literal with no interpolation.
7018
+ *
7019
+ * `foo`
7020
+ * ^^^^^
7021
+ *
6043
7022
  * Type: PM_X_STRING_NODE
6044
7023
  * Flags:
6045
7024
  * PM_ENCODING_FLAGS_FORCED_UTF8_ENCODING
@@ -6075,6 +7054,11 @@ typedef struct pm_x_string_node {
6075
7054
  /**
6076
7055
  * YieldNode
6077
7056
  *
7057
+ * Represents the use of the `yield` keyword.
7058
+ *
7059
+ * yield 1
7060
+ * ^^^^^^^
7061
+ *
6078
7062
  * Type: PM_YIELD_NODE
6079
7063
  *
6080
7064
  * @extends pm_node_t
@@ -6109,10 +7093,13 @@ typedef struct pm_yield_node {
6109
7093
  */
6110
7094
  typedef enum pm_arguments_node_flags {
6111
7095
  /** if arguments contain keywords */
6112
- PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS = 1,
7096
+ PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORDS = 4,
6113
7097
 
6114
7098
  /** if arguments contain keyword splat */
6115
- PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT = 2,
7099
+ PM_ARGUMENTS_NODE_FLAGS_CONTAINS_KEYWORD_SPLAT = 8,
7100
+
7101
+ /** if arguments contain splat */
7102
+ PM_ARGUMENTS_NODE_FLAGS_CONTAINS_SPLAT = 16,
6116
7103
  } pm_arguments_node_flags_t;
6117
7104
 
6118
7105
  /**
@@ -6120,7 +7107,7 @@ typedef enum pm_arguments_node_flags {
6120
7107
  */
6121
7108
  typedef enum pm_array_node_flags {
6122
7109
  /** if array contains splat nodes */
6123
- PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT = 1,
7110
+ PM_ARRAY_NODE_FLAGS_CONTAINS_SPLAT = 4,
6124
7111
  } pm_array_node_flags_t;
6125
7112
 
6126
7113
  /**
@@ -6128,16 +7115,16 @@ typedef enum pm_array_node_flags {
6128
7115
  */
6129
7116
  typedef enum pm_call_node_flags {
6130
7117
  /** &. operator */
6131
- PM_CALL_NODE_FLAGS_SAFE_NAVIGATION = 1,
7118
+ PM_CALL_NODE_FLAGS_SAFE_NAVIGATION = 4,
6132
7119
 
6133
7120
  /** a call that could have been a local variable */
6134
- PM_CALL_NODE_FLAGS_VARIABLE_CALL = 2,
7121
+ PM_CALL_NODE_FLAGS_VARIABLE_CALL = 8,
6135
7122
 
6136
7123
  /** a call that is an attribute write, so the value being written should be returned */
6137
- PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE = 4,
7124
+ PM_CALL_NODE_FLAGS_ATTRIBUTE_WRITE = 16,
6138
7125
 
6139
7126
  /** a call that ignores method visibility */
6140
- PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY = 8,
7127
+ PM_CALL_NODE_FLAGS_IGNORE_VISIBILITY = 32,
6141
7128
  } pm_call_node_flags_t;
6142
7129
 
6143
7130
  /**
@@ -6145,10 +7132,10 @@ typedef enum pm_call_node_flags {
6145
7132
  */
6146
7133
  typedef enum pm_encoding_flags {
6147
7134
  /** internal bytes forced the encoding to UTF-8 */
6148
- PM_ENCODING_FLAGS_FORCED_UTF8_ENCODING = 1,
7135
+ PM_ENCODING_FLAGS_FORCED_UTF8_ENCODING = 4,
6149
7136
 
6150
7137
  /** internal bytes forced the encoding to binary */
6151
- PM_ENCODING_FLAGS_FORCED_BINARY_ENCODING = 2,
7138
+ PM_ENCODING_FLAGS_FORCED_BINARY_ENCODING = 8,
6152
7139
  } pm_encoding_flags_t;
6153
7140
 
6154
7141
  /**
@@ -6156,16 +7143,16 @@ typedef enum pm_encoding_flags {
6156
7143
  */
6157
7144
  typedef enum pm_integer_base_flags {
6158
7145
  /** 0b prefix */
6159
- PM_INTEGER_BASE_FLAGS_BINARY = 1,
7146
+ PM_INTEGER_BASE_FLAGS_BINARY = 4,
6160
7147
 
6161
7148
  /** 0d or no prefix */
6162
- PM_INTEGER_BASE_FLAGS_DECIMAL = 2,
7149
+ PM_INTEGER_BASE_FLAGS_DECIMAL = 8,
6163
7150
 
6164
7151
  /** 0o or 0 prefix */
6165
- PM_INTEGER_BASE_FLAGS_OCTAL = 4,
7152
+ PM_INTEGER_BASE_FLAGS_OCTAL = 16,
6166
7153
 
6167
7154
  /** 0x prefix */
6168
- PM_INTEGER_BASE_FLAGS_HEXADECIMAL = 8,
7155
+ PM_INTEGER_BASE_FLAGS_HEXADECIMAL = 32,
6169
7156
  } pm_integer_base_flags_t;
6170
7157
 
6171
7158
  /**
@@ -6173,10 +7160,10 @@ typedef enum pm_integer_base_flags {
6173
7160
  */
6174
7161
  typedef enum pm_interpolated_string_node_flags {
6175
7162
  /** frozen by virtue of a `frozen_string_literal: true` comment or `--enable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'` */
6176
- PM_INTERPOLATED_STRING_NODE_FLAGS_FROZEN = 1,
7163
+ PM_INTERPOLATED_STRING_NODE_FLAGS_FROZEN = 4,
6177
7164
 
6178
7165
  /** mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'` */
6179
- PM_INTERPOLATED_STRING_NODE_FLAGS_MUTABLE = 2,
7166
+ PM_INTERPOLATED_STRING_NODE_FLAGS_MUTABLE = 8,
6180
7167
  } pm_interpolated_string_node_flags_t;
6181
7168
 
6182
7169
  /**
@@ -6184,7 +7171,7 @@ typedef enum pm_interpolated_string_node_flags {
6184
7171
  */
6185
7172
  typedef enum pm_keyword_hash_node_flags {
6186
7173
  /** a keyword hash which only has `AssocNode` elements all with symbol keys, which means the elements can be treated as keyword arguments */
6187
- PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS = 1,
7174
+ PM_KEYWORD_HASH_NODE_FLAGS_SYMBOL_KEYS = 4,
6188
7175
  } pm_keyword_hash_node_flags_t;
6189
7176
 
6190
7177
  /**
@@ -6192,7 +7179,7 @@ typedef enum pm_keyword_hash_node_flags {
6192
7179
  */
6193
7180
  typedef enum pm_loop_flags {
6194
7181
  /** a loop after a begin statement, so the body is executed first before the condition */
6195
- PM_LOOP_FLAGS_BEGIN_MODIFIER = 1,
7182
+ PM_LOOP_FLAGS_BEGIN_MODIFIER = 4,
6196
7183
  } pm_loop_flags_t;
6197
7184
 
6198
7185
  /**
@@ -6200,7 +7187,7 @@ typedef enum pm_loop_flags {
6200
7187
  */
6201
7188
  typedef enum pm_parameter_flags {
6202
7189
  /** a parameter name that has been repeated in the method signature */
6203
- PM_PARAMETER_FLAGS_REPEATED_PARAMETER = 1,
7190
+ PM_PARAMETER_FLAGS_REPEATED_PARAMETER = 4,
6204
7191
  } pm_parameter_flags_t;
6205
7192
 
6206
7193
  /**
@@ -6208,7 +7195,7 @@ typedef enum pm_parameter_flags {
6208
7195
  */
6209
7196
  typedef enum pm_range_flags {
6210
7197
  /** ... operator */
6211
- PM_RANGE_FLAGS_EXCLUDE_END = 1,
7198
+ PM_RANGE_FLAGS_EXCLUDE_END = 4,
6212
7199
  } pm_range_flags_t;
6213
7200
 
6214
7201
  /**
@@ -6216,59 +7203,51 @@ typedef enum pm_range_flags {
6216
7203
  */
6217
7204
  typedef enum pm_regular_expression_flags {
6218
7205
  /** i - ignores the case of characters when matching */
6219
- PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE = 1,
7206
+ PM_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE = 4,
6220
7207
 
6221
7208
  /** x - ignores whitespace and allows comments in regular expressions */
6222
- PM_REGULAR_EXPRESSION_FLAGS_EXTENDED = 2,
7209
+ PM_REGULAR_EXPRESSION_FLAGS_EXTENDED = 8,
6223
7210
 
6224
7211
  /** m - allows $ to match the end of lines within strings */
6225
- PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE = 4,
7212
+ PM_REGULAR_EXPRESSION_FLAGS_MULTI_LINE = 16,
6226
7213
 
6227
7214
  /** o - only interpolates values into the regular expression once */
6228
- PM_REGULAR_EXPRESSION_FLAGS_ONCE = 8,
7215
+ PM_REGULAR_EXPRESSION_FLAGS_ONCE = 32,
6229
7216
 
6230
7217
  /** e - forces the EUC-JP encoding */
6231
- PM_REGULAR_EXPRESSION_FLAGS_EUC_JP = 16,
7218
+ PM_REGULAR_EXPRESSION_FLAGS_EUC_JP = 64,
6232
7219
 
6233
7220
  /** n - forces the ASCII-8BIT encoding */
6234
- PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT = 32,
7221
+ PM_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT = 128,
6235
7222
 
6236
7223
  /** s - forces the Windows-31J encoding */
6237
- PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J = 64,
7224
+ PM_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J = 256,
6238
7225
 
6239
7226
  /** u - forces the UTF-8 encoding */
6240
- PM_REGULAR_EXPRESSION_FLAGS_UTF_8 = 128,
7227
+ PM_REGULAR_EXPRESSION_FLAGS_UTF_8 = 512,
6241
7228
 
6242
7229
  /** internal bytes forced the encoding to UTF-8 */
6243
- PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING = 256,
7230
+ PM_REGULAR_EXPRESSION_FLAGS_FORCED_UTF8_ENCODING = 1024,
6244
7231
 
6245
7232
  /** internal bytes forced the encoding to binary */
6246
- PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING = 512,
7233
+ PM_REGULAR_EXPRESSION_FLAGS_FORCED_BINARY_ENCODING = 2048,
6247
7234
 
6248
7235
  /** internal bytes forced the encoding to US-ASCII */
6249
- PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING = 1024,
7236
+ PM_REGULAR_EXPRESSION_FLAGS_FORCED_US_ASCII_ENCODING = 4096,
6250
7237
  } pm_regular_expression_flags_t;
6251
7238
 
6252
- /**
6253
- * Flags for return nodes.
6254
- */
6255
- typedef enum pm_return_node_flags {
6256
- /** a return statement that is redundant because it is the last statement in a method */
6257
- PM_RETURN_NODE_FLAGS_REDUNDANT = 1,
6258
- } pm_return_node_flags_t;
6259
-
6260
7239
  /**
6261
7240
  * Flags for shareable constant nodes.
6262
7241
  */
6263
7242
  typedef enum pm_shareable_constant_node_flags {
6264
7243
  /** constant writes that should be modified with shareable constant value literal */
6265
- PM_SHAREABLE_CONSTANT_NODE_FLAGS_LITERAL = 1,
7244
+ PM_SHAREABLE_CONSTANT_NODE_FLAGS_LITERAL = 4,
6266
7245
 
6267
7246
  /** constant writes that should be modified with shareable constant value experimental everything */
6268
- PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_EVERYTHING = 2,
7247
+ PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_EVERYTHING = 8,
6269
7248
 
6270
7249
  /** constant writes that should be modified with shareable constant value experimental copy */
6271
- PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_COPY = 4,
7250
+ PM_SHAREABLE_CONSTANT_NODE_FLAGS_EXPERIMENTAL_COPY = 16,
6272
7251
  } pm_shareable_constant_node_flags_t;
6273
7252
 
6274
7253
  /**
@@ -6276,16 +7255,16 @@ typedef enum pm_shareable_constant_node_flags {
6276
7255
  */
6277
7256
  typedef enum pm_string_flags {
6278
7257
  /** internal bytes forced the encoding to UTF-8 */
6279
- PM_STRING_FLAGS_FORCED_UTF8_ENCODING = 1,
7258
+ PM_STRING_FLAGS_FORCED_UTF8_ENCODING = 4,
6280
7259
 
6281
7260
  /** internal bytes forced the encoding to binary */
6282
- PM_STRING_FLAGS_FORCED_BINARY_ENCODING = 2,
7261
+ PM_STRING_FLAGS_FORCED_BINARY_ENCODING = 8,
6283
7262
 
6284
7263
  /** frozen by virtue of a `frozen_string_literal: true` comment or `--enable-frozen-string-literal` */
6285
- PM_STRING_FLAGS_FROZEN = 4,
7264
+ PM_STRING_FLAGS_FROZEN = 16,
6286
7265
 
6287
7266
  /** mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal` */
6288
- PM_STRING_FLAGS_MUTABLE = 8,
7267
+ PM_STRING_FLAGS_MUTABLE = 32,
6289
7268
  } pm_string_flags_t;
6290
7269
 
6291
7270
  /**
@@ -6293,13 +7272,13 @@ typedef enum pm_string_flags {
6293
7272
  */
6294
7273
  typedef enum pm_symbol_flags {
6295
7274
  /** internal bytes forced the encoding to UTF-8 */
6296
- PM_SYMBOL_FLAGS_FORCED_UTF8_ENCODING = 1,
7275
+ PM_SYMBOL_FLAGS_FORCED_UTF8_ENCODING = 4,
6297
7276
 
6298
7277
  /** internal bytes forced the encoding to binary */
6299
- PM_SYMBOL_FLAGS_FORCED_BINARY_ENCODING = 2,
7278
+ PM_SYMBOL_FLAGS_FORCED_BINARY_ENCODING = 8,
6300
7279
 
6301
7280
  /** internal bytes forced the encoding to US-ASCII */
6302
- PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING = 4,
7281
+ PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING = 16,
6303
7282
  } pm_symbol_flags_t;
6304
7283
 
6305
7284
  /**