sexp_processor 4.1.0 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 4.1.1 / 2012-11-02
2
+
3
+ * 1 minor enhancement:
4
+
5
+ * iter args revamp for ruby_parser 3 changes.
6
+
1
7
  === 4.1.0 / 2012-10-22
2
8
 
3
9
  * 1 minor enhancement:
data/lib/pt_testcase.rb CHANGED
@@ -272,15 +272,14 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
272
272
  "Ruby" => "a { |@a| 42 }",
273
273
  "ParseTree" => s(:iter,
274
274
  s(:call, nil, :a),
275
- s(:iasgn, :@a),
275
+ s(:args, :@a),
276
276
  s(:lit, 42)))
277
277
 
278
278
  add_18tests("iter_masgn_args_ivar",
279
279
  "Ruby" => "a { |a, @b| 42 }",
280
280
  "ParseTree" => s(:iter,
281
281
  s(:call, nil, :a),
282
- s(:masgn,
283
- s(:array, s(:lasgn, :a), s(:iasgn, :@b))),
282
+ s(:args, :a, :@b),
284
283
  s(:lit, 42)))
285
284
 
286
285
  add_18tests("not",
@@ -367,10 +366,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
367
366
  add_19edgecases("lambda { |x, y| (x + y) }",
368
367
  s(:iter,
369
368
  s(:call, nil, :lambda),
370
- s(:masgn,
371
- s(:array,
372
- s(:lasgn, :x),
373
- s(:lasgn, :y))),
369
+ s(:args, :x, :y),
374
370
  s(:call, s(:lvar, :x), :+, s(:lvar, :y))),
375
371
  "stabby_args_2" => "->(x, y) { (x + y) }",
376
372
  "stabby_args_2_doend" => "->(x, y) do (x + y) end",
@@ -380,7 +376,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
380
376
  add_19edgecases("lambda { |x| (x + 1) }",
381
377
  s(:iter,
382
378
  s(:call, nil, :lambda),
383
- s(:lasgn, :x),
379
+ s(:args, :x),
384
380
  s(:call, s(:lvar, :x), :+, s(:lit, 1))),
385
381
  "stabby_args_1" => "->(x) { (x + 1) }",
386
382
  "stabby_args_1_doend" => "->(x) do (x + 1) end",
@@ -456,40 +452,31 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
456
452
  add_19tests("call_splat_mid",
457
453
  "Ruby" => "def f(a = nil, *b, c) end",
458
454
  "ParseTree" => s(:defn, :f,
459
- s(:args, :a, :"*b", :c,
460
- s(:block, s(:lasgn, :a, s(:nil)))),
455
+ s(:args, s(:lasgn, :a, s(:nil)), :"*b", :c),
461
456
  s(:nil)))
462
457
 
463
458
  add_19tests("defn_args_mand_opt_mand",
464
459
  "Ruby" => "def f(mand1, opt = 42, mand2)\n # do nothing\nend",
465
460
  "ParseTree" => s(:defn, :f,
466
- s(:args, :mand1, :opt, :mand2,
467
- s(:block,
468
- s(:lasgn, :opt, s(:lit, 42)))),
461
+ s(:args, :mand1, s(:lasgn, :opt, s(:lit, 42)), :mand2),
469
462
  s(:nil)))
470
463
 
471
464
  add_19tests("defn_args_mand_opt_splat_mand",
472
465
  "Ruby" => "def f(mand1, opt = 42, *rest, mand2)\n # do nothing\nend",
473
466
  "ParseTree" => s(:defn, :f,
474
- s(:args, :mand1, :opt, :"*rest", :mand2,
475
- s(:block,
476
- s(:lasgn, :opt, s(:lit, 42)))),
467
+ s(:args, :mand1, s(:lasgn, :opt, s(:lit, 42)), :"*rest", :mand2),
477
468
  s(:nil)))
478
469
 
479
470
  add_19tests("defn_args_opt_mand",
480
471
  "Ruby" => "def f(opt = 42, mand)\n # do nothing\nend",
481
472
  "ParseTree" => s(:defn, :f,
482
- s(:args, :opt, :mand,
483
- s(:block,
484
- s(:lasgn, :opt, s(:lit, 42)))),
473
+ s(:args, s(:lasgn, :opt, s(:lit, 42)), :mand),
485
474
  s(:nil)))
486
475
 
487
476
  add_19tests("defn_args_opt_splat_mand",
488
477
  "Ruby" => "def f(opt = 42, *rest, mand)\n # do nothing\nend",
489
478
  "ParseTree" => s(:defn, :f,
490
- s(:args, :opt, :"*rest", :mand,
491
- s(:block,
492
- s(:lasgn, :opt, s(:lit, 42)))),
479
+ s(:args, s(:lasgn, :opt, s(:lit, 42)), :"*rest", :mand),
493
480
  s(:nil)))
494
481
 
495
482
  add_19tests("defn_args_splat_mand",
@@ -810,7 +797,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
810
797
  "Ruby" => "a(b) do\n if b then\n true\n else\n c = false\n d { |x| c = true }\n c\n end\nend",
811
798
  "ParseTree" => s(:iter,
812
799
  s(:call, nil, :a, s(:call, nil, :b)),
813
- nil,
800
+ s(:args),
814
801
  s(:if,
815
802
  s(:call, nil, :b),
816
803
  s(:true),
@@ -818,7 +805,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
818
805
  s(:lasgn, :c, s(:false)),
819
806
  s(:iter,
820
807
  s(:call, nil, :d),
821
- s(:lasgn, :x),
808
+ s(:args, :x),
822
809
  s(:lasgn, :c, s(:true))),
823
810
  s(:lvar, :c)))))
824
811
 
@@ -878,8 +865,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
878
865
  s(:block_pass,
879
866
  s(:iter,
880
867
  s(:call, s(:const, :Proc), :new),
881
- s(:masgn,
882
- s(:array, s(:splat, s(:lasgn, :args)))),
868
+ s(:args, :"*args"),
883
869
  s(:nil)))))
