"#, fmt = table_fmt)?;
// A + B: Block header
if self.state_formatter.column_names().is_empty() {
@@ -186,7 +195,7 @@ fn write_node_label(
// C: Entry state
self.bg = Background::Light;
self.results.seek_to_block_start(block);
- self.write_row_with_full_state(w, "", "(on_entry)")?;
+ self.write_row_with_full_state(w, "", "(on entry)")?;
// D: Statement transfer functions
for (i, statement) in body[block].statements.iter().enumerate() {
@@ -212,7 +221,7 @@ fn write_node_label(
self.write_row(w, "", "(on successful return)", |this, w, fmt| {
write!(
w,
- r#"| "#,
+ r#" | "#,
colspan = num_state_columns,
fmt = fmt,
)?;
@@ -311,7 +320,9 @@ fn write_row(
f: impl FnOnce(&mut Self, &mut W, &str) -> io::Result<()>,
) -> io::Result<()> {
let bg = self.toggle_background();
- let fmt = format!("sides=\"tl\" {}", bg.attr());
+ let valign = if mir.starts_with("(on ") && mir != "(on entry)" { "bottom" } else { "top" };
+
+ let fmt = format!("valign=\"{}\" sides=\"tl\" {}", valign, bg.attr());
write!(
w,
@@ -345,7 +356,7 @@ fn write_row_with_full_state(
colspan = this.num_state_columns(),
fmt = fmt,
)?;
- pretty_print_state_elems(w, analysis, state.iter(), ",", LIMIT_40_ALIGN_1)?;
+ pretty_print_state_elems(w, analysis, state.iter(), ", ", LIMIT_30_ALIGN_1)?;
write!(w, "}} | ")
})
}
@@ -416,7 +427,7 @@ fn write_state_for_location(
}
self.prev_loc = location;
- write!(w, r#""#, fmt = fmt)?;
+ write!(w, r#" | "#, fmt = fmt)?;
results.seek_after(location);
let curr_state = results.get();
write_diff(&mut w, results.analysis(), &self.prev_state, curr_state)?;
@@ -524,12 +535,12 @@ fn write_state_for_location(
for set in &[&block_trans.gen, &block_trans.kill] {
write!(
w,
- r#" | "#,
+ r#" | "#,
fmt = fmt,
rowspan = rowspan
)?;
- pretty_print_state_elems(&mut w, results.analysis(), set.iter(), "\n", None)?;
+ pretty_print_state_elems(&mut w, results.analysis(), set.iter(), BR_LEFT, None)?;
write!(w, " | ")?;
}
@@ -561,25 +572,28 @@ fn write_diff>(
if !set.is_empty() {
write!(w, r#"+"#)?;
- pretty_print_state_elems(w, analysis, set.iter(), ",", LIMIT_40_ALIGN_1)?;
+ pretty_print_state_elems(w, analysis, set.iter(), ", ", LIMIT_30_ALIGN_1)?;
write!(w, r#""#)?;
}
if !set.is_empty() && !clear.is_empty() {
- write!(w, "
")?;
+ write!(w, "{}", BR_LEFT)?;
}
if !clear.is_empty() {
write!(w, r#"-"#)?;
- pretty_print_state_elems(w, analysis, clear.iter(), ",", LIMIT_40_ALIGN_1)?;
+ pretty_print_state_elems(w, analysis, clear.iter(), ", ", LIMIT_30_ALIGN_1)?;
write!(w, r#""#)?;
}
Ok(())
}
+const BR_LEFT: &'static str = r#"
"#;
+const BR_LEFT_SPACE: &'static str = r#"
"#;
+
/// Line break policy that breaks at 40 characters and starts the next line with a single space.
-const LIMIT_40_ALIGN_1: Option = Some(LineBreak { sequence: "
", limit: 40 });
+const LIMIT_30_ALIGN_1: Option = Some(LineBreak { sequence: BR_LEFT_SPACE, limit: 30 });
struct LineBreak {
sequence: &'static str,