mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
fix(CCParse): fix issue in recurse
recursively parsing a slice means we temporarily switch the state to the slice; but once the sub-parser returns we need to switch back to the old state.
This commit is contained in:
parent
6d013251fe
commit
10a8a7ce0f
1 changed files with 3 additions and 4 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
open CCShims_
|
open CCShims_
|
||||||
|
|
||||||
module Memo_tbl = Hashtbl.Make (struct
|
module Memo_tbl = Hashtbl.Make (struct
|
||||||
|
|
@ -300,11 +299,11 @@ end
|
||||||
let recurse slice p : _ t =
|
let recurse slice p : _ t =
|
||||||
{
|
{
|
||||||
run =
|
run =
|
||||||
(fun _st ~ok ~err ->
|
(fun st ~ok ~err ->
|
||||||
(* make sure these states are related. all slices share the
|
(* make sure these states are related. all slices share the
|
||||||
same reference as the initial state they derive from. *)
|
same reference as the initial state they derive from. *)
|
||||||
assert (CCShims_.Stdlib.(_st.cs == slice.cs));
|
assert (CCShims_.Stdlib.(st.cs == slice.cs));
|
||||||
p.run slice ~ok ~err);
|
p.run slice ~ok:(fun _st x -> ok st x) ~err);
|
||||||
}
|
}
|
||||||
|
|
||||||
let all =
|
let all =
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue