Permalink
Browse files

Build for Scala 2.13.0-M4

  • Loading branch information...
theon committed Aug 29, 2018
1 parent fd5b793 commit fa0ba4c10abc29249af1e1b313d8017519263f0f
View
@@ -4,3 +4,4 @@ jdk: oraclejdk8
scala:
- 2.11.12
- 2.12.6
- 2.13.0-M4
View
@@ -7,7 +7,7 @@ import org.scalajs.sbtplugin.cross.CrossType
val commonSettings = Seq(
version := "2.1.5-SNAPSHOT",
scalaVersion := "2.11.12",
crossScalaVersions := Seq("2.11.12", "2.12.6"),
crossScalaVersions := Seq("2.11.12", "2.12.6", "2.13.0-M4"),
organization := "org.parboiled",
homepage := Some(new URL("http://parboiled.org")),
description := "Fast and elegant PEG parsing in Scala - lightweight, easy-to-use, powerful",
@@ -71,8 +71,8 @@ val noPublishingSettings = Seq(
def scalaReflect(v: String) = "org.scala-lang" % "scala-reflect" % v % "provided"
val shapeless = "com.chuusai" %% "shapeless" % "2.3.3" % "compile"
val specs2Core = "org.specs2" %% "specs2-core" % "4.0.2" % "test"
val specs2ScalaCheck = "org.specs2" %% "specs2-scalacheck" % "4.0.2" % "test"
val specs2Core = "org.specs2" %% "specs2-core" % "4.3.3" % "test"
val specs2ScalaCheck = "org.specs2" %% "specs2-scalacheck" % "4.3.3" % "test"
/////////////////////// PROJECTS /////////////////////////
@@ -97,9 +97,8 @@ lazy val jsonBenchmark = project
.settings(noPublishingSettings: _*)
.settings(
libraryDependencies ++= Seq(
"org.json4s" %% "json4s-native" % "3.5.3",
"org.json4s" %% "json4s-jackson" % "3.5.3",
"io.argonaut" %% "argonaut" % "6.2.1"),
"org.json4s" %% "json4s-native" % "3.6.0",
"org.json4s" %% "json4s-jackson" % "3.6.0"),
bench := (run in Compile).partialInput(" -i 10 -wi 10 -f1 -t1").evaluated)
lazy val scalaParser = project
@@ -26,12 +26,4 @@ class JsonParserBenchmark {
@Benchmark
def json4SJackson(state: TestState) =
org.json4s.jackson.JsonMethods.parse(state.json)
@Benchmark
def argonaut_(state: TestState) =
argonaut.Parse.parseOption(state.json).get
//@Benchmark
//def parserCombinators(state: TestState): Unit =
// util.parsing.json.JSON.parseRaw(state.json).get
}
@@ -19,8 +19,6 @@ package org.parboiled2
import scala.annotation.tailrec
import java.lang.{ StringBuilder JStringBuilder }
import scala.collection.immutable.VectorBuilder
/**
* Abstraction for error formatting logic.
* Instantiate with a custom configuration or override with custom logic.
@@ -76,7 +74,7 @@ class ErrorFormatter(showExpected: Boolean = true,
val ix = error.position.index
if (ix < input.length) {
val chars = mismatchLength(error)
if (chars == 1) sb.append("Invalid input '").append(CharUtils.escape(input charAt ix)).append(''')
if (chars == 1) sb.append("Invalid input '").append(CharUtils.escape(input charAt ix)).append('\'')
else sb.append("Invalid input \"").append(CharUtils.escape(input.sliceString(ix, ix + chars))).append('"')
} else sb.append("Unexpected end of input")
}
@@ -134,7 +132,7 @@ class ErrorFormatter(showExpected: Boolean = true,
* Formats what is expected at the error location as a [[List]] of Strings.
*/
def formatExpectedAsList(error: ParseError): List[String] = {
val distinctStrings: Set[String] = error.effectiveTraces.map(formatAsExpected)(collection.breakOut)
val distinctStrings = error.effectiveTraces.map(formatAsExpected).distinct
distinctStrings.toList
}
@@ -602,7 +602,10 @@ trait OpTreeContext[OpTreeCtx <: ParserMacros.ParserContext] {
case Left(_) super.render(wrapped)
case Right(x) q"$x ne null"
}
def renderInner(wrapped: Boolean) = call.asInstanceOf[Left[OpTree, Tree]].a.render(wrapped)
def renderInner(wrapped: Boolean) = {
val Left(value) = call.asInstanceOf[Left[OpTree, Tree]]
value.render(wrapped)
}
}
def CharRange(lowerTree: Tree, upperTree: Tree): CharacterRange = {
@@ -645,7 +648,7 @@ trait OpTreeContext[OpTreeCtx <: ParserMacros.ParserContext] {
case Block(statements, res) block(statements, actionBody(res))
case x @ (Ident(_) | Select(_, _))
val valNames: List[TermName] = argTypes.indices.map { i TermName("value" + i) }(collection.breakOut)
val valNames = argTypes.indices.map { i TermName("value" + i) }.toList
val args = valNames map Ident.apply
block(popToVals(valNames), q"__push($x(..$args))")
@@ -40,7 +40,7 @@ class ActionSpec extends TestParserSpec {
"`run(nonRuleExpr)`" in new TestParser0 {
var flag = false
def targetRule = rule { 'a' ~ run(flag = true) ~ EOI }
def targetRule = rule { 'a' ~ run { flag = true } ~ EOI }
"a" must beMatched
flag must beTrue
}
@@ -78,7 +78,7 @@ class CalculatorSpec extends TestParserSpec {
|""")
"1+2)" must beMismatchedWithErrorMsg(
"""Invalid input ')', expected '/', '+', '*', 'EOI', '-' or Digit (line 1, column 4):
"""Invalid input ')', expected Digit, '*', '/', '+', '-' or 'EOI' (line 1, column 4):
|1+2)
| ^
|
@@ -64,7 +64,7 @@ class CharPredicateSpec extends Specification {
}
def show(pred: CharPredicate): String = {
val chars: Array[Char] = ('\u0000' to '\u0080').flatMap(c if (pred(c)) Some(c) else None)(collection.breakOut)
val chars = ('\u0000' to '\u0080').flatMap(c if (pred(c)) Some(c) else None).toArray
new String(chars)
}
@@ -54,12 +54,12 @@ object DynamicRuleDispatch {
def __create[P <: Parser, L <: HList](c: Context)(ruleNames: c.Expr[String]*)(implicit P: c.WeakTypeTag[P], L: c.WeakTypeTag[L]): c.Expr[(DynamicRuleDispatch[P, L], immutable.Seq[String])] = {
import c.universe._
val names: Array[String] = ruleNames.map {
val names = ruleNames.map {
_.tree match {
case Literal(Constant(s: String)) s
case x c.abort(x.pos, s"Invalid `String` argument `x`, only `String` literals are supported!")
}
}(collection.breakOut)
}.toArray
java.util.Arrays.sort(names.asInstanceOf[Array[Object]])
def rec(start: Int, end: Int): Tree =
View
@@ -4,6 +4,6 @@ addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.3")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.24")
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.2")

0 comments on commit fa0ba4c

Please sign in to comment.