Mercurial Hosting > luan
comparison src/luan/interp/RepeatStmt.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 RepeatStmt implements Stmt { | 7 final class RepeatStmt implements Stmt { |
9 private final Stmt doStmt; | 8 private final Stmt doStmt; |
12 RepeatStmt(Stmt doStmt,Expr cnd) { | 11 RepeatStmt(Stmt doStmt,Expr cnd) { |
13 this.doStmt = doStmt; | 12 this.doStmt = doStmt; |
14 this.cnd = cnd; | 13 this.cnd = cnd; |
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 do { | 18 do { |
20 doStmt.eval(lua); | 19 doStmt.eval(lua); |
21 } while( !Lua.toBoolean( cnd.eval(lua) ) ); | 20 } while( !Lua.toBoolean( cnd.eval(lua) ) ); |
22 } catch(BreakException e) {} | 21 } catch(BreakException e) {} |