about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorBen Blum <bblum@andrew.cmu.edu>2013-06-25 18:36:48 -0400
committerCorey Richardson <corey@octayn.net>2013-06-26 18:00:11 -0400
commit00b4138857055ba3495a70a01eea0bc8d9fed690 (patch)
treeca2264410c00c7debb5749a0c9aaa6412e00cf7e /src/libsyntax
parent41f953af2ee86e4bda1025d77dc8525f42bc7a69 (diff)
downloadrust-00b4138857055ba3495a70a01eea0bc8d9fed690.tar.gz
rust-00b4138857055ba3495a70a01eea0bc8d9fed690.zip
Make ^~~~~ colour dependent on error/warning/note level. Also correct spelling of squigglies.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/diagnostic.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index 13fa01c96e1..a904416d7a4 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -231,7 +231,7 @@ pub fn emit(cmsp: Option<(@codemap::CodeMap, span)>, msg: &str, lvl: level) {
         let ss = cm.span_to_str(sp);
         let lines = cm.span_to_lines(sp);
         print_diagnostic(ss, lvl, msg);
-        highlight_lines(cm, sp, lines);
+        highlight_lines(cm, sp, lvl, lines);
         print_macro_backtrace(cm, sp);
       }
       None => {
@@ -241,7 +241,7 @@ pub fn emit(cmsp: Option<(@codemap::CodeMap, span)>, msg: &str, lvl: level) {
 }
 
 fn highlight_lines(cm: @codemap::CodeMap,
-                   sp: span,
+                   sp: span, lvl: level,
                    lines: @codemap::FileLines) {
     let fm = lines.file;
 
@@ -293,18 +293,18 @@ fn highlight_lines(cm: @codemap::CodeMap,
             let curChar = (orig[pos] as char);
             s += match curChar { // Whenever a tab occurs on the previous
                 '\t' => "\t",    // line, we insert one on the error-point-
-                _ => " "         // -squigly-line as well (instead of a
-            };                   // space). This way the squigly-line will
+                _ => " "         // -squiggly-line as well (instead of a
+            };                   // space). This way the squiggly-line will
         }                        // usually appear in the correct position.
         io::stderr().write_str(s);
         let mut s = ~"^";
         let hi = cm.lookup_char_pos(sp.hi);
         if hi.col != lo.col {
             // the ^ already takes up one space
-            let num_squiglies = hi.col.to_uint()-lo.col.to_uint()-1u;
-            for num_squiglies.times() { s += "~"; }
+            let num_squigglies = hi.col.to_uint()-lo.col.to_uint()-1u;
+            for num_squigglies.times() { s += "~"; }
         }
-        print_maybe_colored(s + "\n", term::color_bright_green);
+        print_maybe_colored(s + "\n", diagnosticcolor(lvl));
     }
 }