From: acondolu Date: Mon, 24 Jul 2017 14:15:53 +0000 (+0200) Subject: Allow comments (#) at the end of terms X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=6fc1858e757263b4e651f92fa8aaa3ecee1ab626;p=fireball-separation.git Allow comments (#) at the end of terms --- diff --git a/ocaml/parser.ml b/ocaml/parser.ml index 34b62ba..2b0e04d 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) ;;