Skip to content

Commit

Permalink
added zipped to all
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mie6 committed Apr 16, 2024
1 parent d341b59 commit cdf6eff
Show file tree
Hide file tree
Showing 22 changed files with 670 additions and 693 deletions.
2 changes: 1 addition & 1 deletion docs/api-guide/generic.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ val py: Parsley[Int] = pure(6)
```

```scala mdoc
import parsley.syntax.zipped.Zipped2
import parsley.syntax.zipped.zippedSyntax2
case class Foo(x: Int, y: Int)
// with px, py of type Parsley[Int]
val p = (px, py).zipped(Foo(_, _))
Expand Down
2 changes: 1 addition & 1 deletion docs/cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ after the receiver of the method: it gets given the right argument type straight
for leveraging this property:

```scala mdoc:silent
import parsley.syntax.zipped.Zipped2
import parsley.syntax.zipped.zippedSyntax2

(nonzero, many(digit)).zipped(_ :: _)
```
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/advanced-error-messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ import parsley.Parsley.atomic
import lexer.implicits.implicitSymbol
import lexer.{number, identifier, fully}
import parsley.combinator.sepEndBy
import parsley.syntax.zipped.{Zipped2, Zipped3}
import parsley.syntax.zipped._
import parsley.expr.{Prefix, InfixR, InfixL, precedence, Ops}

def infixN[A, B](p: Parsley[A])(op: Parsley[(A, A) => B]): Parsley[B] =
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/basics-of-combinators.md
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ less efficient) and will give a sense of how the solution works out.
import parsley.Parsley, Parsley.atomic
import parsley.syntax.character.stringLift
import parsley.syntax.lift.liftSyntax2
import parsley.syntax.zipped.Zipped2
import parsley.syntax.zipped._

val or = (x: Boolean, y: Boolean) => x || y

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/building-expression-parsers.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ parse into an `Int`: behold, the magic of combinators!):
import parsley.Parsley, Parsley.atomic
import parsley.character.digit
import parsley.syntax.character.charLift
import parsley.syntax.zipped.Zipped2
import parsley.syntax.zipped._

// Standard number parser
val number = digit.foldLeft1[Int](0)((n, d) => n * 10 + d.asDigit)
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/interlude-1-haskell.md
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ Now, to make this work nicely, I'm going to make use of the `<+>` combinator: pr
this, we can define the factored `<program>`:

