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