ruby_parser 3.18.0 → 3.18.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36780d9d3244dd62d13430987076d5e81ae2e536d6d2bfd259f8a612da3d94cc
4
- data.tar.gz: bec4b32e7f7a8d9ae8e3202f30230f351a2fedc6e2ac4e984260486dbb7529c6
3
+ metadata.gz: dad59e40690dfb746fea4399e13d05f97b43cf562c2559c67d1f9b5868da86c5
4
+ data.tar.gz: 0c14605ecf34929f6d4865c20f085b6ef2a35533a70e530f261f9d04f44998cb
5
5
  SHA512:
6
- metadata.gz: f28d02d2b14687e365bab3a353348b93a9df993be2d1afd3f2783b5b97ca016a6ca2f834ef61ebb4a4eae3decc38e1351349679f951f901bef09c25f23d44322
7
- data.tar.gz: 276ecce4db1f72ed2ce0d276679e65419225a46b885d0050aa7ba6382b45033ccd24b5006a0d382f0aecdbb6c5a5fd93e3e826adeafccc3c47ee051b76772eee
6
+ metadata.gz: 4fa69e55ac577e55fa2945ef9c135b47359a646e654bc8cf9f2ead973852adb97350cf67ac5da549592ea583f4824cd5f6930a167fa19cf3f914cb6d6888093d
7
+ data.tar.gz: 0c13eb02ffaf3b3c60ef358be2fa8f70b951e947170d3eeb8a94e5c37bec5dc8282376e4ab3f03de99e49b6e2aac2aa13169b31c30de1067e1a290c1fd65803a
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,15 @@
1
+ === 3.18.1 / 2021-11-10
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * All parser tests are now explicitly testing line numbers at every level.
6
+
7
+ * 3 bug fixes:
8
+
9
+ * Fixed endless method with noargs. (mitsuru)
10
+ * Fixed line numbers on some yield forms.
11
+ * Handle and clearly report if unifdef is missing.
12
+
1
13
  === 3.18.0 / 2021-10-27
2
14
 
3
15
  Holy crap... 58 commits! 2.7 and 3.0 are feature complete. Strings
data/Rakefile CHANGED
@@ -75,8 +75,17 @@ def maybe_add_to_top path, string
75
75
  File.rename tmp_path, path
76
76
  end
77
77
 
78
+ def unifdef?
79
+ @unifdef ||= system("which unifdef") or abort <<~EOM
80
+ unifdef not found!
81
+
82
+ Please install 'unifdef' package on your system or `rake generate` on a mac.
83
+ EOM
84
+ end
85
+
78
86
  V2.each do |n|
79
87
  file "lib/ruby#{n}_parser.y" => "lib/ruby_parser.yy" do |t|
88
+ unifdef?
80
89
  cmd = 'unifdef -tk -DV=%s -UDEAD %s > %s || true' % [n, t.source, t.name]
81
90
  sh cmd
82
91
  end
@@ -86,6 +95,7 @@ end
86
95
 
87
96
  V3.each do |n|
88
97
  file "lib/ruby#{n}_parser.y" => "lib/ruby3_parser.yy" do |t|
98
+ unifdef?
89
99
  cmd = 'unifdef -tk -DV=%s -UDEAD %s > %s || true' % [n, t.source, t.name]
90
100
  sh cmd
91
101
  end
data/lib/ruby20_parser.rb CHANGED
@@ -5131,19 +5131,25 @@ def _reduce_306(val, _values, result)
5131
5131
  end
5132
5132
 
5133
5133
  def _reduce_307(val, _values, result)
5134
- result = new_yield val[2]
5134
+ (_, line), _, args, _ = val
5135
+
5136
+ result = new_yield(args).line line
5135
5137
 
5136
5138
  result
5137
5139
  end
5138
5140
 
5139
5141
  def _reduce_308(val, _values, result)
5140
- result = new_yield
5142
+ (_, line), _, _ = val
5143
+
5144
+ result = new_yield.line line
5141
5145
 
5142
5146
  result
