ruby_parser 3.20.0 → 3.20.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/ruby26_parser.rb CHANGED
@@ -111,7 +111,7 @@ racc_action_table = [
111
111
  553, 717, 722, -303, -303, -303, -303, -303, -303, -303,
112
112
  -303, -303, -303, -303, -303, -303, -303, 231, 725, -303,
113
113
  -303, -303, 611, 674, 608, 607, 606, -303, 609, 782,
114
- -303, 231, 235, 732, 733, -303, 522, -303, 786, -303,
114
+ -303, 231, 235, 235, 733, -303, 522, -303, 786, -303,
115
115
  -303, -303, -303, -303, -303, -303, 231, -303, 736, -303,
116
116
  725, 725, 611, 575, 608, 607, 606, 616, 609, 725,
117
117
  782, 759, -303, -303, 764, -303, 770, -303, 619, 786,
@@ -5328,7 +5328,7 @@ racc_action_pointer = [
5328
5328
  754, 742, 741, nil, nil, 743, 17201, 750, 17340, 25150,
5329
5329
  25218, 620, 790, nil, 17479, 752, nil, 17618, 17757, 25286,
5330
5330
  25354, 1038, 2722, 17896, 875, 889, 786, nil, nil, 436,
5331
- 450, 818, 801, nil, 507, 828, 3282, 916, nil, 3422,
5331
+ 450, 787, 801, nil, 507, 828, 3282, 916, nil, 3422,
5332
5332
  63, 921, 922, 917, 930, nil, nil, 18035, 25422, 25490,
5333
5333
  26, nil, 347, 483, -20, nil, 640, nil, 834, 18174,
5334
5334
  nil, 854, nil, nil, nil, 18313, nil, 881, nil, 817,
@@ -5440,7 +5440,7 @@ racc_action_default = [
5440
5440
  -651, -639, -81, -302, -97, -86, -651, -639, -650, -651,
5441
5441
  -651, -107, -651, -521, -651, -93, -98, -651, -651, -651,
5442
5442
  -651, -250, -242, -651, -460, -651, -639, -299, -252, -643,
5443
- -643, -651, -651, -613, -643, -651, -650, -366, -367, -650,
5443
+ -643, -639, -651, -613, -643, -651, -650, -366, -367, -650,
5444
5444
  -651, -651, -651, -651, -651, -361, -455, -650, -651, -651,
5445
5445
  -304, -59, -118, -119, -651, -121, -651, -294, -650, -651,
5446
5446
  -335, -548, -339, -631, -632, -651, -421, -570, -424, -609,
@@ -5513,17 +5513,17 @@ racc_goto_table = [
5513
5513
  368, 429, 9, 422, 738, 545, 865, 293, 306, 307,
5514
5514
  278, 419, 929, 690, 654, 343, 561, 689, 385, 562,
5515
5515
  366, 758, 382, 775, 777, 779, 592, 346, 348, 556,
5516
- 349, 350, 19, 369, 447, 876, 589, 878, 19, 1010,
5517
- 468, 371, 762, 591, 352, 352, 352, 352, 1031, 766,
5518
- 960, 519, 977, 237, 928, 930, 1014, 596, 1079, 295,
5519
- 885, 387, 237, 237, 237, 700, 19, 323, 323, 768,
5520
- 512, 1017, 513, 697, 697, 838, 869, 687, 1045, 613,
5521
- 745, 427, 854, 940, 388, 450, 466, 781, 473, 413,
5522
- 1057, 906, 19, 976, 391, 393, 903, 237, 237, 743,
5523
- 396, 237, 363, 399, 1027, 937, 317, 402, 405, 684,
5524
- 769, 991, 908, 866, 295, 295, 874, 456, 462, 792,
5525
- 793, 836, 408, 877, 295, 894, 891, 899, 1025, 700,
5526
- 595, nil, nil, 605, nil, 444, 445, 457, 896, nil,
5516
+ 349, 350, 19, 732, 447, 369, 876, 589, 19, 878,
5517
+ 468, 1010, 371, 762, 352, 352, 352, 352, 1031, 591,
5518
+ 766, 519, 960, 237, 977, 928, 930, 1014, 1079, 295,
5519
+ 596, 885, 237, 237, 237, 700, 19, 323, 323, 387,
5520
+ 768, 1017, 512, 697, 697, 513, 838, 869, 687, 613,
5521
+ 1045, 427, 745, 854, 940, 450, 466, 781, 473, 413,
5522
+ 1057, 906, 19, 976, 388, 391, 903, 237, 237, 743,
5523
+ 393, 237, 363, 396, 1027, 937, 317, 399, 402, 684,
5524
+ 769, 991, 405, 866, 295, 295, 874, 456, 462, 908,
5525
+ 792, 836, 793, 408, 295, 877, 894, 899, 891, 700,
5526
+ 1025, 595, nil, 605, nil, 444, 445, 457, 896, nil,
5527
5527
  450, nil, nil, nil, 469, 470, nil, nil, nil, 896,
5528
5528
  nil, nil, nil, nil, 518, 518, 827, nil, 19, nil,
5529
5529
  390, 546, nil, 237, 237, 237, 237, 19, 570, 542,
@@ -5550,7 +5550,7 @@ racc_goto_table = [
5550
5550
  295, 677, nil, nil, nil, 843, 19, nil, nil, nil,
5551
5551
  nil, 688, 457, nil, nil, 237, 19, 19, nil, nil,
5552
5552
  332, 875, nil, nil, 855, nil, 450, 466, 332, 586,
5553
- 712, 586, nil, nil, 950, 953, nil, 466, nil, 295,
5553
+ 712, 586, 665, nil, 950, 953, nil, 466, nil, 295,
5554
5554
  840, nil, nil, nil, 672, 751, 962, nil, 1077, 1078,
5555
5555
  nil, nil, nil, nil, nil, nil, 735, nil, nil, 737,
5556
5556
  nil, nil, 739, nil, nil, 450, 466, nil, nil, 1053,
@@ -5912,17 +5912,17 @@ racc_goto_check = [
5912
5912
  26, 30, 9, 32, 43, 65, 45, 58, 58, 58,
5913
5913
  49, 9, 162, 55, 74, 79, 81, 86, 98, 101,
5914
5914
  115, 117, 122, 207, 207, 207, 123, 124, 125, 126,
5915
- 127, 128, 35, 129, 75, 130, 131, 132, 35, 133,
5916
- 75, 134, 135, 136, 31, 31, 31, 31, 216, 137,
5917
- 138, 87, 149, 35, 150, 156, 163, 166, 164, 46,
5918
- 167, 168, 35, 35, 35, 220, 35, 35, 35, 169,
5919
- 174, 165, 175, 88, 88, 177, 178, 180, 181, 209,
5920
- 182, 14, 183, 184, 187, 6, 71, 146, 38, 7,
5921
- 148, 146, 35, 145, 189, 190, 147, 35, 35, 113,
5922
- 191, 35, 35, 194, 158, 160, 14, 195, 196, 36,
5923
- 170, 162, 197, 100, 46, 46, 68, 50, 50, 198,
5924
- 199, 53, 202, 203, 46, 208, 212, 215, 213, 220,
5925
- 219, nil, nil, 204, nil, 31, 31, 85, 210, nil,
5915
+ 127, 128, 35, 37, 75, 129, 130, 131, 35, 132,
5916
+ 75, 133, 134, 135, 31, 31, 31, 31, 216, 136,
5917
+ 137, 87, 138, 35, 149, 150, 156, 163, 164, 46,
5918
+ 166, 167, 35, 35, 35, 220, 35, 35, 35, 168,
5919
+ 169, 165, 174, 88, 88, 175, 177, 178, 180, 209,
5920
+ 181, 14, 182, 183, 184, 6, 71, 146, 38, 7,
5921
+ 148, 146, 35, 145, 187, 189, 147, 35, 35, 113,
5922
+ 190, 35, 35, 191, 158, 160, 14, 194, 195, 36,
5923
+ 170, 162, 196, 100, 46, 46, 68, 50, 50, 197,
5924
+ 198, 53, 199, 202, 46, 203, 208, 215, 212, 220,
5925
+ 213, 219, nil, 204, nil, 31, 31, 85, 210, nil,
5926
5926
  6, nil, nil, nil, 31, 31, nil, nil, nil, 210,
5927
5927
  nil, nil, nil, nil, 6, 6, 37, nil, 35, nil,
5928
5928
  6, 63, nil, 35, 35, 35, 35, 35, 24, 40,
@@ -5949,7 +5949,7 @@ racc_goto_check = [
5949
5949
  46, 85, nil, nil, nil, 65, 35, nil, nil, nil,
5950
5950
  nil, 51, 85, nil, nil, 35, 35, 35, nil, nil,
5951
5951
  78, 36, nil, nil, 29, nil, 6, 71, 78, 35,
5952
- 50, 35, nil, nil, 106, 12, nil, 71, nil, 46,
5952
+ 50, 35, 40, nil, 106, 12, nil, 71, nil, 46,
5953
5953
  87, nil, nil, nil, 85, 42, 12, nil, 100, 100,
5954
5954
  nil, nil, nil, nil, nil, nil, 14, nil, nil, 14,
5955
5955
  nil, nil, 118, nil, nil, 6, 71, nil, nil, 207,
@@ -6306,16 +6306,16 @@ racc_goto_pointer = [
6306
6306
  nil, nil, nil, nil, nil, nil, nil, nil, 83, nil,
6307
6307
  -490, -191, -46, nil, nil, nil, -325, -664, nil, -646,
6308
6308
  nil, nil, nil, -334, nil, 88, nil, -427, 2, nil,
6309
- nil, -549, 87, -216, 106, 106, -178, 107, 107, 100,
6310
- -583, -194, -584, -776, 107, -408, -198, -403, -693, nil,
6311
- nil, nil, nil, nil, nil, -790, -555, -546, -792, -712,
6312
- -637, nil, -362, -547, 244, 109, -636, -167, -739, -189,
6313
- -593, nil, -679, -767, -853, -840, -190, -568, 112, -387,
6314
- -347, -11, -202, nil, -77, -76, nil, -478, -529, nil,
6315
- -287, -789, -356, -501, -631, nil, nil, 132, 16, 137,
6316
- 137, 141, -279, 214, 143, 146, 146, -540, -373, -373,
6317
- nil, nil, 157, -496, -324, nil, nil, -439, -509, -168,
6318
- -694, -119, -504, -712, nil, -699, -871, nil, nil, -116,
6309
+ nil, -549, 87, -216, 106, 106, -178, 107, 107, 102,
6310
+ -582, -193, -582, -774, 108, -407, -192, -402, -691, nil,
6311
+ nil, nil, nil, nil, nil, -790, -555, -546, -792, -710,
6312
+ -636, nil, -362, -547, 244, 109, -635, -167, -739, -189,
6313
+ -593, nil, -679, -766, -853, -840, -187, -567, 120, -386,
6314
+ -347, -11, -202, nil, -75, -73, nil, -477, -528, nil,
6315
+ -286, -787, -354, -500, -630, nil, nil, 142, 16, 138,
6316
+ 142, 144, -279, 214, 147, 147, 150, -533, -372, -371,
6317
+ nil, nil, 158, -494, -324, nil, nil, -439, -508, -168,
6318
+ -694, -119, -502, -710, nil, -699, -871, nil, nil, -115,
6319
6319
  -462 ]
6320
6320
 
6321
6321
  racc_goto_default = [
@@ -6985,8 +6985,8 @@ racc_reduce_table = [
6985
6985
  1, 152, :_reduce_none,
6986
6986
  0, 187, :_reduce_none,
6987
6987
  1, 187, :_reduce_none,
6988
- 2, 208, :_reduce_none,
6989
- 2, 184, :_reduce_none,
6988
+ 2, 208, :_reduce_641,
6989
+ 2, 184, :_reduce_642,
6990
6990
  0, 230, :_reduce_none,
6991
6991
  1, 230, :_reduce_none,
6992
6992
  1, 230, :_reduce_none,
@@ -7776,6 +7776,7 @@ end
7776
7776
 
7777
7777
  def _reduce_38(val, _values, result)
7778
7778
  lhs, _, rhs = val
7779
+
7779
7780
  result = new_assign lhs, s(:svalue, rhs).line(rhs.line)
7780
7781
 
7781
7782
  result
@@ -8917,8 +8918,10 @@ def _reduce_257(val, _values, result)
8917
8918
  end
8918
8919
 
8919
8920
  def _reduce_258(val, _values, result)
8920
- _, args, _ = val
8921
+ _, args, (_, line_max) = val
8922
+
8921
8923
  result = args
8924
+ result.line_max = line_max if args
8922
8925
 
8923
8926
  result
8924
8927
  end
@@ -9199,10 +9202,12 @@ def _reduce_305(val, _values, result)
9199
9202
  end
9200
9203
 
9201
9204
  def _reduce_306(val, _values, result)
9202
- _, line, args, _ = val
9205
+ _, line, args, (_, line_max) = val
9206
+
9203
9207
  result = args || s(:array)
9204
9208
  result.sexp_type = :array # aref_args is :args
9205
9209
  result.line line
9210
+ result.line_max = line_max
9206
9211
 
9207
9212
  result
9208
9213
  end
@@ -9988,15 +9993,21 @@ end
9988
9993
  def _reduce_432(val, _values, result)
9989
9994
  call, args = val
9990
9995
 
9991
- result = call.concat args.sexp_body if args
9996
+ result = call
9997
+
9998
+ if args then
9999
+ call.concat args.sexp_body
10000
+ result.line_max = args.line_max
10001
+ end
9992
10002
 
9993
10003
  result
9994
10004
  end
9995
10005
 
9996
10006
  def _reduce_433(val, _values, result)
9997
- recv, call_op, (op, _line), args = val
10007
+ recv, call_op, (op, op_line), args = val
9998
10008
 
9999
10009
  result = new_call recv, op.to_sym, args, call_op
10010
+ result.line_max = op_line unless args
10000
10011
 
10001
10012
  result
10002
10013
  end
@@ -10283,17 +10294,19 @@ def _reduce_477(val, _values, result)
10283
10294
  end
10284
10295
 
10285
10296
  def _reduce_478(val, _values, result)
10286
- (_, line), _, _ = val
10297
+ (_, line), _, (_, line_max) = val
10287
10298
 
10288
10299
  result = s(:array).line line
10300
+ result.line_max = line_max
10289
10301
 
10290
10302
  result
10291
10303
  end
10292
10304
 
10293
10305
  def _reduce_479(val, _values, result)
10294
- (_, line), list, _ = val
10306
+ (_, line), list, (_, line_max) = val
10295
10307
 
10296
10308
  result = list.line line
10309
+ result.line_max = line_max
10297
10310
 
10298
10311
  result
10299
10312
  end
@@ -10319,17 +10332,19 @@ def _reduce_483(val, _values, result)
10319
10332
  end
10320
10333
 
10321
10334
  def _reduce_484(val, _values, result)
10322
- (_, line), _, _ = val
10335
+ (_, line), _, (_, line_max) = val
10323
10336
 
10324
10337
  result = s(:array).line line
10338
+ result.line_max = line_max
10325
10339
 
10326
10340
  result
10327
10341
  end
10328
10342
 
10329
10343
  def _reduce_485(val, _values, result)
10330
- (_, line), list, _, = val
10331
- list.line line
10332
- result = list
10344
+ (_, line), list, (_, line_max), = val
10345
+
10346
+ result = list.line line
10347
+ result.line_max = line_max
10333
10348
 
10334
10349
  result
10335
10350
  end
@@ -10348,33 +10363,37 @@ def _reduce_487(val, _values, result)
10348
10363
  end
10349
10364
 
10350
10365
  def _reduce_488(val, _values, result)
10351
- (_, line), _, _ = val
10366
+ (_, line), _, (_, line_max) = val
10352
10367
 
10353
10368
  result = s(:array).line line
10369
+ result.line_max = line_max
10354
10370
 
10355
10371
  result
10356
10372
  end
10357
10373
 
10358
10374
  def _reduce_489(val, _values, result)
10359
- (_, line), list, _ = val
10375
+ (_, line), list, (_, line_max) = val
10360
10376
 
10361
10377
  result = list.line line
10378
+ result.line_max = line_max
10362
10379
 
10363
10380
  result
10364
10381
  end
10365
10382
 
10366
10383
  def _reduce_490(val, _values, result)
10367
- (_, line), _, _ = val
10384
+ (_, line), _, (_, line_max) = val
10368
10385
 
10369
10386
  result = s(:array).line line
10387
+ result.line_max = line_max
10370
10388
 
10371
10389
  result
10372
10390
  end
10373
10391
 
10374
10392
  def _reduce_491(val, _values, result)
10375
- (_, line), list, _ = val
10393
+ (_, line), list, (_, line_max) = val
10376
10394
 
10377
10395
  result = list.line line
10396
+ result.line_max = line_max
10378
10397
 
10379
10398
  result
10380
10399
  end
@@ -10923,7 +10942,14 @@ def _reduce_581(val, _values, result)
10923
10942
  result = s(:args, list).line list.line
10924
10943
  end
10925
10944
 
10926
- result << (Sexp === item ? item : item.first)
10945
+ if Sexp === item then
10946
+ line_max = item.line_max
10947
+ else
10948
+ item, line_max = item
10949
+ end
10950
+
10951
+ result << item
10952
+ result.line_max = line_max
10927
10953
 
10928
10954
  result
10929
10955
  end
@@ -11217,9 +11243,19 @@ end
11217
11243
 
11218
11244
  # reduce 640 omitted
11219
11245
 
11220
- # reduce 641 omitted
11246
+ def _reduce_641(val, _values, result)
11247
+ _, close = val
11248
+ result = [close, lexer.lineno]
11249
+
11250
+ result
11251
+ end
11252
+
11253
+ def _reduce_642(val, _values, result)
11254
+ _, close = val
11255
+ result = [close, lexer.lineno]
11221
11256
 
11222
- # reduce 642 omitted
11257
+ result
11258
+ end
11223
11259
 
11224
11260
  # reduce 643 omitted
11225
11261
 
data/lib/ruby26_parser.y CHANGED
@@ -223,6 +223,7 @@ rule
223
223
  | lhs tEQL mrhs
224
224
  {
225
225
  lhs, _, rhs = val
226
+
226
227
  result = new_assign lhs, s(:svalue, rhs).line(rhs.line)
227
228
  }
228
229
  | mlhs tEQL mrhs_arg
@@ -998,8 +999,10 @@ rule
998
999
 
999
1000
  paren_args: tLPAREN2 opt_call_args rparen
1000
1001
  {
1001
- _, args, _ = val
1002
+ _, args, (_, line_max) = val
1003
+
1002
1004
  result = args
1005
+ result.line_max = line_max if args
1003
1006
  }
1004
1007
 
1005
1008
  opt_paren_args: none
@@ -1204,12 +1207,14 @@ rule
1204
1207
  {
1205
1208
  result = wrap :colon3, val[1]
1206
1209
  }
1207
- | tLBRACK { result = lexer.lineno } aref_args tRBRACK
1210
+ | tLBRACK { result = lexer.lineno } aref_args rbracket
1208
1211
  {
1209
- _, line, args, _ = val
1212
+ _, line, args, (_, line_max) = val
1213
+
1210
1214
  result = args || s(:array)
1211
1215
  result.sexp_type = :array # aref_args is :args
1212
1216
  result.line line
1217
+ result.line_max = line_max
1213
1218
  }
1214
1219
  | tLBRACE
1215
1220
  {
@@ -1797,13 +1802,19 @@ opt_block_args_tail: tCOMMA block_args_tail
1797
1802
  {
1798
1803
  call, args = val
1799
1804
 
1800
- result = call.concat args.sexp_body if args
1805
+ result = call
1806
+
1807
+ if args then
1808
+ call.concat args.sexp_body
1809
+ result.line_max = args.line_max
1810
+ end
1801
1811
  }
1802
1812
  | primary_value call_op operation2 opt_paren_args
1803
1813
  {
1804
- recv, call_op, (op, _line), args = val
1814
+ recv, call_op, (op, op_line), args = val
1805
1815
 
1806
1816
  result = new_call recv, op.to_sym, args, call_op
1817
+ result.line_max = op_line unless args
1807
1818
  }
1808
1819
  | primary_value tCOLON2 operation2 paren_args
1809
1820
  {
@@ -2017,15 +2028,17 @@ opt_block_args_tail: tCOMMA block_args_tail
2017
2028
 
2018
2029
  words: tWORDS_BEG tSPACE tSTRING_END
2019
2030
  {
2020
- (_, line), _, _ = val
2031
+ (_, line), _, (_, line_max) = val
2021
2032
 
2022
2033
  result = s(:array).line line
2034
+ result.line_max = line_max
2023
2035
  }
2024
2036
  | tWORDS_BEG word_list tSTRING_END
2025
2037
  {
2026
- (_, line), list, _ = val
2038
+ (_, line), list, (_, line_max) = val
2027
2039
 
2028
2040
  result = list.line line
2041
+ result.line_max = line_max
2029
2042
  }
2030
2043
 
2031
2044
  word_list: none
@@ -2045,15 +2058,17 @@ opt_block_args_tail: tCOMMA block_args_tail
2045
2058
 
2046
2059
  symbols: tSYMBOLS_BEG tSPACE tSTRING_END
2047
2060
  {
2048
- (_, line), _, _ = val
2061
+ (_, line), _, (_, line_max) = val
2049
2062
 
2050
2063
  result = s(:array).line line
2064
+ result.line_max = line_max
2051
2065
  }
2052
2066
  | tSYMBOLS_BEG symbol_list tSTRING_END
2053
2067
  {
2054
- (_, line), list, _, = val
2055
- list.line line
2056
- result = list
2068
+ (_, line), list, (_, line_max), = val
2069
+
2070
+ result = list.line line
2071
+ result.line_max = line_max
2057
2072
  }
2058
2073
 
2059
2074
  symbol_list: none
@@ -2068,28 +2083,32 @@ opt_block_args_tail: tCOMMA block_args_tail
2068
2083
 
2069
2084
  qwords: tQWORDS_BEG tSPACE tSTRING_END
2070
2085
  {
2071
- (_, line), _, _ = val
2086
+ (_, line), _, (_, line_max) = val
2072
2087
 
2073
2088
  result = s(:array).line line
2089
+ result.line_max = line_max
2074
2090
  }
2075
2091
  | tQWORDS_BEG qword_list tSTRING_END
2076
2092
  {
2077
- (_, line), list, _ = val
2093
+ (_, line), list, (_, line_max) = val
2078
2094
 
2079
2095
  result = list.line line
2096
+ result.line_max = line_max
2080
2097
  }
2081
2098
 
2082
2099
  qsymbols: tQSYMBOLS_BEG tSPACE tSTRING_END
2083
2100
  {
2084
- (_, line), _, _ = val
2101
+ (_, line), _, (_, line_max) = val
2085
2102
 
2086
2103
  result = s(:array).line line
2104
+ result.line_max = line_max
2087
2105
  }
2088
2106
  | tQSYMBOLS_BEG qsym_list tSTRING_END
2089
2107
  {
2090
- (_, line), list, _ = val
2108
+ (_, line), list, (_, line_max) = val
2091
2109
 
2092
2110
  result = list.line line
2111
+ result.line_max = line_max
2093
2112
  }
2094
2113
 
2095
2114
  qword_list: none
@@ -2493,7 +2512,14 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2493
2512
  result = s(:args, list).line list.line
2494
2513
  end
2495
2514
 
2496
- result << (Sexp === item ? item : item.first)
2515
+ if Sexp === item then
2516
+ line_max = item.line_max
2517
+ else
2518
+ item, line_max = item
2519
+ end
2520
+
2521
+ result << item
2522
+ result.line_max = line_max
2497
2523
  }
2498
2524
 
2499
2525
  f_label: tLABEL
@@ -2711,7 +2737,15 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2711
2737
  opt_terms: | terms
2712
2738
  opt_nl: | tNL
2713
2739
  rparen: opt_nl tRPAREN
2740
+ {
2741
+ _, close = val
2742
+ result = [close, lexer.lineno]
2743
+ }
2714
2744
  rbracket: opt_nl tRBRACK
2745
+ {
2746
+ _, close = val
2747
+ result = [close, lexer.lineno]
2748
+ }
2715
2749
  trailer: | tNL | tCOMMA
2716
2750
 
2717
2751
  term: tSEMI { yyerrok }