Diff
Not logged in

Differences From Artifact [981f3ba98be4374d]:

To Artifact [b6f89f38f0a1626d]:


18 { 18 { 19 Table ctx; 19 Table ctx; 20 string buf; 20 string buf; 21 Value lastVal; 21 Value lastVal; 22 int lineno = 1; 22 int lineno = 1; 23 int nextlineno = 1; 23 int nextlineno = 1; 24 this() { ctx = createGlobalContext(); } 24 this() { ctx = createGlobalContext(); } > 25 this(string filename) { > 26 ctx = createGlobalContext(); > 27 eval(parseFile(filename), ctx, false, "@v"); > 28 } 25 29 26 bool tryRun( string s ) 30 bool tryRun( string s ) 27 { 31 { 28 scope(failure) 32 scope(failure) 29 { buf = ""; lineno = nextlineno; } 33 { buf = ""; lineno = nextlineno; } 30 34 31 buf ~= s; 35 buf ~= s; ................................................................................................................................................................................ 52 writeln(e); 56 writeln(e); 53 } 57 } 54 return true; 58 return true; 55 } 59 } 56 } 60 } 57 61 58 /// Entry point. If args.length==1, invoke REPL. 62 /// Entry point. If args.length==1, invoke REPL. > 63 /// If args.length==3 && args[1]=="-l" read args[2] and invoke REPL. 59 /// Otherwise interpret the argument as a filename. 64 /// Otherwise interpret the argument as a filename. 60 void main( string[] args ) 65 void main( string[] args ) 61 { 66 { 62 if( args.length <= 1 ) 67 if( args.length <= 1 ) 63 { 68 { 64 writeln("Welcome to Polemy 0.1.0"); 69 writeln("Welcome to Polemy 0.1.0"); 65 for(auto r = new REPL; r.singleInteraction();) {} 70 for(auto r = new REPL; r.singleInteraction();) {} 66 } 71 } > 72 else if( args.length>=3 && args[1]=="-l" ) > 73 { > 74 writeln("Welcome to Polemy 0.1.0"); > 75 for(auto r = new REPL(args[2]); r.singleInteraction();) {} > 76 } 67 else 77 else 68 { 78 { 69 evalFile(args[1]); 79 evalFile(args[1]); 70 } 80 } 71 } 81 }