package rapanui.dsl;

import org.eclipse.emf.ecore.util.EcoreUtil;

import rapanui.dsl.moai.Formula;
import rapanui.dsl.moai.Term;

public class DslHelper {
	public static boolean equal(Term left, Term right) {
		return EcoreUtil.equals(left, right);
	}
	public static boolean equal(Formula left, Formula right) {
		return EcoreUtil.equals(left, right);
	}
}

@@ -59,16 +59,112 @@
 oreUtil;
+%0Aimport org.eclipse.xtext.resource.SaveOptions;%0Aimport org.eclipse.xtext.serializer.ISerializer;
 %0A%0Aimport
@@ -343,16 +343,17 @@
 ht);%0A%09%7D%0A
+%0A
 %09public 
@@ -396,32 +396,32 @@
 ormula right) %7B%0A
-
 %09%09return EcoreUt
@@ -446,11 +446,576 @@
 ght);%0A%09%7D
+%0A%0A%09public static String serialize(Formula formula) %7B%0A%09%09return new MoaiStandaloneSetup()%0A%09%09.createInjectorAndDoEMFRegistration()%0A%09%09.getInstance(ISerializer.class)%0A%09%09.serialize(formula)%0A%09%09.replaceAll(%22%5C%5Cs+%22, %22 %22); // remove extraneous whitespace // TODO: do this properly in a formatter%0A%09%7D%0A%0A%09public static String serialize(Term term) %7B%0A%09%09return new MoaiStandaloneSetup()%0A%09%09.createInjectorAndDoEMFRegistration()%0A%09%09.getInstance(ISerializer.class)%0A%09%09.serialize(term)%0A%09%09.replaceAll(%22%5C%5Cs+%22, %22 %22); // remove extraneous whitespace // TODO: do this properly in a formatter%0A%09%7D
 %0A%7D%0A

add DslHelper.serialize(Formula|Term) methods