Search in sources :

Example 91 with ICompositeNode

use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.

the class NodeModelTest method testIgnoreEmptyLines_2.

@Test
public void testIgnoreEmptyLines_2() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("\"first\"");
    _builder.newLine();
    _builder.append("\t");
    _builder.newLine();
    _builder.append("\"second\"");
    _builder.newLine();
    final ICompositeNode tree = this.getRootNode(_builder);
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("[STRING:\"first\"][-WS:");
    _builder_1.newLine();
    _builder_1.append("\\t");
    _builder_1.newLine();
    _builder_1.append("][STRING:\"second\"][-WS:");
    _builder_1.newLine();
    _builder_1.append("]");
    _builder_1.newLine();
    NodeModelTest.assertEquals(_builder_1.toString().trim(), this.asText(tree));
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode) Test(org.junit.Test)

Example 92 with ICompositeNode

use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.

the class NodeModelTest method testIgnoreEmptyLines_7.

@Test
public void testIgnoreEmptyLines_7() {
    final ICompositeNode tree = this.getRootNode("a\n\tb\n\t ");
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("[ID:a][-WS:");
    _builder.newLine();
    _builder.append("\\t][INDENT:][ID:b][-WS:");
    _builder.newLine();
    _builder.append("\\t ][DEDENT:]");
    _builder.newLine();
    NodeModelTest.assertEquals(_builder.toString().trim(), this.asText(tree));
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode) Test(org.junit.Test)

Example 93 with ICompositeNode

use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.

the class NodeModelTest method testTree_01.

@Test
public void testTree_01() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("a");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("b");
    _builder.newLine();
    _builder.append("\t ");
    _builder.append("c");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("d");
    _builder.newLine();
    final ICompositeNode tree = this.getRootNode(_builder);
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("[ID:a][-WS:");
    _builder_1.newLine();
    _builder_1.append("\\t][INDENT:][ID:b][-WS:");
    _builder_1.newLine();
    _builder_1.append("\\t ][INDENT:][ID:c][-WS:");
    _builder_1.newLine();
    _builder_1.append("][DEDENT:][-WS:\\t][ID:d][-WS:");
    _builder_1.newLine();
    _builder_1.append("][DEDENT:]");
    _builder_1.newLine();
    NodeModelTest.assertEquals(_builder_1.toString().trim(), this.asText(tree));
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode) Test(org.junit.Test)

Example 94 with ICompositeNode

use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.

the class NodeModelTest method testTwoRootNodes.

@Test
public void testTwoRootNodes() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("first");
    _builder.newLine();
    _builder.append("second");
    _builder.newLine();
    final ICompositeNode tree = this.getRootNode(_builder);
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("[ID:first][-WS:");
    _builder_1.newLine();
    _builder_1.append("][ID:second][-WS:");
    _builder_1.newLine();
    _builder_1.append("]");
    _builder_1.newLine();
    NodeModelTest.assertEquals(_builder_1.toString().trim(), this.asText(tree));
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode) Test(org.junit.Test)

Example 95 with ICompositeNode

use of org.eclipse.xtext.nodemodel.ICompositeNode in project xtext-core by eclipse.

the class NodeModelTest method testIgnoreEmptyLines_6.

@Test
public void testIgnoreEmptyLines_6() {
    final ICompositeNode tree = this.getRootNode("first\n\t\tabc\n\t\n");
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("[ID:first][-WS:");
    _builder.newLine();
    _builder.append("\\t\\t][INDENT:][ID:abc][-WS:");
    _builder.newLine();
    _builder.append("][DEDENT:][-WS:\\t");
    _builder.newLine();
    _builder.append("]");
    _builder.newLine();
    NodeModelTest.assertEquals(_builder.toString().trim(), this.asText(tree));
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode) Test(org.junit.Test)

Aggregations

ICompositeNode (org.eclipse.xtext.nodemodel.ICompositeNode)263 Test (org.junit.Test)87 INode (org.eclipse.xtext.nodemodel.INode)79 EObject (org.eclipse.emf.ecore.EObject)70 ILeafNode (org.eclipse.xtext.nodemodel.ILeafNode)57 XtextResource (org.eclipse.xtext.resource.XtextResource)41 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)24 ReplaceRegion (org.eclipse.xtext.util.ReplaceRegion)20 Resource (org.eclipse.emf.ecore.resource.Resource)19 Model (org.eclipse.xtext.valueconverter.bug250313.Model)15 IParseResult (org.eclipse.xtext.parser.IParseResult)14 ParserRule (org.eclipse.xtext.ParserRule)12 ITextRegion (org.eclipse.xtext.util.ITextRegion)12 RuleCall (org.eclipse.xtext.RuleCall)11 CrossReference (org.eclipse.xtext.CrossReference)10 ArrayList (java.util.ArrayList)8 List (java.util.List)8 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)8 AbstractRule (org.eclipse.xtext.AbstractRule)8 Keyword (org.eclipse.xtext.Keyword)8