Differences From Artifact [3594122dc7a67c3c]:
- File
main.d
- 2010-11-20 16:35:14 - part of checkin [3464a035ec] on branch trunk - source code cleanup (user: kinaba) [annotate]
To Artifact [636370f08c051cf2]:
- File
main.d
- 2010-11-21 09:53:17 - part of checkin [435fa085ec] on branch trunk - refactored predefined layer names, and filled readme.txt. (user: kinaba) [annotate]
9 import std.algorithm; 9 import std.algorithm;
10 import std.array; 10 import std.array;
11 import polemy.value; 11 import polemy.value;
12 import polemy.failure; 12 import polemy.failure;
13 import polemy.parse; 13 import polemy.parse;
14 import polemy.ast; 14 import polemy.ast;
15 import polemy.eval; 15 import polemy.eval;
> 16 import polemy.layer;
16 17
17 enum VersionNoMajor = 0; 18 enum VersionNoMajor = 0;
18 enum VersionNoMinor = 1; 19 enum VersionNoMinor = 1;
19 enum VersionNoRev = 0; 20 enum VersionNoRev = 0;
20 21
21 /// Read-Eval-Print-Loop 22 /// Read-Eval-Print-Loop
22 23
................................................................................................................................................................................
33 { 34 {
34 writefln("Welcome to Polemy %d.%d.%d", VersionNoMajor, VersionNo 35 writefln("Welcome to Polemy %d.%d.%d", VersionNoMajor, VersionNo
35 } 36 }
36 37
37 /// Run one file on the global scope 38 /// Run one file on the global scope
38 void runFile(string filename) 39 void runFile(string filename)
39 { 40 {
40 eval(parseFile(filename), ctx, false, "@v"); | 41 eval(parseFile(filename), ctx, false, ValueLayer);
41 } 42 }
42 43
43 /// Repeat the singleInteraction 44 /// Repeat the singleInteraction
44 void replLoop() 45 void replLoop()
45 { 46 {
46 while( singleInteraction() ) {} 47 while( singleInteraction() ) {}
47 } 48 }
................................................................................................................................................................................
73 { 74 {
74 scope(failure) 75 scope(failure)
75 { buf = ""; lineno = nextlineno; } 76 { buf = ""; lineno = nextlineno; }
76 77
77 buf ~= s; 78 buf ~= s;
78 nextlineno ++; 79 nextlineno ++;
79 try 80 try
80 { lastVal = eval(parseString(buf, "<REPL>", lineno), ctx | 81 { lastVal = eval(parseString(buf, "<REPL>", lineno), ctx
81 catch( UnexpectedEOF ) 82 catch( UnexpectedEOF )
82 { return false; } // wait 83 { return false; } // wait
83 buf = ""; 84 buf = "";
84 lineno = nextlineno; 85 lineno = nextlineno;
85 return true; 86 return true;
86 } 87 }
87 } 88 }