Search in sources :

Example 11 with ILocationData

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

the class TraceRegionToStringTest method twoFiles.

@Test
public void twoFiles() {
    final TraceRegionToStringTester tester = new TraceRegionToStringTester();
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("foo bar");
    _builder.newLine();
    tester.setLocalText(_builder.toString());
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("baz buz");
    _builder_1.newLine();
    tester.setRemote1(_builder_1.toString());
    StringConcatenation _builder_2 = new StringConcatenation();
    _builder_2.append("xxx zzz");
    _builder_2.newLine();
    tester.setRemote2(_builder_2.toString());
    SourceRelativeURI _uri1 = tester.getUri1();
    TraceRegionToStringTester.Location _location = new TraceRegionToStringTester.Location(0, 7, _uri1);
    TraceRegionToStringTester.Region _region = new TraceRegionToStringTester.Region(0, 7, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location)));
    final Procedure1<TraceRegionToStringTester.Region> _function = (TraceRegionToStringTester.Region it) -> {
        TraceRegionToStringTester.Location _location_1 = new TraceRegionToStringTester.Location(0, 3);
        it.addChild(0, 3, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location_1)));
        SourceRelativeURI _uri2 = tester.getUri2();
        TraceRegionToStringTester.Location _location_2 = new TraceRegionToStringTester.Location(0, 3, _uri2);
        it.addChild(4, 3, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location_2)));
    };
    TraceRegionToStringTester.Region _doubleArrow = ObjectExtensions.<TraceRegionToStringTester.Region>operator_doubleArrow(_region, _function);
    tester.setTrace(_doubleArrow);
    StringConcatenation _builder_3 = new StringConcatenation();
    _builder_3.append("------- local1 -------- | ---- remote1 -----");
    _builder_3.newLine();
    _builder_3.append("[1,2[foo]2] [3[bar]3,1] | [1,2[baz]2] buz]1]");
    _builder_3.newLine();
    _builder_3.append("                        ");
    _builder_3.append("| ---- remote2 -----");
    _builder_3.newLine();
    _builder_3.append("                        ");
    _builder_3.append("| [3[xxx]3] zzz");
    _builder_3.newLine();
    _builder_3.append("--------------------------------------------");
    _builder_3.newLine();
    _builder_3.append("1: D 0-7 Region -> Location[0,7,remote1] {");
    _builder_3.newLine();
    _builder_3.append("2: D 0-3   Region -> Location[0,3]");
    _builder_3.newLine();
    _builder_3.append("3: D 4-3   Region -> Location[0,3,remote2]");
    _builder_3.newLine();
    _builder_3.append("1:       }");
    _builder_3.newLine();
    this.operator_tripleEquals(tester, _builder_3);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) TextRegion(org.eclipse.xtext.util.TextRegion) TraceRegionToStringTester(org.eclipse.xtext.generator.trace.TraceRegionToStringTester) SourceRelativeURI(org.eclipse.xtext.generator.trace.SourceRelativeURI) ILocationData(org.eclipse.xtext.generator.trace.ILocationData) Test(org.junit.Test)

Example 12 with ILocationData

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

the class TraceRegionToStringTest method twoIdentical.

