Search in sources :

Example 6 with ISemanticRegionsFinder

use of org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder in project xtext-core by eclipse.

the class SemanticRegionFinderTest method regionForRuleCallUnassignedDataType.

@Test
public void regionForRuleCallUnassignedDataType() {
    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.ruleCall(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getDatatypeParserRuleCall_1_1_1());
    final List<ISemanticRegion> actuals = finder.ruleCalls(this._regionAccessTestLanguageGrammarAccess.getMixedAccess().getDatatypeParserRuleCall_1_1_1());
    this.assertEquals("datatype foo", actual, actuals);
}
Also used : Mixed(org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Mixed) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) ISemanticRegion(org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion) ISemanticRegionsFinder(org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder) Test(org.junit.Test)

Example 7 with ISemanticRegionsFinder

use of org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder in project xtext-core by eclipse.

the class SemanticRegionFinderTest method regionForRuleCallToAssignedDataType.

@Test
public void regionForRuleCallToAssignedDataType() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("6 (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 ISemanticRegion actuals = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getDatatypeRule());
    Assert.assertEquals("datatype foo", actual, actuals);
}
Also used : Mixed(org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Mixed) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) ISemanticRegion(org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion) ISemanticRegionsFinder(org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder) Test(org.junit.Test)

Example 8 with ISemanticRegionsFinder

use of org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder in project xtext-core by eclipse.

the class SemanticRegionFinderTest method regionForKeywordString.

@Test
public void regionForKeywordString() {
    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("(");
    final List<ISemanticRegion> actuals = finder.keywords("(");
    this.assertEquals("(", actual, actuals);
}
Also used : Mixed(org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Mixed) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) ISemanticRegion(org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion) ISemanticRegionsFinder(org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder) Test(org.junit.Test)

Example 9 with ISemanticRegionsFinder

use of org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder in project xtext-core by eclipse.

the class SemanticRegionFinderTest method regionForRuleCallToAssignedTerminal.

@Test
public void regionForRuleCallToAssignedTerminal() {
    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.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getIDRule());
    final ISemanticRegion actuals = finder.ruleCallTo(this._regionAccessTestLanguageGrammarAccess.getIDRule());
    Assert.assertEquals("foo", actual, actuals);
}
Also used : Mixed(org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Mixed) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) ISemanticRegion(org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion) ISemanticRegionsFinder(org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder) Test(org.junit.Test)

Example 10 with ISemanticRegionsFinder

use of org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder in project xtext-core by eclipse.

the class SemanticRegionFinderTest method regionForFeatureAttribute.

@Test
public void regionForFeatureAttribute() {
    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.feature(RegionaccesstestlanguagePackage.Literals.MIXED__NAME);
    final List<ISemanticRegion> actuals = finder.features(RegionaccesstestlanguagePackage.Literals.MIXED__NAME);
    this.assertEquals("foo", actual, actuals);
}
Also used : Mixed(org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Mixed) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) ISemanticRegion(org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion) ISemanticRegionsFinder(org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder) Test(org.junit.Test)

Aggregations

ISemanticRegionsFinder (org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder)22 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)20 Test (org.junit.Test)20 ISemanticRegion (org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion)17 Mixed (org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Mixed)14 AssignedAction (org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.AssignedAction)4 Expression (org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Expression)2 RegionAccessTestLanguageGrammarAccess (org.eclipse.xtext.formatting2.regionaccess.internal.services.RegionAccessTestLanguageGrammarAccess)2 Extension (org.eclipse.xtext.xbase.lib.Extension)2 URI (org.eclipse.emf.common.util.URI)1 EObject (org.eclipse.emf.ecore.EObject)1 IEObjectRegion (org.eclipse.xtext.formatting2.regionaccess.IEObjectRegion)1 XtextResource (org.eclipse.xtext.resource.XtextResource)1