Mercurial Hosting > luan
comparison core/src/luan/impl/WhileStmt.java @ 171:3dcb0f9bee82
add core component
git-svn-id: https://luan-java.googlecode.com/svn/trunk@172 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Sun, 22 Jun 2014 05:41:22 +0000 |
parents | src/luan/impl/WhileStmt.java@4eaee12f6c65 |
children | b48cfa14ba60 |
comparison
equal
deleted
inserted
replaced
170:7c792a328a83 | 171:3dcb0f9bee82 |
---|---|
1 package luan.impl; | |
2 | |
3 import luan.Luan; | |
4 import luan.LuanException; | |
5 import luan.LuanSource; | |
6 | |
7 | |
8 final class WhileStmt extends CodeImpl implements Stmt { | |
9 private final Expr cnd; | |
10 private final Stmt doStmt; | |
11 | |
12 WhileStmt(LuanSource.Element se,Expr cnd,Stmt doStmt) { | |
13 super(se); | |
14 this.cnd = cnd; | |
15 this.doStmt = doStmt; | |
16 } | |
17 | |
18 @Override public void eval(LuanStateImpl luan) throws LuanException { | |
19 try { | |
20 while( luan.bit(se).checkBoolean( cnd.eval(luan) ) ) { | |
21 doStmt.eval(luan); | |
22 } | |
23 } catch(BreakException e) {} | |
24 } | |
25 } |