Commit 3f487f7a authored by bguillaum's avatar bguillaum

Fix duplicate declaration od Found exception

git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/semagramme/dep2pict/trunk@8998 7838e531-6607-4d57-9587-6c381814729c
parent 3e01201d
......@@ -3,6 +3,8 @@ open Log
open Conll
open Dep2pict
exception Found of int
module File = struct
let read file =
let in_ch = open_in file in
......@@ -35,7 +37,6 @@ let critical msg = ksprintf
| false -> Log.fcritical "%s" m
) msg
exception Found of int
let get_suffix file_name =
let len = String.length file_name in
try
......@@ -93,7 +94,6 @@ let get_id () =
| _ -> Log.critical "[get_id] can be use only with CONLL data"
(* -------------------------------------------------------------------------------- *)
exception Found of int
let array_assoc key array =
try
Array.iteri (fun i (k,_) -> if k = key then raise (Found i)) array;
......
......@@ -40,7 +40,6 @@ let main () =
(* -------------------------------------------------------------------------------- *)
let refresh_view () =
try
let graph = match (!current_data, !current_position) with
| (Conll arr, p) -> Dep2pict.from_conll (snd arr.(p))
| (Dep graph, _) -> graph in
......@@ -57,14 +56,7 @@ let main () =
let _ = ui#last_button#misc#set_sensitive (has_next ()) in
ui#view_label#set_text (view_label ());
ui#toplevel#set_title !input_file;
with
| Dep2pict.Parse_error msgs ->
ui#error_view#buffer#set_text
(String.concat "\n" (List.map (fun (l,m) -> sprintf "Line %d: %s" l m) msgs));
| Dep2pict.Id_already_in_use_ id -> ui#error_view#buffer#set_text ("Id already in use: "^id)
| Dep2pict.Unknown_index id -> ui#error_view#buffer#set_text ("Can't find index: "^id)
| Dep2pict.Loop_in_dep msg -> ui#error_view#buffer#set_text ("Loop in dependency: "^msg)
| Dep2pict.Conll_format msg -> ui#error_view#buffer#set_text ("Conll format: "^msg) in
() in
(* -------------------------------------------------------------------------------- *)
(* Hack to keep the horizontal position *)
......@@ -76,11 +68,23 @@ let main () =
true) in
let reload first =
try
load !input_file;
if first then set_position ();
input_last_modifaction_time := (let stat = Unix.stat !input_file in stat.Unix.st_mtime);
user_hpos := ui#scroll#hadjustment#value; (* Hack (cf above) *)
refresh_view () in
refresh_view ()
with
| Dep2pict.Parse_error msgs ->
ui#error_view#buffer#set_text
(String.concat "\n" (List.map (fun (l,m) -> sprintf "Line %d: %s" l m) msgs));
| Dep2pict.Id_already_in_use_ id -> ui#error_view#buffer#set_text ("Id already in use: "^id)
| Dep2pict.Unknown_index id -> ui#error_view#buffer#set_text ("Can't find index: "^id)
| Dep2pict.Loop_in_dep msg -> ui#error_view#buffer#set_text ("Loop in dependency: "^msg)
| Dep2pict.Conll_format msg -> ui#error_view#buffer#set_text ("Conll format: "^msg)
| Conll.Error msg -> ui#error_view#buffer#set_text ("XXX: "^ msg) in
(* check if file has changed *)
let _ = GMain.Timeout.add
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment