let mk_cont name cont state = let ws_only = state.pstack = [] && Buffer.length state.pbuf = 0 in let parse_fun ~pos ~len str = let max_pos = check_str_bounds name ~pos ~len str in cont state str ~max_pos ~pos in Cont (ws_only, parse_fun)