use of org.eclipse.xtext.generator.trace.node.CompositeGeneratorNode in project xtext-core by eclipse.
the class TracingSugarTest method _generateTypeWithDebugging.
@Traced(useForDebugging = true)
public IGeneratorNode _generateTypeWithDebugging(final Type it) {
ILocationData _location = this._myExtensions.location(it);
CompositeGeneratorNode _traceNode = this._myExtensions.trace(_location, true);
this._myExtensions.appendTemplate(_traceNode, __generateTypeWithDebugging(it));
return _traceNode;
}
use of org.eclipse.xtext.generator.trace.node.CompositeGeneratorNode in project xtext-core by eclipse.
the class TracingSugar method generateTracedFile.
/**
* Convenience extension, to generate traced code.
*/
public void generateTracedFile(final IFileSystemAccess2 fsa, final String path, final EObject rootTrace, final StringConcatenationClient code) {
final CompositeGeneratorNode node = this.trace(rootTrace, code);
this.generateTracedFile(fsa, path, node);
}
use of org.eclipse.xtext.generator.trace.node.CompositeGeneratorNode in project xtext-core by eclipse.
the class GeneratorNodeTest method testEmptyIndent.
@Test
public void testEmptyIndent() {
final LocationData root = this.loc(0);
CompositeGeneratorNode node = this.exts.appendNewLine(this.exts.append(this.exts.trace(root), "Hallo"));
this.exts.indent(node);
this.exts.appendNewLine(this.exts.append(node, "noindent"));
IndentNode _indentNode = new IndentNode(" ", true, true);
this.exts.append(node, _indentNode);
this.exts.appendNewLine(this.exts.append(node, "noindent"));
final GeneratorNodeProcessor processor = new GeneratorNodeProcessor();
StringConcatenation _builder = new StringConcatenation();
_builder.append("Hallo");
_builder.newLine();
_builder.append("noindent");
_builder.newLine();
_builder.append("noindent");
_builder.newLine();
this.assertEquals(_builder.toString(), processor.process(node).toString());
}
use of org.eclipse.xtext.generator.trace.node.CompositeGeneratorNode in project xtext-core by eclipse.
the class TemplateNodeTest method assertEquals.
protected void assertEquals(final StringConcatenationClient c) {
final GeneratorNodeExtensions ext = new GeneratorNodeExtensions();
final GeneratorNodeProcessor processor = new GeneratorNodeProcessor();
final CompositeGeneratorNode root = new CompositeGeneratorNode();
ext.appendTemplate(root, c);
final GeneratorNodeProcessor.Result result = processor.process(root);
final StringConcatenation expected = new StringConcatenation();
expected.append(c);
final String expectedM = expected.toString().replaceAll(System.lineSeparator(), "\n");
final String resultM = result.toString().replaceAll(System.lineSeparator(), "\n");
Assert.assertEquals(expectedM, resultM);
}
use of org.eclipse.xtext.generator.trace.node.CompositeGeneratorNode in project xtext-core by eclipse.
the class TracingSugarTest method _generateType.
@Traced
public IGeneratorNode _generateType(final Type it) {
ILocationData _location = this._myExtensions.location(it);
CompositeGeneratorNode _traceNode = this._myExtensions.trace(_location, false);
this._myExtensions.appendTemplate(_traceNode, __generateType(it));
return _traceNode;
}
Aggregations