use of org.eclipse.xtext.grammarinheritance.inheritanceTest.Element in project xtext-core by eclipse.
the class InheritanceTest2LanguageSemanticSequencer 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;
}
else if (epackage == InheritanceTest2Package.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case InheritanceTest2Package.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_03.
@Test
public void test_03() throws Exception {
Model model = (Model) getModel("model id { element 'string' }");
assertEquals("id", model.getName());
Element element = model.getElements().get(0);
assertEquals("string", element.getName());
List<INode> nodesForFeature = NodeModelUtils.findNodesForFeature(element, InheritanceTestPackage.Literals.ELEMENT__NAME);
assertTrue(nodesForFeature.size() == 1);
assertEquals("'string'", nodesForFeature.get(0).getText());
}
use of org.eclipse.xtext.grammarinheritance.inheritanceTest.Element in project xtext-core by eclipse.
the class ParserTest method test_04.
@Test
public void test_04() throws Exception {
Model model = (Model) getModel("model id { element 'with spaces' }");
assertEquals("id", model.getName());
Element element = model.getElements().get(0);
assertEquals("with spaces", element.getName());
List<INode> nodesForFeature = NodeModelUtils.findNodesForFeature(element, InheritanceTestPackage.Literals.ELEMENT__NAME);
assertTrue(nodesForFeature.size() == 1);
assertEquals("'with spaces'", nodesForFeature.get(0).getText());
}
Aggregations