From 8a61ff432543a29234193cd1f7c14abd3f3d31a0 Mon Sep 17 00:00:00 2001 From: Felix Mulder Date: Wed, 2 Nov 2016 11:08:28 +0100 Subject: Move compiler and compiler tests to compiler dir --- .../dotty/tools/dotc/repl/ammonite/Protocol.scala | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 compiler/src/dotty/tools/dotc/repl/ammonite/Protocol.scala (limited to 'compiler/src/dotty/tools/dotc/repl/ammonite/Protocol.scala') diff --git a/compiler/src/dotty/tools/dotc/repl/ammonite/Protocol.scala b/compiler/src/dotty/tools/dotc/repl/ammonite/Protocol.scala new file mode 100644 index 000000000..34d31aeca --- /dev/null +++ b/compiler/src/dotty/tools/dotc/repl/ammonite/Protocol.scala @@ -0,0 +1,30 @@ +package dotty.tools +package dotc +package repl +package ammonite.terminal + +case class TermInfo(ts: TermState, width: Int) + +sealed trait TermAction +case class Printing(ts: TermState, stdout: String) extends TermAction +case class TermState( + inputs: LazyList[Int], + buffer: Vector[Char], + cursor: Int, + msg: Ansi.Str = "" +) extends TermAction + +object TermState { + def unapply(ti: TermInfo): Option[(LazyList[Int], Vector[Char], Int, Ansi.Str)] = + TermState.unapply(ti.ts) + + def unapply(ti: TermAction): Option[(LazyList[Int], Vector[Char], Int, Ansi.Str)] = + ti match { + case ts: TermState => TermState.unapply(ts) + case _ => None + } +} + +case class ClearScreen(ts: TermState) extends TermAction +case object Exit extends TermAction +case class Result(s: String) extends TermAction -- cgit v1.2.3