Mercurial Hosting > luan
diff src/luan/interp/RepeatStmt.java @ 14:2ddf85634d20
whitespace handling;
comments;
if/while/repeat statements;
git-svn-id: https://luan-java.googlecode.com/svn/trunk@15 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Mon, 26 Nov 2012 10:18:46 +0000 |
parents | |
children | d85510d92eee |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/luan/interp/RepeatStmt.java Mon Nov 26 10:18:46 2012 +0000 @@ -0,0 +1,22 @@ +package luan.interp; + +import luan.Lua; +import luan.LuaState; +import luan.LuaException; + + +final class RepeatStmt implements Stmt { + private final Stmt doStmt; + private final Expr cnd; + + RepeatStmt(Stmt doStmt,Expr cnd) { + this.doStmt = doStmt; + this.cnd = cnd; + } + + @Override public void eval(LuaState lua) throws LuaException { + do { + doStmt.eval(lua); + } while( !Lua.toBoolean( cnd.eval(lua) ) ); + } +}