ruby_parser 3.18.0 → 3.19.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/ruby21_parser.y CHANGED
@@ -679,8 +679,7 @@ rule
679
679
 
680
680
  cpath: tCOLON3 cname
681
681
  {
682
- _, (name, line) = val
683
- result = s(:colon3, name.to_sym).line line
682
+ result = wrap :colon3, val[1]
684
683
  }
685
684
  | cname
686
685
  {
@@ -705,9 +704,7 @@ rule
705
704
 
706
705
  fitem: fname
707
706
  {
708
- (id, line), = val
709
-
710
- result = s(:lit, id.to_sym).line line
707
+ result = wrap :lit, val[0]
711
708
  }
712
709
  | symbol
713
710
 
@@ -776,9 +773,9 @@ rule
776
773
  }
777
774
  | tCOLON3 tCONSTANT tOP_ASGN arg_rhs
778
775
  {
779
- _, (lhs, line), op, rhs = val
776
+ _, lhs, op, rhs = val
780
777
 
781
- lhs = s(:colon3, lhs.to_sym).line line
778
+ lhs = wrap :colon3, lhs
782
779
  result = new_const_op_asgn [lhs, op, rhs]
783
780
  }
784
781
  | backref tOP_ASGN arg_rhs
@@ -1180,9 +1177,7 @@ rule
1180
1177
  }
1181
1178
  | tCOLON3 tCONSTANT
1182
1179
  {
1183
- _, (id, line) = val
1184
-
1185
- result = s(:colon3, id.to_sym).line line
1180
+ result = wrap :colon3, val[1]
1186
1181
  }
1187
1182
  | tLBRACK { result = lexer.lineno } aref_args tRBRACK
1188
1183
  {
@@ -1206,15 +1201,21 @@ rule
1206
1201
  }
1207
1202
  | kYIELD tLPAREN2 call_args rparen
1208
1203
  {
1209
- result = new_yield val[2]
1204
+ (_, line), _, args, _ = val
1205
+
1206
+ result = new_yield(args).line line
1210
1207
  }
1211
1208
  | kYIELD tLPAREN2 rparen
1212
1209
  {
1213
- result = new_yield
1210
+ (_, line), _, _ = val
1211
+
1212
+ result = new_yield.line line
1214
1213
  }
1215
1214
  | kYIELD
1216
1215
  {
1217
- result = new_yield
1216
+ (_, line), = val
1217
+
1218
+ result = new_yield.line line
1218
1219
  }
1219
1220
  | kDEFINED opt_nl tLPAREN2 expr rparen
1220
1221
  {
@@ -1670,8 +1671,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1670
1671
 
1671
1672
  bvar: tIDENTIFIER
1672
1673
  {
1673
- (id, line), = val
1674
- result = s(:shadow, id.to_sym).line line
1674
+ result = wrap :shadow, val[0]
1675
1675
  }
1676
1676
  | f_bad_arg
1677
1677
 
@@ -2186,18 +2186,15 @@ regexp_contents: none
2186
2186
 
2187
2187
  string_dvar: tGVAR
2188
2188
  {
2189
- (id, line), = val
2190
- result = s(:gvar, id.to_sym).line line
2189
+ result = wrap :gvar, val[0]
2191
2190
  }
2192
2191
  | tIVAR
2193
2192
  {
2194
- (id, line), = val
2195
- result = s(:ivar, id.to_sym).line line
2193
+ result = wrap :ivar, val[0]
2196
2194
  }
2197
2195
  | tCVAR
2198
2196
  {
2199
- (id, line), = val
2200
- result = s(:cvar, id.to_sym).line line
2197
+ result = wrap :cvar, val[0]
2201
2198
  }
2202
2199
  | backref
2203
2200
 
@@ -2206,17 +2203,13 @@ regexp_contents: none
2206
2203
 
2207
2204
  ssym: tSYMBEG sym
2208
2205
  {
2209
- _, (id, line) = val
2210
-
2211
2206
  lexer.lex_state = EXPR_END
2212
- result = s(:lit, id.to_sym).line line
2207
+ result = wrap :lit, val[1]
2213
2208
  }
2214
2209
  | tSYMBOL
2215
2210
  {
2216
- (id, line), = val
2217
-
2218
2211
  lexer.lex_state = EXPR_END
2219
- result = s(:lit, id.to_sym).line line
2212
+ result = wrap :lit, val[0]
2220
2213
  }
2221
2214
 
2222
2215
  sym: fname | tIVAR | tGVAR | tCVAR
@@ -2658,10 +2651,10 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2658
2651
  }
2659
2652
  | tLABEL arg_value
2660
2653
  {
2661
- (label, line), arg = val
2654
+ label, arg = val
2662
2655
 
2663
- lit = s(:lit, label.to_sym).line line
2664
- result = s(:array, lit, arg).line line
2656
+ lit = wrap :lit, label
2657
+ result = s(:array, lit, arg).line lit.line
2665
2658
  }
2666
2659
  | tDSTAR arg_value
2667
2660
  {