Skip to content

Commit

Permalink
doc: quick
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mie6 committed Dec 27, 2024
1 parent 0ff95dd commit 7afaf09
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions parsley/shared/src/main/scala/parsley/character.scala
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ private [parsley] trait character {
* @since 4.0.0
* @group string
*/
final def strings(str0: String, strs: String*): Parsley[String] = strings(str0 -> pure(str0), strs.map(s => s -> pure(s)): _*) //TODO: name
final def strings(str0: String, strs: String*): Parsley[String] = strings(str0 -> pure(str0), strs.map(s => s -> pure(s)): _*)

/** This combinator tries to parse each of the key-value pairs `kvs` (and `kv0`), until one of them succeeds.
*
Expand Down Expand Up @@ -543,16 +543,16 @@ private [parsley] trait character {
* @since 4.0.0
* @group string
*/
final def strings[A](kv0: (String, Parsley[A]), kvs: (String, Parsley[A])*): Parsley[A] = { //TODO: name
final def strings[A](kv0: (String, Parsley[A]), kvs: (String, Parsley[A])*): Parsley[A] = {
// this isn't the best we could do: it's possible to eliminate backtracking with a Trie...
// can this be done in a semantic preserving way without resorting to a new instruction?
// I don't think it's worth it. Down the line a general Trie-backed optimisation would be
// more effective.
val ss = kv0 +: kvs
choice(ss.groupBy(_._1.head).toList.sortBy(_._1).view.map(_._2).flatMap { s =>
val (sLast, pLast) :: rest = s.toList.sortBy(_._1.length): @unchecked
((string(sLast) *> pLast) :: rest.map { case (s, p) => atomic(string(s)) *> p }).reverse
}.toSeq: _*)
((string(sLast).ut() *> pLast.ut()).ut() :: rest.map { case (s, p) => (atomic(string(s).ut()).ut() *> p).ut() }).reverse
}.toSeq: _*).uo((kv0._1 +: kvs.map(_._1)).mkString("strings(", ", ", ")"))
}

/** This parser will parse '''any''' single character from the input, failing if there is no input remaining.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,4 @@ object precedence {
case Atoms(atom0, atoms @ _*) => choice((atom0 +: atoms): _*)
case Level(lvls, ops) => ops.chain(crushLevels(lvls))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private [parsley] final class If[A](b: LazyParsley[Boolean], p: =>LazyParsley[A]
// $COVERAGE-OFF$
override def visit[T, U[+_]](visitor: LazyParsleyIVisitor[T, U], context: T): U[A] = visitor.visit(this, context)(b, p, q)

private [parsley] var debugName = "ifP"
private [parsley] var debugName = "ifS"
// $COVERAGE-ON$
}

Expand Down
5 changes: 3 additions & 2 deletions parsley/shared/src/main/scala/parsley/quick.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
*/
package parsley

//TODO: documentation
/**
/** This serves as a quick way of importing everything from `Parsley`, `character`, `position`, `lift`, and `ap`.
* Other packages are not included in this, but this should be a good baseline for any non-lexing/expression
* parsing work.
*
* @since 5.0.0
*
Expand Down

0 comments on commit 7afaf09

Please sign in to comment.