Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 44 lines (38 sloc) 1.055 kB
51ff43f @lexspoon Support jline in the interactive shell.
lexspoon authored
1 /* NSC -- new Scala compiler
2d11a5b Updated copyright notices to 2011
Antonio Cunei authored
2 * Copyright 2005-2011 LAMP/EPFL
51ff43f @lexspoon Support jline in the interactive shell.
lexspoon authored
3 * @author Stepan Koltsov
4 */
5
40707e0 @odersky switch to unnested packages.
odersky authored
6 package scala.tools.nsc
7 package interpreter
51ff43f @lexspoon Support jline in the interactive shell.
lexspoon authored
8
33d4562 @paulp Misc accumulated repl work.
paulp authored
9 import java.io.{ BufferedReader }
f61020b @paulp My repl history hasn't been working right for a...
paulp authored
10 import session.NoHistory
51ff43f @lexspoon Support jline in the interactive shell.
lexspoon authored
11
12 /** Reads using standard JDK API */
13 class SimpleReader(
14 in: BufferedReader,
33d4562 @paulp Misc accumulated repl work.
paulp authored
15 out: JPrintWriter,
51ff43f @lexspoon Support jline in the interactive shell.
lexspoon authored
16 val interactive: Boolean)
f89016a @paulp Bringing lots more encapsulation to the repl.
paulp authored
17 extends InteractiveReader
18 {
19 val history = NoHistory
20 val completion = NoCompletion
3ef8ef6 @paulp Added a :keybindings command to the repl which ...
paulp authored
21 val keyBindings: List[KeyBinding] = Nil
ad3910e @paulp More repl housecleaning.
paulp authored
22
23 def init() = ()
24 def reset() = ()
e9f1ccb @paulp This addresses a few long standing irritations ...
paulp authored
25 def eraseLine() = ()
f89016a @paulp Bringing lots more encapsulation to the repl.
paulp authored
26 def redrawLine() = ()
27 def currentLine = ""
40f8fa9 removed deprecated warning, updated svn props, ...
michelou authored
28 def readOneLine(prompt: String): String = {
51ff43f @lexspoon Support jline in the interactive shell.
lexspoon authored
29 if (interactive) {
30 out.print(prompt)
31 out.flush()
32 }
33 in.readLine()
34 }
e9f1ccb @paulp This addresses a few long standing irritations ...
paulp authored
35 def readOneKey(prompt: String) = sys.error("No char-based input in SimpleReader")
51ff43f @lexspoon Support jline in the interactive shell.
lexspoon authored
36 }
f89016a @paulp Bringing lots more encapsulation to the repl.
paulp authored
37
38 object SimpleReader {
39 def defaultIn = Console.in
33d4562 @paulp Misc accumulated repl work.
paulp authored
40 def defaultOut = new JPrintWriter(Console.out)
f89016a @paulp Bringing lots more encapsulation to the repl.
paulp authored
41
33d4562 @paulp Misc accumulated repl work.
paulp authored
42 def apply(in: BufferedReader = defaultIn, out: JPrintWriter = defaultOut, interactive: Boolean = true): SimpleReader =
f89016a @paulp Bringing lots more encapsulation to the repl.
paulp authored
43 new SimpleReader(in, out, interactive)
44 }
Something went wrong with that request. Please try again.