fix bug in CCParse

This commit is contained in:
Simon Cruanes 2023-04-11 10:54:45 -04:00
parent 10a8a7ce0f
commit c7de9389b0
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
2 changed files with 10 additions and 1 deletions

View file

@ -605,7 +605,7 @@ let take_until_success p : (slice * _) t =
let continue = ref true in
let res = ref None in
while !continue && !i < st.j do
while !continue && !i <= st.j do
let st' = { st with i = !i } in
p.run st'
~ok:(fun new_st x ->

View file

@ -188,6 +188,15 @@ eq
"hello world")
;;
eq
~printer:(errpp Q.Print.(string))
(Ok "ahahahah")
(parse_string
(let+ slice, () = take_until_success eoi in
Slice.to_string slice)
"ahahahah")
;;
t @@ fun () ->
let p0 = skip_white *> U.int in
let p = skip_white *> char '(' *> many p0 <* (skip_white <* char ')') in