5143
5147
  end
5144
5148
 
5145
5149
  def _reduce_309(val, _values, result)
5146
- result = new_yield
5150
+ (_, line), = val
5151
+
5152
+ result = new_yield.line line
5147
5153
 
5148
5154
  result
5149
5155
  end
data/lib/ruby20_parser.y CHANGED
@@ -1208,15 +1208,21 @@ rule
1208
1208
  }
1209
1209
  | kYIELD tLPAREN2 call_args rparen
1210
1210
  {
1211
- result = new_yield val[2]
1211
+ (_, line), _, args, _ = val
1212
+
1213
+ result = new_yield(args).line line
1212
1214
  }
1213
1215
  | kYIELD tLPAREN2 rparen
1214
1216
  {
1215
- result = new_yield
1217
+ (_, line), _, _ = val
1218
+
1219
+ result = new_yield.line line
1216
1220
  }
1217
1221
  | kYIELD
1218
1222
  {
1219
- result = new_yield
1223
+ (_, line), = val
1224
+
1225
+ result = new_yield.line line
1220
1226
  }
1221
1227
  | kDEFINED opt_nl tLPAREN2 expr rparen
1222
1228
  {
data/lib/ruby21_parser.rb CHANGED
@@ -5162,19 +5162,25 @@ def _reduce_306(val, _values, result)
5162
5162
  end
5163
5163
 
5164
5164
  def _reduce_307(val, _values, result)
5165
- result = new_yield val[2]
5165
+ (_, line), _, args, _ = val
5166
+
5167
+ result = new_yield(args).line line
5166
5168
 
5167
5169
  result
5168
5170
  end
5169
5171
 
5170
5172
  def _reduce_308(val, _values, result)
5171
- result = new_yield
5173
+ (_, line), _, _ = val
5174
+
5175
+ result = new_yield.line line
5172
5176
 
5173
5177
  result
5174
5178
  end
5175
5179
 
5176
5180
  def _reduce_309(val, _values, result)
5177
- result = new_yield
5181
+ (_, line), = val
5182
+
5183
+ result = new_yield.line line
5178
5184
 
5179
5185
  result
5180
5186
  end
data/lib/ruby21_parser.y CHANGED
@@ -1206,15 +1206,21 @@ rule
1206
1206
  }
1207
1207
  | kYIELD tLPAREN2 call_args rparen
1208
1208
  {
1209
- result = new_yield val[2]
1209
+ (_, line), _, args, _ = val
1210
+
1211
+ result = new_yield(args).line line
1210
1212
  }
1211
1213
  | kYIELD tLPAREN2 rparen
1212
1214
  {
1213
- result = new_yield
1215
+ (_, line), _, _ = val
1216
+
1217
+ result = new_yield.line line
1214
1218
  }
1215
1219
  | kYIELD
1216
1220
  {
1217
- result = new_yield
1221
+ (_, line), = val
1222
+
1223
+ result = new_yield.line line
1218
1224
  }
1219
1225
  | kDEFINED opt_nl tLPAREN2 expr rparen
1220
1226
  {
data/lib/ruby22_parser.rb CHANGED
@@ -5196,19 +5196,25 @@ def _reduce_306(val, _values, result)
5196
5196
  end
5197
5197
 
5198
5198
  def _reduce_307(val, _values, result)
5199
- result = new_yield val[2]
5199
+ (_, line), _, args, _ = val
5200
+
5201
+ result = new_yield(args).line line
5200
5202
 
5201
5203
  result
5202
5204
  end
5203
5205
 
5204
5206
  def _reduce_308(val, _values, result)
5205
- result = new_yield
5207
+ (_, line), _, _ = val
5208
+
5209
+ result = new_yield.line line
5206
5210
 
5207
5211
  result
5208
5212
  end
5209
5213
 
5210
5214
  def _reduce_309(val, _values, result)
5211
- result = new_yield
5215
+ (_, line), = val
5216
+
5217
+ result = new_yield.line line
5212
5218
 
5213
5219
  result
5214
5220
  end
data/lib/ruby22_parser.y CHANGED
@@ -1207,15 +1207,21 @@ rule
1207
1207
  }
