Diff
Not logged in

Differences From Artifact [81cf3e2a44d63239]:

To Artifact [b29be17d733aa309]:


20 20 Value lastVal; 21 21 int lineno = 1; 22 22 int nextlineno = 1; 23 23 this() { ctx = createGlobalContext(); } 24 24 25 25 bool tryRun( string s ) 26 26 { 27 - nextlineno ++; 27 + scope(failure) 28 + { buf = ""; lineno = nextlineno; } 29 + 28 30 buf ~= s; 29 - try { 30 - AST a = parseString(buf, "<REPL>", lineno); 31 - buf = ""; 32 - lineno = nextlineno; 33 - lastVal = eval(a, ctx); 34 - } catch( LexException ) { 35 - // always EOF exception, so wait next 36 - return false; 37 - } catch( ParseException e ) { 38 - if( find(e.msg, "EOF")!="" ) // ultra ad-hoc 39 - return false; 40 - buf = ""; 41 - lineno = nextlineno; 42 - throw e; 43 - } 31 + nextlineno ++; 32 + try 33 + { lastVal = eval(parseString(buf, "<REPL>", lineno), ctx); } 34 + catch( UnexpectedEOF ) 35 + { return false; } // wait 36 + buf = ""; 37 + lineno = nextlineno; 44 38 return true; 45 39 } 46 40 47 41 bool singleInteraction() 48 42 { 49 43 writef(">> ", lineno); 50 44 string line = readln();