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/ruby31_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
|
|
@@ -620,7 +621,7 @@ rule
|
|
|
620
621
|
}
|
|
621
622
|
| tSTAR
|
|
622
623
|
{
|
|
623
|
-
l =
|
|
624
|
+
(_, l), = val
|
|
624
625
|
result = s(:masgn, s(:array, s(:splat).line(l)).line(l)).line l
|
|
625
626
|
}
|
|
626
627
|
| tSTAR tCOMMA mlhs_post
|
|
@@ -1130,8 +1131,10 @@ rule
|
|
|
1130
1131
|
|
|
1131
1132
|
paren_args: tLPAREN2 opt_call_args rparen
|
|
1132
1133
|
{
|
|
1133
|
-
_, args, _ = val
|
|
1134
|
+
_, args, (_, line_max) = val
|
|
1135
|
+
|
|
1134
1136
|
result = args
|
|
1137
|
+
result.line_max = line_max if args
|
|
1135
1138
|
}
|
|
1136
1139
|
| tLPAREN2 args tCOMMA args_forward rparen
|
|
1137
1140
|
{
|
|
@@ -1248,7 +1251,7 @@ rule
|
|
|
1248
1251
|
args: arg_value
|
|
1249
1252
|
{
|
|
1250
1253
|
arg, = val
|
|
1251
|
-
lineno = arg.line
|
|
1254
|
+
lineno = arg.line
|
|
1252
1255
|
|
|
1253
1256
|
result = s(:array, arg).line lineno
|
|
1254
1257
|
}
|
|
@@ -1264,9 +1267,7 @@ rule
|
|
|
1264
1267
|
}
|
|
1265
1268
|
| args tCOMMA tSTAR arg_value
|
|
1266
1269
|
{
|
|
1267
|
-
|
|
1268
|
-
args, _, _, id = val
|
|
1269
|
-
line = lexer.lineno
|
|
1270
|
+
args, _, (_, line), id = val
|
|
1270
1271
|
result = self.list_append args, s(:splat, id).line(line)
|
|
1271
1272
|
}
|
|
1272
1273
|
|
|
@@ -1285,7 +1286,6 @@ rule
|
|
|
1285
1286
|
}
|
|
1286
1287
|
| args tCOMMA tSTAR arg_value
|
|
1287
1288
|
{
|
|
1288
|
-
# TODO: make all tXXXX terminals include lexer.lineno
|
|
1289
1289
|
arg, _, _, splat = val
|
|
1290
1290
|
result = self.arg_concat arg, splat
|
|
1291
1291
|
}
|
|
@@ -1314,7 +1314,6 @@ rule
|
|
|
1314
1314
|
| k_begin
|
|
1315
1315
|
{
|
|
1316
1316
|
lexer.cmdarg.push false
|
|
1317
|
-
result = self.lexer.lineno
|
|
1318
1317
|
}
|
|
1319
1318
|
bodystmt k_end
|
|
1320
1319
|
{
|
|
@@ -1324,11 +1323,10 @@ rule
|
|
|
1324
1323
|
| tLPAREN_ARG
|
|
1325
1324
|
{
|
|
1326
1325
|
lexer.lex_state = EXPR_ENDARG
|
|
1327
|
-
result = lexer.lineno
|
|
1328
1326
|
}
|
|
1329
1327
|
rparen
|
|
1330
1328
|
{
|
|
1331
|
-
_, line, _ = val
|
|
1329
|
+
(_, line), _, _ = val
|
|
1332
1330
|
result = s(:begin).line line
|
|
1333
1331
|
}
|
|
1334
1332
|
| tLPAREN_ARG
|
|
@@ -1344,9 +1342,8 @@ rule
|
|
|
1344
1342
|
}
|
|
1345
1343
|
| tLPAREN compstmt tRPAREN
|
|
1346
1344
|
{
|
|
1347
|
-
_, stmt, _ = val
|
|
1348
|
-
result = stmt
|
|
1349
|
-
result ||= s(:nil).line lexer.lineno
|
|
1345
|
+
(_, line), stmt, _ = val
|
|
1346
|
+
result = stmt || s(:nil).line(line)
|
|
1350
1347
|
result.paren = true
|
|
1351
1348
|
}
|
|
1352
1349
|
| primary_value tCOLON2 tCONSTANT
|
|
@@ -1359,12 +1356,14 @@ rule
|
|
|
1359
1356
|
{
|
|
1360
1357
|
result = wrap :colon3, val[1]
|
|
1361
1358
|
}
|
|
1362
|
-
| tLBRACK
|
|
1359
|
+
| tLBRACK aref_args rbracket
|
|
1363
1360
|
{
|
|
1364
|
-
_, line, args, _ = val
|
|
1361
|
+
(_, line), args, (_, line_max) = val
|
|
1362
|
+
|
|
1365
1363
|
result = args || s(:array)
|
|
1366
1364
|
result.sexp_type = :array # aref_args is :args
|
|
1367
1365
|
result.line line
|
|
1366
|
+
result.line_max = line_max
|
|
1368
1367
|
}
|
|
1369
1368
|
| tLBRACE
|
|
1370
1369
|
{
|
|
@@ -1475,9 +1474,6 @@ rule
|
|
|
1475
1474
|
result = new_for iter, var, body
|
|
1476
1475
|
}
|
|
1477
1476
|
| k_class
|
|
1478
|
-
{
|
|
1479
|
-
result = self.lexer.lineno
|
|
1480
|
-
}
|
|
1481
1477
|
cpath superclass
|
|
1482
1478
|
{
|
|
1483
1479
|
if (self.in_def || self.in_single > 0) then
|
|
@@ -1492,9 +1488,6 @@ rule
|
|
|
1492
1488
|
self.lexer.ignore_body_comments
|
|
1493
1489
|
}
|
|
1494
1490
|
| k_class tLSHFT
|
|
1495
|
-
{
|
|
1496
|
-
result = self.lexer.lineno
|
|
1497
|
-
}
|
|
1498
1491
|
expr
|
|
1499
1492
|
{
|
|
1500
1493
|
result = self.in_def
|
|
@@ -1506,16 +1499,14 @@ rule
|
|
|
1506
1499
|
self.in_single = 0
|
|
1507
1500
|
self.env.extend
|
|
1508
1501
|
}
|
|
1509
|
-
bodystmt
|
|
1502
|
+
bodystmt
|
|
1503
|
+
k_end
|
|
1510
1504
|
{
|
|
1511
1505
|
result = new_sclass val
|
|
1512
1506
|
self.env.unextend
|
|
1513
1507
|
self.lexer.ignore_body_comments
|
|
1514
1508
|
}
|
|
1515
1509
|
| k_module
|
|
1516
|
-
{
|
|
1517
|
-
result = self.lexer.lineno
|
|
1518
|
-
}
|
|
1519
1510
|
cpath
|
|
1520
1511
|
{
|
|
1521
1512
|
yyerror "module definition in method body" if
|
|
@@ -1657,20 +1648,33 @@ rule
|
|
|
1657
1648
|
}
|
|
1658
1649
|
|
|
1659
1650
|
f_marg: f_norm_arg
|
|
1651
|
+
{
|
|
1652
|
+
(sym, line), = val
|
|
1653
|
+
|
|
1654
|
+
result = s(:dummy, sym).line line
|
|
1655
|
+
}
|
|
1660
1656
|
| tLPAREN f_margs rparen
|
|
1661
1657
|
{
|
|
1662
|
-
|
|
1658
|
+
_, args, _ = val
|
|
1659
|
+
result = args
|
|
1663
1660
|
}
|
|
1664
1661
|
|
|
1665
1662
|
f_marg_list: f_marg
|
|
1666
1663
|
{
|
|
1667
|
-
|
|
1664
|
+
arg, = val
|
|
1665
|
+
line = arg.line
|
|
1668
1666
|
|
|
1669
|
-
|
|
1667
|
+
arg = arg.last if arg.sexp_type == :dummy
|
|
1668
|
+
|
|
1669
|
+
result = s(:array, arg).line line
|
|
1670
1670
|
}
|
|
1671
1671
|
| f_marg_list tCOMMA f_marg
|
|
1672
1672
|
{
|
|
1673
|
-
|
|
1673
|
+
args, _, arg = val
|
|
1674
|
+
|
|
1675
|
+
arg = arg.last if arg.sexp_type == :dummy
|
|
1676
|
+
|
|
1677
|
+
result = list_append args, arg
|
|
1674
1678
|
}
|
|
1675
1679
|
|
|
1676
1680
|
f_margs: f_marg_list
|
|
@@ -1713,8 +1717,8 @@ rule
|
|
|
1713
1717
|
}
|
|
1714
1718
|
| tSTAR
|
|
1715
1719
|
{
|
|
1716
|
-
|
|
1717
|
-
result.line
|
|
1720
|
+
(_, line), = val
|
|
1721
|
+
result = args([:*]).line line
|
|
1718
1722
|
}
|
|
1719
1723
|
|
|
1720
1724
|
f_any_kwrest: f_kwrest
|
|
@@ -1827,7 +1831,9 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
1827
1831
|
}
|
|
1828
1832
|
| tOROP
|
|
1829
1833
|
{
|
|
1830
|
-
|
|
1834
|
+
(_, line), = val
|
|
1835
|
+
|
|
1836
|
+
result = s(:args).line line
|
|
1831
1837
|
}
|
|
1832
1838
|
| tPIPE block_param opt_bv_decl tPIPE
|
|
1833
1839
|
{
|
|
@@ -1859,7 +1865,7 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
1859
1865
|
lambda: tLAMBDA
|
|
1860
1866
|
{
|
|
1861
1867
|
self.env.extend :dynamic
|
|
1862
|
-
result =
|
|
1868
|
+
result = lexer.lpar_beg
|
|
1863
1869
|
lexer.paren_nest += 1
|
|
1864
1870
|
lexer.lpar_beg = lexer.paren_nest
|
|
1865
1871
|
}
|
|
@@ -1869,7 +1875,7 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
1869
1875
|
}
|
|
1870
1876
|
lambda_body
|
|
1871
1877
|
{
|
|
1872
|
-
_,
|
|
1878
|
+
(_, line), lpar, args, _cmdarg, body = val
|
|
1873
1879
|
lexer.lpar_beg = lpar
|
|
1874
1880
|
|
|
1875
1881
|
lexer.cmdarg.pop
|
|
@@ -1953,13 +1959,19 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
1953
1959
|
{
|
|
1954
1960
|
call, args = val
|
|
1955
1961
|
|
|
1956
|
-
result = call
|
|
1962
|
+
result = call
|
|
1963
|
+
|
|
1964
|
+
if args then
|
|
1965
|
+
call.concat args.sexp_body
|
|
1966
|
+
result.line_max = args.line_max
|
|
1967
|
+
end
|
|
1957
1968
|
}
|
|
1958
1969
|
| primary_value call_op operation2 opt_paren_args
|
|
1959
1970
|
{
|
|
1960
|
-
recv, call_op, (op,
|
|
1971
|
+
recv, call_op, (op, op_line), args = val
|
|
1961
1972
|
|
|
1962
1973
|
result = new_call recv, op.to_sym, args, call_op
|
|
1974
|
+
result.line_max = op_line unless args
|
|
1963
1975
|
}
|
|
1964
1976
|
| primary_value tCOLON2 operation2 paren_args
|
|
1965
1977
|
{
|
|
@@ -1987,7 +1999,8 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
1987
1999
|
}
|
|
1988
2000
|
| kSUPER
|
|
1989
2001
|
{
|
|
1990
|
-
|
|
2002
|
+
(_, line), = val
|
|
2003
|
+
result = s(:zsuper).line line
|
|
1991
2004
|
}
|
|
1992
2005
|
| primary_value tLBRACK2 opt_call_args rbracket
|
|
1993
2006
|
{
|
|
@@ -1997,11 +2010,11 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
1997
2010
|
brace_block: tLCURLY
|
|
1998
2011
|
{
|
|
1999
2012
|
self.env.extend :dynamic
|
|
2000
|
-
result = self.lexer.lineno
|
|
2001
2013
|
}
|
|
2002
|
-
brace_body
|
|
2014
|
+
brace_body
|
|
2015
|
+
tRCURLY
|
|
2003
2016
|
{
|
|
2004
|
-
_, line, body, _ = val
|
|
2017
|
+
(_, line), _, body, _ = val
|
|
2005
2018
|
|
|
2006
2019
|
result = body
|
|
2007
2020
|
result.line line
|
|
@@ -2011,11 +2024,11 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
2011
2024
|
| k_do
|
|
2012
2025
|
{
|
|
2013
2026
|
self.env.extend :dynamic
|
|
2014
|
-
result = self.lexer.lineno
|
|
2015
2027
|
}
|
|
2016
|
-
do_body
|
|
2028
|
+
do_body
|
|
2029
|
+
kEND
|
|
2017
2030
|
{
|
|
2018
|
-
_, line, body, _ = val
|
|
2031
|
+
(_, line), _, body, _ = val
|
|
2019
2032
|
|
|
2020
2033
|
result = body
|
|
2021
2034
|
result.line line
|
|
@@ -2073,14 +2086,13 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
2073
2086
|
}
|
|
2074
2087
|
|
|
2075
2088
|
case_body: k_when
|
|
2076
|
-
{
|
|
2077
|
-
result = self.lexer.lineno
|
|
2078
|
-
}
|
|
2079
2089
|
case_args then compstmt cases
|
|
2080
2090
|
{
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
result
|
|
2091
|
+
(_, line), case_args, _then, body, cases = val
|
|
2092
|
+
|
|
2093
|
+
result = new_when case_args, body
|
|
2094
|
+
result.line line
|
|
2095
|
+
result << cases if cases
|
|
2084
2096
|
}
|
|
2085
2097
|
|
|
2086
2098
|
cases: opt_else | case_body
|
|
@@ -2716,15 +2728,17 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
2716
2728
|
|
|
2717
2729
|
words: tWORDS_BEG tSPACE tSTRING_END
|
|
2718
2730
|
{
|
|
2719
|
-
(_, line), _, _ = val
|
|
2731
|
+
(_, line), _, (_, line_max) = val
|
|
2720
2732
|
|
|
2721
2733
|
result = s(:array).line line
|
|
2734
|
+
result.line_max = line_max
|
|
2722
2735
|
}
|
|
2723
2736
|
| tWORDS_BEG word_list tSTRING_END
|
|
2724
2737
|
{
|
|
2725
|
-
(_, line), list, _ = val
|
|
2738
|
+
(_, line), list, (_, line_max) = val
|
|
2726
2739
|
|
|
2727
2740
|
result = list.line line
|
|
2741
|
+
result.line_max = line_max
|
|
2728
2742
|
}
|
|
2729
2743
|
|
|
2730
2744
|
word_list: none
|
|
@@ -2744,15 +2758,17 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
2744
2758
|
|
|
2745
2759
|
symbols: tSYMBOLS_BEG tSPACE tSTRING_END
|
|
2746
2760
|
{
|
|
2747
|
-
(_, line), _, _ = val
|
|
2761
|
+
(_, line), _, (_, line_max) = val
|
|
2748
2762
|
|
|
2749
2763
|
result = s(:array).line line
|
|
2764
|
+
result.line_max = line_max
|
|
2750
2765
|
}
|
|
2751
2766
|
| tSYMBOLS_BEG symbol_list tSTRING_END
|
|
2752
2767
|
{
|
|
2753
|
-
(_, line), list, _, = val
|
|
2754
|
-
|
|
2755
|
-
result = list
|
|
2768
|
+
(_, line), list, (_, line_max), = val
|
|
2769
|
+
|
|
2770
|
+
result = list.line line
|
|
2771
|
+
result.line_max = line_max
|
|
2756
2772
|
}
|
|
2757
2773
|
|
|
2758
2774
|
symbol_list: none
|
|
@@ -2767,28 +2783,32 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
|
2767
2783
|
|
|
2768
2784
|
qwords: tQWORDS_BEG tSPACE tSTRING_END
|
|
2769
2785
|
{
|
|
2770
|
-
(_, line), _, _ = val
|
|
2786
|
+
(_, line), _, (_, line_max) = val
|
|
2771
2787
|
|
|
2772
2788
|
result = s(:array).line line
|
|
2789
|
+
result.line_max = line_max
|
|
2773
2790
|
}
|
|
2774
2791
|
| tQWORDS_BEG qword_list tSTRING_END
|
|
2775
2792
|
{
|
|
2776
|
-
(_, line), list, _ = val
|
|
2793
|
+
(_, line), list, (_, line_max) = val
|
|
2777
2794
|
|
|
2778
2795
|
result = list.line line
|
|
2796
|
+
result.line_max = line_max
|
|
2779
2797
|
}
|
|
2780
2798
|
|
|
2781
2799
|
qsymbols: tQSYMBOLS_BEG tSPACE tSTRING_END
|
|
2782
2800
|
{
|
|
2783
|
-
(_, line), _, _ = val
|
|
2801
|
+
(_, line), _, (_, line_max) = val
|
|
2784
2802
|
|
|
2785
2803
|
result = s(:array).line line
|
|
2804
|
+
result.line_max = line_max
|
|
2786
2805
|
}
|
|
2787
2806
|
| tQSYMBOLS_BEG qsym_list tSTRING_END
|
|
2788
2807
|
{
|
|
2789
|
-
(_, line), list, _ = val
|
|
2808
|
+
(_, line), list, (_, line_max) = val
|
|
2790
2809
|
|
|
2791
2810
|
result = list.line line
|
|
2811
|
+
result.line_max = line_max
|
|
2792
2812
|
}
|
|
2793
2813
|
|
|
2794
2814
|
qword_list: none
|
|
@@ -2863,7 +2883,6 @@ regexp_contents: none
|
|
|
2863
2883
|
lexer.brace_nest,
|
|
2864
2884
|
lexer.string_nest, # TODO: remove
|
|
2865
2885
|
lexer.lex_state,
|
|
2866
|
-
lexer.lineno,
|
|
2867
2886
|
]
|
|
2868
2887
|
|
|
2869
2888
|
lexer.cmdarg.push false
|
|
@@ -2878,9 +2897,9 @@ regexp_contents: none
|
|
|
2878
2897
|
compstmt
|
|
2879
2898
|
tSTRING_DEND
|
|
2880
2899
|
{
|
|
2881
|
-
_, memo, stmt, _ = val
|
|
2900
|
+
(_, line), memo, stmt, _ = val
|
|
2882
2901
|
|
|
2883
|
-
lex_strterm, brace_nest, string_nest, oldlex_state
|
|
2902
|
+
lex_strterm, brace_nest, string_nest, oldlex_state = memo
|
|
2884
2903
|
# TODO: heredoc_indent
|
|
2885
2904
|
|
|
2886
2905
|
lexer.lex_strterm = lex_strterm
|
|
@@ -2940,11 +2959,11 @@ regexp_contents: none
|
|
|
2940
2959
|
|
|
2941
2960
|
dsym: tSYMBEG string_contents tSTRING_END
|
|
2942
2961
|
{
|
|
2943
|
-
_, result, _ = val
|
|
2962
|
+
(_, line), result, _ = val
|
|
2944
2963
|
|
|
2945
2964
|
lexer.lex_state = EXPR_END
|
|
2946
2965
|
|
|
2947
|
-
result ||= s(:str, "").line
|
|
2966
|
+
result ||= s(:str, "").line line
|
|
2948
2967
|
|
|
2949
2968
|
case result.sexp_type
|
|
2950
2969
|
when :dstr then
|
|
@@ -2980,15 +2999,15 @@ regexp_contents: none
|
|
|
2980
2999
|
| tCONSTANT
|
|
2981
3000
|
| tCVAR
|
|
2982
3001
|
|
|
2983
|
-
keyword_variable: kNIL { result = s(:nil).line
|
|
2984
|
-
| kSELF { result = s(:self).line
|
|
2985
|
-
| kTRUE { result = s(:true).line
|
|
2986
|
-
| kFALSE { result = s(:false).line
|
|
2987
|
-
| k__FILE__ { result = s(:str, self.file).line
|
|
2988
|
-
| k__LINE__ { result = s(:lit,
|
|
3002
|
+
keyword_variable: kNIL { (_, line), = val; result = s(:nil).line line }
|
|
3003
|
+
| kSELF { (_, line), = val; result = s(:self).line line }
|
|
3004
|
+
| kTRUE { (_, line), = val; result = s(:true).line line }
|
|
3005
|
+
| kFALSE { (_, line), = val; result = s(:false).line line }
|
|
3006
|
+
| k__FILE__ { (_, line), = val; result = s(:str, self.file).line line }
|
|
3007
|
+
| k__LINE__ { (_, line), = val; result = s(:lit, line).line line }
|
|
2989
3008
|
| k__ENCODING__
|
|
2990
3009
|
{
|
|
2991
|
-
l =
|
|
3010
|
+
(_, l), = val
|
|
2992
3011
|
result =
|
|
2993
3012
|
if defined? Encoding then
|
|
2994
3013
|
s(:colon2, s(:const, :Encoding).line(l), :UTF_8).line l
|
|
@@ -3151,12 +3170,12 @@ f_opt_paren_args: f_paren_args
|
|
|
3151
3170
|
|
|
|
3152
3171
|
{
|
|
3153
3172
|
result = args val
|
|
3154
|
-
# result.line lexer.lineno
|
|
3155
3173
|
}
|
|
3156
3174
|
|
|
3157
3175
|
args_forward: tBDOT3
|
|
3158
3176
|
{
|
|
3159
|
-
|
|
3177
|
+
(_, line), = val
|
|
3178
|
+
result = s(:forward_args).line line
|
|
3160
3179
|
}
|
|
3161
3180
|
|
|
3162
3181
|
f_bad_arg: tCONSTANT
|
|
@@ -3210,7 +3229,14 @@ f_opt_paren_args: f_paren_args
|
|
|
3210
3229
|
result = s(:args, list).line list.line
|
|
3211
3230
|
end
|
|
3212
3231
|
|
|
3213
|
-
|
|
3232
|
+
if Sexp === item then
|
|
3233
|
+
line_max = item.line_max
|
|
3234
|
+
else
|
|
3235
|
+
item, line_max = item
|
|
3236
|
+
end
|
|
3237
|
+
|
|
3238
|
+
result << item
|
|
3239
|
+
result.line_max = line_max
|
|
3214
3240
|
}
|
|
3215
3241
|
|
|
3216
3242
|
f_label: tLABEL
|
|
@@ -3287,9 +3313,10 @@ f_opt_paren_args: f_paren_args
|
|
|
3287
3313
|
}
|
|
3288
3314
|
| kwrest_mark
|
|
3289
3315
|
{
|
|
3316
|
+
(_, line), = val
|
|
3290
3317
|
id = :"**"
|
|
3291
|
-
self.env[id] = :lvar
|
|
3292
|
-
result = [id,
|
|
3318
|
+
self.env[id] = :lvar
|
|
3319
|
+
result = [id, line]
|
|
3293
3320
|
}
|
|
3294
3321
|
|
|
3295
3322
|
f_opt: f_arg_asgn
|
|
@@ -3347,9 +3374,10 @@ f_opt_paren_args: f_paren_args
|
|
|
3347
3374
|
}
|
|
3348
3375
|
| restarg_mark
|
|
3349
3376
|
{
|
|
3377
|
+
(_, line), = val
|
|
3350
3378
|
name = :"*"
|
|
3351
3379
|
self.env[name] = :lvar
|
|
3352
|
-
result = [name,
|
|
3380
|
+
result = [name, line]
|
|
3353
3381
|
}
|
|
3354
3382
|
|
|
3355
3383
|
blkarg_mark: tAMPER2 | tAMPER
|
|
@@ -3454,11 +3482,10 @@ f_opt_paren_args: f_paren_args
|
|
|
3454
3482
|
opt_terms: | terms
|
|
3455
3483
|
opt_nl: | tNL
|
|
3456
3484
|
rparen: opt_nl tRPAREN
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
# }
|
|
3485
|
+
{
|
|
3486
|
+
_, close = val # TODO: include lineno in close?
|
|
3487
|
+
result = [close, lexer.lineno]
|
|
3488
|
+
}
|
|
3462
3489
|
rbracket: opt_nl tRBRACK
|
|
3463
3490
|
{
|
|
3464
3491
|
_, close = val
|