Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import sbtcrossproject.{ crossProject, CrossType }

lazy val catsVersion = "2.6.1"
lazy val fs2CoreVersion = "2.5.6"
lazy val catsVersion = "2.7.0"
lazy val fs2CoreVersion = "2.5.10"
lazy val scalacheckVersion = "1.15.4"

lazy val scala212 = "2.12.16"
lazy val scala213 = "2.13.6"
lazy val scala30 = "3.0.2"
lazy val scala212 = "2.12.20"
lazy val scala213 = "2.13.16"
lazy val scala30 = "3.3.6"
lazy val scala31 = "3.7.0"

lazy val commonSettings = Seq(
organization := "org.tpolecat",
Expand All @@ -19,7 +20,8 @@ lazy val commonSettings = Seq(
("BSD New", url("http://opensource.org/licenses/BSD-3-Clause"))
),
scalaVersion := scala213,
crossScalaVersions := Seq(scala212, scala213, scala30),
crossScalaVersions := Seq(scala212, scala213, scala30, scala31),
scalacOptions += "-Wconf:msg=infix|vararg|deprecated:s",

// dottydoc really doesn't work at all right now
Compile / doc / sources := {
Expand Down Expand Up @@ -70,7 +72,7 @@ lazy val refined =
.settings(commonSettings)
.settings(
name := "atto-refined",
libraryDependencies += "eu.timepit" %%% "refined" % "0.9.26",
libraryDependencies += "eu.timepit" %%% "refined" % "0.11.3",
)

lazy val tests =
Expand Down
4 changes: 2 additions & 2 deletions modules/core/src/main/scala/atto/parser/Character.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import cats.implicits._
import java.lang.String
import atto.syntax.parser._
import scala.{ Char, Boolean, Option, Unit }
import scala.Predef.{ charWrapper, augmentString }
import scala.Predef.{ charWrapper, intWrapper, augmentString }

/** Parsers for various kinds of characters. */
trait Character {
Expand Down Expand Up @@ -102,5 +102,5 @@ trait Character {

/** Whitespace that is not a line break */
def horizontalWhitespace: Parser[Char] =
oneOf(" \t") named "horizontalWhitespace"
oneOf(s" \t\u00A0\u1680\u180e${(0x2000 to 0x200a).map(_.toChar).mkString}\u202f\u205f\u3000").named("horizontalWhitespace")
}
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/atto/parser/Combinator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ trait Combinator0 {

private def prompt[R](st0: State, kf: State => TResult[R], ks: State => TResult[R]): Result[R] =
Partial[R](s =>
if (s.isEmpty) Eval.defer(kf(st0 copy (complete = true)))
if (s.isEmpty) Eval.defer(kf(st0.copy(complete = true)))
else Eval.defer(ks(st0.copy(input = st0.input + s, complete = false)))
)

Expand Down
12 changes: 9 additions & 3 deletions modules/tests/src/test/scala/atto/CharacterTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,14 @@ object CharacterTest extends Properties("Character") {
(if (predicate(c)) Some(()) else None)
}

property("horizontalWhitespace") = forAll { (c: Char) =>
horizontalWhitespace.parseOnly(c.toString).option ===
(if (c == ' ' || c == '\t') Some(c) else None)
property("horizontalWhitespace") = forAll(Gen.oneOf(Generators.horizontalWhitespace, Arbitrary.arbitrary[Char])) { (c: Char) =>
//println(f"CHK(${c.toInt}%04x) TEST(${CharClass.horizontalWhitespace.unapplySeq(c).flatMap(_.headOption)}) PARSE(${horizontalWhitespace.parseOnly(c.toString).option})")
horizontalWhitespace.parseOnly(c.toString).option === CharClass.horizontalWhitespace.unapplySeq(c).flatMap(_.headOption)
}
}

private object CharClass {
val horizontalWhitespace = raw"(\h)".r // " \t\xA0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000"
val horizontalWhitespaceChars =
" \u0009\u00A0\u1680\u180e\u202f\u205f\u3000".toVector ++ ('\u2000' to '\u200a').toVector
}
5 changes: 3 additions & 2 deletions modules/tests/src/test/scala/atto/Generators.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package atto
import org.scalacheck.Gen

object Generators {
val whitespace: Gen[Char] =
Gen.oneOf('\n', ' ', '\t')
val whitespace: Gen[Char] = Gen.oneOf('\n', ' ', '\t')

val horizontalWhitespace = Gen.oneOf(CharClass.horizontalWhitespaceChars)
}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.5.8
sbt.version=1.10.11
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.9.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.3")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.20")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.19.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")