1208
1208
  | kYIELD tLPAREN2 call_args rparen
1209
1209
  {
1210
- result = new_yield val[2]
1210
+ (_, line), _, args, _ = val
1211
+
1212
+ result = new_yield(args).line line
1211
1213
  }
1212
1214
  | kYIELD tLPAREN2 rparen
1213
1215
  {
1214
- result = new_yield
1216
+ (_, line), _, _ = val
1217
+
1218
+ result = new_yield.line line
1215
1219
  }
1216
1220
  | kYIELD
1217
1221
  {
1218
- result = new_yield
1222
+ (_, line), = val
1223
+
1224
+ result = new_yield.line line
1219
1225
  }
1220
1226
  | kDEFINED opt_nl tLPAREN2 expr rparen
1221
1227
  {
data/lib/ruby23_parser.rb CHANGED
@@ -5203,19 +5203,25 @@ def _reduce_306(val, _values, result)
5203
5203
  end
5204
5204
 
5205
5205
  def _reduce_307(val, _values, result)
5206
- result = new_yield val[2]
5206
+ (_, line), _, args, _ = val
5207
+
5208
+ result = new_yield(args).line line
5207
5209
 
5208
5210
  result
5209
5211
  end
5210
5212
 
5211
5213
  def _reduce_308(val, _values, result)
5212
- result = new_yield
5214
+ (_, line), _, _ = val
5215
+
5216
+ result = new_yield.line line
5213
5217
 
5214
5218
  result
5215
5219
  end
5216
5220
 
5217
5221
  def _reduce_309(val, _values, result)
5218
- result = new_yield
5222
+ (_, line), = val
5223
+
5224
+ result = new_yield.line line
5219
5225
 
5220
5226
  result
5221
5227
  end
data/lib/ruby23_parser.y CHANGED
@@ -1208,15 +1208,21 @@ rule
1208
1208
  }
1209
1209
  | kYIELD tLPAREN2 call_args rparen
1210
1210
  {
1211
- result = new_yield val[2]
1211
+ (_, line), _, args, _ = val
1212
+
1213
+ result = new_yield(args).line line
1212
1214
  }
1213
1215
  | kYIELD tLPAREN2 rparen
1214
1216
  {
1215
- result = new_yield
1217
+ (_, line), _, _ = val
1218
+
1219
+ result = new_yield.line line
1216
1220
  }
1217
1221
  | kYIELD
1218
1222
  {
1219
- result = new_yield
1223
+ (_, line), = val
1224
+
1225
+ result = new_yield.line line
1220
1226
  }
1221
1227
  | kDEFINED opt_nl tLPAREN2 expr rparen
1222
1228
  {
data/lib/ruby24_parser.rb CHANGED
@@ -5234,19 +5234,25 @@ def _reduce_307(val, _values, result)
5234
5234
  end
5235
5235
 
5236
5236
  def _reduce_308(val, _values, result)
5237
- result = new_yield val[2]
5237
+ (_, line), _, args, _ = val
5238
+
5239
+ result = new_yield(args).line line
5238
5240
 
5239
5241
  result
5240
5242
  end
5241
5243
 
5242
5244
  def _reduce_309(val, _values, result)
5243
- result = new_yield
5245
+ (_, line), _, _ = val
5246
+
5247
+ result = new_yield.line line
5244
5248
 
5245
5249
  result
5246
5250
  end
5247
5251
 
5248
5252
  def _reduce_310(val, _values, result)
5249
- result = new_yield
5253
+ (_, line), = val
5254
+
5255
+ result = new_yield.line line
5250
5256
 
5251
5257
  result
5252
5258
  end
data/lib/ruby24_parser.y CHANGED
@@ -1216,15 +1216,21 @@ rule
1216
1216
  }
1217
1217
  | kYIELD tLPAREN2 call_args rparen
