Search in sources :

Example 1 with Sdf2ParenthesizeStamper

use of org.metaborg.spoofax.meta.core.pluto.stamp.Sdf2ParenthesizeStamper in project spoofax by metaborg.

the class Sdf2ParenthesizeLegacy method build.

@Override
public None build(Input input) throws IOException {
    requireBuild(input.origin);
    if (SpoofaxContext.BETTER_STAMPERS) {
        require(input.inputFile, new Sdf2ParenthesizeStamper(input.context));
    } else {
        require(input.inputFile);
    }
    // @formatter:off
    final Arguments arguments = new Arguments().addFile("-i", input.inputFile).add("-m", input.inputModule).add("--lang", input.inputModule).add("--omod", input.outputModule).addFile("-o", input.outputFile).add("--main-strategy", "io-" + input.inputModule + "-parenthesize").add("--rule-prefix", input.inputModule).add("--sig-module", "signatures/-");
    final ExecutionResult result = new StrategoExecutor().withToolsContext().withStrategy(main_sdf2parenthesize_0_0.instance).withTracker(newResourceTracker(Pattern.quote("[ sdf2parenthesize | info ]") + ".*", Pattern.quote("Invoking native tool") + ".*")).withName("sdf2parenthesize").executeCLI(arguments);
    if (!result.success) {
        FileCommands.writeToFile(input.outputFile, "module " + input.inputModule + "\nrules\n\n  parenthesize-" + input.inputModule + " = id");
    }
    // @formatter:on
    provide(input.outputFile);
    return None.val;
}
Also used : Sdf2ParenthesizeStamper(org.metaborg.spoofax.meta.core.pluto.stamp.Sdf2ParenthesizeStamper) Arguments(org.metaborg.util.cmd.Arguments) ExecutionResult(org.metaborg.spoofax.meta.core.pluto.util.StrategoExecutor.ExecutionResult) StrategoExecutor(org.metaborg.spoofax.meta.core.pluto.util.StrategoExecutor)

Aggregations

Sdf2ParenthesizeStamper (org.metaborg.spoofax.meta.core.pluto.stamp.Sdf2ParenthesizeStamper)1 StrategoExecutor (org.metaborg.spoofax.meta.core.pluto.util.StrategoExecutor)1 ExecutionResult (org.metaborg.spoofax.meta.core.pluto.util.StrategoExecutor.ExecutionResult)1 Arguments (org.metaborg.util.cmd.Arguments)1