Java Code Examples for org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder#ruleCallTo()

The following examples show how to use org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder#ruleCallTo() . 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: SemanticRegionFinderTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void regionForRuleCallToUnassignedTerminal() throws Exception {
	Mixed mixed = parseAs("6 (unassigned foo)", Mixed.class);
	ISemanticRegionsFinder finder = toAccess(mixed).regionForEObject(mixed).getRegionFor();
	ISemanticRegion actual = finder.ruleCallTo(grammarAccess.getIDRule());
	List<ISemanticRegion> actuals = finder.ruleCallsTo(grammarAccess.getIDRule());
	assertEquals("foo", actual, actuals);
}
 
Example 2
Source File: SemanticRegionFinderTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void regionForRuleCallToUnassignedDataType() throws Exception {
	Mixed mixed = parseAs("6 (unassigned datatype foo)", Mixed.class);
	ISemanticRegionsFinder finder = toAccess(mixed).regionForEObject(mixed).getRegionFor();
	ISemanticRegion actual = finder.ruleCallTo(grammarAccess.getDatatypeRule());
	List<ISemanticRegion> actuals = finder
			.ruleCallsTo(grammarAccess.getDatatypeRule());
	assertEquals("datatype foo", actual, actuals);
}
 
Example 3
Source File: SemanticRegionFinderTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void regionForRuleCallToAssignedTerminal() throws Exception {
	Mixed mixed = parseAs("6 (foo)", Mixed.class);
	ISemanticRegionsFinder finder = toAccess(mixed).regionForEObject(mixed).getRegionFor();
	ISemanticRegion actual = finder.ruleCallTo(grammarAccess.getIDRule());
	ISemanticRegion actuals = finder.ruleCallTo(grammarAccess.getIDRule());
	Assert.assertEquals("foo", actual, actuals);
}
 
Example 4
Source File: SemanticRegionFinderTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void regionForRuleCallToAssignedDataType() throws Exception {
	Mixed mixed = parseAs("6 (datatype foo)", Mixed.class);
	ISemanticRegionsFinder finder = toAccess(mixed).regionForEObject(mixed).getRegionFor();
	ISemanticRegion actual = finder.ruleCallTo(grammarAccess.getDatatypeRule());
	ISemanticRegion actuals = finder.ruleCallTo(grammarAccess.getDatatypeRule());
	Assert.assertEquals("datatype foo", actual, actuals);
}
 
Example 5
Source File: SemanticRegionFinderTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void regionForRuleCallToCrossReference() throws Exception {
	AssignedAction mixed = parseAs("6 (ref foo) action (foo) end", AssignedAction.class);
	ISemanticRegionsFinder finder = toAccess(mixed).regionForEObject(mixed.getChild()).getRegionFor();
	ISemanticRegion actual = finder.ruleCallTo(grammarAccess.getIDRule());
	List<ISemanticRegion> actuals = finder.ruleCallsTo(grammarAccess.getIDRule());
	assertEquals("foo", actual, actuals);
}