res.add "\t\tREDUCE {r}\n"
end
end
- return res.to_s
+ return res.join
end
# Generate a graphviz file of the automaton
var gram = autom.grammar
add "# Parser generated by nitcc for the grammar {name}"
- add "module {name}_parser is no_warning(\"missing-doc\",\"old-init\")"
+ add "module {name}_parser is generated, no_warning(\"missing-doc\",\"old-init\")"
add "import nitcc_runtime"
add "class Parser_{name}"
var name: String
# Mangled name
- fun cname: String do return name.to_cmangle
+ var cname: String is lazy do return name.to_cmangle
# Number
var number: Int = -1
if a.length > 1 then
print "REDUCE/REDUCE Conflict on state {self.number} {self.name} for token {t}:"
for i in a do print "\treduce: {i}"
+ conflicting_items.add_all a
end
if guarded_shift.has_key(t) then
var ri = a.first
print "\treduce: {ri}"
for i in guarded_shift[t] do print "\tshift: {i}"
removed_reduces.add t
+ conflicting_items.add_all a
+ conflicting_items.add_all guarded_shift[t]
end
end
end
end
end
+ # Items within a reduce/reduce or a shift/reduce conflict.
+ #
+ # Is computed by `analysis`
+ var conflicting_items = new ArraySet[Item]
+
# Return `i` and all other items of the state that expands, directly or indirectly, to `i`
fun back_expand(i: Item): Set[Item]
do