use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Root in project xtext-core by eclipse.
the class RegionAccessBuilderTest method testExpression2.
@Test
public void testExpression2() throws Exception {
String model = "5 (a + b) + c\n".trim();
String expectation = " 0 0 H\n" + " B Add Root\n" + " 0 1 S \"5\" Root:'5'\n" + " 1 1 H \" \" Whitespace:TerminalRule'WS'\n" + " B Add Expression:{Add.left=} path:Add/left\n" + " 2 1 S \"(\" Parenthesized:'('\n" + " 3 0 H\n" + " B Named'a' Expression:{Add.left=} path:Add/left=Add/left\n" + " 3 1 S \"a\" Primary:name=ID\n" + " E Named'a' Expression:{Add.left=} path:Add/left=Add/left\n" + " 4 1 H \" \" Whitespace:TerminalRule'WS'\n" + " 5 1 S \"+\" Expression:'+'\n" + " 6 1 H \" \" Whitespace:TerminalRule'WS'\n" + " B Named'b' Expression:right=Primary path:Add/right=Add/left\n" + " 7 1 S \"b\" Primary:name=ID\n" + " E Named'b' Expression:right=Primary path:Add/right=Add/left\n" + " 8 0 H\n" + " 8 1 S \")\" Parenthesized:')'\n" + " E Add Expression:{Add.left=} path:Add/left\n" + " 9 1 H \" \" Whitespace:TerminalRule'WS'\n" + "10 1 S \"+\" Expression:'+'\n" + "11 1 H \" \" Whitespace:TerminalRule'WS'\n" + " B Named'c' Expression:right=Primary path:Add/right\n" + "12 1 S \"c\" Primary:name=ID\n" + " E Named'c' Expression:right=Primary path:Add/right\n" + " E Add Root\n" + "13 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 testActionActionAction.
@Test
public void testActionActionAction() throws Exception {
String model = "6 () action action\n".trim();
String expectation = " 0 0 H\n" + " B AssignedAction Root\n" + " 0 1 S \"6\" Root:'6'\n" + " 1 1 H \" \" Whitespace:TerminalRule'WS'\n" + " B AssignedAction Mixed:{AssignedAction.child=} path:AssignedAction/child\n" + " B Action Mixed:{AssignedAction.child=} path:AssignedAction/child=AssignedAction/child\n" + " 2 1 S \"(\" Mixed:'('\n" + " 3 0 H\n" + " 3 1 S \")\" Mixed:')'\n" + " E Action Mixed:{AssignedAction.child=} path:AssignedAction/child=AssignedAction/child\n" + " 4 1 H \" \" Whitespace:TerminalRule'WS'\n" + " 5 6 S \"action\" Mixed:'action'\n" + " E AssignedAction Mixed:{AssignedAction.child=} path:AssignedAction/child\n" + "11 1 H \" \" Whitespace:TerminalRule'WS'\n" + "12 6 S \"action\" Mixed:'action'\n" + " E AssignedAction Root\n" + "18 0 H\n";
assertRegions(model, expectation);
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Root in project xtext-core by eclipse.
the class RegionAccessTestHelper method toTextRegionAccess.
public ITextRegionAccess toTextRegionAccess(CharSequence file) throws Exception {
Root obj = parseHelper.parse(file.toString().replace("\r\n", "\n").trim());
validationTestHelper.assertNoErrors(obj);
return textRegionAccessBuilder.get().forNodeModel((XtextResource) obj.eResource()).create();
}
use of org.eclipse.xtext.formatting2.regionaccess.internal.regionaccesstestlanguage.Root in project xtext-core by eclipse.
the class RegionAccessBuilderTest method testAssignmentAction.
@Test
public void testAssignmentAction() throws Exception {
String model = "6 (foo) action\n".trim();
String expectation = " 0 0 H\n" + " B AssignedAction Root\n" + " 0 1 S \"6\" Root:'6'\n" + " 1 1 H \" \" Whitespace:TerminalRule'WS'\n" + " B Mixed'foo' Mixed:{AssignedAction.child=} path:AssignedAction/child\n" + " 2 1 S \"(\" Mixed:'('\n" + " 3 0 H\n" + " 3 3 S \"foo\" Mixed:name=ID\n" + " 6 0 H\n" + " 6 1 S \")\" Mixed:')'\n" + " E Mixed'foo' Mixed:{AssignedAction.child=} path:AssignedAction/child\n" + " 7 1 H \" \" Whitespace:TerminalRule'WS'\n" + " 8 6 S \"action\" Mixed:'action'\n" + " E AssignedAction Root\n" + "14 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 testAssignedDatatype2.
@Test
public void testAssignedDatatype2() throws Exception {
String model = "6 (datatype 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 21 S \"datat...\" Mixed:datatype=Datatype\n" + "24 0 H\n" + "24 1 S \")\" Mixed:')'\n" + " E Mixed Root\n" + "25 0 H\n";
assertRegions(model, expectation);
}
Aggregations