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/ruby25_parser.rb CHANGED
@@ -106,7 +106,7 @@ racc_action_table = [
106
106
  -302, 230, -95, 614, 706, 235, 553, -302, 755, 717,
107
107
  722, -302, 624, 623, 627, 626, -302, 757, -302, -301,
108
108
  -301, -301, -301, -301, -301, -301, -301, -302, -301, -301,
109
- 725, 235, 732, -623, 733, 522, -301, -301, 736, 725,
109
+ 725, 235, 235, -623, 733, 522, -301, -301, 736, 725,
110
110
  611, -623, 608, 607, 606, -301, 609, 725, 620, 575,
111
111
  -301, -301, -301, -301, -301, -301, -301, -301, -301, -301,
112
112
  -301, -301, -301, -301, -302, 231, -301, -301, -301, 725,
@@ -5326,7 +5326,7 @@ racc_action_pointer = [
5326
5326
  712, 702, 703, nil, nil, 705, 17197, 709, 17336, 25146,
5327
5327
  25214, 752, 746, nil, 17475, 710, nil, 17614, 17753, 25282,
5328
5328
  25350, 1298, 2718, 17892, 833, 851, 735, nil, nil, -80,
5329
- -68, 767, 751, nil, 340, 777, 3278, 856, nil, 3418,
5329
+ -68, 736, 751, nil, 340, 777, 3278, 856, nil, 3418,
5330
5330
  30, 860, 868, 863, 890, nil, nil, 18031, 25418, 25486,
5331
5331
  5, nil, 311, 342, 308, nil, 753, nil, 794, 18170,
5332
5332
  nil, 812, nil, nil, nil, 18309, nil, 744, nil, 774,
@@ -5438,7 +5438,7 @@ racc_action_default = [
5438
5438
  -649, -637, -81, -300, -97, -86, -649, -637, -648, -649,
5439
5439
  -649, -107, -649, -519, -649, -93, -98, -649, -649, -649,
5440
5440
  -649, -248, -240, -649, -458, -649, -637, -297, -250, -641,
5441
- -641, -649, -649, -611, -641, -649, -648, -364, -365, -648,
5441
+ -641, -637, -649, -611, -641, -649, -648, -364, -365, -648,
5442
5442
  -649, -649, -649, -649, -649, -359, -453, -648, -649, -649,
5443
5443
  -302, -59, -118, -119, -649, -121, -649, -292, -648, -649,
5444
5444
  -333, -546, -337, -629, -630, -649, -419, -568, -422, -607,
@@ -5511,17 +5511,17 @@ racc_goto_table = [
5511
5511
  368, 429, 9, 422, 738, 545, 865, 293, 306, 307,
5512
5512
  278, 419, 929, 690, 654, 343, 561, 689, 385, 562,
5513
5513
  366, 758, 382, 775, 777, 779, 592, 346, 348, 556,
5514
- 349, 350, 19, 369, 447, 876, 589, 878, 19, 1010,
5515
- 468, 371, 762, 591, 352, 352, 352, 352, 1031, 766,
5516
- 960, 519, 977, 237, 928, 930, 1014, 596, 1079, 295,
5517
- 885, 387, 237, 237, 237, 700, 19, 323, 323, 768,
5518
- 512, 1017, 513, 697, 697, 838, 869, 687, 1045, 613,
5519
- 745, 427, 854, 940, 388, 450, 466, 781, 473, 413,
5520
- 1057, 906, 19, 976, 391, 393, 903, 237, 237, 743,
5521
- 396, 237, 363, 399, 1027, 937, 317, 402, 405, 684,
5522
- 769, 991, 908, 866, 295, 295, 874, 456, 462, 792,
5523
- 793, 836, 408, 877, 295, 894, 891, 899, 1025, 700,
5524
- 595, nil, nil, 605, nil, 444, 445, 457, 896, nil,
5514
+ 349, 350, 19, 732, 447, 369, 876, 589, 19, 878,
5515
+ 468, 1010, 371, 762, 352, 352, 352, 352, 1031, 591,
5516
+ 766, 519, 960, 237, 977, 928, 930, 1014, 1079, 295,
5517
+ 596, 885, 237, 237, 237, 700, 19, 323, 323, 387,
5518
+ 768, 1017, 512, 697, 697, 513, 838, 869, 687, 613,
5519
+ 1045, 427, 745, 854, 940, 450, 466, 781, 473, 413,
5520
+ 1057, 906, 19, 976, 388, 391, 903, 237, 237, 743,
5521
+ 393, 237, 363, 396, 1027, 937, 317, 399, 402, 684,
5522
+ 769, 991, 405, 866, 295, 295, 874, 456, 462, 908,
5523
+ 792, 836, 793, 408, 295, 877, 894, 899, 891, 700,
5524
+ 1025, 595, nil, 605, nil, 444, 445, 457, 896, nil,
5525
5525
  450, nil, nil, nil, 469, 470, nil, nil, nil, 896,
5526
5526
  nil, nil, nil, nil, 518, 518, 827, nil, 19, nil,
5527
5527
  390, 546, nil, 237, 237, 237, 237, 19, 570, 542,
@@ -5548,7 +5548,7 @@ racc_goto_table = [
5548
5548
  295, 677, nil, nil, nil, 843, 19, nil, nil, nil,
5549
5549
  nil, 688, 457, nil, nil, 237, 19, 19, nil, nil,
5550
5550
  332, 875, nil, nil, 855, nil, 450, 466, 332, 586,
5551
- 712, 586, nil, nil, 950, 953, nil, 466, nil, 295,
5551
+ 712, 586, 665, nil, 950, 953, nil, 466, nil, 295,
5552
5552
  840, nil, nil, nil, 672, 751, 962, nil, 1077, 1078,
5553
5553
  nil, nil, nil, nil, nil, nil, 735, nil, nil, 737,
5554
5554
  nil, nil, 739, nil, nil, 450, 466, nil, nil, 1053,
@@ -5910,17 +5910,17 @@ racc_goto_check = [
5910
5910
  26, 30, 9, 32, 43, 65, 45, 58, 58, 58,
5911
5911
  49, 9, 162, 55, 74, 79, 81, 86, 98, 101,
5912
5912
  115, 117, 122, 207, 207, 207, 123, 124, 125, 126,
5913
- 127, 128, 35, 129, 75, 130, 131, 132, 35, 133,
5914
- 75, 134, 135, 136, 31, 31, 31, 31, 216, 137,
5915
- 138, 87, 149, 35, 150, 156, 163, 166, 164, 46,
5916
- 167, 168, 35, 35, 35, 220, 35, 35, 35, 169,
5917
- 174, 165, 175, 88, 88, 177, 178, 180, 181, 209,
5918
- 182, 14, 183, 184, 187, 6, 71, 146, 38, 7,
5919
- 148, 146, 35, 145, 189, 190, 147, 35, 35, 113,
5920
- 191, 35, 35, 194, 158, 160, 14, 195, 196, 36,
5921
- 170, 162, 197, 100, 46, 46, 68, 50, 50, 198,
5922
- 199, 53, 202, 203, 46, 208, 212, 215, 213, 220,
5923
- 219, nil, nil, 204, nil, 31, 31, 85, 210, nil,
5913
+ 127, 128, 35, 37, 75, 129, 130, 131, 35, 132,
5914
+ 75, 133, 134, 135, 31, 31, 31, 31, 216, 136,
5915
+ 137, 87, 138, 35, 149, 150, 156, 163, 164, 46,
5916
+ 166, 167, 35, 35, 35, 220, 35, 35, 35, 168,
5917
+ 169, 165, 174, 88, 88, 175, 177, 178, 180, 209,
5918
+ 181, 14, 182, 183, 184, 6, 71, 146, 38, 7,
5919
+ 148, 146, 35, 145, 187, 189, 147, 35, 35, 113,
5920
+ 190, 35, 35, 191, 158, 160, 14, 194, 195, 36,
5921
+ 170, 162, 196, 100, 46, 46, 68, 50, 50, 197,
5922
+ 198, 53, 199, 202, 46, 203, 208, 215, 212, 220,
5923
+ 213, 219, nil, 204, nil, 31, 31, 85, 210, nil,
5924
5924
  6, nil, nil, nil, 31, 31, nil, nil, nil, 210,
5925
5925
  nil, nil, nil, nil, 6, 6, 37, nil, 35, nil,
5926
5926
  6, 63, nil, 35, 35, 35, 35, 35, 24, 40,
@@ -5947,7 +5947,7 @@ racc_goto_check = [
5947
5947
  46, 85, nil, nil, nil, 65, 35, nil, nil, nil,
5948
5948
  nil, 51, 85, nil, nil, 35, 35, 35, nil, nil,
5949
5949
  78, 36, nil, nil, 29, nil, 6, 71, 78, 35,
5950
- 50, 35, nil, nil, 106, 12, nil, 71, nil, 46,
5950
+ 50, 35, 40, nil, 106, 12, nil, 71, nil, 46,
5951
5951
  87, nil, nil, nil, 85, 42, 12, nil, 100, 100,
5952
5952
  nil, nil, nil, nil, nil, nil, 14, nil, nil, 14,
5953
5953
  nil, nil, 118, nil, nil, 6, 71, nil, nil, 207,
@@ -6304,16 +6304,16 @@ racc_goto_pointer = [
6304
6304
  nil, nil, nil, nil, nil, nil, nil, nil, 83, nil,
6305
6305
  -490, -191, -46, nil, nil, nil, -325, -664, nil, -646,
6306
6306
  nil, nil, nil, -334, nil, 88, nil, -427, 2, nil,
6307
- nil, -549, 87, -216, 106, 106, -178, 107, 107, 100,
6308
- -583, -194, -584, -776, 107, -408, -198, -403, -693, nil,
6309
- nil, nil, nil, nil, nil, -790, -555, -546, -792, -712,
6310
- -637, nil, -362, -547, 244, 109, -636, -167, -739, -189,
6311
- -593, nil, -679, -767, -853, -840, -190, -568, 112, -387,
6312
- -347, -11, -202, nil, -77, -76, nil, -478, -529, nil,
6313
- -287, -789, -356, -501, -631, nil, nil, 132, 16, 137,
6314
- 137, 141, -279, 214, 143, 146, 146, -540, -373, -373,
6315
- nil, nil, 157, -496, -324, nil, nil, -439, -509, -168,
6316
- -694, -119, -504, -712, nil, -699, -871, nil, nil, -116,
6307
+ nil, -549, 87, -216, 106, 106, -178, 107, 107, 102,
6308
+ -582, -193, -582, -774, 108, -407, -192, -402, -691, nil,
6309
+ nil, nil, nil, nil, nil, -790, -555, -546, -792, -710,
6310
+ -636, nil, -362, -547, 244, 109, -635, -167, -739, -189,
6311
+ -593, nil, -679, -766, -853, -840, -187, -567, 120, -386,
6312
+ -347, -11, -202, nil, -75, -73, nil, -477, -528, nil,
6313
+ -286, -787, -354, -500, -630, nil, nil, 142, 16, 138,
6314
+ 142, 144, -279, 214, 147, 147, 150, -533, -372, -371,
6315
+ nil, nil, 158, -494, -324, nil, nil, -439, -508, -168,
6316
+ -694, -119, -502, -710, nil, -699, -871, nil, nil, -115,
6317
6317
  -462 ]
6318
6318
 
6319
6319
  racc_goto_default = [
@@ -6981,8 +6981,8 @@ racc_reduce_table = [
6981
6981
  1, 152, :_reduce_none,
6982
6982
  0, 187, :_reduce_none,
6983
6983
  1, 187, :_reduce_none,
6984
- 2, 208, :_reduce_none,
6985
- 2, 184, :_reduce_none,
6984
+ 2, 208, :_reduce_639,
6985
+ 2, 184, :_reduce_640,
6986
6986
  0, 230, :_reduce_none,
6987
6987
  1, 230, :_reduce_none,
6988
6988
  1, 230, :_reduce_none,
@@ -7772,6 +7772,7 @@ end
7772
7772
 
7773
7773
  def _reduce_38(val, _values, result)
7774
7774
  lhs, _, rhs = val
7775
+
7775
7776
  result = new_assign lhs, s(:svalue, rhs).line(rhs.line)
7776
7777
 
7777
7778
  result
@@ -8895,8 +8896,10 @@ def _reduce_255(val, _values, result)
8895
8896
  end
8896
8897
 
8897
8898
  def _reduce_256(val, _values, result)
8898
- _, args, _ = val
8899
+ _, args, (_, line_max) = val
8900
+
8899
8901
  result = args
8902
+ result.line_max = line_max if args
8900
8903
 
8901
8904
  result
8902
8905
  end
@@ -9177,10 +9180,12 @@ def _reduce_303(val, _values, result)
9177
9180
  end
9178
9181
 
9179
9182
  def _reduce_304(val, _values, result)
9180
- _, line, args, _ = val
9183
+ _, line, args, (_, line_max) = val
9184
+
9181
9185
  result = args || s(:array)
9182
9186
  result.sexp_type = :array # aref_args is :args
9183
9187
  result.line line
9188
+ result.line_max = line_max
9184
9189
 
9185
9190
  result
9186
9191
  end
@@ -9966,15 +9971,21 @@ end
9966
9971
  def _reduce_430(val, _values, result)
9967
9972
  call, args = val
9968
9973
 
9969
- result = call.concat args.sexp_body if args
9974
+ result = call
9975
+
9976
+ if args then
9977
+ call.concat args.sexp_body
9978
+ result.line_max = args.line_max
9979
+ end
9970
9980
 
9971
9981
  result
9972
9982
  end
9973
9983
 
9974
9984
  def _reduce_431(val, _values, result)
9975
- recv, call_op, (op, _line), args = val
9985
+ recv, call_op, (op, op_line), args = val
9976
9986
 
9977
9987
  result = new_call recv, op.to_sym, args, call_op
9988
+ result.line_max = op_line unless args
9978
9989
 
9979
9990
  result
9980
9991
  end
@@ -10261,17 +10272,19 @@ def _reduce_475(val, _values, result)
10261
10272
  end
10262
10273
 
10263
10274
  def _reduce_476(val, _values, result)
10264
- (_, line), _, _ = val
10275
+ (_, line), _, (_, line_max) = val
10265
10276
 
10266
10277
  result = s(:array).line line
10278
+ result.line_max = line_max
10267
10279
 
10268
10280
  result
10269
10281
  end
10270
10282
 
10271
10283
  def _reduce_477(val, _values, result)
10272
- (_, line), list, _ = val
10284
+ (_, line), list, (_, line_max) = val
10273
10285
 
10274
10286
  result = list.line line
10287
+ result.line_max = line_max
10275
10288
 
10276
10289
  result
10277
10290
  end
@@ -10297,17 +10310,19 @@ def _reduce_481(val, _values, result)
10297
10310
  end
10298
10311
 
10299
10312
  def _reduce_482(val, _values, result)
10300
- (_, line), _, _ = val
10313
+ (_, line), _, (_, line_max) = val
10301
10314
 
10302
10315
  result = s(:array).line line
10316
+ result.line_max = line_max
10303
10317
 
10304
10318
  result
10305
10319
  end
10306
10320
 
10307
10321
  def _reduce_483(val, _values, result)
10308
- (_, line), list, _, = val
10309
- list.line line
10310
- result = list
10322
+ (_, line), list, (_, line_max), = val
10323
+
10324
+ result = list.line line
10325
+ result.line_max = line_max
10311
10326
 
10312
10327
  result
10313
10328
  end
@@ -10326,33 +10341,37 @@ def _reduce_485(val, _values, result)
10326
10341
  end
10327
10342
 
10328
10343
  def _reduce_486(val, _values, result)
10329
- (_, line), _, _ = val
10344
+ (_, line), _, (_, line_max) = val
10330
10345
 
10331
10346
  result = s(:array).line line
10347
+ result.line_max = line_max
10332
10348
 
10333
10349
  result
10334
10350
  end
10335
10351
 
10336
10352
  def _reduce_487(val, _values, result)
10337
- (_, line), list, _ = val
10353
+ (_, line), list, (_, line_max) = val
10338
10354
 
10339
10355
  result = list.line line
10356
+ result.line_max = line_max
10340
10357
 
10341
10358
  result
10342
10359
  end
10343
10360
 
10344
10361
  def _reduce_488(val, _values, result)
10345
- (_, line), _, _ = val
10362
+ (_, line), _, (_, line_max) = val
10346
10363
 
10347
10364
  result = s(:array).line line
10365
+ result.line_max = line_max
10348
10366
 
10349
10367
  result
10350
10368
  end
10351
10369
 
10352
10370
  def _reduce_489(val, _values, result)
10353
- (_, line), list, _ = val
10371
+ (_, line), list, (_, line_max) = val
10354
10372
 
10355
10373
  result = list.line line
10374
+ result.line_max = line_max
10356
10375
 
10357
10376
  result
10358
10377
  end
@@ -10901,7 +10920,14 @@ def _reduce_579(val, _values, result)
10901
10920
  result = s(:args, list).line list.line
10902
10921
  end
10903
10922
 
10904
- result << (Sexp === item ? item : item.first)
10923
+ if Sexp === item then
10924
+ line_max = item.line_max
10925
+ else
10926
+ item, line_max = item
10927
+ end
10928
+
10929
+ result << item
10930
+ result.line_max = line_max
10905
10931
 
10906
10932
  result
10907
10933
  end
@@ -11195,9 +11221,19 @@ end
11195
11221
 
11196
11222
  # reduce 638 omitted
11197
11223
 
11198
- # reduce 639 omitted
11224
+ def _reduce_639(val, _values, result)
11225
+ _, close = val
11226
+ result = [close, lexer.lineno]
11227
+
11228
+ result
11229
+ end
11230
+
11231
+ def _reduce_640(val, _values, result)
11232
+ _, close = val
11233
+ result = [close, lexer.lineno]
11199
11234
 
11200
- # reduce 640 omitted
11235
+ result
11236
+ end
11201
11237
 
11202
11238
  # reduce 641 omitted
11203
11239
 
data/lib/ruby25_parser.y CHANGED
@@ -222,6 +222,7 @@ rule
222
222
  | lhs tEQL mrhs
223
223
  {
224
224
  lhs, _, rhs = val
225
+
225
226
  result = new_assign lhs, s(:svalue, rhs).line(rhs.line)
226
227
  }
227
228
  | mlhs tEQL mrhs_arg
@@ -983,8 +984,10 @@ rule
983
984
 
984
985
  paren_args: tLPAREN2 opt_call_args rparen
985
986
  {
986
- _, args, _ = val
987
+ _, args, (_, line_max) = val
988
+
987
989
  result = args
990
+ result.line_max = line_max if args
988
991
  }
989
992
 
990
993
  opt_paren_args: none
@@ -1189,12 +1192,14 @@ rule
1189
1192
  {
1190
1193
  result = wrap :colon3, val[1]
1191
1194
  }
1192
- | tLBRACK { result = lexer.lineno } aref_args tRBRACK
1195
+ | tLBRACK { result = lexer.lineno } aref_args rbracket
1193
1196
  {
1194
- _, line, args, _ = val
1197
+ _, line, args, (_, line_max) = val
1198
+
1195
1199
  result = args || s(:array)
1196
1200
  result.sexp_type = :array # aref_args is :args
1197
1201
  result.line line
1202
+ result.line_max = line_max
1198
1203
  }
1199
1204
  | tLBRACE
1200
1205
  {
@@ -1782,13 +1787,19 @@ opt_block_args_tail: tCOMMA block_args_tail
1782
1787
  {
1783
1788
  call, args = val
1784
1789
 
1785
- result = call.concat args.sexp_body if args
1790
+ result = call
1791
+
1792
+ if args then
1793
+ call.concat args.sexp_body
1794
+ result.line_max = args.line_max
1795
+ end
1786
1796
  }
1787
1797
  | primary_value call_op operation2 opt_paren_args
1788
1798
  {
1789
- recv, call_op, (op, _line), args = val
1799
+ recv, call_op, (op, op_line), args = val
1790
1800
 
1791
1801
  result = new_call recv, op.to_sym, args, call_op
1802
+ result.line_max = op_line unless args
1792
1803
  }
1793
1804
  | primary_value tCOLON2 operation2 paren_args
1794
1805
  {
@@ -2002,15 +2013,17 @@ opt_block_args_tail: tCOMMA block_args_tail
2002
2013
 
2003
2014
  words: tWORDS_BEG tSPACE tSTRING_END
2004
2015
  {
2005
- (_, line), _, _ = val
2016
+ (_, line), _, (_, line_max) = val
2006
2017
 
2007
2018
  result = s(:array).line line
2019
+ result.line_max = line_max
2008
2020
  }
2009
2021
  | tWORDS_BEG word_list tSTRING_END
2010
2022
  {
2011
- (_, line), list, _ = val
2023
+ (_, line), list, (_, line_max) = val
2012
2024
 
2013
2025
  result = list.line line
2026
+ result.line_max = line_max
2014
2027
  }
2015
2028
 
2016
2029
  word_list: none
@@ -2030,15 +2043,17 @@ opt_block_args_tail: tCOMMA block_args_tail
2030
2043
 
2031
2044
  symbols: tSYMBOLS_BEG tSPACE tSTRING_END
2032
2045
  {
2033
- (_, line), _, _ = val
2046
+ (_, line), _, (_, line_max) = val
2034
2047
 
2035
2048
  result = s(:array).line line
2049
+ result.line_max = line_max
2036
2050
  }
2037
2051
  | tSYMBOLS_BEG symbol_list tSTRING_END
2038
2052
  {
2039
- (_, line), list, _, = val
2040
- list.line line
2041
- result = list
2053
+ (_, line), list, (_, line_max), = val
2054
+
2055
+ result = list.line line
2056
+ result.line_max = line_max
2042
2057
  }
2043
2058
 
2044
2059
  symbol_list: none
@@ -2053,28 +2068,32 @@ opt_block_args_tail: tCOMMA block_args_tail
2053
2068
 
2054
2069
  qwords: tQWORDS_BEG tSPACE tSTRING_END
2055
2070
  {
2056
- (_, line), _, _ = val
2071
+ (_, line), _, (_, line_max) = val
2057
2072
 
2058
2073
  result = s(:array).line line
2074
+ result.line_max = line_max
2059
2075
  }
2060
2076
  | tQWORDS_BEG qword_list tSTRING_END
2061
2077
  {
2062
- (_, line), list, _ = val
2078
+ (_, line), list, (_, line_max) = val
2063
2079
 
2064
2080
  result = list.line line
2081
+ result.line_max = line_max
2065
2082
  }
2066
2083
 
2067
2084
  qsymbols: tQSYMBOLS_BEG tSPACE tSTRING_END
2068
2085
  {
2069
- (_, line), _, _ = val
2086
+ (_, line), _, (_, line_max) = val
2070
2087
 
2071
2088
  result = s(:array).line line
2089
+ result.line_max = line_max
2072
2090
  }
2073
2091
  | tQSYMBOLS_BEG qsym_list tSTRING_END
2074
2092
  {
2075
- (_, line), list, _ = val
2093
+ (_, line), list, (_, line_max) = val
2076
2094
 
2077
2095
  result = list.line line
2096
+ result.line_max = line_max
2078
2097
  }
2079
2098
 
2080
2099
  qword_list: none
@@ -2478,7 +2497,14 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2478
2497
  result = s(:args, list).line list.line
2479
2498
  end
2480
2499
 
2481
- result << (Sexp === item ? item : item.first)
2500
+ if Sexp === item then
2501
+ line_max = item.line_max
2502
+ else
2503
+ item, line_max = item
2504
+ end
2505
+
2506
+ result << item
2507
+ result.line_max = line_max
2482
2508
  }
2483
2509
 
2484
2510
  f_label: tLABEL
@@ -2696,7 +2722,15 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2696
2722
  opt_terms: | terms
2697
2723
  opt_nl: | tNL
2698
2724
  rparen: opt_nl tRPAREN
2725
+ {
2726
+ _, close = val
2727
+ result = [close, lexer.lineno]
2728
+ }
2699
2729
  rbracket: opt_nl tRBRACK
2730
+ {
2731
+ _, close = val
2732
+ result = [close, lexer.lineno]
2733
+ }
2700
2734
  trailer: | tNL | tCOMMA
2701
2735
 
2702
2736
  term: tSEMI { yyerrok }