use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.
the class NodeModelTest method testWeirdTree.
@Test
public void testWeirdTree() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("root");
_builder.newLine();
_builder.append(" ");
_builder.append("s4");
_builder.newLine();
_builder.append(" ");
_builder.append("s8");
_builder.newLine();
_builder.append(" ");
_builder.append("s6");
_builder.newLine();
final ICompositeNode tree = this.getRootNode(_builder);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("[ID:root][-WS:");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("][INDENT:][ID:s4][-WS:");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("][INDENT:][ID:s8][-WS:");
_builder_1.newLine();
_builder_1.append("][DEDENT:][-WS: ][INDENT:][ID:s6][-WS:");
_builder_1.newLine();
_builder_1.append("][DEDENT:][DEDENT:]");
_builder_1.newLine();
NodeModelTest.assertEquals(_builder_1.toString().trim(), this.asText(tree));
}
use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.
the class NodeModelTest method testParentChildren.
@Test
public void testParentChildren() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("parent");
_builder.newLine();
_builder.append("\t");
_builder.append("child");
_builder.newLine();
_builder.append("\t");
_builder.append("child");
_builder.newLine();
final ICompositeNode tree = this.getRootNode(_builder);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("[ID:parent][-WS:");
_builder_1.newLine();
_builder_1.append("\\t][INDENT:][ID:child][-WS:");
_builder_1.newLine();
_builder_1.append("\\t][ID:child][-WS:");
_builder_1.newLine();
_builder_1.append("][DEDENT:]");
_builder_1.newLine();
NodeModelTest.assertEquals(_builder_1.toString().trim(), this.asText(tree));
}
use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.
the class NodeModelTest method testParentChildWithEof.
@Test
public void testParentChildWithEof() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("parent");
_builder.newLine();
_builder.append("\t");
_builder.append("child");
_builder.newLine();
final ICompositeNode tree = this.getRootNode(_builder.toString().trim());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("[ID:parent][-WS:");
_builder_1.newLine();
_builder_1.append("\\t][INDENT:][ID:child][DEDENT:]");
_builder_1.newLine();
NodeModelTest.assertEquals(_builder_1.toString().trim(), this.asText(tree));
}
use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.
the class UnassignedRuleCallTest method testNodeModel_02.
@Test
public void testNodeModel_02() throws Exception {
String modelAsText = "model 7 13 137 feature Foo 1 keyword 1 'bar';";
Model model = (Model) getModel(modelAsText);
ICompositeNode node = NodeModelUtils.getNode(model);
assertEquals(8, Iterables.size(node.getChildren()));
ModelFeatures modelFeatures = model.getModelFeatures();
ICompositeNode featuresNode = NodeModelUtils.getNode(modelFeatures);
assertSame(featuresNode, Iterables.get(node.getChildren(), 7));
assertEquals(6, Iterables.size(featuresNode.getChildren()));
ICompositeNode dataTypeNode = (ICompositeNode) Iterables.get(featuresNode.getChildren(), 4);
assertEquals(8, Iterables.size(dataTypeNode.getChildren()));
}
use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.
the class SequenceFeeder method accept.
public void accept(Action action, EObject child) {
assertAction(action);
EStructuralFeature ref = getFeature(action.getFeature());
ICompositeNode node = ref.isMany() ? getCompositeNode(ref, 0, 0, child) : getCompositeNode(ref, child);
acceptAction(action, child, node);
}
Aggregations