From: Claudio Sacerdoti Coen Date: Tue, 10 Jun 2003 14:59:38 +0000 (+0000) Subject: - tabs removed X-Git-Tag: V7_3_new_exportation_merged~26 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=52f8a530f09b93c9d5e2c4c93464e6e73fe0e90e;p=helm.git - tabs removed - "\" correctly quoted in strings - in case of self-loops, the process diverged. Self-loops are now ignored during parsing. --- diff --git a/helm/graphs/tools/simplify_deps/simplify_deps.ml b/helm/graphs/tools/simplify_deps/simplify_deps.ml index 0763d6149..9b0fb0042 100644 --- a/helm/graphs/tools/simplify_deps/simplify_deps.ml +++ b/helm/graphs/tools/simplify_deps/simplify_deps.ml @@ -55,32 +55,36 @@ let parse () = try while true do let line = read_line () in - if Str.string_match (Str.regexp " \([^ ]*\) -> \([^ ;]*\)\(\( \[.*\]\)?\);") line 0 then + if Str.string_match (Str.regexp " \\([^ ]*\\) -> \\([^ ;]*\\)\\(\\( \\[.*\\]\\)?\\);") line 0 then let source = Str.matched_group 1 line in let target = Str.matched_group 2 line in - let rest = Str.matched_group 3 line in - let tar = - try - search_node target - with - Not_found -> - let tar = Node (target,ref []) in - nodes := tar :: !nodes ; - tar - in - let sou = - try - let sou = search_node source in - let Node (_,ts) = sou in - ts := tar::!ts ; - sou - with - Not_found -> - let sou = Node (source,ref [tar]) in - nodes := sou :: !nodes ; - sou - in - arcs := (sou,tar,rest)::!arcs + begin + if source <> target then + (* not a self loop *) + let rest = Str.matched_group 3 line in + let tar = + try + search_node target + with + Not_found -> + let tar = Node (target,ref []) in + nodes := tar :: !nodes ; + tar + in + let sou = + try + let sou = search_node source in + let Node (_,ts) = sou in + ts := tar::!ts ; + sou + with + Not_found -> + let sou = Node (source,ref [tar]) in + nodes := sou :: !nodes ; + sou + in + arcs := (sou,tar,rest)::!arcs + end else print_endline line done