diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-09-26 10:54:03 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-09-27 15:53:18 +0200 |
commit | ee1ca007c73d941c88c893637263b7d4b5fc842e (patch) | |
tree | 91045ea53ba1aa2949fb0459112873667c1d7de9 | |
parent | 7e5646388243522bef8f4a1a1e255c7d8e30236d (diff) | |
download | scala-ee1ca007c73d941c88c893637263b7d4b5fc842e.tar.gz scala-ee1ca007c73d941c88c893637263b7d4b5fc842e.tar.bz2 scala-ee1ca007c73d941c88c893637263b7d4b5fc842e.zip |
moves Context.ParseError outside the cake
I did this for ReificationError a long time ago. Must've probably forgot
to do the same for ParseError.
-rw-r--r-- | src/compiler/scala/reflect/macros/runtime/Parsers.scala | 5 | ||||
-rw-r--r-- | src/reflect/scala/reflect/macros/Parsers.scala | 14 |
2 files changed, 7 insertions, 12 deletions
diff --git a/src/compiler/scala/reflect/macros/runtime/Parsers.scala b/src/compiler/scala/reflect/macros/runtime/Parsers.scala index 5096526fdb..ab9b94ec9f 100644 --- a/src/compiler/scala/reflect/macros/runtime/Parsers.scala +++ b/src/compiler/scala/reflect/macros/runtime/Parsers.scala @@ -10,6 +10,7 @@ trait Parsers { def parse(code: String): Tree = // todo. provide decent implementation + // see `Typers.typedUseCase` for details try { import scala.reflect.runtime.{universe => ru} val parsed = ru.rootMirror.mkToolBox().parse(code) @@ -17,9 +18,7 @@ trait Parsers { importer.importTree(parsed) } catch { case ToolBoxError(msg, cause) => + // todo. provide a position throw new ParseError(universe.NoPosition, msg) } - - case class ParseError(val pos: Position, val msg: String) extends Throwable(msg) - object ParseError extends ParseErrorExtractor } diff --git a/src/reflect/scala/reflect/macros/Parsers.scala b/src/reflect/scala/reflect/macros/Parsers.scala index 1742d07b60..c2d4d8a3ab 100644 --- a/src/reflect/scala/reflect/macros/Parsers.scala +++ b/src/reflect/scala/reflect/macros/Parsers.scala @@ -5,14 +5,10 @@ trait Parsers { self: Context => /** .. */ - // todo. distinguish between `parse` and `parse` + // todo. distinguish between parsing an expression and parsing arbitrary code + // for example, parsing in expression mode will fail on packages def parse(code: String): Tree +} - /** Represents an error during parsing - */ - type ParseError <: Throwable - val ParseError: ParseErrorExtractor - abstract class ParseErrorExtractor { - def unapply(error: ParseError): Option[(Position, String)] - } -}
\ No newline at end of file +// should be path-dependent, otherwise exception handling becomes a mess +case class ParseError(val pos: scala.reflect.api.Position, val msg: String) extends Throwable(msg) |