1218
1218
  {
1219
- result = new_yield val[2]
1219
+ (_, line), _, args, _ = val
1220
+
1221
+ result = new_yield(args).line line
1220
1222
  }
1221
1223
  | kYIELD tLPAREN2 rparen
1222
1224
  {
1223
- result = new_yield
1225
+ (_, line), _, _ = val
1226
+
1227
+ result = new_yield.line line
1224
1228
  }
1225
1229
  | kYIELD
1226
1230
  {
1227
- result = new_yield
1231
+ (_, line), = val
1232
+
1233
+ result = new_yield.line line
1228
1234
  }
1229
1235
  | kDEFINED opt_nl tLPAREN2 expr rparen
1230
1236
  {
data/lib/ruby25_parser.rb CHANGED
@@ -5234,19 +5234,25 @@ def _reduce_307(val, _values, result)
5234
5234
  end
5235
5235
 
5236
5236
  def _reduce_308(val, _values, result)
5237
- result = new_yield val[2]
5237
+ (_, line), _, args, _ = val
5238
+
5239
+ result = new_yield(args).line line
5238
5240
 
5239
5241
  result
5240
5242
  end
5241
5243
 
5242
5244
  def _reduce_309(val, _values, result)
5243
- result = new_yield
5245
+ (_, line), _, _ = val
5246
+
5247
+ result = new_yield.line line
5244
5248
 
5245
5249
  result
5246
5250
  end
5247
5251
 
5248
5252
  def _reduce_310(val, _values, result)
5249
- result = new_yield
5253
+ (_, line), = val
5254
+
5255
+ result = new_yield.line line
5250
5256
 
5251
5257
  result
5252
5258
  end
data/lib/ruby25_parser.y CHANGED
@@ -1216,15 +1216,21 @@ rule
1216
1216
  }
1217
1217
  | kYIELD tLPAREN2 call_args rparen
1218
1218
  {
1219
- result = new_yield val[2]
1219
+ (_, line), _, args, _ = val
1220
+
1221
+ result = new_yield(args).line line
1220
1222
  }
1221
1223
  | kYIELD tLPAREN2 rparen
1222
1224
  {
1223
- result = new_yield
1225
+ (_, line), _, _ = val
1226
+
1227
+ result = new_yield.line line
1224
1228
  }
1225
1229
  | kYIELD
1226
1230
  {
1227
- result = new_yield
1231
+ (_, line), = val
1232
+
1233
+ result = new_yield.line line
1228
1234
  }
1229
1235
  | kDEFINED opt_nl tLPAREN2 expr rparen
1230
1236
  {
data/lib/ruby26_parser.rb CHANGED
@@ -5253,19 +5253,25 @@ def _reduce_309(val, _values, result)
5253
5253
  end
5254
5254
 
5255
5255
  def _reduce_310(val, _values, result)
5256
- result = new_yield val[2]
5256
+ (_, line), _, args, _ = val
5257
+
5258
+ result = new_yield(args).line line
5257
5259
 
5258
5260
  result
5259
5261
  end
5260
5262
 
5261
5263
  def _reduce_311(val, _values, result)
5262
- result = new_yield
5264
+ (_, line), _, _ = val
5265
+
5266
+ result = new_yield.line line
5263
5267
 
5264
5268
  result
5265
5269
  end
5266
5270
 
5267
5271
  def _reduce_312(val, _values, result)
5268
- result = new_yield
5272
+ (_, line), = val
5273
+
5274
+ result = new_yield.line line
5269
5275
 
5270
5276
  result
5271
5277
  end
data/lib/ruby26_parser.y CHANGED
@@ -1231,15 +1231,21 @@ rule
1231
1231
  }
1232
1232
  | kYIELD tLPAREN2 call_args rparen
1233
1233
  {
1234
- result = new_yield val[2]
1234
+ (_, line), _, args, _ = val
1235
+
1236
+ result = new_yield(args).line line
1235
1237
  }
1236
1238
  | kYIELD tLPAREN2 rparen
