use of org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder in project xtext-core by eclipse.
the class SemanticRegionFinderTest method regionForRuleCallEObjectParserRule.
@Test
public void regionForRuleCallEObjectParserRule() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("6 (child (foo))");
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
try {
finder.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getEobjMixedParserRuleCall_2_2_1_1_0());
Assert.fail();
} catch (final Throwable _t) {
if (_t instanceof IllegalStateException) {
} else {
throw Exceptions.sneakyThrow(_t);
}
}
try {
finder.ruleCalls(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getEobjMixedParserRuleCall_2_2_1_1_0());
Assert.fail();
} catch (final Throwable _t_1) {
if (_t_1 instanceof IllegalStateException) {
} else {
throw Exceptions.sneakyThrow(_t_1);
}
}
}
use of org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder in project xtext-core by eclipse.
the class SemanticRegionFinderTest method regionForAssignment.
@Test
public void regionForAssignment() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("6 (foo)");
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
final ISemanticRegion actual = finder.assignment(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getNameAssignment_2_2_0());
final List<ISemanticRegion> actuals = finder.assignments(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getNameAssignment_2_2_0());
this.assertEquals("foo", actual, actuals);
}
use of org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder in project xtext-core by eclipse.
the class SemanticRegionFinderTest method regionForKeyword.
@Test
public void regionForKeyword() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("6 (foo)");
final Mixed mixed = this.<Mixed>parseAs(_builder, Mixed.class);
final ISemanticRegionsFinder finder = this.toAccess(mixed).regionForEObject(mixed).getRegionFor();
final ISemanticRegion actual = finder.keyword(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getLeftParenthesisKeyword_0());
final List<ISemanticRegion> actuals = finder.keywords(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getLeftParenthesisKeyword_0());
this.assertEquals("(", actual, actuals);
}
use of org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder in project xtext-core by eclipse.
the class SemanticRegionFinderTest method regionForRuleCallToUnassignedTerminal.
@Test
public void regionForRuleCallToUnassignedTerminal() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("6 (unassigned 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.getIDRule());
final List<ISemanticRegion> actuals = finder.ruleCallsTo(this._regionAccessTestLanguageGrammarAccess.getIDRule());
this.assertEquals("foo", actual, actuals);
}
use of org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder 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);
}
Aggregations