Class: Dhaka::Conflict
- Inherits:
-
Object
- Object
- Dhaka::Conflict
- Defined in:
- lib/dhaka/parser/conflict.rb
Overview
Represents parser shift-reduce and reduce-reduce conflicts and encapsulates logic for resolving them.
Direct Known Subclasses
Instance Method Summary collapse
- #build_conflict_message ⇒ Object
-
#initialize(state, lookahead, new_action) ⇒ Conflict
constructor
:nodoc:.
Constructor Details
#initialize(state, lookahead, new_action) ⇒ Conflict
:nodoc:
4 5 6 |
# File 'lib/dhaka/parser/conflict.rb', line 4 def initialize(state, lookahead, new_action) @lookahead, @new_action, @state = lookahead, new_action, state end |
Instance Method Details
#build_conflict_message ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/dhaka/parser/conflict.rb', line 8 def lines = ["Parser Conflict at State:", @state.to_s(:hide_lookaheads => true)] lines << "Existing: #{@state.actions[@lookahead.name]}" lines << "New: #{@new_action}" lines << "Lookahead: #{@lookahead}" lines.join("\n") end |