prism 1.1.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +39 -1
- data/Makefile +1 -1
- data/config.yml +422 -3
- data/docs/build_system.md +8 -11
- data/docs/relocation.md +34 -0
- data/ext/prism/api_node.c +18 -10
- data/ext/prism/extconf.rb +13 -36
- data/ext/prism/extension.c +68 -0
- data/ext/prism/extension.h +1 -1
- data/include/prism/ast.h +427 -3
- data/include/prism/defines.h +22 -7
- data/include/prism/diagnostic.h +1 -0
- data/include/prism/parser.h +25 -12
- data/include/prism/version.h +2 -2
- data/include/prism.h +47 -0
- data/lib/prism/dot_visitor.rb +10 -0
- data/lib/prism/dsl.rb +4 -4
- data/lib/prism/ffi.rb +49 -2
- data/lib/prism/inspect_visitor.rb +2 -0
- data/lib/prism/node.rb +1839 -96
- data/lib/prism/parse_result/errors.rb +1 -1
- data/lib/prism/parse_result.rb +140 -3
- data/lib/prism/reflection.rb +2 -2
- data/lib/prism/relocation.rb +504 -0
- data/lib/prism/serialize.rb +17 -5
- data/lib/prism/string_query.rb +30 -0
- data/lib/prism/translation/parser/compiler.rb +36 -26
- data/lib/prism/translation/parser.rb +3 -3
- data/lib/prism/translation/ripper.rb +1 -5
- data/lib/prism/translation/ruby_parser.rb +14 -5
- data/lib/prism.rb +6 -4
- data/prism.gemspec +7 -1
- data/rbi/prism/dsl.rbi +4 -4
- data/rbi/prism/node.rbi +5118 -1030
- data/rbi/prism/parse_result.rbi +29 -0
- data/rbi/prism/string_query.rbi +12 -0
- data/rbi/prism.rbi +34 -34
- data/sig/prism/dsl.rbs +2 -2
- data/sig/prism/node.rbs +13 -98
- data/sig/prism/parse_result.rbs +20 -0
- data/sig/prism/relocation.rbs +185 -0
- data/sig/prism/string_query.rbs +11 -0
- data/src/diagnostic.c +3 -1
- data/src/node.c +18 -0
- data/src/prettyprint.c +32 -0
- data/src/prism.c +586 -195
- data/src/regexp.c +7 -3
- data/src/serialize.c +12 -0
- data/src/static_literals.c +1 -1
- data/src/util/pm_char.c +1 -1
- data/src/util/pm_string.c +1 -0
- metadata +9 -3
data/config.yml
CHANGED
@@ -141,6 +141,7 @@ errors:
|
|
141
141
|
- INSTANCE_VARIABLE_BARE
|
142
142
|
- INVALID_BLOCK_EXIT
|
143
143
|
- INVALID_CHARACTER
|
144
|
+
- INVALID_COMMA
|
144
145
|
- INVALID_ENCODING_MAGIC_COMMENT
|
145
146
|
- INVALID_ESCAPE_CHARACTER
|
146
147
|
- INVALID_FLOAT_EXPONENT
|
@@ -854,6 +855,11 @@ nodes:
|
|
854
855
|
^^^^^^^^^
|
855
856
|
- name: keyword_loc
|
856
857
|
type: location
|
858
|
+
comment: |
|
859
|
+
Represents the location of the `alias` keyword.
|
860
|
+
|
861
|
+
alias foo bar
|
862
|
+
^^^^^
|
857
863
|
comment: |
|
858
864
|
Represents the use of the `alias` keyword to alias a method.
|
859
865
|
|
@@ -931,6 +937,11 @@ nodes:
|
|
931
937
|
- name: arguments
|
932
938
|
type: node[]
|
933
939
|
kind: non-void expression
|
940
|
+
comment: |
|
941
|
+
The list of arguments, if present. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
942
|
+
|
943
|
+
foo(bar, baz)
|
944
|
+
^^^^^^^^
|
934
945
|
comment: |
|
935
946
|
Represents a set of arguments to a method or a keyword.
|
936
947
|
|
@@ -976,16 +987,41 @@ nodes:
|
|
976
987
|
- name: requireds
|
977
988
|
type: node[]
|
978
989
|
kind: pattern expression
|
990
|
+
comment: |
|
991
|
+
Represents the required elements of the array pattern.
|
992
|
+
|
993
|
+
foo in [1, 2]
|
994
|
+
^ ^
|
979
995
|
- name: rest
|
980
996
|
type: node?
|
981
997
|
kind: pattern expression
|
998
|
+
comment: |
|
999
|
+
Represents the rest element of the array pattern.
|
1000
|
+
|
1001
|
+
foo in *bar
|
1002
|
+
^^^^
|
982
1003
|
- name: posts
|
983
1004
|
type: node[]
|
984
1005
|
kind: pattern expression
|
1006
|
+
comment: |
|
1007
|
+
Represents the elements after the rest element of the array pattern.
|
1008
|
+
|
1009
|
+
foo in *bar, baz
|
1010
|
+
^^^
|
985
1011
|
- name: opening_loc
|
986
1012
|
type: location?
|
1013
|
+
comment: |
|
1014
|
+
Represents the opening location of the array pattern.
|
1015
|
+
|
1016
|
+
foo in [1, 2]
|
1017
|
+
^
|
987
1018
|
- name: closing_loc
|
988
1019
|
type: location?
|
1020
|
+
comment: |
|
1021
|
+
Represents the closing location of the array pattern.
|
1022
|
+
|
1023
|
+
foo in [1, 2]
|
1024
|
+
^
|
989
1025
|
comment: |
|
990
1026
|
Represents an array pattern in pattern matching.
|
991
1027
|
|
@@ -995,8 +1031,8 @@ nodes:
|
|
995
1031
|
foo in [1, 2]
|
996
1032
|
^^^^^^^^^^^^^
|
997
1033
|
|
998
|
-
foo in *
|
999
|
-
|
1034
|
+
foo in *bar
|
1035
|
+
^^^^^^^^^^^
|
1000
1036
|
|
1001
1037
|
foo in Bar[]
|
1002
1038
|
^^^^^^^^^^^^
|
@@ -1083,20 +1119,50 @@ nodes:
|
|
1083
1119
|
fields:
|
1084
1120
|
- name: begin_keyword_loc
|
1085
1121
|
type: location?
|
1122
|
+
comment: |
|
1123
|
+
Represents the location of the `begin` keyword.
|
1124
|
+
|
1125
|
+
begin x end
|
1126
|
+
^^^^^
|
1086
1127
|
- name: statements
|
1087
1128
|
type: node?
|
1088
1129
|
kind: StatementsNode
|
1130
|
+
comment: |
|
1131
|
+
Represents the statements within the begin block.
|
1132
|
+
|
1133
|
+
begin x end
|
1134
|
+
^
|
1089
1135
|
- name: rescue_clause
|
1090
1136
|
type: node?
|
1091
1137
|
kind: RescueNode
|
1138
|
+
comment: |
|
1139
|
+
Represents the rescue clause within the begin block.
|
1140
|
+
|
1141
|
+
begin x; rescue y; end
|
1142
|
+
^^^^^^^^
|
1092
1143
|
- name: else_clause
|
1093
1144
|
type: node?
|
1094
1145
|
kind: ElseNode
|
1146
|
+
comment: |
|
1147
|
+
Represents the else clause within the begin block.
|
1148
|
+
|
1149
|
+
begin x; rescue y; else z; end
|
1150
|
+
^^^^^^
|
1095
1151
|
- name: ensure_clause
|
1096
1152
|
type: node?
|
1097
1153
|
kind: EnsureNode
|
1154
|
+
comment: |
|
1155
|
+
Represents the ensure clause within the begin block.
|
1156
|
+
|
1157
|
+
begin x; ensure y; end
|
1158
|
+
^^^^^^^^
|
1098
1159
|
- name: end_keyword_loc
|
1099
1160
|
type: location?
|
1161
|
+
comment: |
|
1162
|
+
Represents the location of the `end` keyword.
|
1163
|
+
|
1164
|
+
begin x end
|
1165
|
+
^^^
|
1100
1166
|
newline: false
|
1101
1167
|
comment: |
|
1102
1168
|
Represents a begin statement.
|
@@ -1110,8 +1176,18 @@ nodes:
|
|
1110
1176
|
- name: expression
|
1111
1177
|
type: node?
|
1112
1178
|
kind: non-void expression
|
1179
|
+
comment: |
|
1180
|
+
The expression that is being passed as a block argument. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1181
|
+
|
1182
|
+
foo(&args)
|
1183
|
+
^^^^^
|
1113
1184
|
- name: operator_loc
|
1114
1185
|
type: location
|
1186
|
+
comment: |
|
1187
|
+
Represents the location of the `&` operator.
|
1188
|
+
|
1189
|
+
foo(&args)
|
1190
|
+
^
|
1115
1191
|
comment: |
|
1116
1192
|
Represents a block argument using `&`.
|
1117
1193
|
|
@@ -1122,6 +1198,11 @@ nodes:
|
|
1122
1198
|
fields:
|
1123
1199
|
- name: name
|
1124
1200
|
type: constant
|
1201
|
+
comment: |
|
1202
|
+
The name of the block local variable.
|
1203
|
+
|
1204
|
+
a { |; b| } # name `:b`
|
1205
|
+
^
|
1125
1206
|
comment: |
|
1126
1207
|
Represents a block local variable.
|
1127
1208
|
|
@@ -1131,21 +1212,50 @@ nodes:
|
|
1131
1212
|
fields:
|
1132
1213
|
- name: locals
|
1133
1214
|
type: constant[]
|
1215
|
+
comment: |
|
1216
|
+
The local variables declared in the block.
|
1217
|
+
|
1218
|
+
[1, 2, 3].each { |i| puts x } # locals: [:i]
|
1219
|
+
^
|
1134
1220
|
- name: parameters
|
1135
1221
|
type: node?
|
1136
1222
|
kind:
|
1137
1223
|
- BlockParametersNode
|
1138
1224
|
- NumberedParametersNode
|
1139
1225
|
- ItParametersNode
|
1226
|
+
comment: |
|
1227
|
+
The parameters of the block.
|
1228
|
+
|
1229
|
+
[1, 2, 3].each { |i| puts x }
|
1230
|
+
^^^
|
1231
|
+
[1, 2, 3].each { puts _1 }
|
1232
|
+
^^^^^^^^^^^
|
1233
|
+
[1, 2, 3].each { puts it }
|
1234
|
+
^^^^^^^^^^^
|
1140
1235
|
- name: body
|
1141
1236
|
type: node?
|
1142
1237
|
kind:
|
1143
1238
|
- StatementsNode
|
1144
1239
|
- BeginNode
|
1240
|
+
comment: |
|
1241
|
+
The body of the block.
|
1242
|
+
|
1243
|
+
[1, 2, 3].each { |i| puts x }
|
1244
|
+
^^^^^^
|
1145
1245
|
- name: opening_loc
|
1146
1246
|
type: location
|
1247
|
+
comment: |
|
1248
|
+
Represents the location of the opening `|`.
|
1249
|
+
|
1250
|
+
[1, 2, 3].each { |i| puts x }
|
1251
|
+
^
|
1147
1252
|
- name: closing_loc
|
1148
1253
|
type: location
|
1254
|
+
comment: |
|
1255
|
+
Represents the location of the closing `|`.
|
1256
|
+
|
1257
|
+
[1, 2, 3].each { |i| puts x }
|
1258
|
+
^
|
1149
1259
|
comment: |
|
1150
1260
|
Represents a block of ruby code.
|
1151
1261
|
|
@@ -1156,10 +1266,27 @@ nodes:
|
|
1156
1266
|
fields:
|
1157
1267
|
- name: name
|
1158
1268
|
type: constant?
|
1269
|
+
comment: |
|
1270
|
+
The name of the block parameter.
|
1271
|
+
|
1272
|
+
def a(&b) # name `:b`
|
1273
|
+
^
|
1274
|
+
end
|
1159
1275
|
- name: name_loc
|
1160
1276
|
type: location?
|
1277
|
+
comment: |
|
1278
|
+
Represents the location of the block parameter name.
|
1279
|
+
|
1280
|
+
def a(&b)
|
1281
|
+
^
|
1161
1282
|
- name: operator_loc
|
1162
1283
|
type: location
|
1284
|
+
comment: |
|
1285
|
+
Represents the location of the `&` operator.
|
1286
|
+
|
1287
|
+
def a(&b)
|
1288
|
+
^
|
1289
|
+
end
|
1163
1290
|
comment: |
|
1164
1291
|
Represents a block parameter of a method, block, or lambda definition.
|
1165
1292
|
|
@@ -1171,13 +1298,49 @@ nodes:
|
|
1171
1298
|
- name: parameters
|
1172
1299
|
type: node?
|
1173
1300
|
kind: ParametersNode
|
1301
|
+
comment: |
|
1302
|
+
Represents the parameters of the block.
|
1303
|
+
|
1304
|
+
-> (a, b = 1; local) { }
|
1305
|
+
^^^^^^^^
|
1306
|
+
|
1307
|
+
foo do |a, b = 1; local|
|
1308
|
+
^^^^^^^^
|
1309
|
+
end
|
1174
1310
|
- name: locals
|
1175
1311
|
type: node[]
|
1176
1312
|
kind: BlockLocalVariableNode
|
1313
|
+
comment: |
|
1314
|
+
Represents the local variables of the block.
|
1315
|
+
|
1316
|
+
-> (a, b = 1; local) { }
|
1317
|
+
^^^^^
|
1318
|
+
|
1319
|
+
foo do |a, b = 1; local|
|
1320
|
+
^^^^^
|
1321
|
+
end
|
1177
1322
|
- name: opening_loc
|
1178
1323
|
type: location?
|
1324
|
+
comment: |
|
1325
|
+
Represents the opening location of the block parameters.
|
1326
|
+
|
1327
|
+
-> (a, b = 1; local) { }
|
1328
|
+
^
|
1329
|
+
|
1330
|
+
foo do |a, b = 1; local|
|
1331
|
+
^
|
1332
|
+
end
|
1179
1333
|
- name: closing_loc
|
1180
1334
|
type: location?
|
1335
|
+
comment: |
|
1336
|
+
Represents the closing location of the block parameters.
|
1337
|
+
|
1338
|
+
-> (a, b = 1; local) { }
|
1339
|
+
^
|
1340
|
+
|
1341
|
+
foo do |a, b = 1; local|
|
1342
|
+
^
|
1343
|
+
end
|
1181
1344
|
comment: |
|
1182
1345
|
Represents a block's parameters declaration.
|
1183
1346
|
|
@@ -1215,19 +1378,54 @@ nodes:
|
|
1215
1378
|
- name: receiver
|
1216
1379
|
type: node?
|
1217
1380
|
kind: non-void expression
|
1381
|
+
comment: |
|
1382
|
+
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).
|
1383
|
+
|
1384
|
+
foo.bar &&= value
|
1385
|
+
^^^
|
1218
1386
|
- name: call_operator_loc
|
1219
1387
|
type: location?
|
1388
|
+
comment: |
|
1389
|
+
Represents the location of the call operator.
|
1390
|
+
|
1391
|
+
foo.bar &&= value
|
1392
|
+
^
|
1220
1393
|
- name: message_loc
|
1221
1394
|
type: location?
|
1395
|
+
comment: |
|
1396
|
+
Represents the location of the message.
|
1397
|
+
|
1398
|
+
foo.bar &&= value
|
1399
|
+
^^^
|
1222
1400
|
- name: read_name
|
1223
1401
|
type: constant
|
1402
|
+
comment: |
|
1403
|
+
Represents the name of the method being called.
|
1404
|
+
|
1405
|
+
foo.bar &&= value # read_name `:bar`
|
1406
|
+
^^^
|
1224
1407
|
- name: write_name
|
1225
1408
|
type: constant
|
1409
|
+
comment: |
|
1410
|
+
Represents the name of the method being written to.
|
1411
|
+
|
1412
|
+
foo.bar &&= value # write_name `:bar=`
|
1413
|
+
^^^
|
1226
1414
|
- name: operator_loc
|
1227
1415
|
type: location
|
1416
|
+
comment: |
|
1417
|
+
Represents the location of the operator.
|
1418
|
+
|
1419
|
+
foo.bar &&= value
|
1420
|
+
^^^
|
1228
1421
|
- name: value
|
1229
1422
|
type: node
|
1230
1423
|
kind: non-void expression
|
1424
|
+
comment: |
|
1425
|
+
Represents the value being assigned.
|
1426
|
+
|
1427
|
+
foo.bar &&= value
|
1428
|
+
^^^^^
|
1231
1429
|
comment: |
|
1232
1430
|
Represents the use of the `&&=` operator on a call.
|
1233
1431
|
|
@@ -1252,22 +1450,59 @@ nodes:
|
|
1252
1450
|
^^^
|
1253
1451
|
- name: call_operator_loc
|
1254
1452
|
type: location?
|
1453
|
+
comment: |
|
1454
|
+
Represents the location of the call operator.
|
1455
|
+
|
1456
|
+
foo.bar
|
1457
|
+
^
|
1458
|
+
|
1459
|
+
foo&.bar
|
1460
|
+
^^
|
1255
1461
|
- name: name
|
1256
1462
|
type: constant
|
1463
|
+
comment: |
|
1464
|
+
Represents the name of the method being called.
|
1465
|
+
|
1466
|
+
foo.bar # name `:foo`
|
1467
|
+
^^^
|
1257
1468
|
- name: message_loc
|
1258
1469
|
type: location?
|
1470
|
+
comment: |
|
1471
|
+
Represents the location of the message.
|
1472
|
+
|
1473
|
+
foo.bar
|
1474
|
+
^^^
|
1259
1475
|
- name: opening_loc
|
1260
1476
|
type: location?
|
1477
|
+
comment: |
|
1478
|
+
Represents the location of the left parenthesis.
|
1479
|
+
foo(bar)
|
1480
|
+
^
|
1261
1481
|
- name: arguments
|
1262
1482
|
type: node?
|
1263
1483
|
kind: ArgumentsNode
|
1484
|
+
comment: |
|
1485
|
+
Represents the arguments to the method call. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1486
|
+
|
1487
|
+
foo(bar)
|
1488
|
+
^^^
|
1264
1489
|
- name: closing_loc
|
1265
1490
|
type: location?
|
1491
|
+
comment: |
|
1492
|
+
Represents the location of the right parenthesis.
|
1493
|
+
|
1494
|
+
foo(bar)
|
1495
|
+
^
|
1266
1496
|
- name: block
|
1267
1497
|
type: node?
|
1268
1498
|
kind:
|
1269
1499
|
- BlockNode
|
1270
1500
|
- BlockArgumentNode
|
1501
|
+
comment: |
|
1502
|
+
Represents the block that is being passed to the method.
|
1503
|
+
|
1504
|
+
foo { |a| a }
|
1505
|
+
^^^^^^^^^
|
1271
1506
|
comment: |
|
1272
1507
|
Represents a method call, in all of the various forms that can take.
|
1273
1508
|
|
@@ -1294,21 +1529,61 @@ nodes:
|
|
1294
1529
|
- name: receiver
|
1295
1530
|
type: node?
|
1296
1531
|
kind: non-void expression
|
1532
|
+
comment: |
|
1533
|
+
The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1534
|
+
|
1535
|
+
foo.bar += value
|
1536
|
+
^^^
|
1297
1537
|
- name: call_operator_loc
|
1298
1538
|
type: location?
|
1539
|
+
comment: |
|
1540
|
+
Represents the location of the call operator.
|
1541
|
+
|
1542
|
+
foo.bar += value
|
1543
|
+
^
|
1299
1544
|
- name: message_loc
|
1300
1545
|
type: location?
|
1546
|
+
comment: |
|
1547
|
+
Represents the location of the message.
|
1548
|
+
|
1549
|
+
foo.bar += value
|
1550
|
+
^^^
|
1301
1551
|
- name: read_name
|
1302
1552
|
type: constant
|
1553
|
+
comment: |
|
1554
|
+
Represents the name of the method being called.
|
1555
|
+
|
1556
|
+
foo.bar += value # read_name `:bar`
|
1557
|
+
^^^
|
1303
1558
|
- name: write_name
|
1304
1559
|
type: constant
|
1560
|
+
comment: |
|
1561
|
+
Represents the name of the method being written to.
|
1562
|
+
|
1563
|
+
foo.bar += value # write_name `:bar=`
|
1564
|
+
^^^
|
1305
1565
|
- name: binary_operator
|
1306
1566
|
type: constant
|
1567
|
+
comment: |
|
1568
|
+
Represents the binary operator being used.
|
1569
|
+
|
1570
|
+
foo.bar += value # binary_operator `:+`
|
1571
|
+
^
|
1307
1572
|
- name: binary_operator_loc
|
1308
1573
|
type: location
|
1574
|
+
comment: |
|
1575
|
+
Represents the location of the binary operator.
|
1576
|
+
|
1577
|
+
foo.bar += value
|
1578
|
+
^^
|
1309
1579
|
- name: value
|
1310
1580
|
type: node
|
1311
1581
|
kind: non-void expression
|
1582
|
+
comment: |
|
1583
|
+
Represents the value being assigned.
|
1584
|
+
|
1585
|
+
foo.bar += value
|
1586
|
+
^^^^^
|
1312
1587
|
comment: |
|
1313
1588
|
Represents the use of an assignment operator on a call.
|
1314
1589
|
|
@@ -1320,19 +1595,54 @@ nodes:
|
|
1320
1595
|
- name: receiver
|
1321
1596
|
type: node?
|
1322
1597
|
kind: non-void expression
|
1598
|
+
comment: |
|
1599
|
+
The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1600
|
+
|
1601
|
+
foo.bar ||= value
|
1602
|
+
^^^
|
1323
1603
|
- name: call_operator_loc
|
1324
1604
|
type: location?
|
1605
|
+
comment: |
|
1606
|
+
Represents the location of the call operator.
|
1607
|
+
|
1608
|
+
foo.bar ||= value
|
1609
|
+
^
|
1325
1610
|
- name: message_loc
|
1326
1611
|
type: location?
|
1612
|
+
comment: |
|
1613
|
+
Represents the location of the message.
|
1614
|
+
|
1615
|
+
foo.bar ||= value
|
1616
|
+
^^^
|
1327
1617
|
- name: read_name
|
1328
1618
|
type: constant
|
1619
|
+
comment: |
|
1620
|
+
Represents the name of the method being called.
|
1621
|
+
|
1622
|
+
foo.bar ||= value # read_name `:bar`
|
1623
|
+
^^^
|
1329
1624
|
- name: write_name
|
1330
1625
|
type: constant
|
1626
|
+
comment: |
|
1627
|
+
Represents the name of the method being written to.
|
1628
|
+
|
1629
|
+
foo.bar ||= value # write_name `:bar=`
|
1630
|
+
^^^
|
1331
1631
|
- name: operator_loc
|
1332
1632
|
type: location
|
1633
|
+
comment: |
|
1634
|
+
Represents the location of the operator.
|
1635
|
+
|
1636
|
+
foo.bar ||= value
|
1637
|
+
^^^
|
1333
1638
|
- name: value
|
1334
1639
|
type: node
|
1335
1640
|
kind: non-void expression
|
1641
|
+
comment: |
|
1642
|
+
Represents the value being assigned.
|
1643
|
+
|
1644
|
+
foo.bar ||= value
|
1645
|
+
^^^^^
|
1336
1646
|
comment: |
|
1337
1647
|
Represents the use of the `||=` operator on a call.
|
1338
1648
|
|
@@ -1344,12 +1654,32 @@ nodes:
|
|
1344
1654
|
- name: receiver
|
1345
1655
|
type: node
|
1346
1656
|
kind: non-void expression
|
1657
|
+
comment: |
|
1658
|
+
The object that the method is being called on. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1659
|
+
|
1660
|
+
foo.bar = 1
|
1661
|
+
^^^
|
1347
1662
|
- name: call_operator_loc
|
1348
1663
|
type: location
|
1664
|
+
comment: |
|
1665
|
+
Represents the location of the call operator.
|
1666
|
+
|
1667
|
+
foo.bar = 1
|
1668
|
+
^
|
1349
1669
|
- name: name
|
1350
1670
|
type: constant
|
1671
|
+
comment: |
|
1672
|
+
Represents the name of the method being called.
|
1673
|
+
|
1674
|
+
foo.bar = 1 # name `:foo`
|
1675
|
+
^^^
|
1351
1676
|
- name: message_loc
|
1352
1677
|
type: location
|
1678
|
+
comment: |
|
1679
|
+
Represents the location of the message.
|
1680
|
+
|
1681
|
+
foo.bar = 1
|
1682
|
+
^^^
|
1353
1683
|
comment: |
|
1354
1684
|
Represents assigning to a method call.
|
1355
1685
|
|
@@ -1368,11 +1698,26 @@ nodes:
|
|
1368
1698
|
- name: value
|
1369
1699
|
type: node
|
1370
1700
|
kind: pattern expression
|
1701
|
+
comment: |
|
1702
|
+
Represents the value to capture.
|
1703
|
+
|
1704
|
+
foo => bar
|
1705
|
+
^^^
|
1371
1706
|
- name: target
|
1372
1707
|
type: node
|
1373
1708
|
kind: LocalVariableTargetNode
|
1709
|
+
comment: |
|
1710
|
+
Represents the target of the capture.
|
1711
|
+
|
1712
|
+
foo => bar
|
1713
|
+
^^^
|
1374
1714
|
- name: operator_loc
|
1375
1715
|
type: location
|
1716
|
+
comment: |
|
1717
|
+
Represents the location of the `=>` operator.
|
1718
|
+
|
1719
|
+
foo => bar
|
1720
|
+
^^
|
1376
1721
|
comment: |
|
1377
1722
|
Represents assigning to a local variable in pattern matching.
|
1378
1723
|
|
@@ -1383,16 +1728,41 @@ nodes:
|
|
1383
1728
|
- name: predicate
|
1384
1729
|
type: node?
|
1385
1730
|
kind: non-void expression
|
1731
|
+
comment: |
|
1732
|
+
Represents the predicate of the case match. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1733
|
+
|
1734
|
+
case true; in false; end
|
1735
|
+
^^^^
|
1386
1736
|
- name: conditions
|
1387
1737
|
type: node[]
|
1388
1738
|
kind: InNode
|
1739
|
+
comment: |
|
1740
|
+
Represents the conditions of the case match.
|
1741
|
+
|
1742
|
+
case true; in false; end
|
1743
|
+
^^^^^^^^
|
1389
1744
|
- name: else_clause
|
1390
1745
|
type: node?
|
1391
1746
|
kind: ElseNode
|
1747
|
+
comment: |
|
1748
|
+
Represents the else clause of the case match.
|
1749
|
+
|
1750
|
+
case true; in false; else; end
|
1751
|
+
^^^^
|
1392
1752
|
- name: case_keyword_loc
|
1393
1753
|
type: location
|
1754
|
+
comment: |
|
1755
|
+
Represents the location of the `case` keyword.
|
1756
|
+
|
1757
|
+
case true; in false; end
|
1758
|
+
^^^^
|
1394
1759
|
- name: end_keyword_loc
|
1395
1760
|
type: location
|
1761
|
+
comment: |
|
1762
|
+
Represents the location of the `end` keyword.
|
1763
|
+
|
1764
|
+
case true; in false; end
|
1765
|
+
^^^
|
1396
1766
|
comment: |
|
1397
1767
|
Represents the use of a case statement for pattern matching.
|
1398
1768
|
|
@@ -1405,16 +1775,41 @@ nodes:
|
|
1405
1775
|
- name: predicate
|
1406
1776
|
type: node?
|
1407
1777
|
kind: non-void expression
|
1778
|
+
comment: |
|
1779
|
+
Represents the predicate of the case statement. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1780
|
+
|
1781
|
+
case true; when false; end
|
1782
|
+
^^^^
|
1408
1783
|
- name: conditions
|
1409
1784
|
type: node[]
|
1410
1785
|
kind: WhenNode
|
1786
|
+
comment: |
|
1787
|
+
Represents the conditions of the case statement.
|
1788
|
+
|
1789
|
+
case true; when false; end
|
1790
|
+
^^^^^^^^^^
|
1411
1791
|
- name: else_clause
|
1412
1792
|
type: node?
|
1413
1793
|
kind: ElseNode
|
1794
|
+
comment: |
|
1795
|
+
Represents the else clause of the case statement.
|
1796
|
+
|
1797
|
+
case true; when false; else; end
|
1798
|
+
^^^^
|
1414
1799
|
- name: case_keyword_loc
|
1415
1800
|
type: location
|
1801
|
+
comment: |
|
1802
|
+
Represents the location of the `case` keyword.
|
1803
|
+
|
1804
|
+
case true; when false; end
|
1805
|
+
^^^^
|
1416
1806
|
- name: end_keyword_loc
|
1417
1807
|
type: location
|
1808
|
+
comment: |
|
1809
|
+
Represents the location of the `end` keyword.
|
1810
|
+
|
1811
|
+
case true; when false; end
|
1812
|
+
^^^
|
1418
1813
|
comment: |
|
1419
1814
|
Represents the use of a case statement.
|
1420
1815
|
|
@@ -1457,13 +1852,33 @@ nodes:
|
|
1457
1852
|
fields:
|
1458
1853
|
- name: name
|
1459
1854
|
type: constant
|
1855
|
+
comment: |
|
1856
|
+
The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
1857
|
+
|
1858
|
+
@@target &&= value # name `:@@target`
|
1859
|
+
^^^^^^^^
|
1460
1860
|
- name: name_loc
|
1461
1861
|
type: location
|
1862
|
+
comment: |
|
1863
|
+
Represents the location of the variable name.
|
1864
|
+
|
1865
|
+
@@target &&= value
|
1866
|
+
^^^^^^^^
|
1462
1867
|
- name: operator_loc
|
1463
1868
|
type: location
|
1869
|
+
comment: |
|
1870
|
+
Represents the location of the `&&=` operator.
|
1871
|
+
|
1872
|
+
@@target &&= value
|
1873
|
+
^^^
|
1464
1874
|
- name: value
|
1465
1875
|
type: node
|
1466
1876
|
kind: non-void expression
|
1877
|
+
comment: |
|
1878
|
+
Represents the value being assigned. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1879
|
+
|
1880
|
+
@@target &&= value
|
1881
|
+
^^^^^
|
1467
1882
|
comment: |
|
1468
1883
|
Represents the use of the `&&=` operator for assignment to a class variable.
|
1469
1884
|
|
@@ -3684,7 +4099,7 @@ nodes:
|
|
3684
4099
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
3685
4100
|
end
|
3686
4101
|
|
3687
|
-
`Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `
|
4102
|
+
`Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `reference` field.
|
3688
4103
|
- name: RestParameterNode
|
3689
4104
|
flags: ParameterFlags
|
3690
4105
|
fields:
|
@@ -3966,6 +4381,8 @@ nodes:
|
|
3966
4381
|
fields:
|
3967
4382
|
- name: keyword_loc
|
3968
4383
|
type: location
|
4384
|
+
- name: do_keyword_loc
|
4385
|
+
type: location?
|
3969
4386
|
- name: closing_loc
|
3970
4387
|
type: location?
|
3971
4388
|
- name: predicate
|
@@ -4007,6 +4424,8 @@ nodes:
|
|
4007
4424
|
fields:
|
4008
4425
|
- name: keyword_loc
|
4009
4426
|
type: location
|
4427
|
+
- name: do_keyword_loc
|
4428
|
+
type: location?
|
4010
4429
|
- name: closing_loc
|
4011
4430
|
type: location?
|
4012
4431
|
- name: predicate
|