Source

ocaml-lib / ipp / ipp.ml

Diff from to

File ipp/ipp.ml

 
 (* combinators *)
 
+let is_empty_list = fun l -> l=[]
+
 let rec many print v cursor ctx =
-  (alt (seq (map List.hd print) (map List.tl (many print))) empty) v cursor ctx
+  (alt (seq (map List.hd print) (map List.tl (many print))) (check is_empty_list)) v cursor ctx
 
 let some print v cursor ctx =
   (seq (map List.hd print) (map List.tl (many print))) v cursor ctx
 *)
 
 let list0 elt sep nil v cursor ctx =
-  (alt (list1 elt sep) nil) v cursor ctx
+  (alt (list1 elt sep) (seq (check is_empty_list) nil)) v cursor ctx
 
 
 (* returns one parsing result *)