about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-09-01 17:49:29 -0700
committerBrian Anderson <banderson@mozilla.com>2011-09-01 17:56:25 -0700
commit6972f07510d93a82e2c8d1bdef3120c418c3ae08 (patch)
treeff8177a085b6078fabf21f5cdbe002df914b5d35 /src/comp
parentfc45eb785ad00de59a3cb26225d30f0fbc72b1c0 (diff)
downloadrust-6972f07510d93a82e2c8d1bdef3120c418c3ae08.tar.gz
rust-6972f07510d93a82e2c8d1bdef3120c418c3ae08.zip
Make #fmt and #ifmt synonymous. Issue #855
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/rustc.rc2
-rw-r--r--src/comp/syntax/ext/base.rs4
-rw-r--r--src/comp/syntax/ext/fmt.rs (renamed from src/comp/syntax/ext/ifmt.rs)24
3 files changed, 16 insertions, 14 deletions
diff --git a/src/comp/rustc.rc b/src/comp/rustc.rc
index 4a3a42e289b..8828bfb88f6 100644
--- a/src/comp/rustc.rc
+++ b/src/comp/rustc.rc
@@ -63,7 +63,7 @@ mod syntax {
         mod base;
         mod expand;
 
-        mod ifmt;
+        mod fmt;
         mod env;
         mod simplext;
         mod concat_idents;
diff --git a/src/comp/syntax/ext/base.rs b/src/comp/syntax/ext/base.rs
index 84d9061c614..fda7bb71dbf 100644
--- a/src/comp/syntax/ext/base.rs
+++ b/src/comp/syntax/ext/base.rs
@@ -22,7 +22,9 @@ tag syntax_extension {
 // AST nodes into full ASTs
 fn syntax_expander_table() -> hashmap<istr, syntax_extension> {
     let syntax_expanders = new_str_hash::<syntax_extension>();
-    syntax_expanders.insert(~"ifmt", normal(ext::ifmt::expand_syntax_ext));
+    syntax_expanders.insert(~"fmt", normal(ext::fmt::expand_syntax_ext));
+    // FIXME: Transitional. Remove
+    syntax_expanders.insert(~"ifmt", normal(ext::fmt::expand_syntax_ext));
     syntax_expanders.insert(~"env", normal(ext::env::expand_syntax_ext));
     syntax_expanders.insert(~"macro",
                             macro_defining(ext::simplext::add_new_extension));
diff --git a/src/comp/syntax/ext/ifmt.rs b/src/comp/syntax/ext/fmt.rs
index 3b90ebeed13..5e07c812236 100644
--- a/src/comp/syntax/ext/ifmt.rs
+++ b/src/comp/syntax/ext/fmt.rs
@@ -1,7 +1,7 @@
 
 
 /*
- * The compiler code necessary to support the #ifmt extension. Eventually this
+ * The compiler code necessary to support the #fmt extension. Eventually this
  * should all get sucked into either the standard library extfmt module or the
  * compiler syntax extension plugin interface.
  */
@@ -10,7 +10,7 @@ import std::str;
 import std::option;
 import std::option::none;
 import std::option::some;
-import std::extifmt::ct::*;
+import std::extfmt::ct::*;
 import base::*;
 import codemap::span;
 export expand_syntax_ext;
@@ -22,15 +22,15 @@ fn expand_syntax_ext(cx: &ext_ctxt, sp: span, arg: @ast::expr,
           ast::expr_vec(elts, _) { elts }
           _ {
             cx.span_fatal(
-                sp, ~"#ifmt requires arguments of the form `[...]`.")
+                sp, ~"#fmt requires arguments of the form `[...]`.")
           }
         };
     if vec::len::<@ast::expr>(args) == 0u {
-        cx.span_fatal(sp, ~"#ifmt requires a format string");
+        cx.span_fatal(sp, ~"#fmt requires a format string");
     }
     let fmt =
         expr_to_str(cx, args[0],
-                    ~"first argument to #ifmt must be a "
+                    ~"first argument to #fmt must be a "
                     + ~"string literal.");
     let fmtspan = args[0].span;
     log "Format string:";
@@ -106,8 +106,8 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
             ret str::find(cx.crate_file_name(), ~"std.rc") >= 0;
         }
         if compiling_std(cx) {
-            ret [~"extifmt", ~"rt", ident];
-        } else { ret [~"std", ~"extifmt", ~"rt", ident]; }
+            ret [~"extfmt", ~"rt", ident];
+        } else { ret [~"std", ~"extfmt", ~"rt", ident]; }
     }
     fn make_rt_path_expr(cx: &ext_ctxt, sp: span,
                          ident: &istr) -> @ast::expr {
@@ -151,7 +151,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
                 let count_is_args = [count_lit];
                 ret make_call(cx, sp, count_is_path, count_is_args);
               }
-              _ { cx.span_unimpl(sp, ~"unimplemented #ifmt conversion"); }
+              _ { cx.span_unimpl(sp, ~"unimplemented #fmt conversion"); }
             }
         }
         fn make_ty(cx: &ext_ctxt, sp: span, t: &ty) -> @ast::expr {
@@ -205,7 +205,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
               _ { ret false; }
             }
         }
-        let unsupported = ~"conversion not supported in #ifmt string";
+        let unsupported = ~"conversion not supported in #fmt string";
         alt cnv.param {
           option::none. { }
           _ { cx.span_unimpl(sp, unsupported); }
@@ -217,14 +217,14 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
                 if !is_signed_type(cnv) {
                     cx.span_fatal(sp,
                                   ~"+ flag only valid in " +
-                                      ~"signed #ifmt conversion");
+                                      ~"signed #fmt conversion");
                 }
               }
               flag_space_for_sign. {
                 if !is_signed_type(cnv) {
                     cx.span_fatal(sp,
                                   ~"space flag only valid in " +
-                                      ~"signed #ifmt conversions");
+                                      ~"signed #fmt conversions");
                 }
               }
               flag_left_zero_pad. { }
@@ -329,7 +329,7 @@ fn pieces_to_expr(cx: &ext_ctxt, sp: span, pieces: &[piece],
             n += 1u;
             if n >= nargs {
                 cx.span_fatal(sp,
-                              ~"not enough arguments to #ifmt " +
+                              ~"not enough arguments to #fmt " +
                                   ~"for the given format string");
             }
             log "Building conversion:";