884
870
 
885
871
  add_tests("block_pass_splat",
@@ -967,13 +953,15 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
967
953
  add_tests("break",
968
954
  "Ruby" => "loop { break if true }",
969
955
  "ParseTree" => s(:iter,
970
- s(:call, nil, :loop), nil,
956
+ s(:call, nil, :loop),
957
+ s(:args),
971
958
  s(:if, s(:true), s(:break), nil)))
972
959
 
973
960
  add_tests("break_arg",
974
961
  "Ruby" => "loop { break 42 if true }",
975
962
  "ParseTree" => s(:iter,
976
- s(:call, nil, :loop), nil,
963
+ s(:call, nil, :loop),
964
+ s(:args),
977
965
  s(:if, s(:true), s(:break, s(:lit, 42)), nil)))
978
966
 
979
967
  add_tests("call",
@@ -1226,11 +1214,11 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1226
1214
  "Ruby" => "a.each { |x| b.each { |y| x = (x + 1) } if true }",
1227
1215
  "ParseTree" => s(:iter,
1228
1216
  s(:call, s(:call, nil, :a), :each),
1229
- s(:lasgn, :x),
1217
+ s(:args, :x),
1230
1218
  s(:if, s(:true),
1231
1219
  s(:iter,
1232
1220
  s(:call, s(:call, nil, :b), :each),
1233
- s(:lasgn, :y),
1221
+ s(:args, :y),
1234
1222
  s(:lasgn, :x,
1235
1223
  s(:call, s(:lvar, :x), :+, s(:lit, 1)))),
1236
1224
  nil)))
@@ -1239,11 +1227,11 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1239
1227
  "Ruby" => "a.each { |x| b.each { |y| c = (c + 1) } if true }",
1240
1228
  "ParseTree" => s(:iter,
1241
1229
  s(:call, s(:call, nil, :a), :each),
1242
- s(:lasgn, :x),
1230
+ s(:args, :x),
1243
1231
  s(:if, s(:true),
1244
1232
  s(:iter,
1245
1233
  s(:call, s(:call, nil, :b), :each),
1246
- s(:lasgn, :y),
1234
+ s(:args, :y),
1247
1235
  s(:lasgn, :c,
1248
1236
  s(:call, s(:lvar, :c), :+, s(:lit, 1)))),
1249
1237
  nil)))
@@ -1252,13 +1240,13 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1252
1240
  "Ruby" => "a.each do |x|\n if true then\n c = 0\n b.each { |y| c = (c + 1) }\n end\nend",
