Skip to content

Commit

Permalink
import ReplDriver from dotty so that we can modify it (later) (#62)
Browse files Browse the repository at this point in the history
This PR only imports (and renames) it, the modifications will come in separately. 
It's split into a few commits to hopefully simplify future rebasing, so we'll not squash this PR.

* import dotty ReplDriver: 1) carbon copy
* import dotty ReplDriver: 2) no need to copy State also
* import dotty ReplDriver: 3) carbon copy of Rendering
* import dotty ReplDriver: 4) rename ReplDriver and Rendering
* import dotty ReplDriver: 5) move ReplDriver and Rendering into our package
  • Loading branch information
mpollmeier authored May 15, 2023
2 parents c5ee15e + 5a2c5af commit eb2bf9a
Show file tree
Hide file tree
Showing 4 changed files with 751 additions and 1 deletion.
30 changes: 30 additions & 0 deletions core/src/main/scala/replpp/DottyRandomStuff.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package replpp

import dotty.tools.dotc.reporting.{HideNonSensicalMessages, StoreReporter, UniqueMessagePositions}
import dotty.tools.repl.*

/** random code that I needed to copy over from dotty to make things work, usually because it was `private[repl]`
*/
private[replpp] object DottyRandomStuff {

/** Create empty outer store reporter
* copied from https://github.com/lampepfl/dotty/blob/3.3.0-RC5/compiler/src/dotty/tools/repl/package.scala#L6 */
def newStoreReporter: StoreReporter = {
new StoreReporter(null) with UniqueMessagePositions with HideNonSensicalMessages
}

/** copied from https://github.com/lampepfl/dotty/blob/3.3.0-RC5/compiler/src/dotty/tools/repl/ParseResult.scala#L130 */
object ParseResult {
val commands: List[(String, String => ParseResult)] = List(
Quit.command -> (_ => Quit),
Quit.alias -> (_ => Quit),
Help.command -> (_ => Help),
Reset.command -> (arg => Reset(arg)),
Imports.command -> (_ => Imports),
Load.command -> (arg => Load(arg)),
TypeOf.command -> (arg => TypeOf(arg)),
DocOf.command -> (arg => DocOf(arg)),
Settings.command -> (arg => Settings(arg)),
)
}
}
Loading

0 comments on commit eb2bf9a

Please sign in to comment.