use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.
the class AbstractFragmentsTest method testFragmentRecursive_04.
@Test
public void testFragmentRecursive_04() {
final ParserRuleFragments fragments = this.parseAndValidate("#11 myName ((myPrev))");
Assert.assertNotNull(fragments);
Assert.assertEquals("myName", fragments.getElement().getName());
PRFNamed _element = fragments.getElement();
final PRFNamed prev = ((PRFNamedWithAction) _element).getPrev();
Assert.assertEquals("myPrev", prev.getName());
final ICompositeNode node = NodeModelUtils.findActualNodeFor(prev);
Assert.assertEquals("myPrev", node.getText());
final EObject lookup = NodeModelUtils.findActualSemanticObjectFor(node);
Assert.assertSame(prev, lookup);
}
use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.
the class AbstractFragmentsTest method parseAndValidate.
protected ParserRuleFragments parseAndValidate(final CharSequence s) {
try {
final ParserRuleFragments result = this.parseHelper.parse(s);
this.validationTestHelper.assertNoIssues(result);
Resource _eResource = result.eResource();
final XtextResource resource = ((XtextResource) _eResource);
final ICompositeNode node = resource.getParseResult().getRootNode();
this.invariantChecker.checkInvariant(node);
return result;
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.
the class AbstractFragmentsTest method testFragmentRecursive_01.
@Test
public void testFragmentRecursive_01() {
final ParserRuleFragments fragments = this.parseAndValidate("#10 myName myPrev");
Assert.assertNotNull(fragments);
Assert.assertEquals("myName", fragments.getElement().getName());
PRFNamed _element = fragments.getElement();
final PRFNamed prev = ((PRFNamedWithAction) _element).getPrev();
Assert.assertEquals("myPrev", prev.getName());
final ICompositeNode node = NodeModelUtils.findActualNodeFor(prev);
Assert.assertEquals(" myPrev", node.getText());
final EObject lookup = NodeModelUtils.findActualSemanticObjectFor(node);
Assert.assertSame(prev, lookup);
}
use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.
the class IndentationAwareLanguageTest method parseAndValidate.
private Tree parseAndValidate(final CharSequence s) {
final Tree result = this.parse(s);
this.validationTestHelper.assertNoIssues(result);
Resource _eResource = result.eResource();
final XtextResource resource = ((XtextResource) _eResource);
final ICompositeNode node = resource.getParseResult().getRootNode();
this.invariantChecker.checkInvariant(node);
return result;
}
use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.
the class NodeModelTest method testEmptyTree.
@Test
public void testEmptyTree() {
final ICompositeNode tree = this.getRootNode("");
NodeModelTest.assertEquals("", this.asText(tree));
}
Aggregations