X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=ocaml%2Fparser.ml;fp=ocaml%2Fparser.ml;h=10da3a40d909fcc2013f8e3e69c26a4306bdcac7;hb=44d012f1bf971bca4cb9380f42f8fca79d414ece;hp=ae371c78f5b7efdd269b38ff04e1c6048eb8b71b;hpb=cc3341c4762822e934e694fed7b7757166fd34f2;p=fireball-separation.git diff --git a/ocaml/parser.ml b/ocaml/parser.ml index ae371c7..10da3a4 100644 --- a/ocaml/parser.ml +++ b/ocaml/parser.ml @@ -23,9 +23,10 @@ let mk_app' = function ;; let explode s = + let len = String.length s in let rec aux i l = - if i < 0 then l else aux (i - 1) (s.[i] :: l) - in aux (String.length s - 1) [] + if i >= len || s.[i] = '#' then l else aux (i+1) (s.[i] :: l) + in List.rev (aux 0 []) ;; let implode l = @@ -122,7 +123,7 @@ let parse_many strs = let f (x, y) z = match read_smt y (explode z) with | Some[tm], [], vars -> (tm :: x, vars) | _, _, _ -> assert false - in let aux = List.fold_left f ([], ([], [])) (* index zero is reserved *) + in let aux = List.fold_left f ([], ([], [])) in let (tms, (_, free)) = aux strs in (List.rev tms, free) ;;