Class: ReduceActionsGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/rpdf2txt-rockit/reduce_actions_generator.rb

Overview

$PROFILE = true

Defined Under Namespace

Classes: LaLrPair

Instance Method Summary collapse

Constructor Details

#initialize(stateGraph, grammar, parseTable, allItems) ⇒ ReduceActionsGenerator

Returns a new instance of ReduceActionsGenerator.



34
35
36
37
38
39
40
# File 'lib/rpdf2txt-rockit/reduce_actions_generator.rb', line 34

def initialize(stateGraph, grammar, parseTable, allItems)
  @state_graph, @grammar, @parsetable = stateGraph, grammar, parseTable
  set_index_numbers
  precalc_items_at_nonterminal(allItems)
  @lalr_pair_factory = IndexableFactory.new(LaLrPair, 0)
  init_traverse_cache
end

Instance Method Details

#add_reduce_actionsObject



42
43
44
45
46
47
48
49
# File 'lib/rpdf2txt-rockit/reduce_actions_generator.rb', line 42

def add_reduce_actions
  Profiler.start if $PROFILE
  add_actions_for_consistent_states
  add_actions_for_inconsistent_states
  @parsetable.compact!
  puts Profiler.profile_summary(true, true) if $PROFILE
  @parsetable
end