comparison src/luan/interp/WhileStmt.java @ 31:5cf15507d77e

separate interpreter from interface git-svn-id: https://luan-java.googlecode.com/svn/trunk@32 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Thu, 13 Dec 2012 02:50:04 +0000
parents d85510d92eee
children 64ecb7a3aad7
comparison
equal deleted inserted replaced
30:8d8f4f5caef4 31:5cf15507d77e
1 package luan.interp; 1 package luan.interp;
2 2
3 import luan.Lua; 3 import luan.Lua;
4 import luan.LuaState;
5 import luan.LuaException; 4 import luan.LuaException;
6 5
7 6
8 final class WhileStmt implements Stmt { 7 final class WhileStmt implements Stmt {
9 private final Expr cnd; 8 private final Expr cnd;
12 WhileStmt(Expr cnd,Stmt doStmt) { 11 WhileStmt(Expr cnd,Stmt doStmt) {
13 this.cnd = cnd; 12 this.cnd = cnd;
14 this.doStmt = doStmt; 13 this.doStmt = doStmt;
15 } 14 }
16 15
17 @Override public void eval(LuaState lua) throws LuaException { 16 @Override public void eval(LuaStateImpl lua) throws LuaException {
18 try { 17 try {
19 while( Lua.toBoolean( cnd.eval(lua) ) ) { 18 while( Lua.toBoolean( cnd.eval(lua) ) ) {
20 doStmt.eval(lua); 19 doStmt.eval(lua);
21 } 20 }
22 } catch(BreakException e) {} 21 } catch(BreakException e) {}