use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Root in project xtext-core by eclipse.
the class RegionAccessBuilderTest method testAssignedDatatype.
@Test
public void testAssignedDatatype() throws Exception {
String model = "6 (datatype foo)\n".trim();
String expectation = " 0 0 H\n" + " B Mixed Root\n" + " 0 1 S \"6\" Root:'6'\n" + " 1 1 H \" \" Whitespace:TerminalRule'WS'\n" + " 2 1 S \"(\" Mixed:'('\n" + " 3 0 H\n" + " 3 12 S \"datat...\" Mixed:datatype=Datatype\n" + "15 0 H\n" + "15 1 S \")\" Mixed:')'\n" + " E Mixed Root\n" + "16 0 H\n";
assertRegions(model, expectation);
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Root in project xtext-core by eclipse.
the class RegionAccessBuilderTest method testFragmentRecursionID.
@Test
public void testFragmentRecursionID() throws Exception {
String model = "6 (fragment recursion foo)\n".trim();
String expectation = " 0 0 H\n" + " B Action Root\n" + " 0 1 S \"6\" Root:'6'\n" + " 1 1 H \" \" Whitespace:TerminalRule'WS'\n" + " 2 1 S \"(\" Mixed:'('\n" + " 3 0 H\n" + " 3 8 S \"fragment\" Mixed:'fragment'\n" + "11 1 H \" \" Whitespace:TerminalRule'WS'\n" + "12 9 S \"recur...\" Fragment:'recursion'\n" + "21 1 H \" \" Whitespace:TerminalRule'WS'\n" + "22 3 S \"foo\" Fragment:fragName=ID\n" + "25 0 H\n" + "25 1 S \")\" Mixed:')'\n" + " E Action Root\n" + "26 0 H\n";
assertRegions(model, expectation);
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Root in project xtext-core by eclipse.
the class RegionAccessBuilderTest method testMultiWhitespace1.
@Test
public void testMultiWhitespace1() throws Exception {
String model = "1 /**/ foo\n".trim();
String expectation = " 0 0 H\n" + " B Simple'foo' Root\n" + " 0 1 S \"1\" Simple:'1'\n" + " 1 H \" \" Whitespace:TerminalRule'WS'\n" + " \"/**/\" Comment:TerminalRule'ML_COMMENT' Association:CONTAINER\n" + " 6 \" \" Whitespace:TerminalRule'WS'\n" + " 7 3 S \"foo\" Simple:name=ID\n" + " E Simple'foo' Root\n" + "10 0 H\n";
assertRegions(model, expectation);
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Root in project xtext-core by eclipse.
the class RegionAccessBuilderTest method testEnum.
@Test
public void testEnum() throws Exception {
String model = "6 (lit1)\n".trim();
String expectation = "0 0 H\n" + " B Mixed Root\n" + "0 1 S \"6\" Root:'6'\n" + "1 1 H \" \" Whitespace:TerminalRule'WS'\n" + "2 1 S \"(\" Mixed:'('\n" + "3 0 H\n" + "3 4 S \"lit1\" Mixed:lit=Enum\n" + "7 0 H\n" + "7 1 S \")\" Mixed:')'\n" + " E Mixed Root\n" + "8 0 H\n";
assertRegions(model, expectation);
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Root in project xtext-core by eclipse.
the class RegionAccessDiffTest method testDeleteOne.
@Test
public void testDeleteOne() throws Exception {
String model = "4/*1*/prefix/*2*/foo\n";
ITextRegionAccess access = regionAccessTestHelper.toTextRegionAccess(model);
ITextRegionAccess modifiedAccess = regionAccessTestHelper.modify(access, (ITextRegionDiffBuilder it) -> {
ITextRegionExtensions ext = access.getExtensions();
PrefixedUnassigned rootObj = (PrefixedUnassigned) access.regionForRootEObject().getSemanticElement();
ISemanticRegion prefix = ext.regionFor(rootObj.getDelegate()).keyword("prefix");
it.remove(prefix);
});
String expectation = " 0 0 H\n" + " B PrefixedUnassigned Root\n" + " 0 1 S \"4\" PrefixedUnassigned:'4'\n" + " 1 1 H \"/*1*/\" Comment:TerminalRule'ML_COMMENT' Association:CONTAINER\n" + " 10 \"/*2*/\" Comment:TerminalRule'ML_COMMENT' Association:CONTAINER\n" + " B Delegate'foo' PrefixedUnassigned:delegate=PrefixedDelegate path:PrefixedUnassigned/delegate\n" + "11 3 S \"foo\" Delegate:name=ID\n" + " E Delegate'foo' PrefixedUnassigned:delegate=PrefixedDelegate path:PrefixedUnassigned/delegate\n" + " E PrefixedUnassigned Root\n" + "14 0 H\n" + "------------ diff 1 ------------\n" + " 1 5 H \"/*1*/\" Comment:TerminalRule'ML_COMMENT' Association:CONTAINER\n" + " 6 6 S \"prefix\" PrefixedDelegate:'prefix'\n" + "12 5 H \"/*2*/\" Comment:TerminalRule'ML_COMMENT' Association:CONTAINER\n";
regionAccessTestHelper.assertRegions(modifiedAccess, expectation);
}
Aggregations