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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +6 -0
- data/lib/ruby20_parser.rb +170 -134
- data/lib/ruby20_parser.y +50 -16
- data/lib/ruby21_parser.rb +110 -74
- data/lib/ruby21_parser.y +50 -16
- data/lib/ruby22_parser.rb +238 -202
- data/lib/ruby22_parser.y +50 -16
- data/lib/ruby23_parser.rb +383 -347
- data/lib/ruby23_parser.y +50 -16
- data/lib/ruby24_parser.rb +96 -60
- data/lib/ruby24_parser.y +50 -16
- data/lib/ruby25_parser.rb +92 -56
- data/lib/ruby25_parser.y +50 -16
- data/lib/ruby26_parser.rb +92 -56
- data/lib/ruby26_parser.y +50 -16
- data/lib/ruby27_parser.rb +574 -538
- data/lib/ruby27_parser.y +50 -16
- data/lib/ruby30_parser.rb +357 -331
- data/lib/ruby30_parser.y +42 -16
- data/lib/ruby31_parser.rb +174 -148
- data/lib/ruby31_parser.y +42 -16
- data/lib/ruby32_parser.rb +174 -148
- data/lib/ruby32_parser.y +42 -16
- data/lib/ruby3_parser.yy +42 -16
- data/lib/ruby_parser.yy +50 -16
- data/lib/ruby_parser_extras.rb +19 -13
- data/test/test_ruby_parser.rb +156 -6
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
data/lib/ruby27_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 kRESCUE_MOD stmt
|
@@ -1043,8 +1044,10 @@ rule
|
|
1043
1044
|
|
1044
1045
|
paren_args: tLPAREN2 opt_call_args rparen
|
1045
1046
|
{
|
1046
|
-
_, args, _ = val
|
1047
|
+
_, args, (_, line_max) = val
|
1048
|
+
|
1047
1049
|
result = args
|
1050
|
+
result.line_max = line_max if args
|
1048
1051
|
}
|
1049
1052
|
| tLPAREN2 args tCOMMA args_forward rparen
|
1050
1053
|
{
|
@@ -1267,12 +1270,14 @@ rule
|
|
1267
1270
|
{
|
1268
1271
|
result = wrap :colon3, val[1]
|
1269
1272
|
}
|
1270
|
-
| tLBRACK { result = lexer.lineno } aref_args
|
1273
|
+
| tLBRACK { result = lexer.lineno } aref_args rbracket
|
1271
1274
|
{
|
1272
|
-
_, line, args, _ = val
|
1275
|
+
_, line, args, (_, line_max) = val
|
1276
|
+
|
1273
1277
|
result = args || s(:array)
|
1274
1278
|
result.sexp_type = :array # aref_args is :args
|
1275
1279
|
result.line line
|
1280
|
+
result.line_max = line_max
|
1276
1281
|
}
|
1277
1282
|
| tLBRACE
|
1278
1283
|
{
|
@@ -1870,13 +1875,19 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
1870
1875
|
{
|
1871
1876
|
call, args = val
|
1872
1877
|
|
1873
|
-
result = call
|
1878
|
+
result = call
|
1879
|
+
|
1880
|
+
if args then
|
1881
|
+
call.concat args.sexp_body
|
1882
|
+
result.line_max = args.line_max
|
1883
|
+
end
|
1874
1884
|
}
|
1875
1885
|
| primary_value call_op operation2 opt_paren_args
|
1876
1886
|
{
|
1877
|
-
recv, call_op, (op,
|
1887
|
+
recv, call_op, (op, op_line), args = val
|
1878
1888
|
|
1879
1889
|
result = new_call recv, op.to_sym, args, call_op
|
1890
|
+
result.line_max = op_line unless args
|
1880
1891
|
}
|
1881
1892
|
| primary_value tCOLON2 operation2 paren_args
|
1882
1893
|
{
|
@@ -2596,15 +2607,17 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
2596
2607
|
|
2597
2608
|
words: tWORDS_BEG tSPACE tSTRING_END
|
2598
2609
|
{
|
2599
|
-
(_, line), _, _ = val
|
2610
|
+
(_, line), _, (_, line_max) = val
|
2600
2611
|
|
2601
2612
|
result = s(:array).line line
|
2613
|
+
result.line_max = line_max
|
2602
2614
|
}
|
2603
2615
|
| tWORDS_BEG word_list tSTRING_END
|
2604
2616
|
{
|
2605
|
-
(_, line), list, _ = val
|
2617
|
+
(_, line), list, (_, line_max) = val
|
2606
2618
|
|
2607
2619
|
result = list.line line
|
2620
|
+
result.line_max = line_max
|
2608
2621
|
}
|
2609
2622
|
|
2610
2623
|
word_list: none
|
@@ -2624,15 +2637,17 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
2624
2637
|
|
2625
2638
|
symbols: tSYMBOLS_BEG tSPACE tSTRING_END
|
2626
2639
|
{
|
2627
|
-
(_, line), _, _ = val
|
2640
|
+
(_, line), _, (_, line_max) = val
|
2628
2641
|
|
2629
2642
|
result = s(:array).line line
|
2643
|
+
result.line_max = line_max
|
2630
2644
|
}
|
2631
2645
|
| tSYMBOLS_BEG symbol_list tSTRING_END
|
2632
2646
|
{
|
2633
|
-
(_, line), list, _, = val
|
2634
|
-
|
2635
|
-
result = list
|
2647
|
+
(_, line), list, (_, line_max), = val
|
2648
|
+
|
2649
|
+
result = list.line line
|
2650
|
+
result.line_max = line_max
|
2636
2651
|
}
|
2637
2652
|
|
2638
2653
|
symbol_list: none
|
@@ -2647,28 +2662,32 @@ opt_block_args_tail: tCOMMA block_args_tail
|
|
2647
2662
|
|
2648
2663
|
qwords: tQWORDS_BEG tSPACE tSTRING_END
|
2649
2664
|
{
|
2650
|
-
(_, line), _, _ = val
|
2665
|
+
(_, line), _, (_, line_max) = val
|
2651
2666
|
|
2652
2667
|
result = s(:array).line line
|
2668
|
+
result.line_max = line_max
|
2653
2669
|
}
|
2654
2670
|
| tQWORDS_BEG qword_list tSTRING_END
|
2655
2671
|
{
|
2656
|
-
(_, line), list, _ = val
|
2672
|
+
(_, line), list, (_, line_max) = val
|
2657
2673
|
|
2658
2674
|
result = list.line line
|
2675
|
+
result.line_max = line_max
|
2659
2676
|
}
|
2660
2677
|
|
2661
2678
|
qsymbols: tQSYMBOLS_BEG tSPACE tSTRING_END
|
2662
2679
|
{
|
2663
|
-
(_, line), _, _ = val
|
2680
|
+
(_, line), _, (_, line_max) = val
|
2664
2681
|
|
2665
2682
|
result = s(:array).line line
|
2683
|
+
result.line_max = line_max
|
2666
2684
|
}
|
2667
2685
|
| tQSYMBOLS_BEG qsym_list tSTRING_END
|
2668
2686
|
{
|
2669
|
-
(_, line), list, _ = val
|
2687
|
+
(_, line), list, (_, line_max) = val
|
2670
2688
|
|
2671
2689
|
result = list.line line
|
2690
|
+
result.line_max = line_max
|
2672
2691
|
}
|
2673
2692
|
|
2674
2693
|
qword_list: none
|
@@ -3088,7 +3107,14 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
3088
3107
|
result = s(:args, list).line list.line
|
3089
3108
|
end
|
3090
3109
|
|
3091
|
-
|
3110
|
+
if Sexp === item then
|
3111
|
+
line_max = item.line_max
|
3112
|
+
else
|
3113
|
+
item, line_max = item
|
3114
|
+
end
|
3115
|
+
|
3116
|
+
result << item
|
3117
|
+
result.line_max = line_max
|
3092
3118
|
}
|
3093
3119
|
|
3094
3120
|
f_label: tLABEL
|
@@ -3310,7 +3336,15 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
|
|
3310
3336
|
opt_terms: | terms
|
3311
3337
|
opt_nl: | tNL
|
3312
3338
|
rparen: opt_nl tRPAREN
|
3339
|
+
{
|
3340
|
+
_, close = val
|
3341
|
+
result = [close, lexer.lineno]
|
3342
|
+
}
|
3313
3343
|
rbracket: opt_nl tRBRACK
|
3344
|
+
{
|
3345
|
+
_, close = val
|
3346
|
+
result = [close, lexer.lineno]
|
3347
|
+
}
|
3314
3348
|
rbrace: opt_nl tRCURLY
|
3315
3349
|
trailer: | tNL | tCOMMA
|
3316
3350
|
|