use of org.eclipse.xtext.grammarinheritance.inheritanceTest.Element in project xtext-core by eclipse.
the class InheritanceTest3LanguageSemanticSequencer 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 == InheritanceTestPackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case InheritanceTestPackage.ELEMENT:
if (rule == grammarAccess.getInheritanceTestLanguageElementRule()) {
sequence_Element(context, (Element) semanticObject);
return;
} else if (rule == grammarAccess.getElementRule()) {
sequence_Element_Element(context, (Element) semanticObject);
return;
} else
break;
case InheritanceTestPackage.MODEL:
sequence_Model(context, (Model) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
use of org.eclipse.xtext.grammarinheritance.inheritanceTest.Element in project xtext-core by eclipse.
the class ParserTest method test_02.
@Test
public void test_02() throws Exception {
Model model = (Model) getModel("model id { element inheritedIdSyntax }");
assertEquals("id", model.getName());
Element element = model.getElements().get(0);
assertEquals("inheritedIdSyntax", element.getName());
List<INode> nodesForFeature = NodeModelUtils.findNodesForFeature(element, InheritanceTestPackage.Literals.ELEMENT__NAME);
assertTrue(nodesForFeature.size() == 1);
assertEquals("inheritedIdSyntax", nodesForFeature.get(0).getText());
}
use of org.eclipse.xtext.grammarinheritance.inheritanceTest.Element in project xtext-core by eclipse.
the class ParserTest method test_01.
@Test
public void test_01() throws Exception {
Model model = (Model) getModel("model id { element id }");
assertEquals("id", model.getName());
Element element = model.getElements().get(0);
assertEquals("id", element.getName());
List<INode> nodesForFeature = NodeModelUtils.findNodesForFeature(element, InheritanceTestPackage.Literals.ELEMENT__NAME);
assertTrue(nodesForFeature.size() == 1);
assertEquals("id", nodesForFeature.get(0).getText());
}
use of org.eclipse.xtext.grammarinheritance.inheritanceTest.Element in project xtext-core by eclipse.
the class ParserTest method test_05.
@Test
public void test_05() throws Exception {
Model model = (Model) getModel("model id { element withNumbers01 }");
assertEquals("id", model.getName());
Element element = model.getElements().get(0);
assertEquals("withNumbers01", element.getName());
List<INode> nodesForFeature = NodeModelUtils.findNodesForFeature(element, InheritanceTestPackage.Literals.ELEMENT__NAME);
assertTrue(nodesForFeature.size() == 1);
assertEquals("withNumbers01", nodesForFeature.get(0).getText());
}
use of org.eclipse.xtext.grammarinheritance.inheritanceTest.Element in project xtext-core by eclipse.
the class AbstractInheritanceTestLanguageSemanticSequencer 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 == InheritanceTestPackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case InheritanceTestPackage.ELEMENT:
sequence_Element(context, (Element) semanticObject);
return;
case InheritanceTestPackage.MODEL:
sequence_Model(context, (Model) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Aggregations