Class: Ibex::Impact::AutomatonImpact
- Inherits:
-
Object
- Object
- Ibex::Impact::AutomatonImpact
- Defined in:
- lib/ibex/impact/automaton_impact.rb
Overview
Maps propagated grammar symbols to parser states and conflict changes.
Instance Attribute Summary collapse
- #affected_states ⇒ Object readonly
-
#conflict_states ⇒ Object
readonly
: Array.
-
#production_ids ⇒ Object
readonly
: Array.
Instance Method Summary collapse
- #conflict_changes(diff) ⇒ Object
-
#initialize(automaton, symbol_ids) ⇒ AutomatonImpact
constructor
A new instance of AutomatonImpact.
- #to_h ⇒ Object
Constructor Details
#initialize(automaton, symbol_ids) ⇒ AutomatonImpact
Returns a new instance of AutomatonImpact.
16 17 18 19 20 21 22 23 |
# File 'lib/ibex/impact/automaton_impact.rb', line 16 def initialize(automaton, symbol_ids) @automaton = automaton @symbol_ids = symbol_ids.uniq.sort #: Array[Integer] @production_ids = affected_productions @affected_states = affected_state_ids @conflict_states = conflict_state_ids freeze end |
Instance Attribute Details
#affected_states ⇒ Object (readonly)
11 12 13 |
# File 'lib/ibex/impact/automaton_impact.rb', line 11 def affected_states @affected_states end |
#conflict_states ⇒ Object (readonly)
: Array
13 14 15 |
# File 'lib/ibex/impact/automaton_impact.rb', line 13 def conflict_states @conflict_states end |
#production_ids ⇒ Object (readonly)
: Array
12 13 14 |
# File 'lib/ibex/impact/automaton_impact.rb', line 12 def production_ids @production_ids end |
Instance Method Details
#conflict_changes(diff) ⇒ Object
26 27 28 |
# File 'lib/ibex/impact/automaton_impact.rb', line 26 def conflict_changes(diff) diff.fetch(:conflicts) #: Hash[Symbol, Object?] end |
#to_h ⇒ Object
31 32 33 |
# File 'lib/ibex/impact/automaton_impact.rb', line 31 def to_h { states: @affected_states, productions: @production_ids, conflict_states: @conflict_states } end |