org.eclipse.xtext.generator.trace.ILocationData Java Examples

The following examples show how to use org.eclipse.xtext.generator.trace.ILocationData. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XbaseCompiler.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected ITreeAppendable appendTypeArguments(XAbstractFeatureCall call, ITreeAppendable original) {
	if (!call.getTypeArguments().isEmpty()) {
		return super.appendTypeArguments(call, original);
	}
	ILocationData completeLocationData = getLocationWithTypeArguments(call);
	ITreeAppendable completeFeatureCallAppendable = completeLocationData != null ? original.trace(completeLocationData) : original;
	IResolvedTypes resolvedTypes = batchTypeResolver.resolveTypes(call);
	List<LightweightTypeReference> typeArguments = resolvedTypes.getActualTypeArguments(call);
	if (!typeArguments.isEmpty()) {
		for(LightweightTypeReference typeArgument: typeArguments) {
			if (typeArgument.isWildcard()) {
				return completeFeatureCallAppendable;
			}
		}
		completeFeatureCallAppendable.append("<");
		for (int i = 0; i < typeArguments.size(); i++) {
			if (i != 0) {
				completeFeatureCallAppendable.append(", ");
			}
			completeFeatureCallAppendable.append(typeArguments.get(i));
		}
		completeFeatureCallAppendable.append(">");
	}
	return completeFeatureCallAppendable;
}
 
Example #2
Source File: XbaseCompiler.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
protected ILocationData getLocationOfDefault(XSwitchExpression expression) {
	final ICompositeNode startNode = NodeModelUtils.getNode(expression);
	if (startNode != null) {
		List<INode> resultNodes = Lists.newArrayList();
		boolean defaultSeen = false;
		for (INode child : startNode.getChildren()) {
			if (defaultSeen) {
				resultNodes.add(child);
				if (GrammarUtil.containingAssignment(child.getGrammarElement()) != null) {
					break;
				}
			} else if (child.getGrammarElement() instanceof Keyword && "default".equals(child.getText())) {
				defaultSeen = true;
				resultNodes.add(child);
			}
		}
		return toLocationData(resultNodes);
	}
	return null;
}
 
Example #3
Source File: TreeAppendable.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public ITreeAppendable trace(Iterable<? extends EObject> objects) {
	if (Iterables.isEmpty(objects))
		throw new IllegalArgumentException("List of objects may not be empty");
	int size = Iterables.size(objects);
	if (size == 1)
		return trace(objects.iterator().next(), false);
	Set<ILocationData> newData = new LinkedHashSet<ILocationData>(size);
	for(EObject object: objects) {
		ILocationData locationData = createLocationData(traceURIConverter, locationProvider, object, ILocationInFileProviderExtension.RegionDescription.FULL);
		if (locationData != null)
			newData.add(locationData);
	}
	if (newData.isEmpty() && !isUseForDebugging())
		return this;
	return trace(newData, false);
}
 
Example #4
Source File: TraceRegionToStringTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void simple() {
  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(4, 2, _uri1);
  TraceRegionToStringTester.Region _region = new TraceRegionToStringTester.Region(1, 2, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location)));
  tester.setTrace(_region);
  StringConcatenation _builder_2 = new StringConcatenation();
  _builder_2.append("-- local1 --- | -- remote1 --");
  _builder_2.newLine();
  _builder_2.append("f[1[oo]1] bar | baz [1[bu]1]z");
  _builder_2.newLine();
  _builder_2.append("-----------------------------");
  _builder_2.newLine();
  _builder_2.append("1: D 1-2 Region -> Location[4,2,remote1]");
  _builder_2.newLine();
  this.operator_tripleEquals(tester, _builder_2);
}
 
Example #5
Source File: FeatureCallCompiler.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
protected ILocationData getLocationWithoutTypeArguments(XAbstractFeatureCall call) {
	final ICompositeNode startNode = NodeModelUtils.getNode(call);
	if (startNode != null) {
		List<INode> resultNodes = Lists.newArrayList();
		if (call instanceof XFeatureCall || call instanceof XMemberFeatureCall) {
			boolean featureReferenceSeen = false;
			for (INode child : startNode.getChildren()) {
				if (featureReferenceSeen) {
					resultNodes.add(child);
				} else {
					EObject grammarElement = child.getGrammarElement();
					if (grammarElement instanceof CrossReference) {
						Assignment assignment = GrammarUtil.containingAssignment(grammarElement);
						if (assignment != null && "feature".equals(assignment.getFeature())) {
							featureReferenceSeen = true;
							resultNodes.add(child);
						}
					}
				}
			}
		}
		return toLocationData(resultNodes);
	}
	return null;
}
 
