lib/antelope/generation/tableizer.rb in antelope-0.2.2 vs lib/antelope/generation/tableizer.rb in antelope-0.2.3
- old
+ new
@@ -93,11 +93,14 @@
if data.size == 1
@table[state][on] = data[0]
next
end
- terminal = grammar.precedence_for(on)
+ terminal = if states[state].transitions.key?(on)
+ states[state].rules.
+ detect { |rule| rule.active.name == on }.precedence
+ end
rule_part, other_part = data.sort_by { |(t, _)| t }
conflict = proc do |result|
hash = { result: result,
terminal: terminal,
@@ -116,11 +119,9 @@
}.map { |_|
states[state].rules.
detect { |rule| rule.active.name == on }
})
- #conflicts[state][on] = [result, rule_part, other_part,
- # terminal, @rules[rule_part[1]].prec]
conflicts[state][on] = hash
end
unless other_part[0] == :state
conflict.call(0)