Search in sources :

Example 1 with Branches

use of org.whole.lang.scheme.model.Branches in project whole by wholeplatform.

the class SchemeInterpreterVisitor method visit.

public void visit(CondExpression entity) {
    boolean prune = false;
    Branches branches = (Branches) entity.getBranches();
    if (!branches.wGetEntityDescriptor().equals(SchemeEntityDescriptorEnum.Branches))
        throw new VisitException("expected a " + SchemeEntityDescriptorEnum.Branches);
    for (int i = 0; i < branches.wSize() && !prune; i++) {
        Branch branch = (Branch) entity.wGet(i);
        if (booleanValue(branch.getTest())) {
            branch.getBody().accept(this);
            return;
        }
    }
    entity.getElseBody().accept(this);
}
Also used : Branches(org.whole.lang.scheme.model.Branches) Branch(org.whole.lang.scheme.model.Branch) VisitException(org.whole.lang.visitors.VisitException)

Aggregations

Branch (org.whole.lang.scheme.model.Branch)1 Branches (org.whole.lang.scheme.model.Branches)1 VisitException (org.whole.lang.visitors.VisitException)1