Skip to content

Commit 32ca924

Browse files
marijnhgraydon
authored andcommitted
---
yaml --- r: 1851 b: refs/heads/master c: d3b49f5 h: refs/heads/master i: 1849: d92c9c8 1847: 0b56eb5 v: v3
1 parent 2b5af5e commit 32ca924

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 78c077e428f53d4fc97650317044f6b204ac2d2b
2+
refs/heads/master: d3b49f5aab6a9e9efc2ab1d6713cc0d2bde94f4e

trunk/src/comp/pretty/pp.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ impure fn buffer_token(ps p, token tok) {
9999
}
100100

101101
impure fn finish_block_scan(ps p, contexttype tp) {
102+
auto buf = p.buffered;
103+
auto front = _vec.shift[token](buf);
102104
auto indent;
103-
alt (p.buffered.(0)){
105+
alt (front){
104106
case (open(box_hv,?ind)) {
105107
indent = ind;
106108
}
@@ -109,25 +111,27 @@ impure fn finish_block_scan(ps p, contexttype tp) {
109111
}
110112
}
111113
p.scandepth = 0u;
114+
p.buffered = vec();
112115
push_context(p, tp, indent);
113-
_vec.shift[token](p.buffered);
114-
for (token t in p.buffered) { add_token(p, t); }
116+
for (token t in buf) { add_token(p, t); }
115117
}
116118

117119
impure fn finish_break_scan(ps p) {
120+
auto buf = p.buffered;
121+
auto front = _vec.shift[token](buf);
118122
if (p.bufferedcol > p.width) {
119123
line_break(p);
120124
}
121125
else {
122126
auto width;
123-
alt (p.buffered.(0)) {case(brk(?w)) {width = w;}}
127+
alt (front) {case(brk(?w)) {width = w;}}
124128
auto i = 0u;
125129
while (i < width) {p.out.write_str(" "); i+=1u;}
126130
p.col += width;
127131
}
128132
p.scandepth = 0u;
129-
_vec.shift[token](p.buffered);
130-
for (token t in p.buffered) { add_token(p, t); }
133+
p.buffered = vec();
134+
for (token t in buf) { add_token(p, t); }
131135
}
132136

133137
impure fn start_scan(ps p, token tok) {

0 commit comments

Comments
 (0)