Search in sources :

Example 1 with GAdditionExpression

use of org.eclipse.gemoc.gexpressions.GAdditionExpression in project gemoc-studio by eclipse.

the class AbstractGExpressionsSemanticSequencer 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 == GexpressionsPackage.eINSTANCE)
        switch(semanticObject.eClass().getClassifierID()) {
            case GexpressionsPackage.GADDITION_EXPRESSION:
                sequence_GAdditionExpression(context, (GAdditionExpression) semanticObject);
                return;
            case GexpressionsPackage.GAND_EXPRESSION:
                sequence_GAndExpression(context, (GAndExpression) semanticObject);
                return;
            case GexpressionsPackage.GBOOLEAN_EXPRESSION:
                sequence_GBooleanExpression(context, (GBooleanExpression) semanticObject);
                return;
            case GexpressionsPackage.GBRACE_EXPRESSION:
                sequence_GBraceExpression(context, (GBraceExpression) semanticObject);
                return;
            case GexpressionsPackage.GDOUBLE_EXPRESSION:
                sequence_GDoubleExpression(context, (GDoubleExpression) semanticObject);
                return;
            case GexpressionsPackage.GENUM_LITERAL_EXPRESSION:
                sequence_GEnumLiteralExpression(context, (GEnumLiteralExpression) semanticObject);
                return;
            case GexpressionsPackage.GEQUALITY_EXPRESSION:
                sequence_GEqualityExpression(context, (GEqualityExpression) semanticObject);
                return;
            case GexpressionsPackage.GIF_EXPRESSION:
                sequence_GIfExpression(context, (GIfExpression) semanticObject);
                return;
            case GexpressionsPackage.GIMPORT_STATEMENT:
                sequence_GImportStatement(context, (GImportStatement) semanticObject);
                return;
            case GexpressionsPackage.GINTEGER_EXPRESSION:
                sequence_GIntegerExpression(context, (GIntegerExpression) semanticObject);
                return;
            case GexpressionsPackage.GMULTIPLICATION_EXPRESSION:
                sequence_GMultiplicationExpression(context, (GMultiplicationExpression) semanticObject);
                return;
            case GexpressionsPackage.GNAVIGATION_EXPRESSION:
                sequence_GNavigationExpression(context, (GNavigationExpression) semanticObject);
                return;
            case GexpressionsPackage.GNEGATION_EXPRESSION:
                sequence_GNegationExpression(context, (GNegationExpression) semanticObject);
                return;
            case GexpressionsPackage.GOR_EXPRESSION:
                sequence_GOrExpression(context, (GOrExpression) semanticObject);
                return;
            case GexpressionsPackage.GPROGRAM:
                sequence_GProgram(context, (GProgram) semanticObject);
                return;
            case GexpressionsPackage.GREFERENCE_EXPRESSION:
                sequence_GReferenceExpression(context, (GReferenceExpression) semanticObject);
                return;
            case GexpressionsPackage.GRELATION_EXPRESSION:
                sequence_GRelationExpression(context, (GRelationExpression) semanticObject);
                return;
            case GexpressionsPackage.GSTRING_EXPRESSION:
                sequence_GStringExpression(context, (GStringExpression) semanticObject);
                return;
            case GexpressionsPackage.GXOR_EXPRESSION:
                sequence_GXorExpression(context, (GXorExpression) semanticObject);
                return;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : GReferenceExpression(org.eclipse.gemoc.gexpressions.GReferenceExpression) ParserRule(org.eclipse.xtext.ParserRule) Action(org.eclipse.xtext.Action) GMultiplicationExpression(org.eclipse.gemoc.gexpressions.GMultiplicationExpression) GNegationExpression(org.eclipse.gemoc.gexpressions.GNegationExpression) GProgram(org.eclipse.gemoc.gexpressions.GProgram) GEnumLiteralExpression(org.eclipse.gemoc.gexpressions.GEnumLiteralExpression) GStringExpression(org.eclipse.gemoc.gexpressions.GStringExpression) GDoubleExpression(org.eclipse.gemoc.gexpressions.GDoubleExpression) GNavigationExpression(org.eclipse.gemoc.gexpressions.GNavigationExpression) GAdditionExpression(org.eclipse.gemoc.gexpressions.GAdditionExpression) GBraceExpression(org.eclipse.gemoc.gexpressions.GBraceExpression) EPackage(org.eclipse.emf.ecore.EPackage) GOrExpression(org.eclipse.gemoc.gexpressions.GOrExpression) GXorExpression(org.eclipse.gemoc.gexpressions.GXorExpression) GImportStatement(org.eclipse.gemoc.gexpressions.GImportStatement) GEqualityExpression(org.eclipse.gemoc.gexpressions.GEqualityExpression) GAndExpression(org.eclipse.gemoc.gexpressions.GAndExpression) GIfExpression(org.eclipse.gemoc.gexpressions.GIfExpression) Parameter(org.eclipse.xtext.Parameter) GRelationExpression(org.eclipse.gemoc.gexpressions.GRelationExpression) GIntegerExpression(org.eclipse.gemoc.gexpressions.GIntegerExpression) GBooleanExpression(org.eclipse.gemoc.gexpressions.GBooleanExpression)

Example 2 with GAdditionExpression

use of org.eclipse.gemoc.gexpressions.GAdditionExpression in project gemoc-studio by eclipse.

the class GAdditionExpressionItemProvider method getText.

/**
 * This returns the label text for the adapted class.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public String getText(Object object) {
    GAdditionOperator labelValue = ((GAdditionExpression) object).getOperator();
    String label = labelValue == null ? null : labelValue.toString();
    return label == null || label.length() == 0 ? getString("_UI_GAdditionExpression_type") : getString("_UI_GAdditionExpression_type") + " " + label;
}
Also used : GAdditionOperator(org.eclipse.gemoc.gexpressions.GAdditionOperator) GAdditionExpression(org.eclipse.gemoc.gexpressions.GAdditionExpression)

Example 3 with GAdditionExpression

use of org.eclipse.gemoc.gexpressions.GAdditionExpression in project gemoc-studio by eclipse.

the class TestXtextSerializer method main.

public static void main(String[] args) {
    // Getting the serializer
    GExpressionsStandaloneSetup setup = new GExpressionsStandaloneSetup();
    Injector injector = setup.createInjectorAndDoEMFRegistration();
    Serializer serializer = injector.getInstance(Serializer.class);
    // Creating a model
    GexpressionsFactory factory = GexpressionsFactory.eINSTANCE;
    GAdditionExpression exp = factory.createGAdditionExpression();
    GIntegerExpression un = factory.createGIntegerExpression();
    un.setValue(1);
    GStringExpression deux = factory.createGStringExpression();
    deux.setValue("deux");
    exp.setLeftOperand(un);
    exp.setRightOperand(deux);
    // Serializing
    String s = serializer.serialize(exp);
    System.out.println(s);
}
Also used : GexpressionsFactory(org.eclipse.gemoc.gexpressions.GexpressionsFactory) Injector(com.google.inject.Injector) GStringExpression(org.eclipse.gemoc.gexpressions.GStringExpression) GIntegerExpression(org.eclipse.gemoc.gexpressions.GIntegerExpression) GAdditionExpression(org.eclipse.gemoc.gexpressions.GAdditionExpression) GExpressionsStandaloneSetup(org.eclipse.gemoc.gexpressions.xtext.GExpressionsStandaloneSetup) Serializer(org.eclipse.xtext.serializer.impl.Serializer)

Aggregations

GAdditionExpression (org.eclipse.gemoc.gexpressions.GAdditionExpression)3 GIntegerExpression (org.eclipse.gemoc.gexpressions.GIntegerExpression)2 GStringExpression (org.eclipse.gemoc.gexpressions.GStringExpression)2 Injector (com.google.inject.Injector)1 EPackage (org.eclipse.emf.ecore.EPackage)1 GAdditionOperator (org.eclipse.gemoc.gexpressions.GAdditionOperator)1 GAndExpression (org.eclipse.gemoc.gexpressions.GAndExpression)1 GBooleanExpression (org.eclipse.gemoc.gexpressions.GBooleanExpression)1 GBraceExpression (org.eclipse.gemoc.gexpressions.GBraceExpression)1 GDoubleExpression (org.eclipse.gemoc.gexpressions.GDoubleExpression)1 GEnumLiteralExpression (org.eclipse.gemoc.gexpressions.GEnumLiteralExpression)1 GEqualityExpression (org.eclipse.gemoc.gexpressions.GEqualityExpression)1 GIfExpression (org.eclipse.gemoc.gexpressions.GIfExpression)1 GImportStatement (org.eclipse.gemoc.gexpressions.GImportStatement)1 GMultiplicationExpression (org.eclipse.gemoc.gexpressions.GMultiplicationExpression)1 GNavigationExpression (org.eclipse.gemoc.gexpressions.GNavigationExpression)1 GNegationExpression (org.eclipse.gemoc.gexpressions.GNegationExpression)1 GOrExpression (org.eclipse.gemoc.gexpressions.GOrExpression)1 GProgram (org.eclipse.gemoc.gexpressions.GProgram)1 GReferenceExpression (org.eclipse.gemoc.gexpressions.GReferenceExpression)1