use of org.metaborg.core.action.TransformActionContrib in project spoofax by metaborg.
the class ActionService method actionContributions.
@Override
public Collection<TransformActionContrib> actionContributions(ILanguageImpl language, ITransformGoal goal) {
final Iterable<FacetContribution<ActionFacet>> facetsContributions = language.facetContributions(ActionFacet.class);
final Collection<TransformActionContrib> actionContributions = Lists.newLinkedList();
for (FacetContribution<ActionFacet> facetContribution : facetsContributions) {
final ActionFacet facet = facetContribution.facet;
final ILanguageComponent component = facetContribution.contributor;
for (ITransformAction action : facet.actions(goal)) {
actionContributions.add(new TransformActionContrib(action, component));
}
}
return actionContributions;
}
use of org.metaborg.core.action.TransformActionContrib in project spoofax by metaborg.
the class TransformService method transformAllAnalyzed.
@Override
public Collection<TA> transformAllAnalyzed(Iterable<A> inputs, IContext context, ITransformGoal goal, ITransformConfig config) throws TransformException {
final Iterable<TransformActionContrib> actions = actionService.actionContributions(context.language(), goal);
final Collection<TA> results = Lists.newArrayList();
for (TransformActionContrib action : actions) {
final Collection<TA> result = transformer.transformAllAnalyzed(inputs, context, action, config);
results.addAll(result);
}
return results;
}
use of org.metaborg.core.action.TransformActionContrib in project spoofax by metaborg.
the class TransformService method transformAllParsed.
@Override
public Collection<TP> transformAllParsed(Iterable<P> inputs, IContext context, ITransformGoal goal, ITransformConfig config) throws TransformException {
final Iterable<TransformActionContrib> actions = actionService.actionContributions(context.language(), goal);
final Collection<TP> results = Lists.newArrayList();
for (TransformActionContrib action : actions) {
if (analysisService.available(context.language()))
checkAnalyzed(action);
final Collection<TP> result = transformer.transformAllParsed(inputs, context, action, config);
results.addAll(result);
}
return results;
}
use of org.metaborg.core.action.TransformActionContrib in project spoofax by metaborg.
the class TransformService method transform.
@Override
public Collection<TA> transform(A input, IContext context, ITransformGoal goal, ITransformConfig config) throws TransformException {
if (!input.valid()) {
throw new TransformException("Cannot transform analyze unit " + input + ", it is not valid");
}
final Iterable<TransformActionContrib> actions = actionService.actionContributions(context.language(), goal);
final Collection<TA> results = Lists.newArrayList();
for (TransformActionContrib action : actions) {
final TA result = transformer.transform(input, context, action, config);
results.add(result);
}
return results;
}
use of org.metaborg.core.action.TransformActionContrib in project spoofax by metaborg.
the class TransformService method transform.
@Override
public Collection<TP> transform(P input, IContext context, ITransformGoal goal, ITransformConfig config) throws TransformException {
if (!input.valid()) {
throw new TransformException("Cannot transform parse unit " + input + ", it is not valid");
}
final Iterable<TransformActionContrib> actions = actionService.actionContributions(context.language(), goal);
final Collection<TP> results = Lists.newArrayList();
for (TransformActionContrib action : actions) {
if (analysisService.available(context.language()))
checkAnalyzed(action);
final TP result = transformer.transform(input, context, action, config);
results.add(result);
}
return results;
}
Aggregations