X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Fsolve.ml;h=6e25db2fd6e7dceb030e1b6d5cb96f3553f13061;hp=5074ae068ec2e20b09e73c1566cf2e3556c59fd4;hb=cafb1946df00d3b6b1246199d17a2c1f21b06cb3;hpb=1efafef0e88ad043612ed631eaee31b38b79dfc6 diff --git a/src/solve.ml b/src/solve.ml index 5074ae0..6e25db2 100644 --- a/src/solve.ml +++ b/src/solve.ml @@ -15,7 +15,8 @@ (** use: [./test xml_file -f XPath_queries_file] - one query per line [XPath_querie_file] + one query per line [XPath_querie_file], output + a solution per line. *) open Format @@ -24,7 +25,6 @@ let doc () = let fd = open_in Sys.argv.(1) in let d = Tree.load_xml_file fd in close_in fd; - fprintf err_formatter "Parse Tree OK ! "; d @@ -38,9 +38,8 @@ let query () = with _ -> list in let list = list_qu fq [] in close_in fq; - fprintf err_formatter "Parse query OK !\n %!"; list - else failwith "Use -f" + else failwith "Use ./test xml_file -f XPath_queries_file" let compute_run doc query = let run = Run.compute doc query in @@ -50,9 +49,6 @@ let () = let flag = Array.length Sys.argv = 5 in Format.pp_set_margin err_formatter 80; let doc = doc () in - output_string stderr "##### Doc with positions #####\n"; - Tree.print_xml_preorder stderr doc (Tree.root doc); - output_string stderr "\n"; let queries = query () in let rec print_selec fmt l = match l with | [x] -> fprintf fmt "%s" (string_of_int x) @@ -64,8 +60,11 @@ let () = let asta = Compil.trans query in let selected_nodes = Run.selected_nodes doc asta in let run = compute_run doc asta in - fprintf err_formatter "\n ### Query: %a" - XPath.Ast.print query; + if flag + then + fprintf err_formatter " ### Query: %a" + XPath.Ast.print query + else (); fprintf err_formatter "@. ### Selected nodes: {%a}@." print_selec selected_nodes; if flag @@ -74,7 +73,6 @@ let () = Run.print err_formatter run; end else (); - let asta = Asta.empty in solve_queries tl in solve_queries queries; exit 0