Convert all uses of #ifmt to #fmt. Issue #855

This commit is contained in:
Brian Anderson 2011-09-01 18:49:10 -07:00
parent b4b81117ce
commit 418d09e547
50 changed files with 180 additions and 180 deletions

View file

@ -80,7 +80,7 @@ fn span_to_str(sp: &span, cm: &codemap) -> istr {
let lo = lookup_char_pos(cm, cur.lo);
let hi = lookup_char_pos(cm, cur.hi);
res +=
#ifmt["%s:%u:%u: %u:%u",
#fmt["%s:%u:%u: %u:%u",
if some(lo.filename) == prev_file {
~"-"
} else {
@ -114,9 +114,9 @@ fn emit_diagnostic(sp: &option::t<span>, msg: &istr, kind: &istr, color: u8,
if term::color_supported() {
term::fg(io::stdout().get_buf_writer(), color);
}
io::stdout().write_str(#ifmt[~"%s:", kind]);
io::stdout().write_str(#fmt[~"%s:", kind]);
if term::color_supported() { term::reset(io::stdout().get_buf_writer()); }
io::stdout().write_str(#ifmt[~" %s\n", msg]);
io::stdout().write_str(#fmt[~" %s\n", msg]);
maybe_highlight_lines(sp, cm, maybe_lines);
}
@ -146,14 +146,14 @@ fn maybe_highlight_lines(sp: &option::t<span>, cm: &codemap,
// Print the offending lines
for line: uint in display_lines {
io::stdout().write_str(
#ifmt[~"%s:%u ", fm.name, line + 1u]);
#fmt[~"%s:%u ", fm.name, line + 1u]);
let s = get_line(fm, line as int, file);
if !str::ends_with(s, ~"\n") { s += ~"\n"; }
io::stdout().write_str(s);
}
if elided {
let last_line = display_lines[vec::len(display_lines) - 1u];
let s = #ifmt[~"%s:%u ", fm.name, last_line + 1u];
let s = #fmt[~"%s:%u ", fm.name, last_line + 1u];
let indent = str::char_len(s);
let out = ~"";
while indent > 0u { out += ~" "; indent -= 1u; }

View file

@ -27,7 +27,7 @@ fn expand_expr(exts: &hashmap<istr, syntax_extension>, cx: &ext_ctxt,
alt exts.find(extname) {
none. {
cx.span_fatal(pth.span,
#ifmt["macro undefined: '%s'",
#fmt["macro undefined: '%s'",
extname])
}
some(normal(ext)) {

View file

@ -345,7 +345,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
if expected_nargs < nargs {
cx.span_fatal(
sp,
#ifmt["too many arguments to #fmt. found %u, expected %u",
#fmt["too many arguments to #fmt. found %u, expected %u",
nargs, expected_nargs]);
}
ret tmp_expr;

View file

@ -309,9 +309,9 @@ fn transcribe_exprs(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint],
let len = vec::len(*ms);
if old_len != len {
let msg =
#ifmt["'%s' occurs %u times, but ",
#fmt["'%s' occurs %u times, but ",
fv, len] +
#ifmt["'%s' occurs %u times",
#fmt["'%s' occurs %u times",
old_name,
old_len];
cx.span_fatal(

View file

@ -325,7 +325,7 @@ fn scan_numeric_escape(rdr: &reader, n_hex_digits: uint) -> char {
rdr.bump();
if !is_hex_digit(n) {
rdr.err(
#ifmt["illegal numeric character escape: %d", n as int]);
#fmt["illegal numeric character escape: %d", n as int]);
fail;
}
accum_int *= 16;
@ -469,7 +469,7 @@ fn next_token_inner(rdr: &reader) -> token::token {
'U' { c2 = scan_numeric_escape(rdr, 8u); }
c2 {
rdr.err(
#ifmt["unknown character escape: %d",
#fmt["unknown character escape: %d",
c2 as int]);
fail;
}
@ -510,7 +510,7 @@ fn next_token_inner(rdr: &reader) -> token::token {
}
c2 {
rdr.err(
#ifmt["unknown string escape: %d",
#fmt["unknown string escape: %d",
c2 as int]);
fail;
}
@ -551,7 +551,7 @@ fn next_token_inner(rdr: &reader) -> token::token {
'%' { ret binop(rdr, token::PERCENT); }
c {
rdr.err(
#ifmt["unkown start of token: %d", c as int]);
#fmt["unkown start of token: %d", c as int]);
fail;
}
}
@ -652,7 +652,7 @@ fn read_block_comment(rdr: &reader, code_to_the_left: bool) -> cmnt {
let curr_line = ~"/*";
let level: int = 1;
while level > 0 {
log #ifmt["=== block comment level %d", level];
log #fmt["=== block comment level %d", level];
if rdr.is_eof() { rdr.err(~"unterminated block comment"); fail; }
if rdr.curr() == '\n' {
trim_whitespace_prefix_and_push_line(lines, curr_line, col);

View file

@ -66,7 +66,7 @@ tag token { STRING(istr, int); BREAK(break_t); BEGIN(begin_t); END; EOF; }
fn tok_str(t: token) -> istr {
alt t {
STRING(s, len) {
ret #ifmt[~"STR(%s,%d)", s, len];
ret #fmt[~"STR(%s,%d)", s, len];
}
BREAK(_) { ret ~"BREAK"; }
BEGIN(_) { ret ~"BEGIN"; }
@ -85,7 +85,7 @@ fn buf_str(toks: &[mutable token], szs: &[mutable int], left: uint,
while i != right && L != 0u {
L -= 1u;
if i != left { s += ~", "; }
s += #ifmt[~"%d=%s", szs[i], tok_str(toks[i])];
s += #fmt[~"%d=%s", szs[i], tok_str(toks[i])];
i += 1u;
i %= n;
}
@ -104,7 +104,7 @@ fn mk_printer(out: io::writer, linewidth: uint) -> printer {
// fall behind.
let n: uint = 3u * linewidth;
log #ifmt[~"mk_printer %u", linewidth];
log #fmt[~"mk_printer %u", linewidth];
let token: [mutable token] = vec::init_elt_mut(EOF, n);
let size: [mutable int] = vec::init_elt_mut(0, n);
let scan_stack: [mutable uint] = vec::init_elt_mut(0u, n);
@ -244,7 +244,7 @@ obj printer(out: io::writer,
fn replace_last_token(t: token) { token[right] = t; }
fn pretty_print(t: token) {
log #ifmt[~"pp [%u,%u]", left, right];
log #fmt[~"pp [%u,%u]", left, right];
alt t {
EOF. {
if !scan_stack_empty {
@ -260,17 +260,17 @@ obj printer(out: io::writer,
left = 0u;
right = 0u;
} else { self.advance_right(); }
log #ifmt[~"pp BEGIN/buffer [%u,%u]", left, right];
log #fmt[~"pp BEGIN/buffer [%u,%u]", left, right];
token[right] = t;
size[right] = -right_total;
self.scan_push(right);
}
END. {
if scan_stack_empty {
log #ifmt[~"pp END/print [%u,%u]", left, right];
log #fmt[~"pp END/print [%u,%u]", left, right];
self.print(t, 0);
} else {
log #ifmt[~"pp END/buffer [%u,%u]", left, right];
log #fmt[~"pp END/buffer [%u,%u]", left, right];
self.advance_right();
token[right] = t;
size[right] = -1;
@ -284,7 +284,7 @@ obj printer(out: io::writer,
left = 0u;
right = 0u;
} else { self.advance_right(); }
log #ifmt[~"pp BREAK/buffer [%u,%u]", left, right];
log #fmt[~"pp BREAK/buffer [%u,%u]", left, right];
self.check_stack(0);
self.scan_push(right);
token[right] = t;
@ -293,10 +293,10 @@ obj printer(out: io::writer,
}
STRING(s, len) {
if scan_stack_empty {
log #ifmt[~"pp STRING/print [%u,%u]", left, right];
log #fmt[~"pp STRING/print [%u,%u]", left, right];
self.print(t, len);
} else {
log #ifmt[~"pp STRING/buffer [%u,%u]", left, right];
log #fmt[~"pp STRING/buffer [%u,%u]", left, right];
self.advance_right();
token[right] = t;
size[right] = len;
@ -307,14 +307,14 @@ obj printer(out: io::writer,
}
}
fn check_stream() {
log #ifmt[~"check_stream [%u, %u] with left_total=%d, right_total=%d",
log #fmt[~"check_stream [%u, %u] with left_total=%d, right_total=%d",
left, right, left_total, right_total];
if right_total - left_total > space {
log #ifmt[~"scan window is %d, longer than space on line (%d)",
log #fmt[~"scan window is %d, longer than space on line (%d)",
right_total - left_total, space];
if !scan_stack_empty {
if left == scan_stack[bottom] {
log #ifmt["setting %u to infinity and popping", left];
log #fmt["setting %u to infinity and popping", left];
size[self.scan_pop_bottom()] = size_infinity;
}
}
@ -323,7 +323,7 @@ obj printer(out: io::writer,
}
}
fn scan_push(x: uint) {
log #ifmt["scan_push %u", x];
log #fmt["scan_push %u", x];
if scan_stack_empty {
scan_stack_empty = false;
} else { top += 1u; top %= buf_len; assert (top != bottom); }
@ -352,7 +352,7 @@ obj printer(out: io::writer,
assert (right != left);
}
fn advance_left(x: token, L: int) {
log #ifmt["advnce_left [%u,%u], sizeof(%u)=%d", left, right, left, L];
log #fmt["advnce_left [%u,%u], sizeof(%u)=%d", left, right, left, L];
if L >= 0 {
self.print(x, L);
alt x {
@ -391,13 +391,13 @@ obj printer(out: io::writer,
}
}
fn print_newline(amount: int) {
log #ifmt["NEWLINE %d", amount];
log #fmt["NEWLINE %d", amount];
out.write_str(~"\n");
pending_indentation = 0;
self.indent(amount);
}
fn indent(amount: int) {
log #ifmt["INDENT %d", amount];
log #fmt["INDENT %d", amount];
pending_indentation += amount;
}
fn top() -> print_stack_elt {
@ -414,7 +414,7 @@ obj printer(out: io::writer,
out.write_str(s);
}
fn print(x: token, L: int) {
log #ifmt["print %s %d (remaining line space=%d)",
log #fmt["print %s %d (remaining line space=%d)",
tok_str(x), L,
space];
log buf_str(token, size, left, right, 6u);
@ -422,7 +422,7 @@ obj printer(out: io::writer,
BEGIN(b) {
if L > space {
let col = margin - space + b.offset;
log #ifmt["print BEGIN -> push broken block at col %d", col];
log #fmt["print BEGIN -> push broken block at col %d", col];
print_stack += [{offset: col, pbreak: broken(b.breaks)}];
} else {
log "print BEGIN -> push fitting block";

View file

@ -362,7 +362,7 @@ fn dummy() {
alt *elts.(idx) {
leaf_destructure(x) { x }
_ {
ctx.ff(sp, #ifmt["expected %s in position %u",
ctx.ff(sp, #fmt["expected %s in position %u",
#ident_to_str[leaf_destructure], idx])
}
}],