Sha256: 96dd62fc9e0fba7945a2fd5b0de92861ec8add065678560c8d06b86269112f79

Contents?: true

Size: 680 Bytes

Versions: 1

Compression:

Stored size: 680 Bytes

Contents

module Antlr4ruby
  class ArrayPredictionContext < PredictionContext

    attr_reader :parents, :return_states

    def initialize(context: nil, parents:[], return_states: [])
      if context
        parents,  return_states = [context.parent], [context.return_state]
      end
      super(calculate_hash_code(parents, return_states))
      @parents, @return_states = parents, return_states
    end
    def is_empty?
      return_states[0] == EMPTY_RETURN_STATE
    end

    def size
      return_states.length
    end

    def get_parent(index)
      parents[index]
    end

    def get_return_state(index)
      return_states[index]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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