Sha256: 327aa4d087b3dbe1c024546bcab050e41a73558152bb8f6abb2cd9636c789dd9

Contents?: true

Size: 527 Bytes

Versions: 7

Compression:

Stored size: 527 Bytes

Contents

module Treetop
  module Runtime
    class NodeCache
      attr_reader :parse_results
    
      def initialize
        @parse_results = {}
      end
  
      def empty?
        parse_results.empty?
      end
  
      def store(parse_result)
        if parse_result.failure?
          parse_results[parse_result.index] = parse_result
        else
          parse_results[parse_result.interval.begin] = parse_result
        end
      end
  
      def [](start_index)
        parse_results[start_index]
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
treetop-1.1.1 lib/treetop/runtime/node_cache.rb
treetop-1.0.0 lib/treetop/runtime/node_cache.rb
treetop-1.0.1 lib/treetop/runtime/node_cache.rb
treetop-1.0.2 lib/treetop/runtime/node_cache.rb
treetop-1.1.0 lib/treetop/runtime/node_cache.rb
treetop-1.1.2 lib/treetop/runtime/node_cache.rb
treetop-1.1.4 lib/treetop/runtime/node_cache.rb