Diff
Not logged in

Differences From Artifact [14a3f0cd527958ce]:

To Artifact [81cf3e2a44d63239]:


31 buf = ""; 31 buf = ""; 32 lineno = nextlineno; 32 lineno = nextlineno; 33 lastVal = eval(a, ctx); 33 lastVal = eval(a, ctx); 34 } catch( LexException ) { 34 } catch( LexException ) { 35 // always EOF exception, so wait next 35 // always EOF exception, so wait next 36 return false; 36 return false; 37 } catch( ParseException e ) { 37 } catch( ParseException e ) { 38 if( find(e.msg, "EOF") ) // ultra ad-hoc | 38 if( find(e.msg, "EOF")!="" ) // ultra ad-hoc 39 return false; 39 return false; > 40 buf = ""; > 41 lineno = nextlineno; 40 throw e; 42 throw e; 41 } 43 } 42 return true; 44 return true; 43 } 45 } 44 46 45 bool singleInteraction() 47 bool singleInteraction() 46 { 48 { ................................................................................................................................................................................ 53 writeln(lastVal); 55 writeln(lastVal); 54 } catch(Throwable e) { 56 } catch(Throwable e) { 55 writeln(e); 57 writeln(e); 56 } 58 } 57 return true; 59 return true; 58 } 60 } 59 } 61 } > 62 > 63 version(unittest) { > 64 bool success = false; > 65 static ~this(){ if(!success){writeln("(press enter to exit)"); readln(); > 66 } 60 67 61 void main( string[] args ) 68 void main( string[] args ) 62 { 69 { > 70 version(unittest) success=true; > 71 63 if( args.length <= 1 ) 72 if( args.length <= 1 ) 64 { 73 { 65 writeln("Welcome to Polemy 0.1.0"); 74 writeln("Welcome to Polemy 0.1.0"); 66 for(auto r = new REPL; r.singleInteraction();) {} 75 for(auto r = new REPL; r.singleInteraction();) {} 67 } 76 } 68 else 77 else 69 { 78 { 70 evalFile(args[1]); 79 evalFile(args[1]); 71 } 80 } 72 } 81 }