public
Description: A Ruby-based parsing DSL based on parsing expression grammars.
Homepage: http://treetop.rubyforge.org
Clone URL: git://github.com/nathansobo/treetop.git
Renamed memoization expire to release to clearly distinguish between the 
act of detecting intersection and removing from the ResultCache
Nathan Sobo (author)
Fri May 02 12:12:13 -0700 2008
commit  5df28dcfdad2d5660080ad7cbaf95691766cf5c0
tree    7bf216f9fc0bdaa2eeb5e9d680643960f89e7b6c
parent  f4e3e0cb745231fab7d7471b21dd6a9abcbf4b20
...
26
27
28
29
 
30
31
32
...
26
27
28
 
29
30
31
32
0
@@ -26,7 +26,7 @@ module Treetop
0
         rule_index[interval.first + length_change] = result
0
       end
0
 
0
- def expire
0
+ def release
0
         result.memoizations.delete(self)
0
         rule_index.delete(interval.first)
0
         result.release
...
48
49
50
51
52
53
 
54
55
56
...
58
59
60
 
 
 
 
 
 
 
61
62
63
...
48
49
50
 
 
 
51
52
53
54
...
56
57
58
59
60
61
62
63
64
65
66
67
68
0
@@ -48,9 +48,7 @@ module Treetop
0
 
0
 
0
       def expire(expire_parent=false)
0
- memoizations.each do |memoization|
0
- result_cache.schedule_memoization_expiration(memoization)
0
- end
0
+ schedule_release_of_memoizations
0
         dependents.each { |dependent| dependent.expire(true) }
0
       end
0
       
0
@@ -58,6 +56,13 @@ module Treetop
0
         memoizations.each { |memoization| memoization.relocate(length_change) }
0
         @interval = interval.transpose(length_change)
0
       end
0
+
0
+ protected
0
+ def schedule_release_of_memoizations
0
+ memoizations.each do |memoization|
0
+ result_cache.schedule_memoization_release(memoization)
0
+ end
0
+ end
0
     end
0
   end
0
 end
...
27
28
29
30
31
 
 
32
33
34
...
45
46
47
48
 
49
50
51
 
52
53
54
55
56
57
58
59
 
 
60
61
62
...
27
28
29
 
 
30
31
32
33
34
...
45
46
47
 
48
49
50
 
51
52
53
54
55
56
57
 
 
58
59
60
61
62
0
@@ -27,8 +27,8 @@ module Treetop
0
         relocate_remaining_results(range, length_change)
0
       end
0
 
0
- def schedule_memoization_expiration(memoization)
0
- memoizations_to_expire.push(memoization)
0
+ def schedule_memoization_release(memoization)
0
+ memoizations_to_release.push(memoization)
0
       end
0
 
0
       def inspect
0
@@ -45,18 +45,18 @@ module Treetop
0
 
0
       protected
0
 
0
- attr_reader :result_index, :memoizations_to_expire
0
+ attr_reader :result_index, :memoizations_to_release
0
 
0
       def detect_and_expire_intersected_results(range)
0
- @memoizations_to_expire = []
0
+ @memoizations_to_release = []
0
         results.each do |result|
0
           result.expire if result.interval.intersects?(range)
0
         end
0
       end
0
 
0
       def release_expired_memoizations
0
- memoizations_to_expire.uniq.each do |memoization|
0
- memoization.expire
0
+ memoizations_to_release.uniq.each do |memoization|
0
+ memoization.release
0
         end
0
       end
0
 

Comments

    No one has commented yet.