Search in sources :

Example 11 with IGeneratorNode

use of org.eclipse.xtext.generator.trace.node.IGeneratorNode in project xtext-core by eclipse.

the class CompositeGeneratorNode method toString.

@Override
public String toString() {
    StringConcatenation _builder = new StringConcatenation();
    String _simpleName = this.getClass().getSimpleName();
    _builder.append(_simpleName);
    _builder.append(" {");
    _builder.newLineIfNotEmpty();
    {
        for (final IGeneratorNode c : this.children) {
            _builder.append("\t");
            String _string = c.toString();
            _builder.append(_string, "\t");
            _builder.newLineIfNotEmpty();
        }
    }
    _builder.append("}");
    _builder.newLine();
    return _builder.toString();
}
Also used : IGeneratorNode(org.eclipse.xtext.generator.trace.node.IGeneratorNode) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 12 with IGeneratorNode

use of org.eclipse.xtext.generator.trace.node.IGeneratorNode in project xtext-core by eclipse.

the class GeneratorNodeExtensions method appendTemplate.

/**
 * Creates a template node for the given templateString and appends it to the given parent node.
 *
 * Templates are translated to generator node trees and expressions in templates can be of type IGeneratorNode.
 *
 * @return the given parent node
 */
public CompositeGeneratorNode appendTemplate(final CompositeGeneratorNode parent, final StringConcatenationClient templateString) {
    final TemplateNode proc = new TemplateNode(templateString, this);
    List<IGeneratorNode> _children = parent.getChildren();
    _children.add(proc);
    return parent;
}
Also used : TemplateNode(org.eclipse.xtext.generator.trace.node.TemplateNode) IGeneratorNode(org.eclipse.xtext.generator.trace.node.IGeneratorNode)

Example 13 with IGeneratorNode

use of org.eclipse.xtext.generator.trace.node.IGeneratorNode in project xtext-core by eclipse.

the class GeneratorNodeExtensions method trace.

/**
 * @return a trace node for the given location, appended as a child on the given parent
 */
public CompositeGeneratorNode trace(final CompositeGeneratorNode parent, final ILocationData data, final boolean useForDebugging) {
    final TraceNode result = new TraceNode(data);
    result.setUseForDebugging(useForDebugging);
    List<IGeneratorNode> _children = parent.getChildren();
    _children.add(result);
    return result;
}
Also used : IGeneratorNode(org.eclipse.xtext.generator.trace.node.IGeneratorNode) TraceNode(org.eclipse.xtext.generator.trace.node.TraceNode)

Example 14 with IGeneratorNode

use of org.eclipse.xtext.generator.trace.node.IGeneratorNode in project xtext-core by eclipse.

the class GeneratorNodeExtensions method trace.

/**
 * @return a trace node for the given location, appended as a child on the given parent
 */
public CompositeGeneratorNode trace(final CompositeGeneratorNode parent, final ILocationData data) {
    final TraceNode result = new TraceNode(data);
    List<IGeneratorNode> _children = parent.getChildren();
    _children.add(result);
    return result;
}
Also used : IGeneratorNode(org.eclipse.xtext.generator.trace.node.IGeneratorNode) TraceNode(org.eclipse.xtext.generator.trace.node.TraceNode)

Example 15 with IGeneratorNode

use of org.eclipse.xtext.generator.trace.node.IGeneratorNode in project xtext-core by eclipse.

the class GeneratorNodeExtensions method indent.

/**
 * Appends the indentation string at the current position of the parent and adds a new composite node, indicating the same indentation for
 * subsequent lines.
 *
 * @return an indentation node, using the given indentString, appended as a child on the given parent
 */
public CompositeGeneratorNode indent(final CompositeGeneratorNode parent, final String indentString) {
    final IndentNode indent = new IndentNode(indentString);
    List<IGeneratorNode> _children = parent.getChildren();
    _children.add(indent);
    return indent;
}
Also used : IGeneratorNode(org.eclipse.xtext.generator.trace.node.IGeneratorNode) IndentNode(org.eclipse.xtext.generator.trace.node.IndentNode)

Aggregations

IGeneratorNode (org.eclipse.xtext.generator.trace.node.IGeneratorNode)18 StringConcatenationClient (org.eclipse.xtend2.lib.StringConcatenationClient)9 EList (org.eclipse.emf.common.util.EList)6 Type (org.eclipse.xtext.linking.lazy.lazyLinking.Type)5 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)4 InMemoryFileSystemAccess (org.eclipse.xtext.generator.InMemoryFileSystemAccess)3 AbstractTraceRegion (org.eclipse.xtext.generator.trace.AbstractTraceRegion)3 ITraceRegionProvider (org.eclipse.xtext.generator.trace.ITraceRegionProvider)3 NewLineNode (org.eclipse.xtext.generator.trace.node.NewLineNode)3 Model (org.eclipse.xtext.linking.lazy.lazyLinking.Model)3 Property (org.eclipse.xtext.linking.lazy.lazyLinking.Property)3 UnresolvedProxyProperty (org.eclipse.xtext.linking.lazy.lazyLinking.UnresolvedProxyProperty)3 Test (org.junit.Test)3 IndentNode (org.eclipse.xtext.generator.trace.node.IndentNode)2 TraceNode (org.eclipse.xtext.generator.trace.node.TraceNode)2 CompositeGeneratorNode (org.eclipse.xtext.generator.trace.node.CompositeGeneratorNode)1 TemplateNode (org.eclipse.xtext.generator.trace.node.TemplateNode)1 TextNode (org.eclipse.xtext.generator.trace.node.TextNode)1