Example #6
Source File: TracingSugarTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@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;
}
 
Example #7
Source File: GeneratorNodeExtensions.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @return a trace node for the given location, appended as a child on the given parent
 */
public CompositeGeneratorNode trace(CompositeGeneratorNode parent, ILocationData data, boolean useForDebugging) {
	TraceNode result = new TraceNode(data);
	result.setUseForDebugging(useForDebugging);
	parent.getChildren().add(result);
	return result;
}
 
Example #8
Source File: TracingSugarTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public IGeneratorNode _parentId(final Type target, final Function<Property, String> stringProvider) {
  EStructuralFeature feature = target.eClass().getEStructuralFeature("parentId");
  ILocationData location = this.location(target, feature, -1);
  CompositeGeneratorNode trace = this.trace(location);
  this.append(trace, stringProvider.apply(target.getParentId()));
  return trace;
}
 
Example #9
Source File: TracingSugarTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public IGeneratorNode _name(final UnresolvedProxyProperty target) {
  EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
  ILocationData location = this.location(target, feature, -1);
  CompositeGeneratorNode trace = this.trace(location);
  this.append(trace, target.getName());
  return trace;
}
 
Example #10
Source File: TracingSugarTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public IGeneratorNode _name(final UnresolvedProxyProperty target, final boolean useForDebugging) {
  EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
  ILocationData location = this.location(target, feature, -1);
  CompositeGeneratorNode trace = this.trace(location, useForDebugging);
  this.append(trace, target.getName());
  return trace;
}
 
Example #11
Source File: TracingSugarTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public IGeneratorNode _name(final UnresolvedProxyProperty target, final Function<String, String> stringProvider) {
  EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
  ILocationData location = this.location(target, feature, -1);
  CompositeGeneratorNode trace = this.trace(location);
  this.append(trace, stringProvider.apply(target.getName()));
  return trace;
}
 
Example #12
Source File: TracingSugarTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@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;
}
 
Example #13
Source File: TracingSugarTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public IGeneratorNode _name(final Type target) {
  EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
  ILocationData location = this.location(target, feature, -1);
  CompositeGeneratorNode trace = this.trace(location);
  this.append(trace, target.getName());
  return trace;
}
 
Example #14
Source File: AbstractTrace.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected Iterable<? extends ILocationInResource> toLocations(final Iterable<AbstractTraceRegion> allTraceRegions) {
	return new Iterable<ILocationInResource>() {

		@Override
		public Iterator<ILocationInResource> iterator() {
			return new AbstractIterator<ILocationInResource>() {

				private Iterator<AbstractTraceRegion> delegate = allTraceRegions.iterator();
				private AbstractTraceRegion region;
				private Iterator<ILocationData> locationDelegate;
				
				@Override
				protected ILocationInResource computeNext() {
					while(true) {
						if (locationDelegate == null || !locationDelegate.hasNext()) {
							if (delegate.hasNext()) {
								region = delegate.next();
								locationDelegate = region.getAssociatedLocations().iterator();
								if (!locationDelegate.hasNext()) {
									continue;
								}
							}
						}
						if (locationDelegate != null && locationDelegate.hasNext()) {
							ILocationData locationData = locationDelegate.next();
							ILocationInResource result = createLocationInResourceFor(locationData, region);
							if (result != null) {
								return result;
							}
							continue;
						}
						return endOfData();
					}
				}
			};
		}
		
	};
}
 
Example #15
Source File: AbstractTrace.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Creates a new location for a target resource that matches the given {@code location}.
 * @param location the location
 * @return the location in resource, <code>null</code> detecting a path fails.
 */
protected ILocationInResource createLocationInResourceFor(ILocationData location, AbstractTraceRegion traceRegion) {
	SourceRelativeURI path = location.getSrcRelativePath();
	if (path == null)
		path = traceRegion.getAssociatedSrcRelativePath();
	if (path == null)
		return null;
	return createLocationInResource(location, path);
}
 