1253
1241
  "ParseTree" => s(:iter,
1254
1242
  s(:call, s(:call, nil, :a), :each),
1255
- s(:lasgn, :x),
1243
+ s(:args, :x),
1256
1244
  s(:if, s(:true),
1257
1245
  s(:block,
1258
1246
  s(:lasgn, :c, s(:lit, 0)),
1259
1247
  s(:iter,
1260
1248
  s(:call, s(:call, nil, :b), :each),
1261
- s(:lasgn, :y),
1249
+ s(:args, :y),
1262
1250
  s(:lasgn, :c,
1263
1251
  s(:call, s(:lvar, :c), :+,
1264
1252
  s(:lit, 1))))),
@@ -1268,8 +1256,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1268
1256
  "Ruby" => "data.each do |x, y|\n a = 1\n b = a\n b = a = x\nend",
1269
1257
  "ParseTree" => s(:iter,
1270
1258
  s(:call, s(:call, nil, :data), :each),
1271
- s(:masgn,
1272
- s(:array, s(:lasgn, :x), s(:lasgn, :y))),
1259
+ s(:args, :x, :y),
1273
1260
  s(:block,
1274
1261
  s(:lasgn, :a, s(:lit, 1)),
1275
1262
  s(:lasgn, :b, s(:lvar, :a)),
@@ -1279,13 +1266,13 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1279
1266
  "Ruby" => "a do\n v = nil\n assert_block(full_message) do\n begin\n yield\n rescue Exception => v\n break\n end\n end\nend",
1280
1267
  "ParseTree" => s(:iter,
1281
1268
  s(:call, nil, :a),
1282
- nil,
1269
+ s(:args),
1283
1270
  s(:block,
1284
1271
  s(:lasgn, :v, s(:nil)),
1285
1272
  s(:iter,
1286
1273
  s(:call, nil, :assert_block,
1287
1274
  s(:call, nil, :full_message)),
1288
- nil,
1275
+ s(:args),
1289
1276
  s(:rescue,
1290
1277
  s(:yield),
1291
1278
  s(:resbody,
@@ -1300,7 +1287,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1300
1287
  s(:lasgn, :t, s(:lit, 0)),
1301
1288
  s(:iter,
1302
1289
  s(:call, s(:call, nil, :ns), :each),
1303
- s(:lasgn, :n),
1290
+ s(:args, :n),
1304
1291
  s(:lasgn, :t,
1305
1292
  s(:call, s(:lvar, :t), :+, s(:lvar, :n))))),
1306
1293
  "Ruby2Ruby" => "t = 0\nns.each { |n| t = (t + n) }\n")
@@ -1327,40 +1314,31 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1327
1314
  add_tests("defn_args_mand_opt",
1328
1315
  "Ruby" => "def f(mand, opt = 42)\n # do nothing\nend",
1329
1316
  "ParseTree" => s(:defn, :f,
1330
- s(:args, :mand, :opt,
1331
- s(:block,
1332
- s(:lasgn, :opt, s(:lit, 42)))),
1317
+ s(:args, :mand, s(:lasgn, :opt, s(:lit, 42))),
1333
1318
  s(:nil)))
1334
1319
 
1335
1320
  add_tests("defn_args_mand_opt_block",
1336
1321
  "Ruby" => "def f(mand, opt = 42, &block)\n # do nothing\nend",
1337
1322
  "ParseTree" => s(:defn, :f,
1338
- s(:args, :mand, :opt, :"&block",
1339
- s(:block,
1340
- s(:lasgn, :opt, s(:lit, 42)))),
1323
+ s(:args, :mand, s(:lasgn, :opt, s(:lit, 42)), :"&block"),
1341
1324
  s(:nil)))
1342
1325
 
1343
1326
  add_tests("defn_args_mand_opt_splat",
1344
1327
  "Ruby" => "def f(mand, opt = 42, *rest)\n # do nothing\nend",
1345
1328
  "ParseTree" => s(:defn, :f,
1346
- s(:args, :mand, :opt, :"*rest",
1347
- s(:block,
1348
- s(:lasgn, :opt, s(:lit, 42)))),
1329
+ s(:args, :mand, s(:lasgn, :opt, s(:lit, 42)), :"*rest"),
1349
1330
  s(:nil)))
1350
1331
 
1351
1332
  add_tests("defn_args_mand_opt_splat_block",
1352
1333
  "Ruby" => "def f(mand, opt = 42, *rest, &block)\n # do nothing\nend",
1353
1334
  "ParseTree" => s(:defn, :f,
1354
- s(:args, :mand, :opt, :"*rest", :"&block",
1355
- s(:block,
1356
- s(:lasgn, :opt, s(:lit, 42)))),
1335
+ s(:args, :mand, s(:lasgn, :opt, s(:lit, 42)), :"*rest", :"&block"),
1357
1336
  s(:nil)))
1358
1337
 
1359
1338
  add_tests("defn_args_mand_opt_splat_no_name",
1360
1339
  "Ruby" => "def x(a, b = 42, *)\n # do nothing\nend",
1361
1340
  "ParseTree" => s(:defn, :x,
1362
- s(:args, :a, :b, :"*",
1363
- s(:block, s(:lasgn, :b, s(:lit, 42)))),
1341
+ s(:args, :a, s(:lasgn, :b, s(:lit, 42)), :"*"),
1364
1342
  s(:nil)))
1365
1343
 
1366
1344
  add_tests("defn_args_mand_splat",
@@ -1389,40 +1367,33 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1389
1367
  add_tests("defn_args_opt",
1390
1368
  "Ruby" => "def f(opt = 42)\n # do nothing\nend",
1391
1369
  "ParseTree" => s(:defn, :f,
1392
- s(:args, :opt,
1393
- s(:block,
1394
- s(:lasgn, :opt, s(:lit, 42)))),
1370
+ s(:args, s(:lasgn, :opt, s(:lit, 42))),
1395
1371
  s(:nil)))
1396
1372
 
1397
1373
  add_tests("defn_args_opt_block",
1398
1374
  "Ruby" => "def f(opt = 42, &block)\n # do nothing\nend",
1399
1375
  "ParseTree" => s(:defn, :f,
1400
- s(:args, :opt, :"&block",
1401
- s(:block,
1402
- s(:lasgn, :opt, s(:lit, 42)))),
1403
- s(:nil)))
1376
+ s(:args, s(:lasgn, :opt, s(:lit, 42)), :"&block"),
1377
+ s(:nil)))
1404
1378
 
1405
1379
  add_tests("defn_args_opt_splat",
1406
1380
  "Ruby" => "def f(opt = 42, *rest)\n # do nothing\nend",
1407
1381
  "ParseTree" => s(:defn, :f,
1408
- s(:args, :opt, :"*rest",
1409
- s(:block,
1410
- s(:lasgn, :opt, s(:lit, 42)))),
1382
+ s(:args, s(:lasgn, :opt, s(:lit, 42)), :"*rest"),
1411
1383
  s(:nil)))
1412
1384
 
1413
1385
  add_tests("defn_args_opt_splat_block",
1414
1386
  "Ruby" => "def f(opt = 42, *rest, &block)\n # do nothing\nend",
1415
1387
  "ParseTree" => s(:defn, :f,
1416
- s(:args, :opt, :"*rest", :"&block",
1417
- s(:block,
1418
- s(:lasgn, :opt, s(:lit, 42)))),
1388
+ s(:args,
1389
+ s(:lasgn, :opt, s(:lit, 42)),
1390
+ :"*rest", :"&block"),
1419
1391
  s(:nil)))
1420
1392
 
1421
1393
  add_tests("defn_args_opt_splat_no_name",
1422
1394
  "Ruby" => "def x(b = 42, *)\n # do nothing\nend",
1423
1395
  "ParseTree" => s(:defn, :x,
1424
- s(:args, :b, :"*",
1425
- s(:block, s(:lasgn, :b, s(:lit, 42)))),
1396
+ s(:args, s(:lasgn, :b, s(:lit, 42)), :"*"),
1426
1397
  s(:nil)))
1427
1398
 
1428
1399
  add_tests("defn_args_splat",
@@ -1733,7 +1704,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1733
1704
  "Ruby" => "a(:b) { :c }",
1734
1705
  "ParseTree" => s(:iter,
1735
1706
  s(:call, nil, :a, s(:lit, :b)),
1736
- nil,
1707
+ s(:args),
1737
1708
  s(:lit, :c)))
1738
1709
 
1739
1710
  add_tests("fcall_index_space",
@@ -1896,7 +1867,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1896
1867
  "Ruby" => "a (1) {|c|d}",
1897
1868
  "ParseTree" => s(:iter,
1898
1869
  s(:call, nil, :a, s(:lit, 1)),
1899
- s(:lasgn, :c),
1870
+ s(:args, :c),
1900
1871
  s(:call, nil, :d)),
1901
1872
  "Ruby2Ruby" => "a(1) { |c| d }")
1902
1873
 
@@ -1904,7 +1875,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1904
1875
  "Ruby" => "as.each { |a|\n b += a.b(false) }",
1905
1876
  "ParseTree" => s(:iter,
1906
1877
  s(:call, s(:call, nil, :as), :each),
1907
- s(:lasgn, :a),
1878
+ s(:args, :a),
1908
1879
  s(:lasgn, :b,
1909
1880
  s(:call,
1910
1881
  s(:lvar, :b),
@@ -1916,7 +1887,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1916
1887
  "Ruby" => "3.downto(1) { |n| puts(n.to_s) }",
1917
1888
  "ParseTree" => s(:iter,
1918
1889
  s(:call, s(:lit, 3), :downto, s(:lit, 1)),
1919
- s(:lasgn, :n),
1890
+ s(:args, :n),
1920
1891
  s(:call, nil, :puts,
1921
1892
  s(:call, s(:lvar, :n), :to_s))))
1922
1893
 
@@ -1928,7 +1899,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1928
1899
  s(:lit, 1), s(:lit, 2), s(:lit, 3))),
1929
1900
  s(:iter,
1930
1901
  s(:call, s(:lvar, :array), :each),
1931
- s(:lasgn, :x),
1902
+ s(:args, :x),
1932
1903
  s(:call, nil, :puts,
1933
1904
  s(:call, s(:lvar, :x), :to_s)))))
1934
1905
 
@@ -1943,13 +1914,11 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1943
1914
  s(:lit, 4), s(:lit, 5),
1944
1915
  s(:lit, 6), s(:lit, 7))),
1945
1916
  s(:iter,
1946
- s(:call,
1947
- s(:lvar, :array1), :each),
1948
- s(:lasgn, :x),
1917
+ s(:call, s(:lvar, :array1), :each),
1918
+ s(:args, :x),
1949
1919
  s(:iter,
1950
- s(:call,
1951
- s(:lvar, :array2), :each),
1952
- s(:lasgn, :y),
1920
+ s(:call, s(:lvar, :array2), :each),
1921
+ s(:args, :y),
1953
1922
  s(:block,
1954
1923
  s(:call, nil, :puts,
1955
1924
  s(:call, s(:lvar, :x), :to_s)),
@@ -1958,60 +1927,51 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1958
1927
 
1959
1928
  add_tests("iter_loop_empty",
1960
1929
  "Ruby" => "loop { }",
1961
- "ParseTree" => s(:iter, s(:call, nil, :loop), nil))
1930
+ "ParseTree" => s(:iter, s(:call, nil, :loop), s(:args)))
1962
1931
 
1963
1932
  add_tests("iter_masgn_2",
1964
1933
  "Ruby" => "a { |b, c| p(c) }",
1965
1934
  "ParseTree" => s(:iter,
1966
1935
  s(:call, nil, :a),
1967
- s(:masgn,
1968
- s(:array, s(:lasgn, :b), s(:lasgn, :c))),
1936
+ s(:args, :b, :c),
1969
1937
  s(:call, nil, :p, s(:lvar, :c))))
1970
1938
 
1971
1939
  add_tests("iter_masgn_args_splat",
1972
1940
  "Ruby" => "a { |b, c, *d| p(c) }",
1973
1941
  "ParseTree" => s(:iter,
1974
1942
  s(:call, nil, :a),
1975
- s(:masgn,
1976
- s(:array,
1977
- s(:lasgn, :b),
1978
- s(:lasgn, :c),
1979
- s(:splat, s(:lasgn, :d)))),
1943
+ s(:args, :b, :c, :"*d"),
1980
1944
  s(:call, nil, :p, s(:lvar, :c))))
1981
1945
 
1982
1946
  add_tests("iter_masgn_args_splat_no_name",
1983
1947
  "Ruby" => "a { |b, c, *| p(c) }",
1984
1948
  "ParseTree" => s(:iter,
1985
1949
  s(:call, nil, :a),
1986
- s(:masgn,
1987
- s(:array,
1988
- s(:lasgn, :b),
1989
- s(:lasgn, :c),
1990
- s(:splat))),
1950
+ s(:args, :b, :c, :*),
1991
1951
  s(:call, nil, :p, s(:lvar, :c))))
1992
1952
 
1993
1953
  add_tests("iter_masgn_splat",
1994
1954
  "Ruby" => "a { |*c| p(c) }",
1995
1955
  "ParseTree" => s(:iter,
1996
1956
  s(:call, nil, :a),
1997
- s(:masgn, s(:array, s(:splat, s(:lasgn, :c)))),
1957
+ s(:args, :"*c"),
1998
1958
  s(:call, nil, :p, s(:lvar, :c))))
1999
1959
 
2000
1960
  add_tests("iter_masgn_splat_no_name",
2001
1961
  "Ruby" => "a { |*| p(c) }",
2002
1962
  "ParseTree" => s(:iter,
2003
1963
  s(:call, nil, :a),
2004
- s(:masgn, s(:array, s(:splat))),
1964
+ s(:args, :*),
2005
1965
  s(:call, nil, :p, s(:call, nil, :c))))
2006
1966
 
2007
1967
  add_tests("iter_shadowed_var",
2008
1968
  "Ruby" => "a do |x|\n b do |x|\n puts x\n end\nend",
2009
1969
  "ParseTree" => s(:iter,
2010
1970
  s(:call, nil, :a),
2011
- s(:lasgn, :x),
1971
+ s(:args, :x),
2012
1972
  s(:iter,
2013
1973
  s(:call, nil, :b),
2014
- s(:lasgn, :x),
1974
+ s(:args, :x),
2015
1975
  s(:call, nil, :puts, s(:lvar, :x)))),
2016
1976
  "Ruby2Ruby" => "a { |x| b { |x| puts(x) } }")
2017
1977
 
@@ -2019,7 +1979,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2019
1979
  "Ruby" => "1.upto(3) { |n| puts(n.to_s) }",
2020
1980
  "ParseTree" => s(:iter,
2021
1981
  s(:call, s(:lit, 1), :upto, s(:lit, 3)),
2022
- s(:lasgn, :n),
1982
+ s(:args, :n),
2023
1983
  s(:call, nil, :puts,
2024
1984
  s(:call, s(:lvar, :n), :to_s))))
2025
1985
 
@@ -2047,58 +2007,49 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2047
2007
  "Ruby" => "lambda { |*| nil }",
2048
2008
  "ParseTree" => s(:iter,
2049
2009
  s(:call, nil, :lambda),
2050
- s(:masgn, s(:array, s(:splat))),
2010
+ s(:args, :*),
2051
2011
  s(:nil)))
2052
2012
 
2053
2013
  add_tests("lambda_args_anon_star_block",
2054
2014
  "Ruby" => "lambda { |*, &block| block }",
2055
2015
  "ParseTree" => s(:iter,
2056
2016
  s(:call, nil, :lambda),
2057
- s(:masgn, s(:array,
2058
- s(:splat),
2059
- s(:lasgn, :"&block"))),
2017
+ s(:args, :*, :"&block"),
2060
2018
  s(:lvar, :block)))
2061
2019
 
2062
2020
  add_tests("lambda_args_block",
2063
2021
  "Ruby" => "lambda { |&block| block }",
2064
2022
  "ParseTree" => s(:iter,
2065
2023
  s(:call, nil, :lambda),
2066
- s(:lasgn, :"&block"),
2024
+ s(:args, :"&block"),
2067
2025
  s(:lvar, :block)))
2068
2026
 
2069
2027
  add_tests("lambda_args_norm_anon_star",
2070
2028
  "Ruby" => "lambda { |a, *| a }",
2071
2029
  "ParseTree" => s(:iter,
2072
2030
  s(:call, nil, :lambda),
2073
- s(:masgn, s(:array,
2074
- s(:lasgn, :a),
2075
- s(:splat))),
2031
+ s(:args, :a, :*),
2076
2032
  s(:lvar, :a)))
2077
2033
 
2078
2034
  add_tests("lambda_args_norm_anon_star_block",
2079
2035
  "Ruby" => "lambda { |a, *, &block| block }",
2080
2036
  "ParseTree" => s(:iter,
2081
2037
  s(:call, nil, :lambda),
2082
- s(:masgn, s(:array,
2083
- s(:lasgn, :a),
2084
- s(:splat),
2085
- s(:lasgn, :"&block"))),
2038
+ s(:args, :a, :*, :"&block"),
2086
2039
  s(:lvar, :block)))
2087
2040
 
2088
2041
  add_tests("lambda_args_norm_block",
2089
2042
  "Ruby" => "lambda { |a, &block| block }",
2090
2043
  "ParseTree" => s(:iter,
2091
2044
  s(:call, nil, :lambda),
2092
- s(:masgn, s(:array,
2093
- s(:lasgn, :a),
2094
- s(:lasgn, :"&block"))),
2045
+ s(:args, :a, :"&block"),
2095
2046
  s(:lvar, :block)))
2096
2047
 
2097
2048
  add_tests("lambda_args_norm_comma",
2098
2049
  "Ruby" => "lambda { |a,| a }",
2099
2050
  "ParseTree" => s(:iter,
2100
2051
  s(:call, nil, :lambda),
2101
- s(:lasgn, :a),
2052
+ s(:args, :a),
2102
2053
  s(:lvar, :a)),
2103
2054
  "Ruby2Ruby" => "lambda { |a| a }")
2104
2055
 
@@ -2106,8 +2057,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2106
2057
  "Ruby" => "lambda { |a,b,| a }",
2107
2058
  "ParseTree" => s(:iter,
2108
2059
  s(:call, nil, :lambda),
2109
- s(:masgn,
2110
- s(:array, s(:lasgn, :a), s(:lasgn, :b))),
2060
+ s(:args, :a, :b),
2111
2061
  s(:lvar, :a)),
2112
2062
  "Ruby2Ruby" => "lambda { |a, b| a }")
2113
2063
 
@@ -2115,36 +2065,28 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2115
2065
  "Ruby" => "lambda { |a, *star| star }",
2116
2066
  "ParseTree" => s(:iter,
2117
2067
  s(:call, nil, :lambda),
2118
- s(:masgn, s(:array,
2119
- s(:lasgn, :a),
2120
- s(:splat, s(:lasgn, :star)))),
2068
+ s(:args, :a, :"*star"),
2121
2069
  s(:lvar, :star)))
