Search in sources :

Example 1 with Definition

use of org.whole.lang.scheme.model.Definition 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)

Example 2 with Definition

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

the class DefinitionPart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    List<IEntity> list = new ArrayList<IEntity>(2);
    Definition entity = getModelEntity();
    list.add(entity.getName());
    list.add(entity.getExpression());
    return list;
}
Also used : IEntity(org.whole.lang.model.IEntity) ArrayList(java.util.ArrayList) Definition(org.whole.lang.scheme.model.Definition)

Aggregations

IEntity (org.whole.lang.model.IEntity)2 Definition (org.whole.lang.scheme.model.Definition)2 ArrayList (java.util.ArrayList)1 Definitions (org.whole.lang.scheme.model.Definitions)1 VisitException (org.whole.lang.visitors.VisitException)1