Sha256: 693160e0a877a89c2f7f08cce6020051f5fccb8e4d0739e0f8e28cb254082dff

Contents?: true

Size: 466 Bytes

Versions: 1

Compression:

Stored size: 466 Bytes

Contents

module Treetop
  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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
treetop-0.1.0 lib/treetop/parser/node_cache.rb