Search in sources :

Example 6 with TreeNode

use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.TreeNode in project xtext-core by eclipse.

the class IndentationAwareLanguageTest method testTwoRootNodes.

@Test
public void testTwoRootNodes() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("first");
    _builder.newLine();
    _builder.append("second");
    _builder.newLine();
    final Tree tree = this.parse(_builder);
    Assert.assertNotNull(tree);
    Assert.assertEquals(2, tree.getNodes().size());
    Assert.assertEquals("first", IterableExtensions.<TreeNode>head(tree.getNodes()).getName());
    Assert.assertEquals("second", IterableExtensions.<TreeNode>last(tree.getNodes()).getName());
}
Also used : OtherTreeNode(org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode) TreeNode(org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.TreeNode) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Tree(org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree) Test(org.junit.Test)

Example 7 with TreeNode

use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.TreeNode in project xtext-core by eclipse.

the class IndentationAwareLanguageTest method testIgnoreEmptyLines_3.

@Test
public void testIgnoreEmptyLines_3() {
    final Tree tree = this.parse("first\n\t");
    Assert.assertNotNull(tree);
    Assert.assertEquals(1, tree.getNodes().size());
    Assert.assertEquals("first", IterableExtensions.<TreeNode>head(tree.getNodes()).getName());
    Assert.assertEquals(0, IterableExtensions.<TreeNode>head(tree.getNodes()).getChildren().size());
}
Also used : OtherTreeNode(org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode) TreeNode(org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.TreeNode) Tree(org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree) Test(org.junit.Test)

Example 8 with TreeNode

use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.TreeNode in project xtext-core by eclipse.

the class IndentationAwareLanguageTest method testIgnoreEmptyLines_5.

@Test
public void testIgnoreEmptyLines_5() {
    final Tree tree = this.parse("first\n\t\tabc\n\t");
    Assert.assertNotNull(tree);
    Assert.assertEquals(1, tree.getNodes().size());
    Assert.assertEquals("first", IterableExtensions.<TreeNode>head(tree.getNodes()).getName());
    Assert.assertEquals(1, IterableExtensions.<TreeNode>head(tree.getNodes()).getChildren().size());
}
Also used : OtherTreeNode(org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode) TreeNode(org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.TreeNode) Tree(org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree) Test(org.junit.Test)

Aggregations

OtherTreeNode (org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.OtherTreeNode)8 TreeNode (org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.TreeNode)8 Tree (org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree)7 Test (org.junit.Test)6 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)4 EList (org.eclipse.emf.common.util.EList)1 EPackage (org.eclipse.emf.ecore.EPackage)1 Action (org.eclipse.xtext.Action)1 Parameter (org.eclipse.xtext.Parameter)1 ParserRule (org.eclipse.xtext.ParserRule)1 ChildList (org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.ChildList)1