ruby-next-parser 3.1.1.3 → 3.4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/parser/ruby-next/AST_FORMAT.md +16 -6
- data/lib/parser/ruby-next/ast/processor.rb +5 -3
- data/lib/parser/ruby-next/builder.rb +0 -5
- data/lib/parser/ruby-next/meta.rb +5 -3
- data/lib/parser/ruby-next/parser_ext.rb +12 -6
- data/lib/parser/ruby-next/version.rb +1 -1
- data/lib/parser/rubynext.y +134 -163
- metadata +6 -9
- data/lib/parser/ruby-next/lexer.rb +0 -25177
- data/lib/parser/ruby-next/lexer.rl +0 -2641
- data/lib/parser/rubynext.rb +0 -8383
data/lib/parser/rubynext.y
CHANGED
@@ -18,7 +18,6 @@ token kCLASS kMODULE kDEF kUNDEF kBEGIN kRESCUE kENSURE kEND kIF kUNLESS
|
|
18
18
|
tSTRING_DVAR tSTRING_END tSTRING_DEND tSTRING tSYMBOL
|
19
19
|
tNL tEH tCOLON tCOMMA tSPACE tSEMI tLAMBDA tLAMBEG tCHARACTER
|
20
20
|
tRATIONAL tIMAGINARY tLABEL_END tANDDOT tBDOT2 tBDOT3
|
21
|
-
tMETHREF
|
22
21
|
|
23
22
|
prechigh
|
24
23
|
right tBANG tTILDE tUPLUS
|
@@ -262,7 +261,7 @@ rule
|
|
262
261
|
val[0], val[1], val[2]),
|
263
262
|
val[3], val[4])
|
264
263
|
}
|
265
|
-
| defn_head f_opt_paren_args tEQL
|
264
|
+
| defn_head f_opt_paren_args tEQL endless_command
|
266
265
|
{
|
267
266
|
def_t, (name_t, ctx) = val[0]
|
268
267
|
endless_method_name(name_t)
|
@@ -274,25 +273,7 @@ rule
|
|
274
273
|
@current_arg_stack.pop
|
275
274
|
@context.in_def = ctx.in_def
|
276
275
|
}
|
277
|
-
|
|
278
|
-
{
|
279
|
-
def_t, (name_t, ctx) = val[0]
|
280
|
-
endless_method_name(name_t)
|
281
|
-
|
282
|
-
rescue_body = @builder.rescue_body(val[4],
|
283
|
-
nil, nil, nil,
|
284
|
-
nil, val[5])
|
285
|
-
|
286
|
-
method_body = @builder.begin_body(val[3], [ rescue_body ])
|
287
|
-
|
288
|
-
result = @builder.def_endless_method(def_t, name_t,
|
289
|
-
val[1], val[2], method_body)
|
290
|
-
|
291
|
-
local_pop
|
292
|
-
@current_arg_stack.pop
|
293
|
-
@context.in_def = ctx.in_def
|
294
|
-
}
|
295
|
-
| defs_head f_opt_paren_args tEQL command
|
276
|
+
| defs_head f_opt_paren_args tEQL endless_command
|
296
277
|
{
|
297
278
|
def_t, recv, dot_t, (name_t, ctx) = val[0]
|
298
279
|
endless_method_name(name_t)
|
@@ -304,27 +285,23 @@ rule
|
|
304
285
|
@current_arg_stack.pop
|
305
286
|
@context.in_def = ctx.in_def
|
306
287
|
}
|
307
|
-
|
|
288
|
+
| backref tOP_ASGN command_rhs
|
308
289
|
{
|
309
|
-
|
310
|
-
|
290
|
+
@builder.op_assign(val[0], val[1], val[2])
|
291
|
+
}
|
311
292
|
|
312
|
-
|
293
|
+
endless_command: command
|
294
|
+
| endless_command kRESCUE_MOD arg
|
295
|
+
{
|
296
|
+
rescue_body = @builder.rescue_body(val[1],
|
313
297
|
nil, nil, nil,
|
314
|
-
nil, val[
|
315
|
-
|
316
|
-
method_body = @builder.begin_body(val[3], [ rescue_body ])
|
317
|
-
|
318
|
-
result = @builder.def_endless_singleton(def_t, recv, dot_t, name_t,
|
319
|
-
val[1], val[2], method_body)
|
298
|
+
nil, val[2])
|
320
299
|
|
321
|
-
|
322
|
-
@current_arg_stack.pop
|
323
|
-
@context.in_def = ctx.in_def
|
300
|
+
result = @builder.begin_body(val[0], [ rescue_body ])
|
324
301
|
}
|
325
|
-
|
|
302
|
+
| kNOT opt_nl endless_command
|
326
303
|
{
|
327
|
-
@builder.
|
304
|
+
result = @builder.not_op(val[0], nil, val[2], nil)
|
328
305
|
}
|
329
306
|
|
330
307
|
command_rhs: command_call =tOP_ASGN
|
@@ -355,35 +332,19 @@ rule
|
|
355
332
|
{
|
356
333
|
result = @builder.not_op(val[0], nil, val[1], nil)
|
357
334
|
}
|
358
|
-
| arg tASSOC
|
359
|
-
{
|
360
|
-
@lexer.state = :expr_beg
|
361
|
-
@lexer.command_start = false
|
362
|
-
@pattern_variables.push
|
363
|
-
|
364
|
-
result = @context.in_kwarg
|
365
|
-
@context.in_kwarg = true
|
366
|
-
}
|
367
|
-
p_top_expr_body
|
335
|
+
| arg tASSOC p_in_kwarg p_pvtbl p_pktbl p_top_expr_body
|
368
336
|
{
|
369
337
|
@pattern_variables.pop
|
338
|
+
@pattern_hash_keys.pop
|
370
339
|
@context.in_kwarg = val[2]
|
371
|
-
result = @builder.match_pattern(val[0], val[1], val[
|
340
|
+
result = @builder.match_pattern(val[0], val[1], val[5])
|
372
341
|
}
|
373
|
-
| arg kIN
|
374
|
-
{
|
375
|
-
@lexer.state = :expr_beg
|
376
|
-
@lexer.command_start = false
|
377
|
-
@pattern_variables.push
|
378
|
-
|
379
|
-
result = @context.in_kwarg
|
380
|
-
@context.in_kwarg = true
|
381
|
-
}
|
382
|
-
p_top_expr_body
|
342
|
+
| arg kIN p_in_kwarg p_pvtbl p_pktbl p_top_expr_body
|
383
343
|
{
|
384
344
|
@pattern_variables.pop
|
345
|
+
@pattern_hash_keys.pop
|
385
346
|
@context.in_kwarg = val[2]
|
386
|
-
result = @builder.match_pattern_p(val[0], val[1], val[
|
347
|
+
result = @builder.match_pattern_p(val[0], val[1], val[5])
|
387
348
|
}
|
388
349
|
| arg =tLBRACE_ARG
|
389
350
|
|
@@ -405,6 +366,7 @@ rule
|
|
405
366
|
|
406
367
|
result = [ val[0], @context.dup ]
|
407
368
|
@context.in_def = true
|
369
|
+
@context.cant_return = false
|
408
370
|
}
|
409
371
|
|
410
372
|
defn_head: k_def def_name
|
@@ -488,6 +450,14 @@ rule
|
|
488
450
|
result = @builder.block(method_call,
|
489
451
|
begin_t, args, body, end_t)
|
490
452
|
}
|
453
|
+
| primary_value tCOLON2 tCONSTANT tLCURLY brace_body tRCURLY
|
454
|
+
{
|
455
|
+
method_call = @builder.call_method(val[0], val[1], val[2],
|
456
|
+
nil, [], nil)
|
457
|
+
|
458
|
+
args, body = val[4]
|
459
|
+
result = @builder.block(method_call, val[3], args, body, val[5])
|
460
|
+
}
|
491
461
|
| kSUPER command_args
|
492
462
|
{
|
493
463
|
result = @builder.keyword_cmd(:super, val[0],
|
@@ -922,13 +892,9 @@ rule
|
|
922
892
|
{
|
923
893
|
result = @builder.logical_op(:or, val[0], val[1], val[2])
|
924
894
|
}
|
925
|
-
| kDEFINED opt_nl
|
895
|
+
| kDEFINED opt_nl begin_defined arg
|
926
896
|
{
|
927
|
-
@context.in_defined =
|
928
|
-
}
|
929
|
-
arg
|
930
|
-
{
|
931
|
-
@context.in_defined = false
|
897
|
+
@context.in_defined = val[2].in_defined
|
932
898
|
result = @builder.keyword_cmd(:defined?, val[0], nil, [ val[3] ], nil)
|
933
899
|
}
|
934
900
|
| arg tEH arg opt_nl tCOLON arg
|
@@ -936,7 +902,7 @@ rule
|
|
936
902
|
result = @builder.ternary(val[0], val[1],
|
937
903
|
val[2], val[4], val[5])
|
938
904
|
}
|
939
|
-
| defn_head f_opt_paren_args tEQL
|
905
|
+
| defn_head f_opt_paren_args tEQL endless_arg
|
940
906
|
{
|
941
907
|
def_t, (name_t, ctx) = val[0]
|
942
908
|
endless_method_name(name_t)
|
@@ -948,25 +914,7 @@ rule
|
|
948
914
|
@current_arg_stack.pop
|
949
915
|
@context.in_def = ctx.in_def
|
950
916
|
}
|
951
|
-
|
|
952
|
-
{
|
953
|
-
def_t, (name_t, ctx) = val[0]
|
954
|
-
endless_method_name(name_t)
|
955
|
-
|
956
|
-
rescue_body = @builder.rescue_body(val[4],
|
957
|
-
nil, nil, nil,
|
958
|
-
nil, val[5])
|
959
|
-
|
960
|
-
method_body = @builder.begin_body(val[3], [ rescue_body ])
|
961
|
-
|
962
|
-
result = @builder.def_endless_method(def_t, name_t,
|
963
|
-
val[1], val[2], method_body)
|
964
|
-
|
965
|
-
local_pop
|
966
|
-
@current_arg_stack.pop
|
967
|
-
@context.in_def = ctx.in_def
|
968
|
-
}
|
969
|
-
| defs_head f_opt_paren_args tEQL arg
|
917
|
+
| defs_head f_opt_paren_args tEQL endless_arg
|
970
918
|
{
|
971
919
|
def_t, recv, dot_t, (name_t, ctx) = val[0]
|
972
920
|
endless_method_name(name_t)
|
@@ -978,25 +926,21 @@ rule
|
|
978
926
|
@current_arg_stack.pop
|
979
927
|
@context.in_def = ctx.in_def
|
980
928
|
}
|
981
|
-
|
|
982
|
-
{
|
983
|
-
def_t, recv, dot_t, (name_t, ctx) = val[0]
|
984
|
-
endless_method_name(name_t)
|
929
|
+
| primary
|
985
930
|
|
986
|
-
|
931
|
+
endless_arg: arg=kRESCUE_MOD
|
932
|
+
| endless_arg kRESCUE_MOD arg
|
933
|
+
{
|
934
|
+
rescue_body = @builder.rescue_body(val[1],
|
987
935
|
nil, nil, nil,
|
988
|
-
nil, val[
|
989
|
-
|
990
|
-
method_body = @builder.begin_body(val[3], [ rescue_body ])
|
991
|
-
|
992
|
-
result = @builder.def_endless_singleton(def_t, recv, dot_t, name_t,
|
993
|
-
val[1], val[2], method_body)
|
936
|
+
nil, val[2])
|
994
937
|
|
995
|
-
|
996
|
-
|
997
|
-
|
938
|
+
result = @builder.begin_body(val[0], [ rescue_body ])
|
939
|
+
}
|
940
|
+
| kNOT opt_nl endless_arg
|
941
|
+
{
|
942
|
+
result = @builder.not_op(val[0], nil, val[2], nil)
|
998
943
|
}
|
999
|
-
| primary
|
1000
944
|
|
1001
945
|
relop: tGT | tLT | tGEQ | tLEQ
|
1002
946
|
|
@@ -1009,6 +953,11 @@ rule
|
|
1009
953
|
result = @builder.binary_op(val[0], val[1], val[2])
|
1010
954
|
}
|
1011
955
|
|
956
|
+
begin_defined: none
|
957
|
+
{
|
958
|
+
result = @context.dup
|
959
|
+
}
|
960
|
+
|
1012
961
|
arg_value: arg
|
1013
962
|
|
1014
963
|
aref_args: none
|
@@ -1152,6 +1101,11 @@ rule
|
|
1152
1101
|
diagnostic :error, :no_anonymous_blockarg, nil, val[0]
|
1153
1102
|
end
|
1154
1103
|
|
1104
|
+
if @context.in_dynamic_block? && context.in_def &&
|
1105
|
+
@static_env.declared_anonymous_blockarg_in_current_scpe? && @static_env.parent_has_anonymous_blockarg?
|
1106
|
+
diagnostic :error, :ambiguous_anonymous_blockarg, nil, val[0]
|
1107
|
+
end
|
1108
|
+
|
1155
1109
|
result = @builder.block_pass(val[0], nil)
|
1156
1110
|
}
|
1157
1111
|
|
@@ -1168,17 +1122,32 @@ rule
|
|
1168
1122
|
{
|
1169
1123
|
result = [ val[0] ]
|
1170
1124
|
}
|
1171
|
-
|
|
1172
|
-
{
|
1173
|
-
result = [ @builder.splat(val[0], val[1]) ]
|
1174
|
-
}
|
1125
|
+
| arg_splat
|
1175
1126
|
| args tCOMMA arg_value
|
1176
1127
|
{
|
1177
1128
|
result = val[0] << val[2]
|
1178
1129
|
}
|
1179
|
-
| args tCOMMA
|
1130
|
+
| args tCOMMA arg_splat
|
1180
1131
|
{
|
1181
|
-
result = val[0]
|
1132
|
+
result = val[0].concat(val[2])
|
1133
|
+
}
|
1134
|
+
|
1135
|
+
arg_splat: tSTAR arg_value
|
1136
|
+
{
|
1137
|
+
result = [ @builder.splat(val[0], val[1]) ]
|
1138
|
+
}
|
1139
|
+
| tSTAR
|
1140
|
+
{
|
1141
|
+
if !@static_env.declared_anonymous_restarg?
|
1142
|
+
diagnostic :error, :no_anonymous_restarg, nil, val[0]
|
1143
|
+
end
|
1144
|
+
|
1145
|
+
if @context.in_dynamic_block? && context.in_def &&
|
1146
|
+
@static_env.declared_anonymous_restarg_in_current_scope? && @static_env.parent_has_anonymous_restarg?
|
1147
|
+
diagnostic :error, :ambiguous_anonymous_restarg, nil, val[0]
|
1148
|
+
end
|
1149
|
+
|
1150
|
+
result = [ @builder.forwarded_restarg(val[0]) ]
|
1182
1151
|
}
|
1183
1152
|
|
1184
1153
|
mrhs_arg: mrhs
|
@@ -1224,22 +1193,14 @@ rule
|
|
1224
1193
|
|
1225
1194
|
result = @builder.begin_keyword(val[0], val[2], val[3])
|
1226
1195
|
}
|
1227
|
-
| tLPAREN_ARG
|
1196
|
+
| tLPAREN_ARG compstmt
|
1228
1197
|
{
|
1229
1198
|
@lexer.state = :expr_endarg
|
1230
1199
|
}
|
1231
|
-
|
1200
|
+
tRPAREN
|
1232
1201
|
{
|
1233
1202
|
result = @builder.begin(val[0], val[1], val[3])
|
1234
1203
|
}
|
1235
|
-
| tLPAREN_ARG
|
1236
|
-
{
|
1237
|
-
@lexer.state = :expr_endarg
|
1238
|
-
}
|
1239
|
-
opt_nl tRPAREN
|
1240
|
-
{
|
1241
|
-
result = @builder.begin(val[0], nil, val[3])
|
1242
|
-
}
|
1243
1204
|
| tLPAREN compstmt tRPAREN
|
1244
1205
|
{
|
1245
1206
|
result = @builder.begin(val[0], val[1], val[2])
|
@@ -1276,13 +1237,9 @@ rule
|
|
1276
1237
|
{
|
1277
1238
|
result = @builder.keyword_cmd(:yield, val[0])
|
1278
1239
|
}
|
1279
|
-
| kDEFINED opt_nl tLPAREN2
|
1240
|
+
| kDEFINED opt_nl tLPAREN2 begin_defined expr rparen
|
1280
1241
|
{
|
1281
|
-
@context.in_defined =
|
1282
|
-
}
|
1283
|
-
expr rparen
|
1284
|
-
{
|
1285
|
-
@context.in_defined = false
|
1242
|
+
@context.in_defined = val[3].in_defined
|
1286
1243
|
result = @builder.keyword_cmd(:defined?, val[0],
|
1287
1244
|
val[2], [ val[4] ], val[5])
|
1288
1245
|
}
|
@@ -1363,6 +1320,7 @@ rule
|
|
1363
1320
|
| k_class cpath superclass
|
1364
1321
|
{
|
1365
1322
|
@context.in_class = true
|
1323
|
+
@context.cant_return = true
|
1366
1324
|
local_push
|
1367
1325
|
}
|
1368
1326
|
bodystmt kEND
|
@@ -1378,11 +1336,13 @@ rule
|
|
1378
1336
|
|
1379
1337
|
local_pop
|
1380
1338
|
@context.in_class = ctx.in_class
|
1339
|
+
@context.cant_return = ctx.cant_return
|
1381
1340
|
}
|
1382
|
-
| k_class tLSHFT
|
1341
|
+
| k_class tLSHFT expr_value term
|
1383
1342
|
{
|
1384
1343
|
@context.in_def = false
|
1385
1344
|
@context.in_class = false
|
1345
|
+
@context.cant_return = true
|
1386
1346
|
local_push
|
1387
1347
|
}
|
1388
1348
|
bodystmt kEND
|
@@ -1394,10 +1354,12 @@ rule
|
|
1394
1354
|
local_pop
|
1395
1355
|
@context.in_def = ctx.in_def
|
1396
1356
|
@context.in_class = ctx.in_class
|
1357
|
+
@context.cant_return = ctx.cant_return
|
1397
1358
|
}
|
1398
1359
|
| k_module cpath
|
1399
1360
|
{
|
1400
1361
|
@context.in_class = true
|
1362
|
+
@context.cant_return = true
|
1401
1363
|
local_push
|
1402
1364
|
}
|
1403
1365
|
bodystmt kEND
|
@@ -1411,6 +1373,7 @@ rule
|
|
1411
1373
|
|
1412
1374
|
local_pop
|
1413
1375
|
@context.in_class = ctx.in_class
|
1376
|
+
@context.cant_return = ctx.cant_return
|
1414
1377
|
}
|
1415
1378
|
| defn_head f_arglist bodystmt kEND
|
1416
1379
|
{
|
@@ -1448,10 +1411,6 @@ rule
|
|
1448
1411
|
{
|
1449
1412
|
result = @builder.keyword_cmd(:retry, val[0])
|
1450
1413
|
}
|
1451
|
-
| primary_value tMETHREF operation2
|
1452
|
-
{
|
1453
|
-
result = @builder.method_ref(val[0], val[1], val[2])
|
1454
|
-
}
|
1455
1414
|
|
1456
1415
|
primary_value: primary
|
1457
1416
|
|
@@ -1473,7 +1432,7 @@ rule
|
|
1473
1432
|
|
1474
1433
|
k_return: kRETURN
|
1475
1434
|
{
|
1476
|
-
if @context.
|
1435
|
+
if @context.cant_return && !(context.in_block || context.in_lambda)
|
1477
1436
|
diagnostic :error, :invalid_return, nil, val[0]
|
1478
1437
|
end
|
1479
1438
|
}
|
@@ -1950,17 +1909,26 @@ opt_block_args_tail:
|
|
1950
1909
|
}
|
1951
1910
|
| case_body
|
1952
1911
|
|
1953
|
-
|
1912
|
+
p_pvtbl: none
|
1954
1913
|
{
|
1955
|
-
@lexer.state = :expr_beg
|
1956
|
-
@lexer.command_start = false
|
1957
1914
|
@pattern_variables.push
|
1915
|
+
}
|
1916
|
+
|
1917
|
+
p_pktbl: none
|
1918
|
+
{
|
1958
1919
|
@pattern_hash_keys.push
|
1920
|
+
}
|
1959
1921
|
|
1922
|
+
p_in_kwarg: none
|
1923
|
+
{
|
1960
1924
|
result = @context.in_kwarg
|
1925
|
+
|
1926
|
+
@lexer.state = :expr_beg
|
1927
|
+
@lexer.command_start = false
|
1961
1928
|
@context.in_kwarg = true
|
1962
1929
|
}
|
1963
|
-
|
1930
|
+
|
1931
|
+
p_case_body: kIN p_in_kwarg p_pvtbl p_pktbl p_top_expr then
|
1964
1932
|
{
|
1965
1933
|
@pattern_variables.pop
|
1966
1934
|
@pattern_hash_keys.pop
|
@@ -1968,8 +1936,8 @@ opt_block_args_tail:
|
|
1968
1936
|
}
|
1969
1937
|
compstmt p_cases
|
1970
1938
|
{
|
1971
|
-
result = [ @builder.in_pattern(val[0], *val[
|
1972
|
-
*val[
|
1939
|
+
result = [ @builder.in_pattern(val[0], *val[4], val[5], val[7]),
|
1940
|
+
*val[8] ]
|
1973
1941
|
}
|
1974
1942
|
|
1975
1943
|
p_cases: opt_else
|
@@ -2345,7 +2313,7 @@ opt_block_args_tail:
|
|
2345
2313
|
result = @builder.pin(val[0], non_lvar)
|
2346
2314
|
}
|
2347
2315
|
|
2348
|
-
p_expr_ref: tCARET tLPAREN expr_value
|
2316
|
+
p_expr_ref: tCARET tLPAREN expr_value rparen
|
2349
2317
|
{
|
2350
2318
|
expr = @builder.begin(val[1], val[2], val[3])
|
2351
2319
|
result = @builder.pin(val[0], expr)
|
@@ -2445,6 +2413,9 @@ opt_block_args_tail:
|
|
2445
2413
|
result = @builder.regexp_compose(val[0], val[1], val[2], opts)
|
2446
2414
|
}
|
2447
2415
|
|
2416
|
+
words_sep: tSPACE
|
2417
|
+
| words_sep tSPACE
|
2418
|
+
|
2448
2419
|
words: tWORDS_BEG word_list tSTRING_END
|
2449
2420
|
{
|
2450
2421
|
result = @builder.words_compose(val[0], val[1], val[2])
|
@@ -2454,7 +2425,7 @@ opt_block_args_tail:
|
|
2454
2425
|
{
|
2455
2426
|
result = []
|
2456
2427
|
}
|
2457
|
-
| word_list word
|
2428
|
+
| word_list word words_sep
|
2458
2429
|
{
|
2459
2430
|
result = val[0] << @builder.word(val[1])
|
2460
2431
|
}
|
@@ -2477,7 +2448,7 @@ opt_block_args_tail:
|
|
2477
2448
|
{
|
2478
2449
|
result = []
|
2479
2450
|
}
|
2480
|
-
| symbol_list word
|
2451
|
+
| symbol_list word words_sep
|
2481
2452
|
{
|
2482
2453
|
result = val[0] << @builder.word(val[1])
|
2483
2454
|
}
|
@@ -2496,7 +2467,7 @@ opt_block_args_tail:
|
|
2496
2467
|
{
|
2497
2468
|
result = []
|
2498
2469
|
}
|
2499
|
-
| qword_list tSTRING_CONTENT
|
2470
|
+
| qword_list tSTRING_CONTENT words_sep
|
2500
2471
|
{
|
2501
2472
|
result = val[0] << @builder.string_internal(val[1])
|
2502
2473
|
}
|
@@ -2505,7 +2476,7 @@ opt_block_args_tail:
|
|
2505
2476
|
{
|
2506
2477
|
result = []
|
2507
2478
|
}
|
2508
|
-
| qsym_list tSTRING_CONTENT
|
2479
|
+
| qsym_list tSTRING_CONTENT words_sep
|
2509
2480
|
{
|
2510
2481
|
result = val[0] << @builder.symbol_internal(val[1])
|
2511
2482
|
}
|
@@ -2550,7 +2521,7 @@ regexp_contents: # nothing
|
|
2550
2521
|
@lexer.cmdarg.push(false)
|
2551
2522
|
@lexer.cond.push(false)
|
2552
2523
|
}
|
2553
|
-
compstmt
|
2524
|
+
compstmt string_dend
|
2554
2525
|
{
|
2555
2526
|
@lexer.cmdarg.pop
|
2556
2527
|
@lexer.cond.pop
|
@@ -2558,17 +2529,11 @@ regexp_contents: # nothing
|
|
2558
2529
|
result = @builder.begin(val[0], val[2], val[3])
|
2559
2530
|
}
|
2560
2531
|
|
2561
|
-
|
2562
|
-
|
2563
|
-
|
2564
|
-
}
|
2565
|
-
| tIVAR
|
2566
|
-
{
|
2567
|
-
result = @builder.ivar(val[0])
|
2568
|
-
}
|
2569
|
-
| tCVAR
|
2532
|
+
string_dend: tSTRING_DEND
|
2533
|
+
|
2534
|
+
string_dvar: nonlocal_var
|
2570
2535
|
{
|
2571
|
-
result = @builder.
|
2536
|
+
result = @builder.accessible(val[0])
|
2572
2537
|
}
|
2573
2538
|
| backref
|
2574
2539
|
|
@@ -2639,22 +2604,11 @@ regexp_contents: # nothing
|
|
2639
2604
|
{
|
2640
2605
|
result = @builder.ident(val[0])
|
2641
2606
|
}
|
2642
|
-
| tIVAR
|
2643
|
-
{
|
2644
|
-
result = @builder.ivar(val[0])
|
2645
|
-
}
|
2646
|
-
| tGVAR
|
2647
|
-
{
|
2648
|
-
result = @builder.gvar(val[0])
|
2649
|
-
}
|
2650
2607
|
| tCONSTANT
|
2651
2608
|
{
|
2652
2609
|
result = @builder.const(val[0])
|
2653
2610
|
}
|
2654
|
-
|
|
2655
|
-
{
|
2656
|
-
result = @builder.cvar(val[0])
|
2657
|
-
}
|
2611
|
+
| nonlocal_var
|
2658
2612
|
|
2659
2613
|
keyword_variable: kNIL
|
2660
2614
|
{
|
@@ -3002,6 +2956,8 @@ f_opt_paren_args: f_paren_args
|
|
3002
2956
|
}
|
3003
2957
|
| kwrest_mark
|
3004
2958
|
{
|
2959
|
+
@static_env.declare_anonymous_kwrestarg
|
2960
|
+
|
3005
2961
|
result = [ @builder.kwrestarg(val[0]) ]
|
3006
2962
|
}
|
3007
2963
|
|
@@ -3047,6 +3003,8 @@ f_opt_paren_args: f_paren_args
|
|
3047
3003
|
}
|
3048
3004
|
| restarg_mark
|
3049
3005
|
{
|
3006
|
+
@static_env.declare_anonymous_restarg
|
3007
|
+
|
3050
3008
|
result = [ @builder.restarg(val[0]) ]
|
3051
3009
|
}
|
3052
3010
|
|
@@ -3115,6 +3073,19 @@ f_opt_paren_args: f_paren_args
|
|
3115
3073
|
{
|
3116
3074
|
result = @builder.kwsplat(val[0], val[1])
|
3117
3075
|
}
|
3076
|
+
| tDSTAR
|
3077
|
+
{
|
3078
|
+
if !@static_env.declared_anonymous_kwrestarg?
|
3079
|
+
diagnostic :error, :no_anonymous_kwrestarg, nil, val[0]
|
3080
|
+
end
|
3081
|
+
|
3082
|
+
if @context.in_dynamic_block? && context.in_def &&
|
3083
|
+
@static_env.declared_anonymous_kwrestarg_in_current_scope? && @static_env.parent_has_anonymous_kwrestarg?
|
3084
|
+
diagnostic :error, :ambiguous_anonymous_kwrestarg, nil, val[0]
|
3085
|
+
end
|
3086
|
+
|
3087
|
+
result = @builder.forwarded_kwrestarg(val[0])
|
3088
|
+
}
|
3118
3089
|
|
3119
3090
|
operation: tIDENTIFIER | tCONSTANT | tFID
|
3120
3091
|
operation2: operation | op
|
@@ -3142,7 +3113,7 @@ f_opt_paren_args: f_paren_args
|
|
3142
3113
|
{
|
3143
3114
|
result = val[1]
|
3144
3115
|
}
|
3145
|
-
trailer:
|
3116
|
+
trailer: opt_nl | tCOMMA
|
3146
3117
|
|
3147
3118
|
term: tSEMI
|
3148
3119
|
{
|
@@ -3169,7 +3140,7 @@ require 'parser/ruby-next/parser_ext'
|
|
3169
3140
|
prepend Parser::NextExt
|
3170
3141
|
|
3171
3142
|
def version
|
3172
|
-
|
3143
|
+
34
|
3173
3144
|
end
|
3174
3145
|
|
3175
3146
|
def default_encoding
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-next-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -35,12 +35,9 @@ files:
|
|
35
35
|
- lib/parser/ruby-next/AST_FORMAT.md
|
36
36
|
- lib/parser/ruby-next/ast/processor.rb
|
37
37
|
- lib/parser/ruby-next/builder.rb
|
38
|
-
- lib/parser/ruby-next/lexer.rb
|
39
|
-
- lib/parser/ruby-next/lexer.rl
|
40
38
|
- lib/parser/ruby-next/meta.rb
|
41
39
|
- lib/parser/ruby-next/parser_ext.rb
|
42
40
|
- lib/parser/ruby-next/version.rb
|
43
|
-
- lib/parser/rubynext.rb
|
44
41
|
- lib/parser/rubynext.y
|
45
42
|
homepage: http://github.com/ruby-next/parser
|
46
43
|
licenses:
|
@@ -48,7 +45,7 @@ licenses:
|
|
48
45
|
metadata:
|
49
46
|
homepage_uri: http://github.com/ruby-next/parser
|
50
47
|
source_code_uri: http://github.com/ruby-next/parser
|
51
|
-
post_install_message:
|
48
|
+
post_install_message:
|
52
49
|
rdoc_options: []
|
53
50
|
require_paths:
|
54
51
|
- lib
|
@@ -63,8 +60,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
60
|
- !ruby/object:Gem::Version
|
64
61
|
version: '0'
|
65
62
|
requirements: []
|
66
|
-
rubygems_version: 3.
|
67
|
-
signing_key:
|
63
|
+
rubygems_version: 3.4.19
|
64
|
+
signing_key:
|
68
65
|
specification_version: 4
|
69
66
|
summary: Parser extension to support edge and experimental Ruby syntax
|
70
67
|
test_files: []
|