Mercurial Hosting > luan
view core/src/luan/impl/WhileStmt.java @ 652:067d9470184d
compile SetStmt and ForStmt
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 04 Apr 2016 23:26:06 -0600 |
parents | 8e8c30b72e9b |
children |
line wrap: on
line source
package luan.impl; import luan.Luan; import luan.LuanException; final class WhileStmt extends CodeImpl implements Stmt { private final Expr cnd; private final Stmt doStmt; WhileStmt(Expr cnd,Stmt doStmt) { this.cnd = cnd; this.doStmt = doStmt; } @Override public void eval(LuanStateImpl luan) throws LuanException { try { while( Luan.checkBoolean( cnd.eval(luan) ) ) { doStmt.eval(luan); } } catch(BreakException e) {} } }