Mercurial Hosting > luan
comparison src/luan/impl/WhileStmt.java @ 166:4eaee12f6c65
move luan/interp to impl
git-svn-id: https://luan-java.googlecode.com/svn/trunk@167 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Sun, 22 Jun 2014 04:17:38 +0000 |
parents | src/luan/interp/WhileStmt.java@c9100f29fae0 |
children |
comparison
equal
deleted
inserted
replaced
165:94bbc4cbc106 | 166:4eaee12f6c65 |
---|---|
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 } |