let try_parser ps strm =
let strm' = Stream.dup strm in
let r =
try ps strm'
with
| Stream.Error _ | Loc.Exc_located (_, (Stream.Error _))
-> raise Stream.Failure
| exc -> raise exc
in (njunk strm (StreamOrig.count strm'); r)