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 import polemy.layer; 9 import polemy.layer;
10 import polemy.eval; 10 import polemy.eval;
11 import polemy.runtime; 11 import polemy.runtime;
12 import polemy.value; 12 import polemy.value;
13 import polemy.valueconv; 13 import polemy.valueconv;
14 import std.stdio; 14 import std.stdio;
15 import std.string; 15 import std.string;
> 16 import std.cstream;
16 17
17 enum VersionNoMajor = 0; /// Version Number 18 enum VersionNoMajor = 0; /// Version Number
18 enum VersionNoMinor = 1; /// Version Number 19 enum VersionNoMinor = 1; /// Version Number
19 enum VersionNoRev = 0; /// Version Number 20 enum VersionNoRev = 0; /// Version Number
20 21
21 /// Read-Eval-Print-Loop 22 /// Read-Eval-Print-Loop
22 23
................................................................................................................................................................................
49 } 50 }
50 51
51 /// Read one line from stdin, and do some reaction 52 /// Read one line from stdin, and do some reaction
52 bool singleInteraction() 53 bool singleInteraction()
53 { 54 {
54 writef(">> ", lineno); 55 writef(">> ", lineno);
55 string line = readln(); 56 string line = readln();
56 if( line.startsWith("exit") || line.startsWith("quit") ) | 57 if( line.startsWith("exit") || line.startsWith("quit") || din.eo
57 return false; 58 return false;
58 try { 59 try {
59 if( tryRun(line) ) 60 if( tryRun(line) )
60 writeln(lastVal); 61 writeln(lastVal);
61 } catch(Throwable e) { 62 } catch(Throwable e) {
62 writeln(e); 63 writeln(e);
63 } 64 }