1237
1239
  {
1238
- result = new_yield
1240
+ (_, line), _, _ = val
1241
+
1242
+ result = new_yield.line line
1239
1243
  }
1240
1244
  | kYIELD
1241
1245
  {
1242
- result = new_yield
1246
+ (_, line), = val
1247
+
1248
+ result = new_yield.line line
1243
1249
  }
1244
1250
  | kDEFINED opt_nl tLPAREN2 expr rparen
1245
1251
  {
data/lib/ruby27_parser.rb CHANGED
@@ -5794,19 +5794,25 @@ def _reduce_316(val, _values, result)
5794
5794
  end
5795
5795
 
5796
5796
  def _reduce_317(val, _values, result)
5797
- result = new_yield val[2]
5797
+ (_, line), _, args, _ = val
5798
+
5799
+ result = new_yield(args).line line
5798
5800
 
5799
5801
  result
5800
5802
  end
5801
5803
 
5802
5804
  def _reduce_318(val, _values, result)
5803
- result = new_yield
5805
+ (_, line), _, _ = val
5806
+
5807
+ result = new_yield.line line
5804
5808
 
5805
5809
  result
5806
5810
  end
5807
5811
 
5808
5812
  def _reduce_319(val, _values, result)
5809
- result = new_yield
5813
+ (_, line), = val
5814
+
5815
+ result = new_yield.line line
5810
5816
 
5811
5817
  result
5812
5818
  end
data/lib/ruby27_parser.y CHANGED
@@ -1294,15 +1294,21 @@ rule
1294
1294
  }
1295
1295
  | kYIELD tLPAREN2 call_args rparen
1296
1296
  {
1297
- result = new_yield val[2]
1297
+ (_, line), _, args, _ = val
1298
+
1299
+ result = new_yield(args).line line
1298
1300
  }
1299
1301
  | kYIELD tLPAREN2 rparen
1300
1302
  {
1301
- result = new_yield
1303
+ (_, line), _, _ = val
1304
+
1305
+ result = new_yield.line line
1302
1306
  }
1303
1307
  | kYIELD
1304
1308
  {
1305
- result = new_yield
1309
+ (_, line), = val
1310
+
1311
+ result = new_yield.line line
1306
1312
  }
1307
1313
  | kDEFINED opt_nl tLPAREN2 expr rparen
