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

The following examples show how to use org.eclipse.xtext.formatting2.regionaccess.ISemanticRegionsFinder#ruleCall() . 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 regionForRuleCallUnassignedTerminal() throws Exception {
	Mixed mixed = parseAs("6 (unassigned foo)", Mixed.class);
	ISemanticRegionsFinder finder = toAccess(mixed).regionForEObject(mixed).getRegionFor();
	ISemanticRegion actual = finder
			.ruleCall(grammarAccess.getMixedAccess().getIDTerminalRuleCall_1_1_0());
	List<ISemanticRegion> actuals = finder
			.ruleCalls(grammarAccess.getMixedAccess().getIDTerminalRuleCall_1_1_0());
	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 regionForRuleCallUnassignedDataType() throws Exception {
	Mixed mixed = parseAs("6 (unassigned datatype foo)", Mixed.class);
	ISemanticRegionsFinder finder = toAccess(mixed).regionForEObject(mixed).getRegionFor();
	ISemanticRegion actual = finder.ruleCall(
			grammarAccess.getMixedAccess().getDatatypeParserRuleCall_1_1_1());
	List<ISemanticRegion> actuals = finder.ruleCalls(
			grammarAccess.getMixedAccess().getDatatypeParserRuleCall_1_1_1());
	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 regionForRuleCallAssignedTerminal() throws Exception {
	Mixed mixed = parseAs("6 (foo)", Mixed.class);
	ISemanticRegionsFinder finder = toAccess(mixed).regionForEObject(mixed).getRegionFor();
	ISemanticRegion actual = finder.ruleCall(
			grammarAccess.getMixedAccess().getNameIDTerminalRuleCall_2_2_0_0());
	ISemanticRegion actuals = finder.ruleCall(
			grammarAccess.getMixedAccess().getNameIDTerminalRuleCall_2_2_0_0());
	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 regionForRuleCallAssignedDataType() throws Exception {
	Mixed mixed = parseAs("6 (datatype foo)", Mixed.class);
	ISemanticRegionsFinder finder = toAccess(mixed).regionForEObject(mixed).getRegionFor();
	ISemanticRegion actual = finder.ruleCall(grammarAccess.getMixedAccess()
			.getDatatypeDatatypeParserRuleCall_2_2_2_0());
	ISemanticRegion actuals = finder.ruleCall(grammarAccess.getMixedAccess()
			.getDatatypeDatatypeParserRuleCall_2_2_2_0());
	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 regionForRuleCallCrossReference() throws Exception {
	AssignedAction mixed = parseAs("6 (ref foo) action (foo) end", AssignedAction.class);
	ISemanticRegionsFinder finder = toAccess(mixed).regionForEObject(mixed.getChild()).getRegionFor();
	ISemanticRegion actual = finder.ruleCall(grammarAccess.getMixedAccess()
			.getRefMixedIDTerminalRuleCall_2_2_3_1_0_1());
	List<ISemanticRegion> actuals = finder.ruleCalls(grammarAccess.getMixedAccess()
			.getRefMixedIDTerminalRuleCall_2_2_3_1_0_1());
	assertEquals("foo", actual, actuals);
}