ruby_parser 3.18.0 → 3.19.1

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.
data/lib/ruby27_parser.y CHANGED
@@ -721,8 +721,7 @@ rule
721
721
 
722
722
  cpath: tCOLON3 cname
723
723
  {
724
- _, (name, line) = val
725
- result = s(:colon3, name.to_sym).line line
724
+ result = wrap :colon3, val[1]
726
725
  }
727
726
  | cname
728
727
  {
@@ -747,9 +746,7 @@ rule
747
746
 
748
747
  fitem: fname
749
748
  {
750
- (id, line), = val
751
-
752
- result = s(:lit, id.to_sym).line line
749
+ result = wrap :lit, val[0]
753
750
  }
754
751
  | symbol
755
752
 
@@ -818,9 +815,9 @@ rule
818
815
  }
819
816
  | tCOLON3 tCONSTANT tOP_ASGN arg_rhs
820
817
  {
821
- _, (lhs, line), op, rhs = val
818
+ _, lhs, op, rhs = val
822
819
 
823
- lhs = s(:colon3, lhs.to_sym).line line
820
+ lhs = wrap :colon3, lhs
824
821
  result = new_const_op_asgn [lhs, op, rhs]
825
822
  }
826
823
  | backref tOP_ASGN arg_rhs
@@ -1268,9 +1265,7 @@ rule
1268
1265
  }
1269
1266
  | tCOLON3 tCONSTANT
1270
1267
  {
1271
- _, (id, line) = val
1272
-
1273
- result = s(:colon3, id.to_sym).line line
1268
+ result = wrap :colon3, val[1]
1274
1269
  }
1275
1270
  | tLBRACK { result = lexer.lineno } aref_args tRBRACK
1276
1271
  {
@@ -1294,15 +1289,21 @@ rule
1294
1289
  }
1295
1290
  | kYIELD tLPAREN2 call_args rparen
1296
1291
  {
1297
- result = new_yield val[2]
1292
+ (_, line), _, args, _ = val
1293
+
1294
+ result = new_yield(args).line line
1298
1295
  }
1299
1296
  | kYIELD tLPAREN2 rparen
1300
1297
  {
1301
- result = new_yield
1298
+ (_, line), _, _ = val
1299
+
1300
+ result = new_yield.line line
1302
1301
  }
1303
1302
  | kYIELD
1304
1303
  {
1305
- result = new_yield
1304
+ (_, line), = val
1305
+
1306
+ result = new_yield.line line
1306
1307
  }
1307
1308
  | kDEFINED opt_nl tLPAREN2 expr rparen
1308
1309
  {
@@ -1768,8 +1769,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1768
1769
 
1769
1770
  bvar: tIDENTIFIER
1770
1771
  {
1771
- (id, line), = val
1772
- result = s(:shadow, id.to_sym).line line
1772
+ result = wrap :shadow, val[0]
1773
1773
  }
1774
1774
  | f_bad_arg
1775
1775
 
@@ -2375,9 +2375,7 @@ opt_block_args_tail: tCOMMA block_args_tail
2375
2375
 
2376
2376
  p_kw_label: tLABEL
2377
2377
  {
2378
- (id, line), = val
2379
-
2380
- result = s(:lit, id.to_sym).line line
2378
+ result = wrap :lit, val[0]
2381
2379
  }
2382
2380
 
2383
2381
  p_kwrest: kwrest_mark tIDENTIFIER
@@ -2469,26 +2467,20 @@ opt_block_args_tail: tCOMMA block_args_tail
2469
2467
 
2470
2468
  p_variable: tIDENTIFIER
2471
2469
  {
2472
- (id, line), = val
2473
-
2474
2470
  # TODO: error_duplicate_pattern_variable(p, $1, &@1);
2475
2471
  # TODO: assignable(p, $1, 0, &@$);
2476
- result = s(:lvar, id.to_sym).line line
2472
+ result = wrap :lvar, val[0]
2477
2473
  }
2478
2474
 
2479
2475
  p_var_ref: tCARET tIDENTIFIER
2480
2476
  {
2481
- _, (id, line) = val
2482
-
2483
2477
  # TODO: check id against env for lvar or dvar
2484
-
2485
- result = s(:lvar, id.to_sym).line line
2478
+ result = wrap :lvar, val[1]
2486
2479
  }
2487
2480
 
2488
2481
  p_const: tCOLON3 cname
2489
2482
  {
2490
- _, (id, line) = val
2491
- result = s(:colon3, id.to_sym).line line
2483
+ result = wrap :colon3, val[1]
2492
2484
  }
2493
2485
  | p_const tCOLON2 cname
2494
2486
  {
@@ -2500,8 +2492,7 @@ opt_block_args_tail: tCOMMA block_args_tail
2500
2492
  | tCONSTANT
2501
2493
  {
2502
2494
  # TODO $$ = gettable(p, $1, &@$);
2503
- (id, line), = val
2504
- result = s(:const, id.to_sym).line line
2495
+ result = wrap :const, val[0]
2505
2496
  }
2506
2497
  ######################################################################
2507
2498
 
@@ -2787,18 +2778,15 @@ regexp_contents: none
2787
2778
 
2788
2779
  string_dvar: tGVAR
2789
2780
  {
2790
- (id, line), = val
2791
- result = s(:gvar, id.to_sym).line line
2781
+ result = wrap :gvar, val[0]
2792
2782
  }
2793
2783
  | tIVAR
2794
2784
  {
2795
- (id, line), = val
2796
- result = s(:ivar, id.to_sym).line line
2785
+ result = wrap :ivar, val[0]
2797
2786
  }
2798
2787
  | tCVAR
2799
2788
  {
2800
- (id, line), = val
2801
- result = s(:cvar, id.to_sym).line line
2789
+ result = wrap :cvar, val[0]
2802
2790
  }
2803
2791
  | backref
2804
2792
 
@@ -2807,17 +2795,13 @@ regexp_contents: none
2807
2795
 
2808
2796
  ssym: tSYMBEG sym
2809
2797
  {
2810
- _, (id, line) = val
2811
-
2812
2798
  lexer.lex_state = EXPR_END
2813
- result = s(:lit, id.to_sym).line line
2799
+ result = wrap :lit, val[1]
2814
2800
  }
2815
2801
  | tSYMBOL
2816
2802
  {
2817
- (id, line), = val
2818
-
2819
2803
  lexer.lex_state = EXPR_END
2820
- result = s(:lit, id.to_sym).line line
2804
+ result = wrap :lit, val[0]
2821
2805
  }
2822
2806
 
2823
2807
  sym: fname | tIVAR | tGVAR | tCVAR
@@ -3281,10 +3265,10 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
3281
3265
  }
3282
3266
  | tLABEL arg_value
3283
3267
  {
3284
- (label, line), arg = val
3268
+ label, arg = val
3285
3269
 
3286
- lit = s(:lit, label.to_sym).line line
3287
- result = s(:array, lit, arg).line line
3270
+ lit = wrap :lit, label
3271
+ result = s(:array, lit, arg).line lit.line
3288
3272
  }
3289
3273
  | tSTRING_BEG string_contents tLABEL_END arg_value
3290
3274
  {