]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matitaExcPp.ml
Big commit to let Ferruccio try the merge_coercion patch.
[helm.git] / helm / matita / matitaExcPp.ml
index 38951713eab19127332836aa3d6f84aed11b2205..c09b22fdd1c053127981cad7226a9968375e34af 100644 (file)
@@ -31,11 +31,11 @@ let rec to_string =
       let _,msg = to_string exn in
       let (x, y) = HExtlib.loc_of_floc floc in
        Some floc, sprintf "Error at %d-%d: %s" x y msg
-  | MatitaTypes.Option_error ("baseuri", "not found" ) -> 
+  | GrafiteTypes.Option_error ("baseuri", "not found" ) -> 
       None,
       "Baseuri not set for this script. "
       ^ "Use 'set \"baseuri\" \"<uri>\".' to set it."
-  | MatitaTypes.Command_error msg -> None, "Error: " ^ msg
+  | GrafiteTypes.Command_error msg -> None, "Error: " ^ msg
   | CicNotationParser.Parse_error err ->
       None, sprintf "Parse error: %s" err
   | UriManager.IllFormedUri uri -> None, sprintf "invalid uri: %s" uri
@@ -44,12 +44,12 @@ let rec to_string =
   | Unix.Unix_error (code, api, param) ->
       let err = Unix.error_message code in
       None, "Unix Error (" ^ api ^ "): " ^ err
-  | MatitaMoo.Corrupt_moo fname ->
+  | GrafiteMarshal.Corrupt_moo fname ->
       None, sprintf ".moo file '%s' is corrupt (shorter than expected)" fname
-  | MatitaMoo.Checksum_failure fname ->
+  | GrafiteMarshal.Checksum_failure fname ->
       None,
        sprintf "checksum failed for .moo file '%s', please recompile it'" fname
-  | MatitaMoo.Version_mismatch fname ->
+  | GrafiteMarshal.Version_mismatch fname ->
       None,
       sprintf
         (".moo file '%s' has been compiled by a different version of matita, "
@@ -61,7 +61,9 @@ let rec to_string =
      None, "Type checking error: " ^ Lazy.force msg
   | CicTypeChecker.AssertFailure msg ->
      None, "Type checking assertion failed: " ^ Lazy.force msg
-  | MatitaDisambiguator.DisambiguationError errorll ->
+  | LibrarySync.AlreadyDefined s -> 
+     None, "Already defined: " ^ UriManager.string_of_uri s
+  | MatitaDisambiguator.DisambiguationError (offset,errorll) ->
      let rec aux n =
       function
          [] -> ""
@@ -75,13 +77,21 @@ let rec to_string =
                    None -> ""
                  | Some floc ->
                     let (x, y) = HExtlib.loc_of_floc floc in
-                     sprintf " at %d-%d" x y
+                     sprintf " at %d-%d" (x+offset) (y+offset)
                in
                 "*Error" ^ loc_descr ^ ": " ^ Lazy.force msg) phase) ^
             "\n\n\n" in
      let loc =
       match errorll with
-         ((Some _ as loc,_)::_)::_ -> loc
+         ((Some floc,_)::_)::_ ->
+          let (x, y) = HExtlib.loc_of_floc floc in
+          let x = x + offset in
+          let y = y + offset in
+          let flocb,floce = floc in
+          let floc =
+           {flocb with Lexing.pos_cnum = x}, {floce with Lexing.pos_cnum = y}
+          in
+           Some floc
        | _ -> None
      in
       loc,