Skip to content

version bumps and code improvement #329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 4, 2020
Merged
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
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,17 @@ import: scala/scala-dev:travis/default.yml
language: scala

scala:
- 3.0.0-M1
- 3.0.0-M2
- 2.11.12
- 2.12.12
- 2.13.3
- 2.13.4

env:
- ADOPTOPENJDK=8 SCALAJS_VERSION=
- ADOPTOPENJDK=8 SCALAJS_VERSION=1.3.1
- ADOPTOPENJDK=11 SCALAJS_VERSION=

matrix:
exclude:
- scala: 3.0.0-M1
env: ADOPTOPENJDK=8 SCALAJS_VERSION=1.3.1
include:
- scala: 2.11.12
env: ADOPTOPENJDK=8 SCALANATIVE_VERSION=0.3.9
Expand Down
3 changes: 3 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ lazy val parserCombinators = crossProject(JVMPlatform, JSPlatform, NativePlatfor

libraryDependencies += "junit" % "junit" % "4.13.1" % Test,
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test,
// so we can `@nowarn` in test code, but only in test code, so the dependency
// doesn't leak downstream
libraryDependencies += "org.scala-lang.modules" %% "scala-collection-compat" % "2.3.1" % Test,

apiMappings ++= scalaInstance.value.libraryJars.collect {
case file if file.getName.startsWith("scala-library") && file.getName.endsWith(".jar") =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ to update each parser involved in the recursion.
case LR(seed ,rule, Some(head)) =>
if(head.getHead != p) /*not head rule, so not growing*/ seed.asInstanceOf[ParseResult[T]]
else {
in.updateCacheAndGet(p, MemoEntry(Right[LR, ParseResult[T]](seed.asInstanceOf[ParseResult[T]])))
in.updateCacheAndGet(p, MemoEntry(Right(seed.asInstanceOf[ParseResult[T]])))
seed match {
case f@Failure(_,_) => f
case e@Error(_,_) => e
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,9 @@ trait Parsers {
val res1 = Parser.this(in)
val res2 = q(in)

(res1, res2) match {
// compiler thinks match isn't exhaustive; perhaps it's right, but does that mean there's a bug here?
// that's not clear to me, so for now let's just `@unchecked` it
((res1, res2): @unchecked) match {
case (s1 @ Success(_, next1), s2 @ Success(_, next2)) => if (next2.pos < next1.pos || next2.pos == next1.pos) s1 else s2
case (s1 @ Success(_, _), _) => s1
case (_, s2 @ Success(_, _)) => s2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ private object grammars3 extends StandardTokenParsers with PackratParsers {
| success(Nil)
)

@annotation.nowarn // Some(xs) in pattern isn't exhaustive
def repMany1[T](p: => Parser[T], q: => Parser[T]): Parser[List[T]] =
p~opt(repMany(p,q))~q ^^ {case x~Some(xs)~y => x::xs:::(y::Nil)}
p~opt(repMany(p,q))~q ^^ {case x~Some(xs)~y => x::xs:::(y::Nil)}

}