aboutsummaryrefslogtreecommitdiff
path: root/src/comp/pretty/pp.rs
diff options
context:
space:
mode:
authorMarijn Haverbeke <[email protected]>2011-05-06 22:13:13 +0200
committerMarijn Haverbeke <[email protected]>2011-05-06 22:51:19 +0200
commita3ec0b1f643d00b9418e4884bd7caa07bf052201 (patch)
tree82000510ac9c9cf3f0c7cf4ae5f3c6b123b559cb /src/comp/pretty/pp.rs
parentRegister new snapshots. (diff)
downloadrust-a3ec0b1f643d00b9418e4884bd7caa07bf052201.tar.xz
rust-a3ec0b1f643d00b9418e4884bd7caa07bf052201.zip
Rename std modules to be camelcased
(Have fun mergining your stuff with this.)
Diffstat (limited to 'src/comp/pretty/pp.rs')
-rw-r--r--src/comp/pretty/pp.rs36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/comp/pretty/pp.rs b/src/comp/pretty/pp.rs
index 85651c78..f9667042 100644
--- a/src/comp/pretty/pp.rs
+++ b/src/comp/pretty/pp.rs
@@ -1,6 +1,6 @@
-import std.io;
-import std._vec;
-import std._str;
+import std.IO;
+import std.Vec;
+import std.Str;
tag boxtype {box_h; box_v; box_hv; box_align;}
tag contexttype {cx_h; cx_v;}
@@ -19,7 +19,7 @@ type context = rec(contexttype tp, uint indent);
type ps = @rec(mutable vec[context] context,
uint width,
- io.writer out,
+ IO.writer out,
mutable uint col,
mutable uint spaces,
mutable vec[token] buffered,
@@ -30,7 +30,7 @@ type ps = @rec(mutable vec[context] context,
mutable bool start_of_box,
mutable bool potential_brk);
-fn mkstate(io.writer out, uint width) -> ps {
+fn mkstate(IO.writer out, uint width) -> ps {
let vec[context] stack = vec(rec(tp=cx_v, indent=0u));
let vec[token] buff = vec();
let vec[boxtype] sd = vec();
@@ -57,12 +57,12 @@ fn write_spaces(ps p, uint i) {
fn push_context(ps p, contexttype tp, uint indent) {
before_print(p, false);
- _vec.push[context](p.context, rec(tp=tp, indent=indent));
+ Vec.push[context](p.context, rec(tp=tp, indent=indent));
p.start_of_box = true;
}
fn pop_context(ps p) {
- _vec.pop[context](p.context);
+ Vec.pop[context](p.context);
}
fn add_token(ps p, token tok) {
@@ -89,7 +89,7 @@ fn buffer_token(ps p, token tok) {
} else {
alt (tok) {
case (open(?tp,_)) {
- _vec.push[boxtype](p.scandepth, tp);
+ Vec.push[boxtype](p.scandepth, tp);
if (p.scanning == scan_h) {
if (tp == box_h) {
check_potential_brk(p);
@@ -97,14 +97,14 @@ fn buffer_token(ps p, token tok) {
}
}
case (close) {
- _vec.pop[boxtype](p.scandepth);
- if (_vec.len[boxtype](p.scandepth) == 0u) {
+ Vec.pop[boxtype](p.scandepth);
+ if (Vec.len[boxtype](p.scandepth) == 0u) {
finish_scan(p, true);
}
}
case (brk(_)) {
if (p.scanning == scan_h) {
- if (p.scandepth.(_vec.len[boxtype](p.scandepth)-1u) == box_v) {
+ if (p.scandepth.(Vec.len[boxtype](p.scandepth)-1u) == box_v) {
finish_scan(p, true);
}
}
@@ -123,7 +123,7 @@ fn check_potential_brk(ps p) {
fn finish_scan(ps p, bool fits) {
auto buf = p.buffered;
- auto front = _vec.shift[token](buf);
+ auto front = Vec.shift[token](buf);
auto chosen_tp = cx_h;
if (!fits) {chosen_tp = cx_v;}
alt (front) {
@@ -154,10 +154,10 @@ fn start_scan(ps p, token tok, scantype tp) {
}
fn cur_context(ps p) -> context {
- ret p.context.(_vec.len[context](p.context)-1u);
+ ret p.context.(Vec.len[context](p.context)-1u);
}
fn base_indent(ps p) -> uint {
- auto i = _vec.len[context](p.context);
+ auto i = Vec.len[context](p.context);
while (i > 0u) {
i -= 1u;
auto cx = p.context.(i);
@@ -190,7 +190,7 @@ fn do_token(ps p, token tok) {
line_break(p);
}
case (word(?w)) {
- auto len = _str.char_len(w);
+ auto len = Str.char_len(w);
if (len + p.col + p.spaces > p.width && !start_of_box &&
!p.start_of_line) {
line_break(p);
@@ -202,7 +202,7 @@ fn do_token(ps p, token tok) {
case (cword(?w)) {
before_print(p, true);
p.out.write_str(w);
- p.col += _str.char_len(w);
+ p.col += Str.char_len(w);
}
case (open(?tp, ?indent)) {
if (tp == box_v) {
@@ -247,8 +247,8 @@ fn token_size(token tok) -> uint {
alt (tok) {
case (brk(?sz)) {ret sz;}
case (hardbrk) {ret 0xFFFFFFu;}
- case (word(?w)) {ret _str.char_len(w);}
- case (cword(?w)) {ret _str.char_len(w);}
+ case (word(?w)) {ret Str.char_len(w);}
+ case (cword(?w)) {ret Str.char_len(w);}
case (open(_, _)) {ret 0u;}
case (close) {ret 0u;}
}