Example #16
Source File: TreeAppendable.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected TreeAppendable trace(Set<ILocationData> newData, boolean useForDebugging) {
	if (this.useForDebugging == useForDebugging && newData.equals(locationData)) {
		return this;
	}
	TreeAppendable result = createChild(state, locationProvider, jvmModelAssociations, newData, useForDebugging);
	if(result != this)
		children.add(result);
	return result;
}
 
Example #17
Source File: TreeAppendable.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected TreeAppendable(SharedAppendableState state,
		final ITraceURIConverter converter,
		ILocationInFileProvider locationProvider,
		IJvmModelAssociations jvmModelAssociations,
		Set<ILocationData> sourceLocations, 
		boolean useForDebugging) {
	this.state = state;
	this.traceURIConverter = converter;
	this.locationProvider = locationProvider;
	this.jvmModelAssociations = jvmModelAssociations;
	this.children = Lists.newArrayList();
	this.locationData = sourceLocations;
	this.useForDebugging = useForDebugging;
	this.lightweightTypeReferenceSerializer = createLightweightTypeReferenceSerializer();
}
 
Example #18
Source File: TracingSugarTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public IGeneratorNode _name(final Type target, final Function<String, String> stringProvider) {
  EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
  ILocationData location = this.location(target, feature, -1);
  CompositeGeneratorNode trace = this.trace(location);
  this.append(trace, stringProvider.apply(target.getName()));
  return trace;
}
 
Example #19
Source File: TracingSugarTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public IGeneratorNode _name(final Type target, final boolean useForDebugging) {
  EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
  ILocationData location = this.location(target, feature, -1);
  CompositeGeneratorNode trace = this.trace(location, useForDebugging);
  this.append(trace, target.getName());
  return trace;
}
 
Example #20
Source File: TracingSugarTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Traced
public IGeneratorNode _generateProperty(final Property it) {
  ILocationData _location = this._myExtensions.location(it);
  CompositeGeneratorNode _traceNode = this._myExtensions.trace(_location, false);
  this._myExtensions.appendTemplate(_traceNode, __generateProperty(it));
  return _traceNode;
}
 
Example #21
Source File: TracingSugarTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public IGeneratorNode _extends(final Type target, final Function<Type, String> stringProvider) {
  EStructuralFeature feature = target.eClass().getEStructuralFeature("extends");
  ILocationData location = this.location(target, feature, -1);
  CompositeGeneratorNode trace = this.trace(location);
  this.append(trace, stringProvider.apply(target.getExtends()));
  return trace;
}
 
Example #22
Source File: TraceRegionToStringTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void oneChild() {
  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, 6, _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(2, 4);
    it.addChild(1, 6, 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[f[2[oo bar]2,1] | b[1[a[2[z bu]2]z]1]");
  _builder_2.newLine();
  _builder_2.append("----------------------------------------");
  _builder_2.newLine();
  _builder_2.append("1: D 0-7 Region -> Location[1,6,remote1] {");
  _builder_2.newLine();
  _builder_2.append("2: D 1-6   Region -> Location[2,4]");
  _builder_2.newLine();
  _builder_2.append("1:       }");
  _builder_2.newLine();
  this.operator_tripleEquals(tester, _builder_2);
}
 
Example #23
Source File: TraceRegionToStringTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@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);
}
 
Example #24
Source File: TraceRegionToStringTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void twoBounding() {
  final TraceRegionToStringTester tester = new TraceRegionToStringTester();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("foobar");
  _builder.newLine();
  tester.setLocalText(_builder.toString());
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("bazbuz");
  _builder_1.newLine();
  tester.setRemote1(_builder_1.toString());
  SourceRelativeURI _uri1 = tester.getUri1();
  TraceRegionToStringTester.Location _location = new TraceRegionToStringTester.Location(0, 6, _uri1);
  TraceRegionToStringTester.Region _region = new TraceRegionToStringTester.Region(0, 6, 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)));
    TraceRegionToStringTester.Location _location_2 = new TraceRegionToStringTester.Location(3, 3);
    it.addChild(3, 3, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location_2)));
  };
  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]2][3[bar]3,1] | [1,2[baz]2][3[buz]3,1]");
  _builder_2.newLine();
  _builder_2.append("-----------------------------------------------");
  _builder_2.newLine();
  _builder_2.append("1: D 0-6 Region -> Location[0,6,remote1] {");
  _builder_2.newLine();
  _builder_2.append("2: D 0-3   Region -> Location[0,3]");
  _builder_2.newLine();
  _builder_2.append("3: D 3-3   Region -> Location[3,3]");
  _builder_2.newLine();
  _builder_2.append("1:       }");
  _builder_2.newLine();
  this.operator_tripleEquals(tester, _builder_2);
}
 
