Differences From Artifact [4d8d31e11afa4a19]:
- File
polemy/repl.d
- 2010-11-23 10:09:03 - part of checkin [36c517dfc4] on branch trunk - refactored d-value and polemy-value conversion (user: kinaba) [annotate]
To Artifact [b98f6cda3b1606b7]:
- File
polemy/repl.d
- 2010-12-04 15:15:28 - part of checkin [fc0b463347] on branch trunk - Made the repl terminate by EOF (thanks yhamigaki!) (user: kinaba) [annotate]
9 9 import polemy.layer;
10 10 import polemy.eval;
11 11 import polemy.runtime;
12 12 import polemy.value;
13 13 import polemy.valueconv;
14 14 import std.stdio;
15 15 import std.string;
16 +import std.cstream;
16 17
17 18 enum VersionNoMajor = 0; /// Version Number
18 19 enum VersionNoMinor = 1; /// Version Number
19 20 enum VersionNoRev = 0; /// Version Number
20 21
21 22 /// Read-Eval-Print-Loop
22 23
................................................................................
49 50 }
50 51
51 52 /// Read one line from stdin, and do some reaction
52 53 bool singleInteraction()
53 54 {
54 55 writef(">> ", lineno);
55 56 string line = readln();
56 - if( line.startsWith("exit") || line.startsWith("quit") )
57 + if( line.startsWith("exit") || line.startsWith("quit") || din.eof() )
57 58 return false;
58 59 try {
59 60 if( tryRun(line) )
60 61 writeln(lastVal);
61 62 } catch(Throwable e) {
62 63 writeln(e);
63 64 }