Commit 1498e079 authored by Jeff Smits's avatar Jeff Smits

Print single guarded choice chains from consmatch so consmatch can be built again when read

parent f27805ad
......@@ -421,13 +421,15 @@ impl<'a> ATermWrite for Strategy<'a> {
write!(writer, "{}", str::repeat(")", pairs.len()))
}
Strategy::ConsMatch(ref map, ref final_else) => {
for strat in map.values() {
write!(writer, "GuardedLChoice(")?;
strat.to_ascii(writer)?;
write!(writer, ",Id,")?;
}
final_else.to_ascii(writer)?;
write!(writer, "{}", str::repeat(")", map.len()))
let strat = map.values().fold(final_else.clone(), |else_strat, glc| {
match *glc {
Strategy::GuardedLChoice(ref pairs, _) => {
Rc::new(Strategy::GuardedLChoice(pairs.clone(), else_strat))
}
_ => unreachable!("ConsMatch should have GuardedLChoices"),
}
});
strat.to_ascii(writer)
}
Strategy::PrimT(name, ref sargs, ref targs) => {
write!(writer, "PrimT(")?;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment