use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree in project xtext-core by eclipse.
the class AbstractIndentationAwareTestLanguageSemanticSequencer method sequence.
@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
EPackage epackage = semanticObject.eClass().getEPackage();
ParserRule rule = context.getParserRule();
Action action = context.getAssignedAction();
Set<Parameter> parameters = context.getEnabledBooleanParameters();
if (epackage == IndentationAwareTestLanguagePackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case IndentationAwareTestLanguagePackage.CHILD_LIST:
sequence_ChildList(context, (ChildList) semanticObject);
return;
case IndentationAwareTestLanguagePackage.OTHER_TREE_NODE:
sequence_OtherTreeNode(context, (OtherTreeNode) semanticObject);
return;
case IndentationAwareTestLanguagePackage.TREE:
sequence_Tree(context, (Tree) semanticObject);
return;
case IndentationAwareTestLanguagePackage.TREE_NODE:
sequence_TreeNode(context, (TreeNode) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree in project xtext-core by eclipse.
the class IndentationAwareLanguageTest method testIgnoreEmptyLines_1.
@Test
public void testIgnoreEmptyLines_1() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("first");
_builder.newLine();
_builder.append("\t");
_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(0, IterableExtensions.<TreeNode>head(tree.getNodes()).getChildren().size());
Assert.assertEquals("second", IterableExtensions.<TreeNode>last(tree.getNodes()).getName());
}
use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree in project xtext-core by eclipse.
the class IndentationAwareLanguageTest method testSingleRootNode.
@Test
public void testSingleRootNode() {
final Tree tree = this.parse("root");
Assert.assertNotNull(tree);
Assert.assertEquals(1, tree.getNodes().size());
Assert.assertEquals("root", IterableExtensions.<TreeNode>head(tree.getNodes()).getName());
}
use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree in project xtext-core by eclipse.
the class IndentationAwareLanguageTest method testTree_02.
@Test
public void testTree_02() {
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();
_builder.append("\t");
_builder.append("e");
_builder.newLine();
_builder.append("\t\t ");
_builder.append("f");
_builder.newLine();
_builder.append("\t\t ");
_builder.append("g");
_builder.newLine();
_builder.append("h");
_builder.newLine();
final Tree tree = this.parseAndValidate(_builder);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("a");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("b");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("c");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("d");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("e");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("f");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("g");
_builder_1.newLine();
_builder_1.append("h");
_builder_1.newLine();
Assert.assertEquals(_builder_1.toString(), this.asText(tree));
}
use of org.eclipse.xtext.parser.indentation.indentationAwareTestLanguage.Tree in project xtext-core by eclipse.
the class IndentationAwareLanguageTest method testTree_04.
@Test
public void testTree_04() {
StringConcatenation _builder = new StringConcatenation();
_builder.append("level0_1");
_builder.newLine();
_builder.append("\t");
_builder.append("level1_1");
_builder.newLine();
_builder.append("\t");
_builder.append("level1_2");
_builder.newLine();
_builder.append("\t\t");
_builder.append("level2_1");
_builder.newLine();
_builder.append("\t\t");
_builder.append("level2_2");
_builder.newLine();
_builder.append("\t");
_builder.append("level1_3");
_builder.newLine();
_builder.append("\t\t");
_builder.append("level2_3");
_builder.newLine();
_builder.append("\t\t");
_builder.append("level2_4");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("level3_1");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("level3_2");
_builder.newLine();
_builder.append("\t\t");
_builder.append("level2_5");
_builder.newLine();
_builder.append("\t");
_builder.append("level1_4");
_builder.newLine();
_builder.append("\t\t");
_builder.append("level2_6");
_builder.newLine();
_builder.append("level0_2");
_builder.newLine();
_builder.append("\t\t");
_builder.append("level1_5");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("level2_7");
_builder.newLine();
_builder.append("\t\t\t\t\t\t");
_builder.append("level3_8");
_builder.newLine();
_builder.append("\t\t\t\t\t\t\t\t");
_builder.append("level4_9");
_builder.newLine();
final Tree tree = this.parseAndValidate(_builder);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("level0_1");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("level1_1");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("level1_2");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("level2_1");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("level2_2");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("level1_3");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("level2_3");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("level2_4");
_builder_1.newLine();
_builder_1.append("\t\t\t");
_builder_1.append("level3_1");
_builder_1.newLine();
_builder_1.append("\t\t\t");
_builder_1.append("level3_2");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("level2_5");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("level1_4");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("level2_6");
_builder_1.newLine();
_builder_1.append("level0_2");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("level1_5");
_builder_1.newLine();
_builder_1.append("\t\t");
_builder_1.append("level2_7");
_builder_1.newLine();
_builder_1.append("\t\t\t");
_builder_1.append("level3_8");
_builder_1.newLine();
_builder_1.append("\t\t\t\t");
_builder_1.append("level4_9");
_builder_1.newLine();
Assert.assertEquals(_builder_1.toString(), this.asText(tree));
}
Aggregations