Search in sources :

Example 1 with ISpoofaxTransformUnit

use of org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit in project spoofax by metaborg.

the class StrategoTransformer method transformAllParsed.

@Override
public Collection<ISpoofaxTransformUnit<ISpoofaxParseUnit>> transformAllParsed(Iterable<ISpoofaxParseUnit> inputs, IContext context, TransformActionContrib action, ITransformConfig config) throws TransformException {
    final int size = Iterables.size(inputs);
    final Collection<ISpoofaxTransformUnit<ISpoofaxParseUnit>> transformUnits = Lists.newArrayListWithCapacity(size);
    for (ISpoofaxParseUnit input : inputs) {
        transformUnits.add(transform(input, context, action, input.source(), input.ast(), config));
    }
    return transformUnits;
}
Also used : ISpoofaxParseUnit(org.metaborg.spoofax.core.unit.ISpoofaxParseUnit) ISpoofaxTransformUnit(org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit)

Example 2 with ISpoofaxTransformUnit

use of org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit in project spoofax by metaborg.

the class StrategoTransformer method transformAllAnalyzed.

@Override
public Collection<ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit>> transformAllAnalyzed(Iterable<ISpoofaxAnalyzeUnit> inputs, IContext context, TransformActionContrib action, ITransformConfig config) throws TransformException {
    final int size = Iterables.size(inputs);
    final Collection<ISpoofaxTransformUnit<ISpoofaxAnalyzeUnit>> transformUnits = Lists.newArrayListWithCapacity(size);
    for (ISpoofaxAnalyzeUnit input : inputs) {
        if (!input.valid()) {
            throw new TransformException("Cannot transform analyze unit " + input + ", it is not valid");
        }
        if (!input.hasAst()) {
            throw new TransformException("Cannot transform analyze unit " + input + ", it has no AST");
        }
        transformUnits.add(transform(input, context, action, input.source(), input.ast(), config));
    }
    return transformUnits;
}
Also used : ISpoofaxTransformUnit(org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit) TransformException(org.metaborg.core.transform.TransformException) ISpoofaxAnalyzeUnit(org.metaborg.spoofax.core.unit.ISpoofaxAnalyzeUnit)

Aggregations

ISpoofaxTransformUnit (org.metaborg.spoofax.core.unit.ISpoofaxTransformUnit)2 TransformException (org.metaborg.core.transform.TransformException)1 ISpoofaxAnalyzeUnit (org.metaborg.spoofax.core.unit.ISpoofaxAnalyzeUnit)1 ISpoofaxParseUnit (org.metaborg.spoofax.core.unit.ISpoofaxParseUnit)1