let keep_prev_loc strm =
                  match Stream.peek strm with
                  | None -> Stream.sempty
                  | Some ((_, init_loc)) ->
                      let rec go prev_loc (__strm : _ Stream.t) =
                        (match Stream.peek __strm with
                         | Some ((tok, cur_loc)) ->
                             (Stream.junk __strm;
                              let strm = __strm
                              in
                                Stream.lcons
                                  (fun _ ->
                                     (tok,
                                      {
                                        prev_loc = prev_loc;
                                        cur_loc = cur_loc;
                                      }))
                                  (Stream.slazy (fun _ -> go cur_loc strm)))
                         | _ -> Stream.sempty)
                      in go init_loc strm