Search in sources :

Example 1 with TransformActionContrib

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;
}
Also used : TransformActionContrib(org.metaborg.core.action.TransformActionContrib) FacetContribution(org.metaborg.core.language.FacetContribution) ITransformAction(org.metaborg.core.action.ITransformAction) ILanguageComponent(org.metaborg.core.language.ILanguageComponent)

Example 2 with TransformActionContrib

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;
}
Also used : TransformActionContrib(org.metaborg.core.action.TransformActionContrib)

Example 3 with TransformActionContrib

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;
}
Also used : TransformActionContrib(org.metaborg.core.action.TransformActionContrib)

Example 4 with TransformActionContrib

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;
}
Also used : TransformActionContrib(org.metaborg.core.action.TransformActionContrib)

Example 5 with TransformActionContrib

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;
}
Also used : TransformActionContrib(org.metaborg.core.action.TransformActionContrib)

Aggregations

TransformActionContrib (org.metaborg.core.action.TransformActionContrib)5 ITransformAction (org.metaborg.core.action.ITransformAction)1 FacetContribution (org.metaborg.core.language.FacetContribution)1 ILanguageComponent (org.metaborg.core.language.ILanguageComponent)1