@Test
public void twoIdentical() {
    final TraceRegionToStringTester tester = new TraceRegionToStringTester();
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("foo bar");
    _builder.newLine();
    tester.setLocalText(_builder.toString());
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("baz buz");
    _builder_1.newLine();
    tester.setRemote1(_builder_1.toString());
    SourceRelativeURI _uri1 = tester.getUri1();
    TraceRegionToStringTester.Location _location = new TraceRegionToStringTester.Location(1, 5, _uri1);
    TraceRegionToStringTester.Region _region = new TraceRegionToStringTester.Region(0, 7, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location)));
    final Procedure1<TraceRegionToStringTester.Region> _function = (TraceRegionToStringTester.Region it) -> {
        TraceRegionToStringTester.Location _location_1 = new TraceRegionToStringTester.Location(1, 5);
        it.addChild(0, 7, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location_1)));
    };
    TraceRegionToStringTester.Region _doubleArrow = ObjectExtensions.<TraceRegionToStringTester.Region>operator_doubleArrow(_region, _function);
    tester.setTrace(_doubleArrow);
    StringConcatenation _builder_2 = new StringConcatenation();
    _builder_2.append("---- local1 ----- | ---- remote1 ----");
    _builder_2.newLine();
    _builder_2.append("[1,2[foo bar]2,1] | b[1,2[az bu]2,1]z");
    _builder_2.newLine();
    _builder_2.append("-------------------------------------");
    _builder_2.newLine();
    _builder_2.append("1: D 0-7 Region -> Location[1,5,remote1] {");
    _builder_2.newLine();
    _builder_2.append("2: D 0-7   Region -> Location[1,5]");
    _builder_2.newLine();
    _builder_2.append("1:       }");
    _builder_2.newLine();
    this.operator_tripleEquals(tester, _builder_2);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) TextRegion(org.eclipse.xtext.util.TextRegion) TraceRegionToStringTester(org.eclipse.xtext.generator.trace.TraceRegionToStringTester) SourceRelativeURI(org.eclipse.xtext.generator.trace.SourceRelativeURI) ILocationData(org.eclipse.xtext.generator.trace.ILocationData) Test(org.junit.Test)

Example 13 with ILocationData

use of org.eclipse.xtext.generator.trace.ILocationData 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;
}
Also used : CompositeGeneratorNode(org.eclipse.xtext.generator.trace.node.CompositeGeneratorNode) ILocationData(org.eclipse.xtext.generator.trace.ILocationData) Traced(org.eclipse.xtext.generator.trace.node.Traced)

Example 14 with ILocationData

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

the class TracingSugarTest method _generatePropertyWithDebugging.

@Traced(useForDebugging = true)
public IGeneratorNode _generatePropertyWithDebugging(final Property it) {
    ILocationData _location = this._myExtensions.location(it);
    CompositeGeneratorNode _traceNode = this._myExtensions.trace(_location, true);
    this._myExtensions.appendTemplate(_traceNode, __generatePropertyWithDebugging(it));
    return _traceNode;
}
Also used : CompositeGeneratorNode(org.eclipse.xtext.generator.trace.node.CompositeGeneratorNode) ILocationData(org.eclipse.xtext.generator.trace.ILocationData) Traced(org.eclipse.xtext.generator.trace.node.Traced)

Example 15 with ILocationData

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

the class TracingSugarTest method _generateTypeWithDebugging02.

@Traced
public IGeneratorNode _generateTypeWithDebugging02(final Type it) {
    ILocationData _location = this._myExtensions.location(it);
    CompositeGeneratorNode _traceNode = this._myExtensions.trace(_location, false);
    this._myExtensions.appendTemplate(_traceNode, __generateTypeWithDebugging02(it));
    return _traceNode;
}
Also used : CompositeGeneratorNode(org.eclipse.xtext.generator.trace.node.CompositeGeneratorNode) ILocationData(org.eclipse.xtext.generator.trace.ILocationData) Traced(org.eclipse.xtext.generator.trace.node.Traced)

Aggregations

ILocationData (org.eclipse.xtext.generator.trace.ILocationData)19 SourceRelativeURI (org.eclipse.xtext.generator.trace.SourceRelativeURI)10 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)7 TraceRegionToStringTester (org.eclipse.xtext.generator.trace.TraceRegionToStringTester)7 TextRegion (org.eclipse.xtext.util.TextRegion)7 Test (org.junit.Test)7 AbstractTraceRegion (org.eclipse.xtext.generator.trace.AbstractTraceRegion)5 CompositeGeneratorNode (org.eclipse.xtext.generator.trace.node.CompositeGeneratorNode)5 Traced (org.eclipse.xtext.generator.trace.node.Traced)5 ITextRegionWithLineInformation (org.eclipse.xtext.util.ITextRegionWithLineInformation)3 LocationData (org.eclipse.xtext.generator.trace.LocationData)2 ITextRegion (org.eclipse.xtext.util.ITextRegion)2 AbstractIterator (com.google.common.collect.AbstractIterator)1 BufferedInputStream (java.io.BufferedInputStream)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InputStream (java.io.InputStream)1 Iterator (java.util.Iterator)1 IPath (org.eclipse.core.runtime.IPath)1 URI (org.eclipse.emf.common.util.URI)1