1308
1314
  {
data/lib/ruby30_parser.rb CHANGED
@@ -3424,7 +3424,7 @@ racc_reduce_table = [
3424
3424
  4, 277, :_reduce_658,
3425
3425
  1, 277, :_reduce_659,
3426
3426
  1, 235, :_reduce_none,
3427
- 1, 235, :_reduce_none,
3427
+ 1, 235, :_reduce_661,
3428
3428
  3, 394, :_reduce_662,
3429
3429
  5, 394, :_reduce_663,
3430
3430
  3, 394, :_reduce_664,
@@ -6008,19 +6008,25 @@ def _reduce_326(val, _values, result)
6008
6008
  end
6009
6009
 
6010
6010
  def _reduce_327(val, _values, result)
6011
- result = new_yield val[2]
6011
+ (_, line), _, args, _ = val
6012
+
6013
+ result = new_yield(args).line line
6012
6014
 
6013
6015
  result
6014
6016
  end
6015
6017
 
6016
6018
  def _reduce_328(val, _values, result)
6017
- result = new_yield
6019
+ (_, line), _, _ = val
6020
+
6021
+ result = new_yield.line line
6018
6022
 
6019
6023
  result
6020
6024
  end
6021
6025
 
6022
6026
  def _reduce_329(val, _values, result)
6023
- result = new_yield
6027
+ (_, line), = val
6028
+
6029
+ result = new_yield.line line
6024
6030
 
6025
6031
  result
6026
6032
  end
@@ -8164,7 +8170,11 @@ end
8164
8170
 
8165
8171
  # reduce 660 omitted
8166
8172
 
8167
- # reduce 661 omitted
8173
+ def _reduce_661(val, _values, result)
8174
+ result = end_args val
8175
+
8176
+ result
8177
+ end
8168
8178
 
8169
8179
  def _reduce_662(val, _values, result)
8170
8180
  result = end_args val
data/lib/ruby30_parser.y CHANGED
@@ -1392,15 +1392,21 @@ rule
1392
1392
  }
1393
1393
  | kYIELD tLPAREN2 call_args rparen
1394
1394
  {
1395
- result = new_yield val[2]
1395
+ (_, line), _, args, _ = val
1396
+
1397
+ result = new_yield(args).line line
1396
1398
  }
1397
1399
  | kYIELD tLPAREN2 rparen
1398
1400
  {
1399
- result = new_yield
1401
+ (_, line), _, _ = val
1402
+
1403
+ result = new_yield.line line
1400
1404
  }
1401
1405
  | kYIELD
1402
1406
  {
1403
- result = new_yield
1407
+ (_, line), = val
1408
+
1409
+ result = new_yield.line line
1404
1410
  }
1405
1411
  | kDEFINED opt_nl tLPAREN2 expr rparen
1406
1412
  {
@@ -3035,6 +3041,9 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
3035
3041
 
3036
3042
  f_opt_paren_args: f_paren_args
3037
3043
  | none
3044
+ {
3045
+ result = end_args val
3046
+ }
3038
3047
 
3039
3048
  f_paren_args: tLPAREN2 f_args rparen
3040
3049
  {
data/lib/ruby3_parser.yy CHANGED
@@ -1396,15 +1396,21 @@ rule
1396
1396
  }
1397
1397
  | kYIELD tLPAREN2 call_args rparen
1398
1398
  {
1399
- result = new_yield val[2]
1399
+ (_, line), _, args, _ = val
1400
+
1401
+ result = new_yield(args).line line
1400
1402
  }
1401
1403
  | kYIELD tLPAREN2 rparen
1402
1404
  {
1403
- result = new_yield
1405
+ (_, line), _, _ = val
1406
+
1407
+ result = new_yield.line line
1404
1408
  }
1405
1409
  | kYIELD
1406
1410
  {
1407
- result = new_yield
1411
+ (_, line), = val
1412
+
1413
+ result = new_yield.line line
1408
1414
  }
1409
1415
  | kDEFINED opt_nl tLPAREN2 expr rparen
1410
1416
  {
@@ -3039,6 +3045,9 @@ keyword_variable: kNIL { result = s(:nil).line lexer.lineno }
3039
3045
 
3040
3046
  f_opt_paren_args: f_paren_args
3041
3047
  | none
3048
+ {
3049
+ result = end_args val
3050
+ }
3042
3051
 
3043
3052
  f_paren_args: tLPAREN2 f_args rparen
3044
3053
  {
data/lib/ruby_parser.yy CHANGED
@@ -1362,15 +1362,21 @@ rule
1362
1362
  }
1363
1363
  | kYIELD tLPAREN2 call_args rparen
1364
1364
  {
1365
- result = new_yield val[2]
1365
+ (_, line), _, args, _ = val
1366
+
1367
+ result = new_yield(args).line line
1366
1368
  }
1367
1369
  | kYIELD tLPAREN2 rparen
1368
1370
  {
1369
- result = new_yield
1371
+ (_, line), _, _ = val
1372
+
1373
+ result = new_yield.line line
1370
1374
  }
1371
1375
  | kYIELD
1372
1376
  {
1373
- result = new_yield
1377
+ (_, line), = val
1378
+
1379
+ result = new_yield.line line
1374
1380
  }
1375
1381
  | kDEFINED opt_nl tLPAREN2 expr rparen
1376
1382
  {
@@ -30,7 +30,7 @@ class Sexp
30
30
  end
31
31
 
32
32
  module RubyParserStuff
33
- VERSION = "3.18.0"
33
+ VERSION = "3.18.1"
34
34
 
35
35
  attr_accessor :lexer, :in_def, :in_single, :file
36
36
  attr_accessor :in_kwarg