view core/src/luan/impl/RepeatStmt.java @ 576:4723d22062ce

remove LuanBit
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 13 Jul 2015 20:38:26 -0600
parents b48cfa14ba60
children 859c0dedc8b6
line wrap: on
line source

package luan.impl;

import luan.Luan;
import luan.LuanException;
import luan.LuanElement;


final class RepeatStmt extends CodeImpl implements Stmt {
	private final Stmt doStmt;
	private final Expr cnd;

	RepeatStmt(LuanElement el,Stmt doStmt,Expr cnd) {
		super(el);
		this.doStmt = doStmt;
		this.cnd = cnd;
	}

	@Override public void eval(LuanStateImpl luan) throws LuanException {
		try {
			do {
				doStmt.eval(luan);
			} while( !luan.checkBoolean( cnd.eval(luan), el ) );
		} catch(BreakException e) {}
	}
}