package org.sugarj.driver.transformations.primitive; import org.spoofax.interpreter.core.IContext; import org.spoofax.interpreter.core.InterpreterException; import org.spoofax.interpreter.library.AbstractPrimitive; import org.spoofax.interpreter.stratego.Strategy; import org.spoofax.interpreter.terms.IStrategoTerm; import org.sugarj.common.ATermCommands; /** * Primitive for looking up and loading a model according to the current environment. * If successful, this primitive returns the loaded model as a term. * * @author seba */ class ATermToString extends AbstractPrimitive { public ATermToString() { super("SUGARJ_aterm_to_string", 0, 0); } @Override public boolean call(IContext context, Strategy[] svars, IStrategoTerm[] tvars) throws InterpreterException { IStrategoTerm term = context.current(); String s = term.toString(); context.setCurrent(ATermCommands.makeString(s)); return true; } }