Sha256: 710594c0af290780de7de98ed1c8e9f43738db60e2baf4b05c5f2bfc3b2d1c4b

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

module Antlr4ruby
  class SingletonPredictionContext < PredictionContext
    attr_reader :parent, :return_state

    def initialize(parent, return_state)
      super(parent ? calculate_hash_code(parent, return_state) : calculate_empty_hash_code)
      @parent, @return_state = parent, return_state
    end

    def self.create(parent, return_state)
      return EmptyPredictionContext.INSTANCE if return_state == EMPTY_RETURN_STATE && !parent
      SingletonPredictionContext.new(parent, return_state)
    end

    def get_parent(index)
      parent
    end

    def get_return_state(index)
      return_state
    end

    def size
      1
    end

    def to_s
      # todo
    end

    def eql?(other)
      # todo
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
antlr4ruby-0.1.0 lib/antlr4ruby/atn/context/singleton_prediction_context.rb