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/ruby20_parser.y CHANGED
@@ -682,8 +682,7 @@ rule
682
682
 
683
683
  cpath: tCOLON3 cname
684
684
  {
685
- _, (name, line) = val
686
- result = s(:colon3, name.to_sym).line line
685
+ result = wrap :colon3, val[1]
687
686
  }
688
687
  | cname
689
688
  {
@@ -708,9 +707,7 @@ rule
708
707
 
709
708
  fitem: fname
710
709
  {
711
- (id, line), = val
712
-
713
- result = s(:lit, id.to_sym).line line
710
+ result = wrap :lit, val[0]
714
711
  }
715
712
  | symbol
716
713
 
@@ -779,9 +776,9 @@ rule
779
776
  }
780
777
  | tCOLON3 tCONSTANT tOP_ASGN arg_rhs
781
778
  {
782
- _, (lhs, line), op, rhs = val
779
+ _, lhs, op, rhs = val
783
780
 
784
- lhs = s(:colon3, lhs.to_sym).line line
781
+ lhs = wrap :colon3, lhs
785
782
  result = new_const_op_asgn [lhs, op, rhs]
786
783
  }
787
784
  | backref tOP_ASGN arg_rhs
@@ -1182,9 +1179,7 @@ rule
1182
1179
  }
1183
1180
  | tCOLON3 tCONSTANT
1184
1181
  {
1185
- _, (id, line) = val
1186
-
1187
- result = s(:colon3, id.to_sym).line line
1182
+ result = wrap :colon3, val[1]
1188
1183
  }
1189
1184
  | tLBRACK { result = lexer.lineno } aref_args tRBRACK
1190
1185
  {
@@ -1208,15 +1203,21 @@ rule
1208
1203
  }
1209
1204
  | kYIELD tLPAREN2 call_args rparen
1210
1205
  {
1211
- result = new_yield val[2]
1206
+ (_, line), _, args, _ = val
1207
+
1208
+ result = new_yield(args).line line
1212
1209
  }
1213
1210
  | kYIELD tLPAREN2 rparen
1214
1211
  {
1215
- result = new_yield
1212
+ (_, line), _, _ = val
1213
+
1214
+ result = new_yield.line line
1216
1215
  }
1217
1216
  | kYIELD
1218
1217
  {
1219
- result = new_yield
1218
+ (_, line), = val
1219
+
1220
+ result = new_yield.line line
1220
1221
  }
1221
1222
  | kDEFINED opt_nl tLPAREN2 expr rparen
1222
1223
  {
@@ -1672,8 +1673,7 @@ opt_block_args_tail: tCOMMA block_args_tail
1672
1673
 
1673
1674
  bvar: tIDENTIFIER
1674
1675
  {
1675
- (id, line), = val
1676
- result = s(:shadow, id.to_sym).line line
1676
+ result = wrap :shadow, val[0]
1677
1677
  }
1678
1678
  | f_bad_arg
1679
1679
 
@@ -2188,18 +2188,15 @@ regexp_contents: none
2188
2188
 
2189
2189
  string_dvar: tGVAR
2190
2190
  {
2191
- (id, line), = val
2192
- result = s(:gvar, id.to_sym).line line
2191
+ result = wrap :gvar, val[0]
2193
2192
  }
2194
2193
  | tIVAR
2195
2194
  {
2196
- (id, line), = val
2197
- result = s(:ivar, id.to_sym).line line
2195
+ result = wrap :ivar, val[0]
2198
2196
  }
2199
2197
  | tCVAR
2200
2198
  {
2201
- (id, line), = val
2202
- result = s(:cvar, id.to_sym).line line
2199
+ result = wrap :cvar, val[0]
2203
2200
  }
2204
2201
  | backref
2205
2202
 
@@ -2208,17 +2205,13 @@ regexp_contents: none
2208
2205
 
2209
2206
  ssym: tSYMBEG sym
2210
2207
  {
2211
- _, (id, line) = val
2212
-
2213
2208
  lexer.lex_state = EXPR_END
2214
- result = s(:lit, id.to_sym).line line
2209
+ result = wrap :lit, val[1]
2215
2210
  }
2216
2211
  | tSYMBOL
2217
2212
  {
2218
- (id, line), = val
2219
-
2220
2213
  lexer.lex_state = EXPR_END
2221
- result = s(:lit, id.to_sym).line line
2214
+ result = wrap :lit, val[0]
2222
2215
  }
2223
2216
 
2224
2217
  sym: fname | tIVAR | tGVAR | tCVAR
@@ -2641,10 +2634,10 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
2641
2634
  }
2642
2635
  | tLABEL arg_value
2643
2636
  {
2644
- (label, line), arg = val
2637
+ label, arg = val
2645
2638
 
2646
- lit = s(:lit, label.to_sym).line line
2647
- result = s(:array, lit, arg).line line
2639
+ lit = wrap :lit, label
2640
+ result = s(:array, lit, arg).line lit.line
2648
2641
  }
2649
2642
  | tDSTAR arg_value
2650
2643
  {