use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.
the class PartialParserTest method testGrammarElementAssigned.
@Test
public void testGrammarElementAssigned() throws Exception {
with(ReferenceGrammarTestLanguageStandaloneSetup.class);
String model = "spielplatz 1 {kind (k 1)\n}";
XtextResource resource = getResourceFromString(model);
ICompositeNode rootNode = resource.getParseResult().getRootNode();
checkGrammarAssigned(rootNode);
IParseResult reparse = reparse(resource.getParseResult(), model.length() - 2, 0, "\n");
rootNode = reparse.getRootNode();
checkGrammarAssigned(rootNode);
}
use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.
the class PartialParserTest method testPartialParseConcreteRuleInnermostToken_02.
@Test
public void testPartialParseConcreteRuleInnermostToken_02() throws Exception {
with(PartialParserTestLanguageStandaloneSetup.class);
String model = "container c1 {\n" + " children {\n" + " -> C ( ch1 )\n" + " }" + "}";
XtextResource resource = getResourceFromString(model);
assertTrue(resource.getErrors().isEmpty());
ICompositeNode root = resource.getParseResult().getRootNode();
ILeafNode childrenLeaf = findLeafNodeByText(root, model, "children");
ILeafNode ch1Leaf = findLeafNodeByText(root, model, "ch1");
// change the model and undo the change
resource.update(model.indexOf("ch1") + 1, 1, "x");
resource.update(model.indexOf("ch1") + 1, 1, "h");
assertSame(root, resource.getParseResult().getRootNode());
assertSame(childrenLeaf, findLeafNodeByText(root, model, "children"));
assertNotSame(ch1Leaf, findLeafNodeByText(root, model, "ch1"));
}
use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.
the class PartialParserTest method testPartialParseConcreteRuleFirstInnerToken_02.
@Test
public void testPartialParseConcreteRuleFirstInnerToken_02() throws Exception {
with(PartialParserTestLanguageStandaloneSetup.class);
String model = "container c1 {\n" + " children {\n" + " -> C ( ch1 )\n" + " }" + "}";
XtextResource resource = getResourceFromString(model);
assertTrue(resource.getErrors().isEmpty());
ICompositeNode root = resource.getParseResult().getRootNode();
ILeafNode childrenLeaf = findLeafNodeByText(root, model, "children");
ILeafNode arrowLeaf = findLeafNodeByText(root, model, "->");
// change the model and undo the change
resource.update(model.indexOf("->"), 2, "-> ");
resource.update(model.indexOf("->"), 3, "->");
assertSame(root, resource.getParseResult().getRootNode());
assertSame(childrenLeaf, findLeafNodeByText(root, model, "children"));
assertNotSame(arrowLeaf, findLeafNodeByText(root, model, "->"));
}
use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.
the class PartialParserTest method testPartialParseConcreteRuleInnerToken.
@Test
public void testPartialParseConcreteRuleInnerToken() throws Exception {
with(PartialParserTestLanguageStandaloneSetup.class);
String model = "container c1 {\n" + " children {\n" + " -> C ( ch1 )\n" + " }" + "}";
XtextResource resource = getResourceFromString(model);
assertTrue(resource.getErrors().isEmpty());
ICompositeNode root = resource.getParseResult().getRootNode();
ILeafNode childrenLeaf = findLeafNodeByText(root, model, "children");
ILeafNode cLeaf = findLeafNodeByText(root, model, "C");
resource.update(model.indexOf("C"), 1, "C");
resource.update(model.indexOf("C"), 1, "C");
assertSame(root, resource.getParseResult().getRootNode());
assertSame(childrenLeaf, findLeafNodeByText(root, model, "children"));
assertNotSame(cLeaf, findLeafNodeByText(root, model, "ch1"));
}
use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.
the class XtextParserBugsTest method testFirstTokenIsIllegal_254841.
@Test
public void testFirstTokenIsIllegal_254841() throws Exception {
with(FowlerDslTestLanguageStandaloneSetup.class);
String model = "firstToken";
ICompositeNode rootNode = getRootNodeAndExpect(model, 1);
assertNotNull(rootNode);
}
Aggregations