use of org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion in project xtext-core by eclipse.
the class SemanticRegionFinderTest method regionForRuleCallToUnassignedDataType.
@Test
public void regionForRuleCallToUnassignedDataType() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("6 (unassigned datatype foo)");
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
final ISemanticRegion actual = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getDatatypeRule());
final List<ISemanticRegion> actuals = finder.ruleCallsTo(this._regionAccessTestLanguageGrammarAccess.getDatatypeRule());
this.assertEquals("datatype foo", actual, actuals);
}
use of org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion in project xtext-core by eclipse.
the class SemanticRegionFinderTest method regionForCrossReference.
@Test
public void regionForCrossReference() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("6 (ref foo) action (foo) end");
final AssignedAction mixed = this.<AssignedAction>parseAs(_builder, AssignedAction.class);
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed.getChild()).getRegionFor();
final ISemanticRegion actual = finder.crossRef(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getRefMixedCrossReference_2_2_3_1_0());
final List<ISemanticRegion> actuals = finder.crossRefs(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getRefMixedCrossReference_2_2_3_1_0());
this.assertEquals("foo", actual, actuals);
}
use of org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion in project xtext-core by eclipse.
the class FormattableDocument method prepend.
@Override
public ISemanticRegion prepend(ISemanticRegion token, Procedure1<? super IHiddenRegionFormatter> before) {
if (token != null) {
IHiddenRegion gap = token.getPreviousHiddenRegion();
set(gap, before);
}
return token;
}
use of org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion in project xtext-core by eclipse.
the class FormattableDocument method append.
@Override
public ISemanticRegion append(ISemanticRegion token, Procedure1<? super IHiddenRegionFormatter> after) {
if (token != null) {
IHiddenRegion gap = token.getNextHiddenRegion();
set(gap, after);
}
return token;
}
use of org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion in project xtext-core by eclipse.
the class FormattableDocument method surround.
@Override
public ISemanticRegion surround(ISemanticRegion token, Procedure1<? super IHiddenRegionFormatter> beforeAndAfter) {
if (token != null) {
IHiddenRegion previous = token.getPreviousHiddenRegion();
IHiddenRegion next = token.getNextHiddenRegion();
set(previous, next, beforeAndAfter);
}
return token;
}
Aggregations