2122
2070
 
2123
2071
  add_tests("lambda_args_norm_star_block",
2124
2072
  "Ruby" => "lambda { |a, *star, &block| block }",
2125
2073
  "ParseTree" => s(:iter,
2126
2074
  s(:call, nil, :lambda),
2127
- s(:masgn, s(:array,
2128
- s(:lasgn, :a),
2129
- s(:splat, s(:lasgn, :star)),
2130
- s(:lasgn, :"&block"))),
2075
+ s(:args, :a, :"*star", :"&block"),
2131
2076
  s(:lvar, :block)))
2132
2077
 
2133
2078
  add_tests("lambda_args_star",
2134
2079
  "Ruby" => "lambda { |*star| star }",
2135
2080
  "ParseTree" => s(:iter,
2136
2081
  s(:call, nil, :lambda),
2137
- s(:masgn, s(:array,
2138
- s(:splat, s(:lasgn, :star)))),
2082
+ s(:args, :"*star"),
2139
2083
  s(:lvar, :star)))
2140
2084
 
2141
2085
  add_tests("lambda_args_star_block",
2142
2086
  "Ruby" => "lambda { |*star, &block| block }",
2143
2087
  "ParseTree" => s(:iter,
2144
2088
  s(:call, nil, :lambda),
2145
- s(:masgn, s(:array,
2146
- s(:splat, s(:lasgn, :star)),
2147
- s(:lasgn, :"&block"))),
2089
+ s(:args, :"*star", :"&block"),
2148
2090
  s(:lvar, :block)))
