Skip to content

Commit

Permalink
added infix annotations to help with Scala 3
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mie6 committed May 14, 2024
1 parent 72fee1e commit dbfcb9e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions parsley/shared/src/main/scala/parsley/Parsley.scala
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ final class Parsley[+A] private [parsley] (private [parsley] val internal: front
* @return a new parser that behaves the same as this parser, but always succeeds with `x` as the result.
* @group map
*/
def as[B](x: B): Parsley[B] = this.rseq(pure(x), "as")
infix def as[B](x: B): Parsley[B] = this.rseq(pure(x), "as")
/** Replaces the result of this parser with `()`.
*
* This combinator is useful when the result of this parser is not required, and the
Expand Down Expand Up @@ -283,7 +283,7 @@ final class Parsley[+A] private [parsley] (private [parsley] val internal: front
* @note just an alias for `<|>`.
* @group alt
*/
def orElse[Aʹ >: A](q: Parsley[Aʹ]): Parsley[Aʹ] = this.alt(q, "orElse")
infix def orElse[Aʹ >: A](q: Parsley[Aʹ]): Parsley[Aʹ] = this.alt(q, "orElse")
/** This combinator, pronounced "or constant", $orconst
*
* $attemptreason
Expand Down Expand Up @@ -564,7 +564,7 @@ final class Parsley[+A] private [parsley] (private [parsley] val internal: front
* @since 2.3.0
* @group seq
*/
def zip[B](q: =>Parsley[B]): Parsley[(A, B)] = lift.lift2[A, B, (A, B)]((_, _), this, q).uo("zip")
infix def zip[B](q: =>Parsley[B]): Parsley[(A, B)] = lift.lift2[A, B, (A, B)]((_, _), this, q).uo("zip")

// FILTERING COMBINATORS
/** This combinator filters the result of this parser using a given predicate, succeeding only if the predicate returns `true`.
Expand Down
2 changes: 1 addition & 1 deletion parsley/shared/src/main/scala/parsley/generic.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ object generic {
*
* @param op the parser that should be parsed before returning `con`.
*/
final def from(op: Parsley[_]): Parsley[A] = error(op.as(con).ut()).uo(s"$this.from")
infix final def from(op: Parsley[_]): Parsley[A] = error(op.as(con).ut()).uo(s"$this.from")
}

/** Generic bridge trait for singleton objects that simply return themselves
Expand Down

0 comments on commit dbfcb9e

Please sign in to comment.