Do better at preserving blank lines during pretty-printing

This commit is contained in:
Brian Anderson 2011-08-18 21:07:07 -07:00
parent 8c3ed8640b
commit 113be53df3
2 changed files with 20 additions and 1 deletions

View File

@ -1563,7 +1563,11 @@ fn print_comment(s: &ps, cmnt: lexer::cmnt) {
}
lexer::blank_line. {
// We need to do at least one, possibly two hardbreaks.
if is_begin(s) || is_end(s) { hardbreak(s.s) }
let is_semi = alt s.s.last_token() {
pp::STRING(s, _) { s == ";" }
_ { false }
};
if is_semi || is_begin(s) || is_end(s) { hardbreak(s.s) }
hardbreak(s.s);
}
}

View File

@ -0,0 +1,15 @@
// pp-exact
fn f() -> [int] {
let picard = 0;
let data = 1;
let worf = 2;
let enterprise = [picard, data, worf];
ret enterprise;
}