Commits

Pierre Surply  committed 0cd1824

Fix pretty error messages

  • Participants
  • Parent commits 4a511a3

Comments (0)

Files changed (1)

File compiler/error.ml

 **    along with Mara.  If not, see <http://www.gnu.org/licenses/>.
 **
 ** Started on  Wed Dec 26 11:47:42 2012 Pierre Surply
-** Last update Fri Mar 29 18:11:31 2013 Pierre Surply
+** Last update Fri Mar 29 20:05:30 2013 Pierre Surply
 *)
 
 open Conf
     let _ = input_line cin in ()
   done;
   let l = input_line cin in
-  let ul = String.create e in
+  let ul = String.create
+    (if e > 0 then e else b)
+  in
   Printf.fprintf stderr
     "\x1B[34m%s\x1B[0m\n" l;
-  for i = 0 to b - 1 do
-    ul.[i] <- ' '
-  done;
-  for i = b to e - 1 do
-    ul.[i] <- '~'
-  done;
+  if e = 0 then
+    begin
+      for i = 0 to b - 2 do
+        ul.[i] <- ' '
+      done;
+      ul.[b - 1] <- '~'
+    end
+  else
+    begin
+      for i = 0 to b - 1 do
+        ul.[i] <- ' '
+      done;
+      for i = b to e - 1 do
+        ul.[i] <- '~'
+      done
+    end;
   Printf.fprintf stderr
     "\x1B[33m%s\x1B[0m\n" ul