```scala mdoc:nest:silent
import parsley.syntax.zipped.Zipped3
import parsley.syntax.zipped._

val `<declaration>` = "::" ~> `<type>`

Expand Down
6 changes: 3 additions & 3 deletions docs/tutorial/parser-bridge-pattern.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ import lexer.implicits._
val letExpr: Parsley[LetExpr] = empty
```
```scala mdoc:silent
import parsley.syntax.zipped.Zipped2
import parsley.syntax.zipped._
val binding: Parsley[Binding] =
pos <**> (identifier, "=" ~> letExpr).zipped(Binding(_, _) _)
```
Expand Down Expand Up @@ -286,7 +286,7 @@ object lexer {
```scala mdoc
object ast {
import parsley.position.pos
import parsley.syntax.zipped.Zipped2
import parsley.syntax.zipped._

sealed trait LetExpr
case class Let(bindings: List[Binding], x: Expr)(val pos: (Int, Int)) extends LetExpr
Expand Down Expand Up @@ -446,7 +446,7 @@ constructors themselves. But there is enough structure here to extract some shin
template traits:

```scala mdoc:invisible
import parsley.syntax.zipped.Zipped2
import parsley.syntax.zipped._
import parsley.position.pos
```
```scala mdoc
Expand Down
4 changes: 2 additions & 2 deletions parsley/shared/src/main/scala/parsley/character.scala
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ private [parsley] trait character {
*
* @example {{{
* scala> import parsley.character.{letter, letterOrDigit, stringOfMany}
* scala> import parsley.syntax.zipped.Zipped2
* scala> import parsley.syntax.zipped._
* scala> val ident = (letter, stringOfMany(letterOrDigit)).zipped((c, s) => s"&#36;c&#36;s")
* scala> ident.parse("abdc9d")
* val res0 = Success("abdc9d")
Expand All @@ -408,7 +408,7 @@ private [parsley] trait character {
*
* @example {{{
* scala> import parsley.character.{letter, stringOfMany}
* scala> import parsley.syntax.zipped.Zipped2
* scala> import parsley.syntax.zipped._
* scala> val ident = (letter, stringOfMany(_.isLetterOrDigit)).zipped((c, s) => s"&#36;c&#36;s")
* scala> ident.parse("abdc9d")
* val res0 = Success("abdc9d")
Expand Down
2 changes: 1 addition & 1 deletion parsley/shared/src/main/scala/parsley/combinator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import scala.collection.{Factory, mutable}

import parsley.Parsley.{atomic, empty, fresh, many, notFollowedBy, pure, secretSome, select, some, unit}
import parsley.state.{RefMaker, StateCombinators, forP}
import parsley.syntax.zipped.Zipped2
import parsley.syntax.zipped.zippedSyntax2

import parsley.internal.deepembedding.frontend

Expand Down
2 changes: 1 addition & 1 deletion parsley/shared/src/main/scala/parsley/expr/infix.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package parsley.expr
import parsley.Parsley, Parsley.notFollowedBy
import parsley.XAnnotation.{implicitNotFound212, implicitNotFound213}
import parsley.errors.combinator.ErrorMethods
import parsley.syntax.zipped.Zipped2
import parsley.syntax.zipped.zippedSyntax2

import parsley.internal.deepembedding.frontend

Expand Down
2 changes: 1 addition & 1 deletion parsley/shared/src/main/scala/parsley/expr/mixed.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package parsley.expr
import parsley.Parsley, Parsley._
import parsley.XAnnotation.{implicitNotFound212, implicitNotFound213}
import parsley.lift.lift4
import parsley.syntax.zipped.Zipped2
import parsley.syntax.zipped.zippedSyntax2

/** This module contains specialist combinators for mixing unary and binary operators
* on the same level. This is only sensible when mixing infix-left and postfix
Expand Down
2 changes: 1 addition & 1 deletion parsley/shared/src/main/scala/parsley/position.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
package parsley

import parsley.syntax.zipped.Zipped3
import parsley.syntax.zipped.zippedSyntax3

import parsley.internal.deepembedding.singletons

Expand Down
2 changes: 1 addition & 1 deletion parsley/shared/src/main/scala/parsley/state.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import scala.collection.Factory

import parsley.XAssert._
import parsley.combinator.{whenS, whileS}
import parsley.syntax.zipped.Zipped2
import parsley.syntax.zipped.{zippedSyntax2}
import parsley.exceptions.UnfilledReferenceException

import parsley.internal.deepembedding.{frontend, singletons}
Expand Down
2 changes: 1 addition & 1 deletion parsley/shared/src/main/scala/parsley/syntax/all.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
*/
package parsley.syntax

object all extends lift
object all extends lift with zipped
2 changes: 1 addition & 1 deletion parsley/shared/src/main/scala/parsley/syntax/lift.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import parsley.lift._
* For a version of this syntax that behaves better with type inference, see [[zipped `zipped`]].
*/
object lift extends lift
private [parsley] trait lift {
private [syntax] trait lift {
implicit final def liftSyntax0[R](x: R): Lift0[R] = new Lift0(x)
implicit final def liftSyntax1[T1, R](f: T1 => R): Lift1[T1, R] = new Lift1(f)
implicit final def liftSyntax2[T1, T2, R](f: (T1, T2) => R): Lift2[T1, T2, R] = new Lift2(f)
Expand Down
Loading

0 comments on commit cdf6eff

Please sign in to comment.