Skip to content

Commit

Permalink
fix json parse example (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
zsluedem authored Oct 4, 2021
1 parent 6fad586 commit c1f7ffc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import org.typelevel.jawn.ast._

object Json {
private[this] val whitespace: P[Unit] = P.charIn(" \t\r\n").void
private[this] val whitespaces0: P[Unit] = whitespace.rep.void
private[this] val whitespaces0: Parser0[Unit] = whitespace.rep0.void

val parser: P[JValue] = P.recursive[JValue] { recurse =>
val pnull = P.string("null").as(JNull)
Expand All @@ -52,7 +52,7 @@ object Json {
val num = Numbers.jsonNumber.map(JNum(_))

val listSep: P[Unit] =
P.char(',').surroundedBy(whitespaces0).void
(whitespaces0.with1.soft ~ P.char(',') ~ whitespaces0).void

def rep[A](pa: P[A]): Parser0[List[A]] =
pa.repSep0(listSep).surroundedBy(whitespaces0)
Expand Down

0 comments on commit c1f7ffc

Please sign in to comment.