use of org.whole.lang.visitors.IVisitor in project whole by wholeplatform.
the class Matcher method find.
@SuppressWarnings("unchecked")
public static <E extends IEntity> E find(E pattern, IEntity model, IBindingManager bindings, boolean includeAdjacents) {
GenericMatcherFactory mf = GenericMatcherFactory.instance;
IVisitor mv = mf.matchInScope(pattern);
mv.setBindings(bindings);
return (E) find(mv, model, includeAdjacents);
}
use of org.whole.lang.visitors.IVisitor in project whole by wholeplatform.
the class GrammarsUIDeployer method deploy.
public void deploy(ReflectionFactory platform) {
platform.addEditorKit(GrammarsEditorKit.ID);
platform.addEditorKit(GrammarsParserEditorKit.ID);
platform.addEditorKit(GrammarsUnparserEditorKit.ID);
platform.addOperationFactory(GrammarsLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
if (stage == 0)
return new GrammarsUIInterpreterVisitor();
else
return null;
}
});
}
use of org.whole.lang.visitors.IVisitor in project whole by wholeplatform.
the class ArtifactsLanguageDeployer method deploy.
public void deploy(ReflectionFactory platform) {
platform.addLanguageKit(new ArtifactsLanguageKit());
platform.addOperationFactory(ArtifactsLanguageKit.URI, GenericBuilderAdapterOperation.ID, new IBuilderFactory() {
public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
return new ArtifactsGenericBuilderAdapter((IArtifactsBuilder) strategy, entityContext);
}
});
platform.addOperationFactory(ArtifactsLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {
public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
return new ArtifactsSpecificBuilderAdapter(strategy, entityContext);
}
});
platform.addOperationFactory(ArtifactsLanguageKit.URI, ArtifactsGeneratorOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
return new ResourceArtifactsGeneratorVisitor();
}
});
platform.addOperationFactory(ArtifactsLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
if (stage == 0)
return new ArtifactsInterpreterVisitor();
else
return null;
}
});
}
use of org.whole.lang.visitors.IVisitor in project whole by wholeplatform.
the class EnvironmentLanguageDeployer method deploy.
public void deploy(ReflectionFactory platform) {
platform.addLanguageKit(new EnvironmentLanguageKit());
platform.addOperationFactory(EnvironmentLanguageKit.URI, GenericBuilderAdapterOperation.ID, new IBuilderFactory() {
public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
return new EnvironmentGenericBuilderAdapter((IEnvironmentBuilder) strategy, entityContext);
}
});
platform.addOperationFactory(EnvironmentLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {
public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
return new EnvironmentSpecificBuilderAdapter(strategy, entityContext);
}
});
platform.addOperationFactory(EnvironmentLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
return stage == 0 ? new EnvironmentInterpreterVisitor() : null;
}
});
platform.addOperationFactory(EnvironmentLanguageKit.URI, ArtifactsGeneratorOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
return stage == 0 ? new EnvironmentInterpreterVisitor() : null;
}
});
platform.addOperationFactory(EnvironmentLanguageKit.URI, PrettyPrinterOperation.ID, new IVisitorFactory() {
public IVisitor create(IOperation operation, int stage) {
return new EnvironmentPrettyPrinterVisitor((PrettyPrinterOperation) operation);
}
});
}
use of org.whole.lang.visitors.IVisitor in project whole by wholeplatform.
the class AbstractOperation method getVisitor.
public IVisitor getVisitor(IEntity entity, int absoluteStage) {
int normalizedStage = absoluteStage <= 0 ? 0 : 1;
String uri = ReflectionFactory.getLanguageKit(entity).getURI();
IVisitor[] stagedVisitors = stagedVisitorsMap.get(uri);
if (stagedVisitors == null)
stagedVisitorsMap.put(uri, stagedVisitors = new IVisitor[2]);
IVisitor visitor = stagedVisitors[normalizedStage];
if (visitor == null) {
visitor = stagedVisitors[normalizedStage] = initVisitor(entity, normalizedStage);
visitor.setOperation(this);
}
return visitor;
}
Aggregations