use of org.eclipse.xtext.serializer.contextFinderTest.ParentRefTest1 in project xtext-core by eclipse.
the class ContextFinderTest method testParentRefTest1.
@Test
public void testParentRefTest1() throws Exception {
Model model = parseHelper.parse("#4 kw1 foo");
ParentRefTestChild child1 = ((ParentRefTest1) model.getParentRef()).getChild1();
assertEquals("ParentRefTestChild1", findContextsByContentsAndContainer(child1));
}
use of org.eclipse.xtext.serializer.contextFinderTest.ParentRefTest1 in project xtext-core by eclipse.
the class ContextFinderTestLanguageSemanticSequencer 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 == ContextFinderTestPackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case ContextFinderTestPackage.ATTRIBUTE_EXCLUSION_TEST:
if (rule == grammarAccess.getAttributeExclusionTest1Rule()) {
sequence_AttributeExclusionTest1(context, (AttributeExclusionTest) semanticObject);
return;
} else if (rule == grammarAccess.getAttributeExclusionTest2Rule()) {
sequence_AttributeExclusionTest2(context, (AttributeExclusionTest) semanticObject);
return;
} else
break;
case ContextFinderTestPackage.MODEL:
if (rule == grammarAccess.getModel2Rule()) {
sequence_Model2(context, (Model) semanticObject);
return;
} else if (rule == grammarAccess.getModelRule()) {
sequence_Model(context, (Model) semanticObject);
return;
} else
break;
case ContextFinderTestPackage.NESTED_TYPE_CHILD1:
sequence_NestedTypeChild1(context, (NestedTypeChild1) semanticObject);
return;
case ContextFinderTestPackage.NESTED_TYPE_CHILD2:
sequence_NestedTypeChild2(context, (NestedTypeChild2) semanticObject);
return;
case ContextFinderTestPackage.NESTED_TYPE_RECURSIVE_TEST:
if (rule == grammarAccess.getNestedTypeRecursiveTest1Rule() || action == grammarAccess.getNestedTypeRecursiveTest1Access().getNestedTypeRecursiveTestLeftAction_2_0()) {
sequence_NestedTypeRecursiveTest1(context, (NestedTypeRecursiveTest) semanticObject);
return;
} else if (rule == grammarAccess.getNestedTypeRecursiveTest2Rule() || action == grammarAccess.getNestedTypeRecursiveTest2Access().getNestedTypeRecursiveTestLeftAction_2_0()) {
sequence_NestedTypeRecursiveTest2(context, (NestedTypeRecursiveTest) semanticObject);
return;
} else
break;
case ContextFinderTestPackage.NESTED_TYPE_RECURSIVE_TEST1:
sequence_NestedTypeRecursiveTest1_NestedTypeRecursiveTest_2_0(context, (NestedTypeRecursiveTest1) semanticObject);
return;
case ContextFinderTestPackage.NESTED_TYPE_RECURSIVE_TEST2:
sequence_NestedTypeRecursiveTest2_NestedTypeRecursiveTest_2_0(context, (NestedTypeRecursiveTest2) semanticObject);
return;
case ContextFinderTestPackage.NESTED_TYPE_TEST:
if (rule == grammarAccess.getNestedTypeTest1Rule()) {
sequence_NestedTypeTest1(context, (NestedTypeTest) semanticObject);
return;
} else if (rule == grammarAccess.getNestedTypeTest2Rule()) {
sequence_NestedTypeTest2(context, (NestedTypeTest) semanticObject);
return;
} else
break;
case ContextFinderTestPackage.NODE_EXCLUSION:
if (rule == grammarAccess.getNodeExclusion1Rule()) {
sequence_NodeExclusion1(context, (NodeExclusion) semanticObject);
return;
} else if (rule == grammarAccess.getNodeExclusion2Rule()) {
sequence_NodeExclusion2(context, (NodeExclusion) semanticObject);
return;
} else
break;
case ContextFinderTestPackage.NODE_EXCLUSION_LIST:
if (rule == grammarAccess.getNodeExclusion1ListRule()) {
sequence_NodeExclusion1List(context, (NodeExclusionList) semanticObject);
return;
} else if (rule == grammarAccess.getNodeExclusion2ListRule()) {
sequence_NodeExclusion2List(context, (NodeExclusionList) semanticObject);
return;
} else
break;
case ContextFinderTestPackage.PARENT_REF_TEST1:
sequence_ParentRefTest1(context, (ParentRefTest1) semanticObject);
return;
case ContextFinderTestPackage.PARENT_REF_TEST2:
sequence_ParentRefTest2(context, (ParentRefTest2) semanticObject);
return;
case ContextFinderTestPackage.PARENT_REF_TEST_CHILD:
if (rule == grammarAccess.getParentRefTestChild1Rule()) {
sequence_ParentRefTestChild1(context, (ParentRefTestChild) semanticObject);
return;
} else if (rule == grammarAccess.getParentRefTestChild2Rule()) {
sequence_ParentRefTestChild2(context, (ParentRefTestChild) semanticObject);
return;
} else
break;
case ContextFinderTestPackage.QUANTITY_EXCLUSION_TEST:
if (rule == grammarAccess.getQuantityExclusionTest1Rule()) {
sequence_QuantityExclusionTest1(context, (QuantityExclusionTest) semanticObject);
return;
} else if (rule == grammarAccess.getQuantityExclusionTest2Rule()) {
sequence_QuantityExclusionTest2(context, (QuantityExclusionTest) semanticObject);
return;
} else
break;
case ContextFinderTestPackage.VALUE_EXCLUSION_TEST:
if (rule == grammarAccess.getValueExclusionTest1Rule()) {
sequence_ValueExclusionTest1(context, (ValueExclusionTest) semanticObject);
return;
} else if (rule == grammarAccess.getValueExclusionTest2Rule()) {
sequence_ValueExclusionTest2(context, (ValueExclusionTest) semanticObject);
return;
} else
break;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
use of org.eclipse.xtext.serializer.contextFinderTest.ParentRefTest1 in project xtext-core by eclipse.
the class ContextFinderTest method testParentRefTest3.
@Test
public void testParentRefTest3() throws Exception {
Model model = parseHelper.parse("#4 kw1 foo foo foo");
ParentRefTestChild child1 = ((ParentRefTest1) model.getParentRef()).getChild1().getChild().getChild();
assertEquals("ParentRefTestChild1", findContextsByContentsAndContainer(child1));
}
Aggregations