use of org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess in project xtext-core by eclipse.
the class RegionAccessCommentsTest method testDeleteFirstRegion3.
@Test
public void testDeleteFirstRegion3() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("/*h*/");
_builder.newLine();
_builder.append("/*81*/");
_builder.newLine();
_builder.newLine();
_builder.append("/*82*/");
_builder.newLine();
_builder.append("8 //8");
_builder.newLine();
_builder.append("/*a*/");
_builder.newLine();
_builder.append("a");
_builder.newLine();
final ITextRegionAccess access = this._regionAccessTestHelper.toTextRegionAccess(_builder);
final Procedure1<ITextRegionDiffBuilder> _function = (ITextRegionDiffBuilder it) -> {
final ISemanticRegion foo = access.regionForRootEObject().getAllRegionsFor().keyword("8");
it.remove(foo);
};
ITextRegionAccess _modify = this._regionAccessTestHelper.modify(access, _function);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append(" ");
_builder_1.append("0 1 H \"/*h*/\" Comment:TerminalRule\'ML_COMMENT\' Association:CONTAINER");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*81*/\" Comment:TerminalRule\'ML_COMMENT\' Association:CONTAINER");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"\\n\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*a*/\" Comment:TerminalRule\'ML_COMMENT\' Association:NEXT");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("20 \"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("B ValueList\'[a]\' Root");
_builder_1.newLine();
_builder_1.append("20 1 S \"a\" ValueList:name+=ID");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("E ValueList\'[a]\' Root");
_builder_1.newLine();
_builder_1.append("21 0 H");
_builder_1.newLine();
_builder_1.append("------------ diff 1 ------------");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("0 H \"/*h*/\" Comment:TerminalRule\'ML_COMMENT\' Association:CONTAINER");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*81*/\" Comment:TerminalRule\'ML_COMMENT\' Association:CONTAINER");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"\\n\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*82*/\" Comment:TerminalRule\'ML_COMMENT\' Association:NEXT");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("21 \"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append("21 1 S \"8\" Root:\'8\'");
_builder_1.newLine();
_builder_1.append("22 H \" \" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"//8\\n\" Comment:TerminalRule\'SL_COMMENT\' Association:PREVIOUS");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*a*/\" Comment:TerminalRule\'ML_COMMENT\' Association:NEXT");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("11 \"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
this._regionAccessTestHelper.operator_tripleEquals(_modify, _builder_1);
}
use of org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess in project xtext-core by eclipse.
the class RegionAccessCommentsTest method testDeleteFirstRegion1.
@Test
public void testDeleteFirstRegion1() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("/*h*/");
_builder.newLine();
_builder.newLine();
_builder.append("/*8*/");
_builder.newLine();
_builder.append("8 //8");
_builder.newLine();
_builder.append("/*a*/");
_builder.newLine();
_builder.append("a");
_builder.newLine();
final ITextRegionAccess access = this._regionAccessTestHelper.toTextRegionAccess(_builder);
final Procedure1<ITextRegionDiffBuilder> _function = (ITextRegionDiffBuilder it) -> {
final ISemanticRegion foo = access.regionForRootEObject().getAllRegionsFor().keyword("8");
it.remove(foo);
};
ITextRegionAccess _modify = this._regionAccessTestHelper.modify(access, _function);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append(" ");
_builder_1.append("0 1 H \"/*h*/\" Comment:TerminalRule\'ML_COMMENT\' Association:CONTAINER");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"\\n\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*a*/\" Comment:TerminalRule\'ML_COMMENT\' Association:NEXT");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("13 \"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("B ValueList\'[a]\' Root");
_builder_1.newLine();
_builder_1.append("13 1 S \"a\" ValueList:name+=ID");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("E ValueList\'[a]\' Root");
_builder_1.newLine();
_builder_1.append("14 0 H");
_builder_1.newLine();
_builder_1.append("------------ diff 1 ------------");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("0 H \"/*h*/\" Comment:TerminalRule\'ML_COMMENT\' Association:CONTAINER");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"\\n\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*8*/\" Comment:TerminalRule\'ML_COMMENT\' Association:NEXT");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("13 \"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append("13 1 S \"8\" Root:\'8\'");
_builder_1.newLine();
_builder_1.append("14 H \" \" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"//8\\n\" Comment:TerminalRule\'SL_COMMENT\' Association:PREVIOUS");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*a*/\" Comment:TerminalRule\'ML_COMMENT\' Association:NEXT");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("11 \"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
this._regionAccessTestHelper.operator_tripleEquals(_modify, _builder_1);
}
use of org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess in project xtext-core by eclipse.
the class RegionAccessCommentsTest method testDeleteFirstRegion2.
@Test
public void testDeleteFirstRegion2() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("/*h*/");
_builder.newLine();
_builder.newLine();
_builder.append("/*81*/");
_builder.newLine();
_builder.append("/*82*/");
_builder.newLine();
_builder.append("8 //8");
_builder.newLine();
_builder.append("/*a*/");
_builder.newLine();
_builder.append("a");
_builder.newLine();
final ITextRegionAccess access = this._regionAccessTestHelper.toTextRegionAccess(_builder);
final Procedure1<ITextRegionDiffBuilder> _function = (ITextRegionDiffBuilder it) -> {
final ISemanticRegion foo = access.regionForRootEObject().getAllRegionsFor().keyword("8");
it.remove(foo);
};
ITextRegionAccess _modify = this._regionAccessTestHelper.modify(access, _function);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append(" ");
_builder_1.append("0 1 H \"/*h*/\" Comment:TerminalRule\'ML_COMMENT\' Association:CONTAINER");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"\\n\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*a*/\" Comment:TerminalRule\'ML_COMMENT\' Association:NEXT");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("13 \"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("B ValueList\'[a]\' Root");
_builder_1.newLine();
_builder_1.append("13 1 S \"a\" ValueList:name+=ID");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("E ValueList\'[a]\' Root");
_builder_1.newLine();
_builder_1.append("14 0 H");
_builder_1.newLine();
_builder_1.append("------------ diff 1 ------------");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("0 H \"/*h*/\" Comment:TerminalRule\'ML_COMMENT\' Association:CONTAINER");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"\\n\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*81*/\" Comment:TerminalRule\'ML_COMMENT\' Association:NEXT");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*82*/\" Comment:TerminalRule\'ML_COMMENT\' Association:NEXT");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("21 \"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append("21 1 S \"8\" Root:\'8\'");
_builder_1.newLine();
_builder_1.append("22 H \" \" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"//8\\n\" Comment:TerminalRule\'SL_COMMENT\' Association:PREVIOUS");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*a*/\" Comment:TerminalRule\'ML_COMMENT\' Association:NEXT");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("11 \"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
this._regionAccessTestHelper.operator_tripleEquals(_modify, _builder_1);
}
use of org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess in project xtext-core by eclipse.
the class RegionAccessCommentsTest method testDeleteMiddleRegion.
@Test
public void testDeleteMiddleRegion() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("8");
_builder.newLine();
_builder.append("a /*a*/ //a");
_builder.newLine();
_builder.append("/*b1*/");
_builder.newLine();
_builder.append("/*b2*/");
_builder.newLine();
_builder.append("b");
_builder.newLine();
final ITextRegionAccess access = this._regionAccessTestHelper.toTextRegionAccess(_builder);
final Procedure1<ITextRegionDiffBuilder> _function = (ITextRegionDiffBuilder it) -> {
final ISemanticRegion foo = IterableExtensions.<ISemanticRegion>head(access.regionForRootEObject().getAllRegionsFor().features(RegionaccesstestlanguagePackage.Literals.VALUE_LIST__NAME));
it.remove(foo);
};
ITextRegionAccess _modify = this._regionAccessTestHelper.modify(access, _function);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append(" ");
_builder_1.append("0 0 H");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("B ValueList\'[a, b]\' Root");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("0 1 S \"8\" Root:\'8\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("1 1 H \"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*b1*/\" Comment:TerminalRule\'ML_COMMENT\' Association:NEXT");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*b2*/\" Comment:TerminalRule\'ML_COMMENT\' Association:NEXT");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("15 \"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append("16 1 S \"b\" ValueList:name+=ID");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("E ValueList\'[a, b]\' Root");
_builder_1.newLine();
_builder_1.append("17 0 H");
_builder_1.newLine();
_builder_1.append("------------ diff 1 ------------");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("1 1 H \"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("2 1 S \"a\" ValueList:name+=ID");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("3 H \" \" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*a*/\" Comment:TerminalRule\'ML_COMMENT\' Association:PREVIOUS");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\" \" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"//a\\n\" Comment:TerminalRule\'SL_COMMENT\' Association:PREVIOUS");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*b1*/\" Comment:TerminalRule\'ML_COMMENT\' Association:NEXT");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("\"/*b2*/\" Comment:TerminalRule\'ML_COMMENT\' Association:NEXT");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("25 \"\\n\" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
this._regionAccessTestHelper.operator_tripleEquals(_modify, _builder_1);
}
use of org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess in project xtext-core by eclipse.
the class RegionAccessDiffTest method testEmptyModification.
@Test
public void testEmptyModification() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("1 foo");
_builder.newLine();
final ITextRegionAccess access = this._regionAccessTestHelper.toTextRegionAccess(_builder);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("0 0 H");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("B Simple\'foo\' Root");
_builder_1.newLine();
_builder_1.append("0 1 S \"1\" Simple:\'1\'");
_builder_1.newLine();
_builder_1.append("1 1 H \" \" Whitespace:TerminalRule\'WS\'");
_builder_1.newLine();
_builder_1.append("2 3 S \"foo\" Simple:name=ID");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("E Simple\'foo\' Root");
_builder_1.newLine();
_builder_1.append("5 0 H");
_builder_1.newLine();
this._regionAccessTestHelper.operator_tripleEquals(access, _builder_1);
final Procedure1<ITextRegionDiffBuilder> _function = (ITextRegionDiffBuilder it) -> {
};
ITextRegionAccess _modify = this._regionAccessTestHelper.modify(access, _function);
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append("0 0 H");
_builder_2.newLine();
_builder_2.append(" ");
_builder_2.append("B Simple\'foo\' Root");
_builder_2.newLine();
_builder_2.append("0 1 S \"1\" Simple:\'1\'");
_builder_2.newLine();
_builder_2.append("1 1 H \" \" Whitespace:TerminalRule\'WS\'");
_builder_2.newLine();
_builder_2.append("2 3 S \"foo\" Simple:name=ID");
_builder_2.newLine();
_builder_2.append(" ");
_builder_2.append("E Simple\'foo\' Root");
_builder_2.newLine();
_builder_2.append("5 0 H");
_builder_2.newLine();
this._regionAccessTestHelper.operator_tripleEquals(_modify, _builder_2);
}
Aggregations