2149
2091
 
2150
2092
  add_tests("lasgn_array",
@@ -2223,7 +2165,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2223
2165
  s(:defn, :a, s(:args),
2224
2166
  s(:iter,
2225
2167
  s(:call, nil, :c),
2226
- nil,
2168
+ s(:args),
2227
2169
  s(:rescue,
2228
2170
  s(:call, nil, :do_stuff),
2229
2171
  s(:resbody,
@@ -2436,14 +2378,14 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2436
2378
  "Ruby" => "loop { next if false }",
2437
2379
  "ParseTree" => s(:iter,
2438
2380
  s(:call, nil, :loop),
2439
- nil,
2381
+ s(:args),
2440
2382
  s(:if, s(:false), s(:next), nil)))
2441
2383
 
2442
2384
  add_tests("next_arg",
2443
2385
  "Ruby" => "loop { next 42 if false }",
2444
2386
  "ParseTree" => s(:iter,
2445
2387
  s(:call, nil, :loop),
2446
- nil,
2388
+ s(:args),
2447
2389
  s(:if, s(:false), s(:next, s(:lit, 42)), nil)))
2448
2390
 
2449
2391
  add_tests("nth_ref",
@@ -2585,16 +2527,15 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2585
2527
  add_tests("parse_floats_as_args",
2586
2528
  "Ruby" => "def x(a=0.0,b=0.0)\n a+b\nend",
2587
2529
  "ParseTree" => s(:defn, :x,
2588
- s(:args, :a, :b,
2589
- s(:block,
2590
- s(:lasgn, :a, s(:lit, 0.0)),
2591
- s(:lasgn, :b, s(:lit, 0.0)))),
2530
+ s(:args,
2531
+ s(:lasgn, :a, s(:lit, 0.0)),
2532
+ s(:lasgn, :b, s(:lit, 0.0))),
2592
2533
  s(:call, s(:lvar, :a), :+, s(:lvar, :b))),
2593
2534
  "Ruby2Ruby" => "def x(a = 0.0, b = 0.0)\n (a + b)\nend")
2594
2535
 
2595
2536
  add_tests("postexe",
2596
2537
  "Ruby" => "END { 1 }",
2597
- "ParseTree" => s(:iter, s(:postexe), nil, s(:lit, 1)))
2538
+ "ParseTree" => s(:iter, s(:postexe), s(:args), s(:lit, 1)))
2598
2539
 
2599
2540
  add_tests("proc_args_0",
2600
2541
  "Ruby" => "proc { || (x + 1) }",
@@ -2607,31 +2548,28 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2607
2548
  "Ruby" => "proc { |x| (x + 1) }",
2608
2549
  "ParseTree" => s(:iter,
2609
2550
  s(:call, nil, :proc),
2610
- s(:lasgn, :x),
2551
+ s(:args, :x),
2611
2552
  s(:call, s(:lvar, :x), :+, s(:lit, 1))))
2612
2553
 
2613
2554
  add_tests("proc_args_2",
2614
2555
  "Ruby" => "proc { |x, y| (x + y) }",
2615
2556
  "ParseTree" => s(:iter,
2616
2557
  s(:call, nil, :proc),
2617
- s(:masgn,
2618
- s(:array,
2619
- s(:lasgn, :x),
2620
- s(:lasgn, :y))),
2558
+ s(:args, :x, :y),
2621
2559
  s(:call, s(:lvar, :x), :+, s(:lvar, :y))))
2622
2560
 
2623
2561
  add_tests("proc_args_no",
2624
2562
  "Ruby" => "proc { (x + 1) }",
2625
2563
  "ParseTree" => s(:iter,
2626
2564
  s(:call, nil, :proc),
2627
- nil,
2565
+ s(:args),
2628
2566
  s(:call, s(:call, nil, :x), :+, s(:lit, 1))))
2629
2567
 
2630
2568
  add_tests("redo",
2631
2569
  "Ruby" => "loop { redo if false }",
2632
2570
  "ParseTree" => s(:iter,
2633
2571
  s(:call, nil, :loop),
2634
- nil,
2572
+ s(:args),
2635
2573
  s(:if, s(:false), s(:redo), nil)))
2636
2574
 
2637
2575
  add_tests("rescue", # TODO: need a resbody w/ multiple classes and a splat
@@ -2889,12 +2827,8 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2889
2827
  add_tests("structure_extra_block_for_dvar_scoping",
2890
2828
  "Ruby" => "a.b do |c, d|\n unless e.f(c) then\n g = false\n d.h { |x, i| g = true }\n end\nend",
2891
2829
  "ParseTree" => s(:iter,
2892
- s(:call,
2893
- s(:call, nil, :a),
2894
- :b),
2895
- s(:masgn, s(:array,
2896
- s(:lasgn, :c),
2897
- s(:lasgn, :d))),
2830
+ s(:call, s(:call, nil, :a), :b),
2831
+ s(:args, :c, :d),
2898
2832
  s(:if,
2899
2833
  s(:call, s(:call, nil, :e), :f, s(:lvar, :c)),
2900
2834
  nil,
@@ -2902,9 +2836,7 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2902
2836
  s(:lasgn, :g, s(:false)),
2903
2837
  s(:iter,
2904
2838
  s(:call, s(:lvar, :d), :h),
2905
- s(:masgn, s(:array,
2906
- s(:lasgn, :x),
2907
- s(:lasgn, :i))),
2839
+ s(:args, :x, :i),
2908
2840
  s(:lasgn, :g, s(:true)))))))
2909
2841
 
2910
2842
  add_tests("structure_remove_begin_1",
@@ -34,7 +34,7 @@ require 'sexp'
34
34
 
35
35
  class SexpProcessor
36
36
 
37
- VERSION = '4.1.0'
37
+ VERSION = '4.1.1'
38
38
 
39
39
  ##
40
40
  # Automatically shifts off the Sexp type before handing the
data.tar.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- �ʠ�����6���|݊��`��WF6S�������b�|O��uB6oL�u��.3�B��0Y�Ldw�(��QïCZ$��� :��z �`e@�]سY:������5G#�"ԕ!H.����C:kw��K\j��!F7`ҵ��d��/���!���q_i����;UKC�����zEk�+���a\��8$�ljl�թ�p�IsXt�DvUpU�~��`��>�
2
- G���ʲA���%bD�����[��
1
+ 4Ph�<U=�ע�,|�I�}Dm00y&���p���cZ!��thj��z�� iTlð|<������i~yzJ����8�3.�(f��BIL
2
+ �tbN�H'�M2�4�?6� ߂;����F�ʅL !-p�)���Rn����Nb5�Z5(~1� ����)A��\�O!,{�^�?H��Z�J�Щ�C���:�$l����(G�;.��KZ�=�������g�Ô�I��e`�7FױM��ۚ��"^2@p�CS7�J� ^6#��1*
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sexp_processor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 59
4
+ hash: 57
5
5
  prerelease:
6
6
  segments:
7
7
  - 4
8
8
  - 1
9
- - 0
10
- version: 4.1.0
9
+ - 1
10
+ version: 4.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Davis
@@ -36,7 +36,7 @@ cert_chain:
36
36
  FBHgymkyj/AOSqKRIpXPhjC6
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2012-10-22 00:00:00 Z
39
+ date: 2012-11-02 00:00:00 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
metadata.gz.sig CHANGED
Binary file