Mercurial Hosting > luan
comparison src/luan/interp/WhileStmt.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 |
comparison
equal
deleted
inserted
replaced
13:3b22ffbdb83a | 14:2ddf85634d20 |
---|---|
1 package luan.interp; | |
2 | |
3 import luan.Lua; | |
4 import luan.LuaState; | |
5 import luan.LuaException; | |
6 | |
7 | |
8 final class WhileStmt implements Stmt { | |
9 private final Expr cnd; | |
10 private final Stmt doStmt; | |
11 | |
12 WhileStmt(Expr cnd,Stmt doStmt) { | |
13 this.cnd = cnd; | |
14 this.doStmt = doStmt; | |
15 } | |
16 | |
17 @Override public void eval(LuaState lua) throws LuaException { | |
18 while( Lua.toBoolean( cnd.eval(lua) ) ) { | |
19 doStmt.eval(lua); | |
20 } | |
21 } | |
22 } |