Skip to content

Commit

Permalink
Simplify string_body even more
Browse files Browse the repository at this point in the history
  • Loading branch information
feihong committed Aug 23, 2021
1 parent 3f721fb commit 517e6ef
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions json_combinator.ml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ let boolean =
true' <|> false'

let string_body =
any >>= function
| '"' -> mzero (* terminate string *)
| '\\' -> any >>= fun c2 -> return ['\\'; c2]
| c -> return [c]
let escape_sequence = exactly '\\' >> any >>= fun c2 -> return ['\\'; c2] in
let not_quote = satisfy ((<>) '"') => fun c -> [c] in
escape_sequence <|> not_quote

let pure_string =
let* _ = exactly '"' in
Expand Down

0 comments on commit 517e6ef

Please sign in to comment.