Search in sources :

Example 1 with CompositeModel

use of org.eclipse.xtext.parser.datatyperules.datatypeRulesTestLanguage.CompositeModel in project xtext-core by eclipse.

the class DatatypeRulesTestLanguageSemanticSequencer 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 == DatatypeRulesTestLanguagePackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case DatatypeRulesTestLanguagePackage.COMPOSITE_MODEL:
                sequence_CompositeModel(context, (CompositeModel) semanticObject);
                return;
            case DatatypeRulesTestLanguagePackage.MODEL:
                sequence_Model(context, (Model) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) CompositeModel(org.eclipse.xtext.parser.datatyperules.datatypeRulesTestLanguage.CompositeModel) Model(org.eclipse.xtext.parser.datatyperules.datatypeRulesTestLanguage.Model) Parameter(org.eclipse.xtext.Parameter) CompositeModel(org.eclipse.xtext.parser.datatyperules.datatypeRulesTestLanguage.CompositeModel) EPackage(org.eclipse.emf.ecore.EPackage)

Example 2 with CompositeModel

use of org.eclipse.xtext.parser.datatyperules.datatypeRulesTestLanguage.CompositeModel in project xtext-core by eclipse.

the class EFactoryValueConverterTest method testImplicitEFactoryValueConverter.

@Test
public void testImplicitEFactoryValueConverter() throws Exception {
    with(DatatypeRulesTestLanguageStandaloneSetup.class);
    EObject model = getModel("a.b.c.d * -2.5E-23 ;");
    assertTrue(model instanceof CompositeModel);
    assertFalse(((CompositeModel) model).getModel().isEmpty());
    model = ((CompositeModel) model).getModel().get(0);
    double myDouble = ((Model) model).getDouble();
    assertEquals(-2.5E-23, myDouble, 0.0001);
}
Also used : EObject(org.eclipse.emf.ecore.EObject) Model(org.eclipse.xtext.parser.datatyperules.datatypeRulesTestLanguage.Model) CompositeModel(org.eclipse.xtext.parser.datatyperules.datatypeRulesTestLanguage.CompositeModel) CompositeModel(org.eclipse.xtext.parser.datatyperules.datatypeRulesTestLanguage.CompositeModel) Test(org.junit.Test)

Aggregations

CompositeModel (org.eclipse.xtext.parser.datatyperules.datatypeRulesTestLanguage.CompositeModel)2 Model (org.eclipse.xtext.parser.datatyperules.datatypeRulesTestLanguage.Model)2 EObject (org.eclipse.emf.ecore.EObject)1 EPackage (org.eclipse.emf.ecore.EPackage)1 Action (org.eclipse.xtext.Action)1 Parameter (org.eclipse.xtext.Parameter)1 ParserRule (org.eclipse.xtext.ParserRule)1 Test (org.junit.Test)1