Class: Lrama::Reporter::States

Inherits:
Object
  • Object
show all
Defined in:
lib/lrama/reporter/states.rb

Instance Method Summary collapse

Constructor Details

#initialize(itemsets: false, lookaheads: false, solved: false, counterexamples: false, verbose: false, **_) ⇒ States

Returns a new instance of States.



8
9
10
11
12
13
14
# File 'lib/lrama/reporter/states.rb', line 8

def initialize(itemsets: false, lookaheads: false, solved: false, counterexamples: false, verbose: false, **_)
  @itemsets = itemsets
  @lookaheads = lookaheads
  @solved = solved
  @counterexamples = counterexamples
  @verbose = verbose
end

Instance Method Details

#report(io, states, ielr: false) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/lrama/reporter/states.rb', line 17

def report(io, states, ielr: false)
  cex = Counterexamples.new(states) if @counterexamples

  states.compute_la_sources_for_conflicted_states
  report_split_states(io, states.states) if ielr

  states.states.each do |state|
    report_state_header(io, state)
    report_items(io, state)
    report_conflicts(io, state)
    report_shifts(io, state)
    report_nonassoc_errors(io, state)
    report_reduces(io, state)
    report_nterm_transitions(io, state)
    report_conflict_resolutions(io, state) if @solved
    report_counterexamples(io, state, cex) if @counterexamples && state.has_conflicts? # @type var cex: Lrama::Counterexamples
    report_verbose_info(io, state, states) if @verbose
    # End of Report State
    io << "\n"
  end
end