Created
November 14, 2019 01:13
-
-
Save abeln/9a769d9150521e0d0d5c3114915421d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/cssparse/test/src-jvm/cssparse/ProjectTests.scala b/cssparse/test/src-jvm/cssparse/ProjectTests.scala | |
index a9dcc39..bc76b63 100644 | |
--- a/cssparse/test/src-jvm/cssparse/ProjectTests.scala | |
+++ b/cssparse/test/src-jvm/cssparse/ProjectTests.scala | |
@@ -10,7 +10,7 @@ object ProjectTests extends TestSuite { | |
def checkCss()(implicit testPath: utest.framework.TestPath) = { | |
val url = "https://github.com/" + testPath.value.last | |
- val name = url.split("/").last | |
+ val name = url.split("/").last.nn | |
println(Paths.get("target", "files", name)) | |
if (!Files.exists(Paths.get("out", "repos", name))){ | |
diff --git a/cssparse/test/src-jvm/cssparse/TestUtil.scala b/cssparse/test/src-jvm/cssparse/TestUtil.scala | |
index fdd3bb3..c468c14 100644 | |
--- a/cssparse/test/src-jvm/cssparse/TestUtil.scala | |
+++ b/cssparse/test/src-jvm/cssparse/TestUtil.scala | |
@@ -38,15 +38,17 @@ object TestUtil { | |
val source = new InputSource(new StringReader(css)) | |
val parser = new CSSOMParser(new SACParserCSS3()) | |
parser.setErrorHandler(new ErrorHandler{ | |
- def error(ex: CSSParseException) = { | |
+ def error(ex1: CSSParseException|Null) = { | |
+ val ex = ex1.nn | |
errors += ex.toString | |
println("ERROR " + ex + " Line: " + ex.getLineNumber + " Column:" + ex.getColumnNumber) | |
} | |
- def fatalError(ex: CSSParseException) = { | |
+ def fatalError(ex1: CSSParseException|Null) = { | |
+ val ex = ex1.nn | |
errors += ex.toString | |
println("FATAL ERROR " + ex) | |
} | |
- def warning(ex: CSSParseException) = println("WARNING " + ex) | |
+ def warning(ex: CSSParseException|Null) = println("WARNING " + ex.nn) | |
}) | |
val sheet = parser.parseStyleSheet(source, null, null) | |
errors.toSeq | |
diff --git a/fastparse/src/fastparse/Parsed.scala b/fastparse/src/fastparse/Parsed.scala | |
index e36d9d2..c5ca023 100644 | |
--- a/fastparse/src/fastparse/Parsed.scala | |
+++ b/fastparse/src/fastparse/Parsed.scala | |
@@ -20,7 +20,7 @@ object Parsed{ | |
def fromParsingRun[T](p: ParsingRun[T]): Parsed[T] = { | |
if (p.isSuccess) Parsed.Success(p.successValue.asInstanceOf[T], p.index) | |
else Parsed.Failure( | |
- Option(p.lastFailureMsg).fold("")(_.render), | |
+ Option(p.lastFailureMsg.nn).fold("")(_.render), | |
p.index, | |
Parsed.Extra(p.input, p.startIndex, p.index, p.originalParser, p.failureStack) | |
) | |
@@ -148,7 +148,7 @@ object Parsed{ | |
// println("failureGroupAggregate " + Util.parenthize(p.failureGroupAggregate)) | |
TracedFailure( | |
p.failureTerminalAggregate, | |
- p.lastFailureMsg ::: p.failureGroupAggregate, | |
+ p.lastFailureMsg.nn ::: p.failureGroupAggregate, | |
Parsed.fromParsingRun(p).asInstanceOf[Failure] | |
) | |
} | |
diff --git a/fastparse/src/fastparse/ParsingRun.scala b/fastparse/src/fastparse/ParsingRun.scala | |
index ce42f65..7098cc7 100644 | |
--- a/fastparse/src/fastparse/ParsingRun.scala | |
+++ b/fastparse/src/fastparse/ParsingRun.scala | |
@@ -106,12 +106,12 @@ final class ParsingRun[+T](val input: ParserInput, | |
val startIndex: Int, | |
val originalParser: ParsingRun[_] => ParsingRun[_], | |
val traceIndex: Int, | |
- val instrument: Instrument, | |
+ val instrument: Instrument|Null, | |
// Mutable vars below: | |
var failureTerminalAggregate: Msgs, | |
var failureGroupAggregate: Msgs, | |
var shortParserMsg: Msgs, | |
- var lastFailureMsg: Msgs, | |
+ var lastFailureMsg: Msgs|Null, | |
var failureStack: List[(String, Int)], | |
var isSuccess: Boolean, | |
var logDepth: Int, | |
@@ -332,4 +332,4 @@ final class ParsingRun[+T](val input: ParserInput, | |
object ParsingRun{ | |
def current(implicit i: ParsingRun[Any]): ParsingRun[Any] = i | |
-} | |
\ No newline at end of file | |
+} | |
diff --git a/fastparse/src/fastparse/internal/RepImpls.scala b/fastparse/src/fastparse/internal/RepImpls.scala | |
index 615411a..3eed012 100644 | |
--- a/fastparse/src/fastparse/internal/RepImpls.scala | |
+++ b/fastparse/src/fastparse/internal/RepImpls.scala | |
@@ -141,7 +141,7 @@ object MacroRepImpls{ | |
class RepImpls[T](val parse0: () => ParsingRun[T]) extends AnyVal{ | |
def repX[V](min: Int = 0, | |
- sep: => ParsingRun[_] = null, | |
+ sep: => ParsingRun[_]|Null = null, | |
max: Int = Int.MaxValue, | |
exactly: Int = -1) | |
(implicit repeater: Implicits.Repeater[T, V], | |
@@ -159,8 +159,8 @@ class RepImpls[T](val parse0: () => ParsingRun[T]) extends AnyVal{ | |
count: Int, | |
precut: Boolean, | |
outerCut: Boolean, | |
- sepMsg: Msgs, | |
- lastAgg: Msgs): ParsingRun[V] = { | |
+ sepMsg: Msgs|Null, | |
+ lastAgg: Msgs|Null): ParsingRun[V] = { | |
ctx.cut = precut | (count < min && outerCut) | |
if (count == 0 && actualMax == 0) ctx.freshSuccess(repeater.result(acc), startIndex) | |
else { | |
@@ -223,8 +223,8 @@ class RepImpls[T](val parse0: () => ParsingRun[T]) extends AnyVal{ | |
count: Int, | |
precut: Boolean, | |
outerCut: Boolean, | |
- sepMsg: Msgs, | |
- lastAgg: Msgs): ParsingRun[V] = { | |
+ sepMsg: Msgs|Null, | |
+ lastAgg: Msgs|Null): ParsingRun[V] = { | |
ctx.cut = precut | (count < min && outerCut) | |
parse0() | |
val parsedMsg = ctx.shortParserMsg | |
@@ -261,7 +261,7 @@ class RepImpls[T](val parse0: () => ParsingRun[T]) extends AnyVal{ | |
rec(ctx.index, 0, false, ctx.cut, null, null) | |
} | |
def rep[V](min: Int = 0, | |
- sep: => ParsingRun[_] = null, | |
+ sep: => ParsingRun[_]|Null = null, | |
max: Int = Int.MaxValue, | |
exactly: Int = -1) | |
(implicit repeater: Implicits.Repeater[T, V], | |
@@ -280,8 +280,8 @@ class RepImpls[T](val parse0: () => ParsingRun[T]) extends AnyVal{ | |
count: Int, | |
precut: Boolean, | |
outerCut: Boolean, | |
- sepMsg: Msgs, | |
- lastAgg: Msgs): ParsingRun[V] = { | |
+ sepMsg: Msgs|Null, | |
+ lastAgg: Msgs|Null): ParsingRun[V] = { | |
ctx.cut = precut | (count < min && outerCut) | |
if (count == 0 && actualMax == 0) ctx.freshSuccess(repeater.result(acc), startIndex) | |
else { | |
@@ -351,8 +351,8 @@ class RepImpls[T](val parse0: () => ParsingRun[T]) extends AnyVal{ | |
count: Int, | |
precut: Boolean, | |
outerCut: Boolean, | |
- sepMsg: Msgs, | |
- lastAgg: Msgs): ParsingRun[V] = { | |
+ sepMsg: Msgs|Null, | |
+ lastAgg: Msgs|Null): ParsingRun[V] = { | |
ctx.cut = precut | (count < min && outerCut) | |
parse0() | |
@@ -418,9 +418,9 @@ class RepImpls[T](val parse0: () => ParsingRun[T]) extends AnyVal{ | |
private def aggregateMsgInRep[V](startIndex: Int, | |
min: Int, | |
ctx: ParsingRun[Any], | |
- sepMsg: Msgs, | |
+ sepMsg: Msgs|Null, | |
parsedMsg: Msgs, | |
- lastAgg: Msgs, | |
+ lastAgg: Msgs|Null, | |
precut: Boolean) = { | |
if (sepMsg == null || precut) { | |
ctx.aggregateMsg( | |
@@ -437,7 +437,7 @@ class RepImpls[T](val parse0: () => ParsingRun[T]) extends AnyVal{ | |
// we backtrack past the sep on failure) as well as the failure | |
// aggregate of the previous rep, which we could have continued | |
if (lastAgg == null) Util.joinBinOp(sepMsg, parsedMsg) | |
- else Util.joinBinOp(sepMsg, parsedMsg) ::: lastAgg | |
+ else Util.joinBinOp(sepMsg, parsedMsg) ::: lastAgg.nn | |
) | |
} | |
} | |
diff --git a/fastparse/src/fastparse/internal/Util.scala b/fastparse/src/fastparse/internal/Util.scala | |
index 340f3b2..8f10bb7 100644 | |
--- a/fastparse/src/fastparse/internal/Util.scala | |
+++ b/fastparse/src/fastparse/internal/Util.scala | |
@@ -50,15 +50,15 @@ object Util { | |
var i = 0 | |
var col = 1 | |
var cr = false | |
- var prev: Character = null | |
+ var prev: Character|Null = null | |
while (i < data.length){ | |
val char = data(i) | |
if (char == '\r') { | |
- if (prev != '\n' && col == 1) lineStarts.append(i) | |
+ if (prev.asInstanceOf[Character] != '\n' && col == 1) lineStarts.append(i) | |
col = 1 | |
cr = true | |
}else if (char == '\n') { | |
- if (prev != '\r' && col == 1) lineStarts.append(i) | |
+ if (prev.asInstanceOf[Character] != '\r' && col == 1) lineStarts.append(i) | |
col = 1 | |
cr = false | |
}else{ | |
@@ -154,4 +154,4 @@ case class Msgs(value: List[Lazy[String]]){ | |
def ::(other: Lazy[String]) = Msgs(other :: value) | |
override def toString = render | |
def render = Util.parenthize(value) | |
-} | |
\ No newline at end of file | |
+} | |
diff --git a/fastparse/src/fastparse/package.scala b/fastparse/src/fastparse/package.scala | |
index fd10e51..ce875ec 100644 | |
--- a/fastparse/src/fastparse/package.scala | |
+++ b/fastparse/src/fastparse/package.scala | |
@@ -31,7 +31,7 @@ package object fastparse { | |
parser: P[_] => P[T], | |
verboseFailures: Boolean = false, | |
startIndex: Int = 0, | |
- instrument: Instrument = null): Parsed[T] = { | |
+ instrument: Instrument|Null = null): Parsed[T] = { | |
Parsed.fromParsingRun(parseInputRaw[T]( | |
input, | |
parser, | |
@@ -47,7 +47,7 @@ package object fastparse { | |
verboseFailures: Boolean = false, | |
startIndex: Int = 0, | |
traceIndex: Int = -1, | |
- instrument: Instrument = null, | |
+ instrument: Instrument|Null = null, | |
enableLogging: Boolean = true): ParsingRun[T] = parser(new ParsingRun( | |
input = input, | |
startIndex = startIndex, | |
@@ -247,7 +247,7 @@ package object fastparse { | |
* `max` to the same value. | |
*/ | |
def rep[V](min: Int,// = 0, | |
- sep: => P[_],// = null, | |
+ sep: => P[_]|Null,// = null, | |
max: Int,// = Int.MaxValue, | |
exactly: Int)// = -1) | |
(implicit repeater: Implicits.Repeater[T, V], | |
@@ -300,7 +300,7 @@ package object fastparse { | |
* `max` to the same value. | |
*/ | |
def repX[V](min: Int,// = 0, | |
- sep: => P[_],// = null, | |
+ sep: => P[_]|Null,// = null, | |
max: Int,// = Int.MaxValue, | |
exactly: Int)// = -1) | |
(implicit repeater: Implicits.Repeater[T, V], | |
@@ -420,7 +420,7 @@ package object fastparse { | |
} else { | |
val trace = Parsed.Failure.formatStack( | |
ctx.input, | |
- ctx.failureStack ++ Seq(ctx.lastFailureMsg.render -> ctx.index) | |
+ ctx.failureStack ++ Seq(ctx.lastFailureMsg.nn.render -> ctx.index) | |
) | |
val trailing = ctx.input match { | |
case c: IndexedParserInput => Parsed.Failure.formatTrailing(ctx.input, startIndex) | |
diff --git a/fastparse/test/src/fastparse/FailureTests.scala b/fastparse/test/src/fastparse/FailureTests.scala | |
index a807ebc..83e431a 100644 | |
--- a/fastparse/test/src/fastparse/FailureTests.scala | |
+++ b/fastparse/test/src/fastparse/FailureTests.scala | |
@@ -9,7 +9,7 @@ object FailureTests extends TestSuite{ | |
def checkOffset(input: String, | |
expected: String, | |
label: String, | |
- terminals: String = null, | |
+ terminals: String|Null = null, | |
parser: P[_] => P[_]) = { | |
val f @ Parsed.Failure(failureString, index, extra) = parse(input, parser(_)) | |
diff --git a/perftests/bench2/src/perftests/FasterParserParser.scala b/perftests/bench2/src/perftests/FasterParserParser.scala | |
index 65a28a7..2735575 100644 | |
--- a/perftests/bench2/src/perftests/FasterParserParser.scala | |
+++ b/perftests/bench2/src/perftests/FasterParserParser.scala | |
@@ -292,7 +292,7 @@ object fastparseParser{ | |
def params[$: P]: P[Expr.Params] = P( (id ~ ("=" ~ expr).?).rep(0, ",", Int.MaxValue, -1) ~ ",".? ).flatMap{ x => | |
val seen = collection.mutable.Set.empty[String] | |
- var overlap: String = null | |
+ var overlap: String|Null = null | |
for((k, v) <- x){ | |
if (seen(k)) overlap = k | |
else seen.add(k) | |
diff --git a/pythonparse/test/src-jvm/pythonparse/ProjectTests.scala b/pythonparse/test/src-jvm/pythonparse/ProjectTests.scala | |
index 054eacb..3acc357 100644 | |
--- a/pythonparse/test/src-jvm/pythonparse/ProjectTests.scala | |
+++ b/pythonparse/test/src-jvm/pythonparse/ProjectTests.scala | |
@@ -36,9 +36,9 @@ object ProjectTests extends TestSuite{ | |
def listFiles(s: java.io.File): Iterator[String] = { | |
val (dirs, files) = Option(s.listFiles()).toIterator | |
.flatMap(_.toIterator) | |
- .partition(_.isDirectory) | |
+ .partition(_.nn.isDirectory) | |
- files.map(_.getPath) ++ dirs.flatMap(listFiles) | |
+ files.map(_.nn.getPath) ++ dirs.flatMap(f => listFiles(f.nn)) | |
} | |
val pythonFiles: Seq[String] = listFiles(new java.io.File(path.toString)) | |
diff --git a/scalaparse/test/src-jvm/scalaparse/ProjectTests.scala b/scalaparse/test/src-jvm/scalaparse/ProjectTests.scala | |
index 35315be..63849fe 100644 | |
--- a/scalaparse/test/src-jvm/scalaparse/ProjectTests.scala | |
+++ b/scalaparse/test/src-jvm/scalaparse/ProjectTests.scala | |
@@ -19,7 +19,7 @@ object ProjectTests extends TestSuite{ | |
def checkDir(path: String, filter: String => Boolean = _ => true) = { | |
println("Checking Dir " + path) | |
def listFiles(s: File): Seq[String] = { | |
- val (dirs, files) = Option(s.listFiles).getOrElse(Array[File]()).partition(_.isDirectory) | |
+ val (dirs, files) = Option[Array[File]](s.listFiles.asInstanceOf[Array[File]]).getOrElse(Array[File]()).partition(_.isDirectory) | |
files.map(_.getPath) ++ dirs.flatMap(listFiles) | |
} | |
diff --git a/scalaparse/test/src-jvm/scalaparse/ScalacParser.scala b/scalaparse/test/src-jvm/scalaparse/ScalacParser.scala | |
index 404b8d2..7b44be2 100644 | |
--- a/scalaparse/test/src-jvm/scalaparse/ScalacParser.scala | |
+++ b/scalaparse/test/src-jvm/scalaparse/ScalacParser.scala | |
@@ -13,7 +13,7 @@ object ScalacParser{ | |
while(current != null){ | |
current match{ | |
case t: java.net.URLClassLoader => | |
- files.appendAll(t.getURLs.map(u => new java.io.File(u.toURI))) | |
+ files.appendAll(t.getURLs.map(u => new java.io.File(u.nn.toURI))) | |
case _ => | |
} | |
current = current.getParent | |
@@ -53,4 +53,4 @@ object ScalacParser{ | |
parser.parse() | |
fail | |
} | |
-} | |
\ No newline at end of file | |
+} | |
diff --git a/scalaparse/test/src/scalaparse/TestUtil.scala b/scalaparse/test/src/scalaparse/TestUtil.scala | |
index 578c732..9bb64fe 100644 | |
--- a/scalaparse/test/src/scalaparse/TestUtil.scala | |
+++ b/scalaparse/test/src/scalaparse/TestUtil.scala | |
@@ -10,8 +10,8 @@ import fastparse._ | |
*/ | |
object TestUtil { | |
def checkNeg[T](input: String, | |
- terminals: String, | |
- aggregate: String, | |
+ terminals: String|Null, | |
+ aggregate: String|Null, | |
found: String) | |
(implicit line: sourcecode.Line) = { | |
// println("Checking Neg...\n" ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment