ruby_parser 3.20.0 → 3.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +12 -0
- data/compare/normalize.rb +1 -0
- data/lib/ruby20_parser.rb +4266 -4283
- data/lib/ruby20_parser.y +50 -26
- data/lib/ruby21_parser.rb +4240 -4239
- data/lib/ruby21_parser.y +50 -26
- data/lib/ruby22_parser.rb +4288 -4289
- data/lib/ruby22_parser.y +50 -26
- data/lib/ruby23_parser.rb +4273 -4242
- data/lib/ruby23_parser.y +50 -26
- data/lib/ruby24_parser.rb +4278 -4297
- data/lib/ruby24_parser.y +50 -26
- data/lib/ruby25_parser.rb +4269 -4288
- data/lib/ruby25_parser.y +50 -26
- data/lib/ruby26_parser.rb +4269 -4288
- data/lib/ruby26_parser.y +50 -26
- data/lib/ruby27_parser.rb +4172 -4205
- data/lib/ruby27_parser.y +50 -26
- data/lib/ruby30_parser.rb +6009 -5974
- data/lib/ruby30_parser.y +111 -84
- data/lib/ruby31_parser.rb +6130 -6227
- data/lib/ruby31_parser.y +111 -84
- data/lib/ruby32_parser.rb +6297 -6352
- data/lib/ruby32_parser.y +132 -104
- data/lib/ruby3_parser.yy +147 -84
- data/lib/ruby_lexer.rb +2 -0
- data/lib/ruby_lexer.rex.rb +1 -1
- data/lib/ruby_lexer_strings.rb +2 -2
- data/lib/ruby_parser.yy +50 -26
- data/lib/ruby_parser_extras.rb +23 -18
- data/test/test_ruby_parser.rb +187 -7
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
data/lib/ruby30_parser.y
CHANGED
|
@@ -96,9 +96,9 @@ rule
|
|
|
96
96
|
result = iter
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
begin_block: tLCURLY
|
|
99
|
+
begin_block: tLCURLY top_compstmt tRCURLY
|
|
100
100
|
{
|
|
101
|
-
_, line, stmt, _ = val
|
|
101
|
+
(_, line), stmt, _ = val
|
|
102
102
|
result = new_iter s(:preexe).line(line), 0, stmt
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -221,6 +221,7 @@ rule
|
|
|
221
221
|
| lhs tEQL mrhs
|
|
222
222
|
{
|
|
223
223
|
lhs, _, rhs = val
|
|
224
|
+
|
|
224
225
|
result = new_assign lhs, s(:svalue, rhs).line(rhs.line)
|
|
225
226
|
}
|
|
226
227
|
| mlhs tEQL mrhs_arg kRESCUE_MOD stmt
|
|
@@ -604,7 +605,7 @@ rule
|
|
|
604
605
|
}
|
|
605
606
|
| tSTAR
|
|
606
607
|
{
|
|
607
|
-
l =
|
|
608
|
+
(_, l), = val
|
|
608
609
|
result = s(:masgn, s(:array, s(:splat).line(l)).line(l)).line l
|
|
609
610
|
}
|
|
610
611
|
| tSTAR tCOMMA mlhs_post
|
|
@@ -1114,8 +1115,10 @@ rule
|
|
|
1114
1115
|
|
|
1115
1116
|
paren_args: tLPAREN2 opt_call_args rparen
|
|
1116
1117
|
{
|
|
1117
|
-
_, args, _ = val
|
|
1118
|
+
_, args, (_, line_max) = val
|
|
1119
|
+
|
|
1118
1120
|
result = args
|
|
1121
|
+
result.line_max = line_max if args
|
|
1119
1122
|
}
|
|
1120
1123
|
| tLPAREN2 args tCOMMA args_forward rparen
|
|
1121
1124
|
{
|
|
@@ -1227,7 +1230,7 @@ rule
|
|
|
1227
1230
|
args: arg_value
|
|
1228
1231
|
{
|
|
1229
1232
|
arg, = val
|
|
1230
|
-
lineno = arg.line
|
|
1233
|
+
lineno = arg.line
|
|
1231
1234
|
|
|
1232
1235
|
result = s(:array, arg).line lineno
|
|
1233
1236
|
}
|
|
@@ -1243,9 +1246,7 @@ rule
|
|
|
1243
1246
|
}
|
|
1244
1247
|
| args tCOMMA tSTAR arg_value
|
|
1245
1248
|
{
|
|
1246
|
-
|
|
1247
|
-
args, _, _, id = val
|
|
1248
|
-
line = lexer.lineno
|
|
1249
|
+
args, _, (_, line), id = val
|
|
1249
1250
|
result = self.list_append args, s(:splat, id).line(line)
|
|
1250
1251
|
}
|
|
1251
1252
|
|
|
@@ -1264,7 +1265,6 @@ rule
|
|
|
1264
1265
|
}
|
|
1265
1266
|
| args tCOMMA tSTAR arg_value
|
|
1266
1267
|
{
|
|
1267
|
-
# TODO: make all tXXXX terminals include lexer.lineno
|
|
1268
1268
|
arg, _, _, splat = val
|
|
1269
1269
|
result = self.arg_concat arg, splat
|
|
1270
1270
|
}
|
|
@@ -1293,7 +1293,6 @@ rule
|
|
|
1293
1293
|
| k_begin
|
|
1294
1294
|
{
|
|
1295
1295
|
lexer.cmdarg.push false
|
|
1296
|
-
result = self.lexer.lineno
|
|
1297
1296
|
}
|
|
1298
1297
|
bodystmt k_end
|
|
1299
1298
|
{
|
|
@@ -1303,11 +1302,10 @@ rule
|
|
|
1303
1302
|
| tLPAREN_ARG
|
|
1304
1303
|
{
|
|
1305
1304
|
lexer.lex_state = EXPR_ENDARG
|
|
1306
|
-
result = lexer.lineno
|
|
1307
1305
|
}
|
|
1308
1306
|
rparen
|
|
1309
1307
|
{
|
|
1310
|
-
_, line, _ = val
|
|
1308
|
+
(_, line), _, _ = val
|
|
1311
1309
|
result = s(:begin).line line
|
|
1312
1310
|
}
|
|
1313
1311
|
| tLPAREN_ARG
|
|
@@ -1323,9 +1321,8 @@ rule
|
|
|
1323
1321
|
}
|
|
1324
1322
|
| tLPAREN compstmt tRPAREN
|
|
1325
1323
|
{
|
|
1326
|
-
_, stmt, _ = val
|
|
1327
|
-
result = stmt
|
|
1328
|
-
result ||= s(:nil).line lexer.lineno
|
|
1324
|
+
(_, line), stmt, _ = val
|
|
1325
|
+
result = stmt || s(:nil).line(line)
|
|
1329
1326
|
result.paren = true
|
|
1330
1327
|
}
|
|
1331
1328
|
| primary_value tCOLON2 tCONSTANT
|
|
@@ -1338,12 +1335,14 @@ rule
|
|
|
1338
1335
|
{
|
|
1339
1336
|
result = wrap :colon3, val[1]
|
|
1340
1337
|
}
|
|
1341
|
-
| tLBRACK
|
|
1338
|
+
| tLBRACK aref_args rbracket
|
|
1342
1339
|
{
|
|
1343
|
-
_, line, args, _ = val
|
|
1340
|
+
(_, line), args, (_, line_max) = val
|
|
1341
|
+
|
|
1344
1342
|
result = args || s(:array)
|
|
1345
1343
|
result.sexp_type = :array # aref_args is :args
|
|
1346
1344
|
result.line line
|
|
1345
|
+
result.line_max = line_max
|
|
1347
1346
|
}
|
|
1348
1347
|
| tLBRACE
|
|
1349
1348
|
{
|
|
@@ -1454,9 +1453,6 @@ rule
|
|
|
1454
1453
|
result = new_for iter, var, body
|
|
1455
1454
|
}
|
|
1456
1455
|
| k_class
|
|
1457
|
-
{
|
|
1458
|
-
result = self.lexer.lineno
|
|
1459
|
-
}
|
|
1460
1456
|
cpath superclass
|
|
1461
1457
|
{
|
|
1462
1458
|
if (self.in_def || self.in_single > 0) then
|
|
@@ -1471,9 +1467,6 @@ rule
|
|
|
1471
1467
|
self.lexer.ignore_body_comments
|
|
1472
1468
|
}
|
|
1473
1469
|
| k_class tLSHFT
|
|
1474
|
-
{
|
|
1475
|
-
result = self.lexer.lineno
|
|
1476
|
-
}
|
|
1477
1470
|
expr
|
|
1478
1471
|
{
|
|
1479
1472
|
result = self.in_def
|
|
@@ -1485,16 +1478,14 @@ rule
|
|
|
1485
1478
|
self.in_single = 0
|
|
1486
1479
|
self.env.extend
|
|
1487
1480
|
}
|
|
1488
|
-
bodystmt
|
|
1481
|
+
bodystmt
|
|
1482
|
+
k_end
|
|
1489
1483
|
{
|
|
1490
1484
|
result = new_sclass val
|
|
1491
1485
|
self.env.unextend
|
|
1492
1486
|
self.lexer.ignore_body_comments
|
|
1493
1487
|
}
|
|
1494
1488
|
| k_module
|
|
1495
|
-
{
|
|
1496
|
-
result = self.lexer.lineno
|
|
1497
|
-
}
|
|
1498
1489
|
cpath
|
|
1499
1490
|
{
|
|
1500
1491
|
yyerror "module definition in method body" if
|
|
@@ -1636,20 +1627,33 @@ rule
|
|
|
1636
1627
|
}
|
|
1637
1628
|
|
|
1638
1629
|
f_marg: f_norm_arg
|
|
1630
|
+
{
|
|
1631
|
+
(sym, line), = val
|
|
1632
|
+
|
|
1633
|
+
result = s(:dummy, sym).line line
|
|
1634
|
+
}
|
|
1639
1635
|
| tLPAREN f_margs rparen
|
|
1640
1636
|
{
|
|
1641
|
-
|
|
1637
|
+
_, args, _ = val
|
|
1638
|
+
result = args
|
|
1642
1639
|
}
|
|
1643
1640
|
|
|
1644
1641
|
f_marg_list: f_marg
|
|
1645
1642
|
{
|
|
1646
|
-
|
|
1643
|
+
arg, = val
|
|
1644
|
+
line = arg.line
|
|
1647
1645
|
|
|
1648
|
-
|
|
1646
|
+
arg = arg.last if arg.sexp_type == :dummy
|
|
1647
|
+
|
|
1648
|
+
result = s(:array, arg).line line
|
|
1649
1649
|
}
|
|
1650
1650
|
| f_marg_list tCOMMA f_marg
|
|
1651
1651
|
{
|
|
1652
|
-
|
|
1652
|
+
args, _, arg = val
|
|
1653
|
+
|
|
1654
|
+
arg = arg.last if arg.sexp_type == :dummy
|
|
1655
|
+
|
|
1656
|
+
result = list_append args, arg
|
|
1653
1657
|
}
|
|
1654
1658
|
|
|
1655
1659
|
f_margs: f_marg_list
|
|
@@ -1692,8 +1696,8 @@ rule
|
|
|
1692
1696
|
}
|
|
1693
1697
|
| tSTAR
|
|
1694
1698
|
{
|
|
1695
|
-
|
|
1696
|
-
result.line
|
|
1699
|
+
(_, line), = val
|
|
1700
|
+
result = args([:*]).line line
|
|
1697
1701
|
}
|
|
1698
1702
|
|
|
1699
1703
|
f_any_kwrest: f_kwrest
|
|
@@ -1805,7 +1809,9 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
1805
1809
|
}
|
|
1806
1810
|
| tOROP
|
|
1807
1811
|
{
|
|
1808
|
-
|
|
1812
|
+
(_, line), = val
|
|
1813
|
+
|
|
1814
|
+
result = s(:args).line line
|
|
1809
1815
|
}
|
|
1810
1816
|
| tPIPE block_param opt_bv_decl tPIPE
|
|
1811
1817
|
{
|
|
@@ -1837,7 +1843,7 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
1837
1843
|
lambda: tLAMBDA
|
|
1838
1844
|
{
|
|
1839
1845
|
self.env.extend :dynamic
|
|
1840
|
-
result =
|
|
1846
|
+
result = lexer.lpar_beg
|
|
1841
1847
|
lexer.paren_nest += 1
|
|
1842
1848
|
lexer.lpar_beg = lexer.paren_nest
|
|
1843
1849
|
}
|
|
@@ -1847,7 +1853,7 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
1847
1853
|
}
|
|
1848
1854
|
lambda_body
|
|
1849
1855
|
{
|
|
1850
|
-
_,
|
|
1856
|
+
(_, line), lpar, args, _cmdarg, body = val
|
|
1851
1857
|
lexer.lpar_beg = lpar
|
|
1852
1858
|
|
|
1853
1859
|
lexer.cmdarg.pop
|
|
@@ -1931,13 +1937,19 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
1931
1937
|
{
|
|
1932
1938
|
call, args = val
|
|
1933
1939
|
|
|
1934
|
-
result = call
|
|
1940
|
+
result = call
|
|
1941
|
+
|
|
1942
|
+
if args then
|
|
1943
|
+
call.concat args.sexp_body
|
|
1944
|
+
result.line_max = args.line_max
|
|
1945
|
+
end
|
|
1935
1946
|
}
|
|
1936
1947
|
| primary_value call_op operation2 opt_paren_args
|
|
1937
1948
|
{
|
|
1938
|
-
recv, call_op, (op,
|
|
1949
|
+
recv, call_op, (op, op_line), args = val
|
|
1939
1950
|
|
|
1940
1951
|
result = new_call recv, op.to_sym, args, call_op
|
|
1952
|
+
result.line_max = op_line unless args
|
|
1941
1953
|
}
|
|
1942
1954
|
| primary_value tCOLON2 operation2 paren_args
|
|
1943
1955
|
{
|
|
@@ -1965,7 +1977,8 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
1965
1977
|
}
|
|
1966
1978
|
| kSUPER
|
|
1967
1979
|
{
|
|
1968
|
-
|
|
1980
|
+
(_, line), = val
|
|
1981
|
+
result = s(:zsuper).line line
|
|
1969
1982
|
}
|
|
1970
1983
|
| primary_value tLBRACK2 opt_call_args rbracket
|
|
1971
1984
|
{
|
|
@@ -1975,11 +1988,11 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
1975
1988
|
brace_block: tLCURLY
|
|
1976
1989
|
{
|
|
1977
1990
|
self.env.extend :dynamic
|
|
1978
|
-
result = self.lexer.lineno
|
|
1979
1991
|
}
|
|
1980
|
-
brace_body
|
|
1992
|
+
brace_body
|
|
1993
|
+
tRCURLY
|
|
1981
1994
|
{
|
|
1982
|
-
_, line, body, _ = val
|
|
1995
|
+
(_, line), _, body, _ = val
|
|
1983
1996
|
|
|
1984
1997
|
result = body
|
|
1985
1998
|
result.line line
|
|
@@ -1989,11 +2002,11 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
1989
2002
|
| k_do
|
|
1990
2003
|
{
|
|
1991
2004
|
self.env.extend :dynamic
|
|
1992
|
-
result = self.lexer.lineno
|
|
1993
2005
|
}
|
|
1994
|
-
do_body
|
|
2006
|
+
do_body
|
|
2007
|
+
kEND
|
|
1995
2008
|
{
|
|
1996
|
-
_, line, body, _ = val
|
|
2009
|
+
(_, line), _, body, _ = val
|
|
1997
2010
|
|
|
1998
2011
|
result = body
|
|
1999
2012
|
result.line line
|
|
@@ -2051,14 +2064,13 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
2051
2064
|
}
|
|
2052
2065
|
|
|
2053
2066
|
case_body: k_when
|
|
2054
|
-
{
|
|
2055
|
-
result = self.lexer.lineno
|
|
2056
|
-
}
|
|
2057
2067
|
case_args then compstmt cases
|
|
2058
2068
|
{
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
result
|
|
2069
|
+
(_, line), case_args, _then, body, cases = val
|
|
2070
|
+
|
|
2071
|
+
result = new_when case_args, body
|
|
2072
|
+
result.line line
|
|
2073
|
+
result << cases if cases
|
|
2062
2074
|
}
|
|
2063
2075
|
|
|
2064
2076
|
cases: opt_else | case_body
|
|
@@ -2678,15 +2690,17 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
2678
2690
|
|
|
2679
2691
|
words: tWORDS_BEG tSPACE tSTRING_END
|
|
2680
2692
|
{
|
|
2681
|
-
(_, line), _, _ = val
|
|
2693
|
+
(_, line), _, (_, line_max) = val
|
|
2682
2694
|
|
|
2683
2695
|
result = s(:array).line line
|
|
2696
|
+
result.line_max = line_max
|
|
2684
2697
|
}
|
|
2685
2698
|
| tWORDS_BEG word_list tSTRING_END
|
|
2686
2699
|
{
|
|
2687
|
-
(_, line), list, _ = val
|
|
2700
|
+
(_, line), list, (_, line_max) = val
|
|
2688
2701
|
|
|
2689
2702
|
result = list.line line
|
|
2703
|
+
result.line_max = line_max
|
|
2690
2704
|
}
|
|
2691
2705
|
|
|
2692
2706
|
word_list: none
|
|
@@ -2706,15 +2720,17 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
2706
2720
|
|
|
2707
2721
|
symbols: tSYMBOLS_BEG tSPACE tSTRING_END
|
|
2708
2722
|
{
|
|
2709
|
-
(_, line), _, _ = val
|
|
2723
|
+
(_, line), _, (_, line_max) = val
|
|
2710
2724
|
|
|
2711
2725
|
result = s(:array).line line
|
|
2726
|
+
result.line_max = line_max
|
|
2712
2727
|
}
|
|
2713
2728
|
| tSYMBOLS_BEG symbol_list tSTRING_END
|
|
2714
2729
|
{
|
|
2715
|
-
(_, line), list, _, = val
|
|
2716
|
-
|
|
2717
|
-
result = list
|
|
2730
|
+
(_, line), list, (_, line_max), = val
|
|
2731
|
+
|
|
2732
|
+
result = list.line line
|
|
2733
|
+
result.line_max = line_max
|
|
2718
2734
|
}
|
|
2719
2735
|
|
|
2720
2736
|
symbol_list: none
|
|
@@ -2729,28 +2745,32 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
2729
2745
|
|
|
2730
2746
|
qwords: tQWORDS_BEG tSPACE tSTRING_END
|
|
2731
2747
|
{
|
|
2732
|
-
(_, line), _, _ = val
|
|
2748
|
+
(_, line), _, (_, line_max) = val
|
|
2733
2749
|
|
|
2734
2750
|
result = s(:array).line line
|
|
2751
|
+
result.line_max = line_max
|
|
2735
2752
|
}
|
|
2736
2753
|
| tQWORDS_BEG qword_list tSTRING_END
|
|
2737
2754
|
{
|
|
2738
|
-
(_, line), list, _ = val
|
|
2755
|
+
(_, line), list, (_, line_max) = val
|
|
2739
2756
|
|
|
2740
2757
|
result = list.line line
|
|
2758
|
+
result.line_max = line_max
|
|
2741
2759
|
}
|
|
2742
2760
|
|
|
2743
2761
|
qsymbols: tQSYMBOLS_BEG tSPACE tSTRING_END
|
|
2744
2762
|
{
|
|
2745
|
-
(_, line), _, _ = val
|
|
2763
|
+
(_, line), _, (_, line_max) = val
|
|
2746
2764
|
|
|
2747
2765
|
result = s(:array).line line
|
|
2766
|
+
result.line_max = line_max
|
|
2748
2767
|
}
|
|
2749
2768
|
| tQSYMBOLS_BEG qsym_list tSTRING_END
|
|
2750
2769
|
{
|
|
2751
|
-
(_, line), list, _ = val
|
|
2770
|
+
(_, line), list, (_, line_max) = val
|
|
2752
2771
|
|
|
2753
2772
|
result = list.line line
|
|
2773
|
+
result.line_max = line_max
|
|
2754
2774
|
}
|
|
2755
2775
|
|
|
2756
2776
|
qword_list: none
|
|
@@ -2825,7 +2845,6 @@ regexp_contents: none
|
|
|
2825
2845
|
lexer.brace_nest,
|
|
2826
2846
|
lexer.string_nest, # TODO: remove
|
|
2827
2847
|
lexer.lex_state,
|
|
2828
|
-
lexer.lineno,
|
|
2829
2848
|
]
|
|
2830
2849
|
|
|
2831
2850
|
lexer.cmdarg.push false
|
|
@@ -2840,9 +2859,9 @@ regexp_contents: none
|
|
|
2840
2859
|
compstmt
|
|
2841
2860
|
tSTRING_DEND
|
|
2842
2861
|
{
|
|
2843
|
-
_, memo, stmt, _ = val
|
|
2862
|
+
(_, line), memo, stmt, _ = val
|
|
2844
2863
|
|
|
2845
|
-
lex_strterm, brace_nest, string_nest, oldlex_state
|
|
2864
|
+
lex_strterm, brace_nest, string_nest, oldlex_state = memo
|
|
2846
2865
|
# TODO: heredoc_indent
|
|
2847
2866
|
|
|
2848
2867
|
lexer.lex_strterm = lex_strterm
|
|
@@ -2902,11 +2921,11 @@ regexp_contents: none
|
|
|
2902
2921
|
|
|
2903
2922
|
dsym: tSYMBEG string_contents tSTRING_END
|
|
2904
2923
|
{
|
|
2905
|
-
_, result, _ = val
|
|
2924
|
+
(_, line), result, _ = val
|
|
2906
2925
|
|
|
2907
2926
|
lexer.lex_state = EXPR_END
|
|
2908
2927
|
|
|
2909
|
-
result ||= s(:str, "").line
|
|
2928
|
+
result ||= s(:str, "").line line
|
|
2910
2929
|
|
|
2911
2930
|
case result.sexp_type
|
|
2912
2931
|
when :dstr then
|
|
@@ -2939,15 +2958,15 @@ regexp_contents: none
|
|
|
2939
2958
|
| tCONSTANT
|
|
2940
2959
|
| tCVAR
|
|
2941
2960
|
|
|
2942
|
-
keyword_variable: kNIL { result = s(:nil).line
|
|
2943
|
-
| kSELF { result = s(:self).line
|
|
2944
|
-
| kTRUE { result = s(:true).line
|
|
2945
|
-
| kFALSE { result = s(:false).line
|
|
2946
|
-
| k__FILE__ { result = s(:str, self.file).line
|
|
2947
|
-
| k__LINE__ { result = s(:lit,
|
|
2961
|
+
keyword_variable: kNIL { (_, line), = val; result = s(:nil).line line }
|
|
2962
|
+
| kSELF { (_, line), = val; result = s(:self).line line }
|
|
2963
|
+
| kTRUE { (_, line), = val; result = s(:true).line line }
|
|
2964
|
+
| kFALSE { (_, line), = val; result = s(:false).line line }
|
|
2965
|
+
| k__FILE__ { (_, line), = val; result = s(:str, self.file).line line }
|
|
2966
|
+
| k__LINE__ { (_, line), = val; result = s(:lit, line).line line }
|
|
2948
2967
|
| k__ENCODING__
|
|
2949
2968
|
{
|
|
2950
|
-
l =
|
|
2969
|
+
(_, l), = val
|
|
2951
2970
|
result =
|
|
2952
2971
|
if defined? Encoding then
|
|
2953
2972
|
s(:colon2, s(:const, :Encoding).line(l), :UTF_8).line l
|
|
@@ -3117,12 +3136,12 @@ f_opt_paren_args: f_paren_args
|
|
|
3117
3136
|
|
|
|
3118
3137
|
{
|
|
3119
3138
|
result = args val
|
|
3120
|
-
# result.line lexer.lineno
|
|
3121
3139
|
}
|
|
3122
3140
|
|
|
3123
3141
|
args_forward: tBDOT3
|
|
3124
3142
|
{
|
|
3125
|
-
|
|
3143
|
+
(_, line), = val
|
|
3144
|
+
result = s(:forward_args).line line
|
|
3126
3145
|
}
|
|
3127
3146
|
|
|
3128
3147
|
f_bad_arg: tCONSTANT
|
|
@@ -3176,7 +3195,14 @@ f_opt_paren_args: f_paren_args
|
|
|
3176
3195
|
result = s(:args, list).line list.line
|
|
3177
3196
|
end
|
|
3178
3197
|
|
|
3179
|
-
|
|
3198
|
+
if Sexp === item then
|
|
3199
|
+
line_max = item.line_max
|
|
3200
|
+
else
|
|
3201
|
+
item, line_max = item
|
|
3202
|
+
end
|
|
3203
|
+
|
|
3204
|
+
result << item
|
|
3205
|
+
result.line_max = line_max
|
|
3180
3206
|
}
|
|
3181
3207
|
|
|
3182
3208
|
f_label: tLABEL
|
|
@@ -3253,9 +3279,10 @@ f_opt_paren_args: f_paren_args
|
|
|
3253
3279
|
}
|
|
3254
3280
|
| kwrest_mark
|
|
3255
3281
|
{
|
|
3282
|
+
(_, line), = val
|
|
3256
3283
|
id = :"**"
|
|
3257
|
-
self.env[id] = :lvar
|
|
3258
|
-
result = [id,
|
|
3284
|
+
self.env[id] = :lvar
|
|
3285
|
+
result = [id, line]
|
|
3259
3286
|
}
|
|
3260
3287
|
|
|
3261
3288
|
f_opt: f_arg_asgn
|
|
@@ -3313,9 +3340,10 @@ f_opt_paren_args: f_paren_args
|
|
|
3313
3340
|
}
|
|
3314
3341
|
| restarg_mark
|
|
3315
3342
|
{
|
|
3343
|
+
(_, line), = val
|
|
3316
3344
|
name = :"*"
|
|
3317
3345
|
self.env[name] = :lvar
|
|
3318
|
-
result = [name,
|
|
3346
|
+
result = [name, line]
|
|
3319
3347
|
}
|
|
3320
3348
|
|
|
3321
3349
|
blkarg_mark: tAMPER2 | tAMPER
|
|
@@ -3420,11 +3448,10 @@ f_opt_paren_args: f_paren_args
|
|
|
3420
3448
|
opt_terms: | terms
|
|
3421
3449
|
opt_nl: | tNL
|
|
3422
3450
|
rparen: opt_nl tRPAREN
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
# }
|
|
3451
|
+
{
|
|
3452
|
+
_, close = val # TODO: include lineno in close?
|
|
3453
|
+
result = [close, lexer.lineno]
|
|
3454
|
+
}
|
|
3428
3455
|
rbracket: opt_nl tRBRACK
|
|
3429
3456
|
{
|
|
3430
3457
|
_, close = val
|