Search in sources :

Example 1 with Definitions

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

the class SchemeInterpreterVisitor method visit.

public void visit(LocalExpression entity) {
    getBindings().wEnterScope();
    Definitions defs = entity.getDefinitions();
    if (!defs.wGetEntityDescriptor().equals(SchemeEntityDescriptorEnum.Definitions))
        throw new VisitException("expected a " + SchemeEntityDescriptorEnum.Definitions);
    for (int i = 0; i < defs.wSize(); i++) {
        IEntity e = defs.wGet(i);
        if (e.wGetEntityDescriptor().equals(SchemeEntityDescriptorEnum.Definition)) {
            Definition def = ((Definition) e);
            getBindings().wDef(def.getName().wStringValue(), def.getExpression());
        }
    }
    entity.getBody().accept(this);
    getBindings().wExitScope();
}
Also used : IEntity(org.whole.lang.model.IEntity) Definitions(org.whole.lang.scheme.model.Definitions) VisitException(org.whole.lang.visitors.VisitException) Definition(org.whole.lang.scheme.model.Definition)

Aggregations

IEntity (org.whole.lang.model.IEntity)1 Definition (org.whole.lang.scheme.model.Definition)1 Definitions (org.whole.lang.scheme.model.Definitions)1 VisitException (org.whole.lang.visitors.VisitException)1