use of org.eclipse.xtext.resource.SaveOptions in project xtext-core by eclipse.
the class GrammarAccessExtensions method grammarFragmentToString.
/**
* @noreference
*/
public static String grammarFragmentToString(final ISerializer serializer, final EObject object, final String prefix) {
String s = null;
try {
final SaveOptions options = SaveOptions.newBuilder().format().getOptions();
s = serializer.serialize(object, options);
} catch (final Throwable _t) {
if (_t instanceof Exception) {
final Exception e = (Exception) _t;
s = e.toString();
} else {
throw Exceptions.sneakyThrow(_t);
}
}
String _replace = s.trim().replaceAll("(\\r?\\n)", ("$1" + prefix)).replace("\\u", "\\\\u");
String _plus = (prefix + _replace);
s = _plus;
return s;
}
use of org.eclipse.xtext.resource.SaveOptions in project xtext-core by eclipse.
the class XtextFormatterTest method _testXtextXtext.
public void _testXtextXtext() {
Serializer serializer = get(Serializer.class);
IGrammarAccess grammar = get(IGrammarAccess.class);
SaveOptions opt = SaveOptions.newBuilder().format().getOptions();
System.out.println(serializer.serialize(grammar.getGrammar(), opt));
}
Aggregations