flog 3.0.0.b1 → 3.0.0.b2
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +6 -0
- data/lib/flog.rb +7 -7
- data/test/test_flog.rb +21 -24
- metadata +8 -8
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/lib/flog.rb
CHANGED
@@ -12,7 +12,7 @@ class File
|
|
12
12
|
end
|
13
13
|
|
14
14
|
class Flog < SexpProcessor
|
15
|
-
VERSION = '3.0.0.
|
15
|
+
VERSION = '3.0.0.b2'
|
16
16
|
|
17
17
|
THRESHOLD = 0.60
|
18
18
|
SCORES = Hash.new 1
|
@@ -645,11 +645,11 @@ class Flog < SexpProcessor
|
|
645
645
|
recv = exp.first
|
646
646
|
|
647
647
|
# DSL w/ names. eg task :name do ... end
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
submsg =
|
652
|
-
in_klass
|
648
|
+
# looks like s(:call, nil, :task, s(:lit, :name))
|
649
|
+
t, r, m, a = recv
|
650
|
+
if (t == :call and r == nil and a and [:lit, :str].include? a[0]) then
|
651
|
+
submsg = a[1]
|
652
|
+
in_klass m do # :task
|
653
653
|
in_method submsg, exp.file, exp.line do # :name
|
654
654
|
process_until_empty exp
|
655
655
|
end
|
@@ -660,7 +660,7 @@ class Flog < SexpProcessor
|
|
660
660
|
|
661
661
|
add_to_score :branch
|
662
662
|
|
663
|
-
exp.delete 0 #
|
663
|
+
exp.delete 0 # { || ... } has 0 in arg slot
|
664
664
|
|
665
665
|
process exp.shift # no penalty for LHS
|
666
666
|
|
data/test/test_flog.rb
CHANGED
@@ -266,12 +266,11 @@ class TestFlog < MiniTest::Unit::TestCase
|
|
266
266
|
|
267
267
|
def test_process_attrasgn
|
268
268
|
sexp = s(:attrasgn,
|
269
|
-
s(:call, nil, :a
|
269
|
+
s(:call, nil, :a),
|
270
270
|
:[]=,
|
271
|
-
s(:
|
272
|
-
s(:
|
273
|
-
|
274
|
-
s(:call, nil, :c, s(:arglist))))
|
271
|
+
s(:splat,
|
272
|
+
s(:call, nil, :b)),
|
273
|
+
s(:call, nil, :c))
|
275
274
|
|
276
275
|
util_process(sexp, 3.162,
|
277
276
|
:c => 1.0, :b => 1.0, :a => 1.0, :assignment => 1.0)
|
@@ -294,9 +293,8 @@ class TestFlog < MiniTest::Unit::TestCase
|
|
294
293
|
|
295
294
|
def test_process_block_pass
|
296
295
|
sexp = s(:call, nil, :a,
|
297
|
-
s(:
|
298
|
-
s(:
|
299
|
-
s(:call, nil, :b, s(:arglist)))))
|
296
|
+
s(:block_pass,
|
297
|
+
s(:call, nil, :b)))
|
300
298
|
|
301
299
|
util_process(sexp, 9.4,
|
302
300
|
:a => 1.0,
|
@@ -307,9 +305,8 @@ class TestFlog < MiniTest::Unit::TestCase
|
|
307
305
|
|
308
306
|
def test_process_block_pass_colon2
|
309
307
|
sexp = s(:call, nil, :a,
|
310
|
-
s(:
|
311
|
-
s(:
|
312
|
-
s(:colon2, s(:const, :A), :B))))
|
308
|
+
s(:block_pass,
|
309
|
+
s(:colon2, s(:const, :A), :B)))
|
313
310
|
|
314
311
|
util_process(sexp, 2.2,
|
315
312
|
:a => 1.0,
|
@@ -318,7 +315,7 @@ class TestFlog < MiniTest::Unit::TestCase
|
|
318
315
|
|
319
316
|
def test_process_block_pass_iter
|
320
317
|
sexp = s(:block_pass,
|
321
|
-
s(:iter, s(:call, nil, :lambda
|
318
|
+
s(:iter, s(:call, nil, :lambda), nil, s(:lit, 1)))
|
322
319
|
|
323
320
|
util_process(sexp, 12.316,
|
324
321
|
:lit_fixnum => 0.275,
|
@@ -332,7 +329,7 @@ class TestFlog < MiniTest::Unit::TestCase
|
|
332
329
|
sexp = s(:block_pass,
|
333
330
|
s(:lasgn,
|
334
331
|
:b,
|
335
|
-
s(:iter, s(:call, nil, :lambda
|
332
|
+
s(:iter, s(:call, nil, :lambda), nil, s(:lit, 1))))
|
336
333
|
|
337
334
|
util_process(sexp, 17.333,
|
338
335
|
:lit_fixnum => 0.275,
|
@@ -344,7 +341,7 @@ class TestFlog < MiniTest::Unit::TestCase
|
|
344
341
|
end
|
345
342
|
|
346
343
|
def test_process_call
|
347
|
-
sexp = s(:call, nil, :a
|
344
|
+
sexp = s(:call, nil, :a)
|
348
345
|
util_process sexp, 1.0, :a => 1.0
|
349
346
|
end
|
350
347
|
|
@@ -417,15 +414,15 @@ class TestFlog < MiniTest::Unit::TestCase
|
|
417
414
|
|
418
415
|
def test_process_if
|
419
416
|
sexp = s(:if,
|
420
|
-
s(:call, nil, :b
|
421
|
-
s(:call, nil, :a
|
417
|
+
s(:call, nil, :b), # outside block, not penalized
|
418
|
+
s(:call, nil, :a), nil)
|
422
419
|
|
423
420
|
util_process sexp, 2.326, :branch => 1.0, :b => 1.0, :a => 1.1
|
424
421
|
end
|
425
422
|
|
426
423
|
def test_process_iter
|
427
424
|
sexp = s(:iter,
|
428
|
-
s(:call, nil, :loop
|
425
|
+
s(:call, nil, :loop), nil,
|
429
426
|
s(:if, s(:true), s(:break), nil))
|
430
427
|
|
431
428
|
util_process sexp, 2.326, :loop => 1.0, :branch => 2.1
|
@@ -437,9 +434,9 @@ class TestFlog < MiniTest::Unit::TestCase
|
|
437
434
|
# end
|
438
435
|
|
439
436
|
sexp = s(:iter,
|
440
|
-
s(:call, nil, :task, s(:
|
437
|
+
s(:call, nil, :task, s(:lit, :blah)),
|
441
438
|
nil,
|
442
|
-
s(:call, nil, :something
|
439
|
+
s(:call, nil, :something))
|
443
440
|
|
444
441
|
@klass, @meth = "task", "#blah"
|
445
442
|
|
@@ -452,9 +449,9 @@ class TestFlog < MiniTest::Unit::TestCase
|
|
452
449
|
# end
|
453
450
|
|
454
451
|
sexp = s(:iter,
|
455
|
-
s(:call, nil, :task, s(:
|
452
|
+
s(:call, nil, :task, s(:lit, /regexp/)),
|
456
453
|
nil,
|
457
|
-
s(:call, nil, :something
|
454
|
+
s(:call, nil, :something))
|
458
455
|
|
459
456
|
@klass, @meth = "task", "#/regexp/"
|
460
457
|
|
@@ -485,7 +482,7 @@ class TestFlog < MiniTest::Unit::TestCase
|
|
485
482
|
def test_process_masgn
|
486
483
|
sexp = s(:masgn,
|
487
484
|
s(:array, s(:lasgn, :a), s(:lasgn, :b)),
|
488
|
-
s(:to_ary, s(:call, nil, :c
|
485
|
+
s(:to_ary, s(:call, nil, :c)))
|
489
486
|
|
490
487
|
util_process sexp, 3.162, :c => 1.0, :assignment => 3.0
|
491
488
|
end
|
@@ -515,8 +512,8 @@ class TestFlog < MiniTest::Unit::TestCase
|
|
515
512
|
|
516
513
|
def test_process_while
|
517
514
|
sexp = s(:while,
|
518
|
-
s(:call, nil, :a
|
519
|
-
s(:call, nil, :b
|
515
|
+
s(:call, nil, :a),
|
516
|
+
s(:call, nil, :b),
|
520
517
|
true)
|
521
518
|
|
522
519
|
util_process sexp, 2.417, :branch => 1.0, :a => 1.1, :b => 1.1
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: -1937524008
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
9
|
- 0
|
10
10
|
- b
|
11
|
-
-
|
12
|
-
version: 3.0.0.
|
11
|
+
- 2
|
12
|
+
version: 3.0.0.b2
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Ryan Davis
|
@@ -38,7 +38,7 @@ cert_chain:
|
|
38
38
|
FBHgymkyj/AOSqKRIpXPhjC6
|
39
39
|
-----END CERTIFICATE-----
|
40
40
|
|
41
|
-
date: 2012-07
|
41
|
+
date: 2012-08-07 00:00:00 Z
|
42
42
|
dependencies:
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: sexp_processor
|
@@ -63,7 +63,7 @@ dependencies:
|
|
63
63
|
requirements:
|
64
64
|
- - ~>
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
hash:
|
66
|
+
hash: -1937540908
|
67
67
|
segments:
|
68
68
|
- 3
|
69
69
|
- 0
|
@@ -81,11 +81,11 @@ dependencies:
|
|
81
81
|
requirements:
|
82
82
|
- - ~>
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
hash:
|
84
|
+
hash: 1
|
85
85
|
segments:
|
86
86
|
- 3
|
87
|
-
-
|
88
|
-
version: "3.
|
87
|
+
- 3
|
88
|
+
version: "3.3"
|
89
89
|
type: :development
|
90
90
|
version_requirements: *id003
|
91
91
|
- !ruby/object:Gem::Dependency
|
metadata.gz.sig
CHANGED
Binary file
|