Example #25
Source File: TraceRegionToStringTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void twoFrame1() {
  final TraceRegionToStringTester tester = new TraceRegionToStringTester();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("foo bar");
  _builder.newLine();
  tester.setLocalText(_builder.toString());
  TextRegion _textRegion = new TextRegion(1, 5);
  tester.setLocalFrame(_textRegion);
  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(2, 1, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location_1)));
    TraceRegionToStringTester.Location _location_2 = new TraceRegionToStringTester.Location(1, 5);
    it.addChild(5, 1, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location_2)));
  };
  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("o[1[o]1] b[2[a]2] | b[1,2[az bu]2,1]z");
  _builder_2.newLine();
  _builder_2.append("-------------------------------------");
  _builder_2.newLine();
  _builder_2.append("1: D 2-1 Region -> Location[1,5]");
  _builder_2.newLine();
  _builder_2.append("2: D 5-1 Region -> Location[1,5]");
  _builder_2.newLine();
  this.operator_tripleEquals(tester, _builder_2);
}
 
Example #26
Source File: TraceRegionToStringTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void twoFrame2() {
  final TraceRegionToStringTester tester = new TraceRegionToStringTester();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("foo bar");
  _builder.newLine();
  tester.setLocalText(_builder.toString());
  TextRegion _textRegion = new TextRegion(2, 4);
  tester.setLocalFrame(_textRegion);
  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(2, 1, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location_1)));
    TraceRegionToStringTester.Location _location_2 = new TraceRegionToStringTester.Location(1, 5);
    it.addChild(5, 1, Collections.<ILocationData>unmodifiableList(CollectionLiterals.<ILocationData>newArrayList(_location_2)));
  };
  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[o]1] b[2[a]2] | b[1,2[az bu]2,1]z");
  _builder_2.newLine();
  _builder_2.append("------------------------------------");
  _builder_2.newLine();
  _builder_2.append("1: D 2-1 Region -> Location[1,5]");
  _builder_2.newLine();
  _builder_2.append("2: D 5-1 Region -> Location[1,5]");
  _builder_2.newLine();
  this.operator_tripleEquals(tester, _builder_2);
}
 
Example #27
Source File: TracingSugarTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public IGeneratorNode _name(final Property target, final Function<String, String> stringProvider) {
  EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
  ILocationData location = this.location(target, feature, -1);
  CompositeGeneratorNode trace = this.trace(location);
  this.append(trace, stringProvider.apply(target.getName()));
  return trace;
}
 
Example #28
Source File: TracingSugarTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * manual implementation for unsupported multi cross reference
 */
public IGeneratorNode _type(final Property it, final Function1<? super Type, ? extends String> provider) {
  final ILocationData location = this.location(it, it.eClass().getEStructuralFeature("type"), 0);
  final CompositeGeneratorNode result = this.trace(location);
  this.append(result, provider.apply(IterableExtensions.<Type>head(it.getType())));
  return result;
}
 
Example #29
Source File: TracingSugarTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public IGeneratorNode _name(final Property target) {
  EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
  ILocationData location = this.location(target, feature, -1);
  CompositeGeneratorNode trace = this.trace(location);
  this.append(trace, target.getName());
  return trace;
}
 
Example #30
Source File: TracingSugarTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public IGeneratorNode _name(final Property target, final boolean useForDebugging) {
  EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
  ILocationData location = this.location(target, feature, -1);
  CompositeGeneratorNode trace = this.trace(location, useForDebugging);
  this.append(trace, target.getName());
  return trace;
}