Search in sources :

Example 11 with Expression

use of com.avaloq.tools.ddk.xtext.expression.expression.Expression in project dsl-devkit by dsldevkit.

the class ChainExpressionImpl method basicSetNext.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetNext(Expression newNext, NotificationChain msgs) {
    Expression oldNext = next;
    next = newNext;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ExpressionPackage.CHAIN_EXPRESSION__NEXT, oldNext, newNext);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ChainExpression(com.avaloq.tools.ddk.xtext.expression.expression.ChainExpression) Expression(com.avaloq.tools.ddk.xtext.expression.expression.Expression) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 12 with Expression

use of com.avaloq.tools.ddk.xtext.expression.expression.Expression in project dsl-devkit by dsldevkit.

the class SwitchExpressionImpl method basicSetSwitchExpr.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetSwitchExpr(Expression newSwitchExpr, NotificationChain msgs) {
    Expression oldSwitchExpr = switchExpr;
    switchExpr = newSwitchExpr;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ExpressionPackage.SWITCH_EXPRESSION__SWITCH_EXPR, oldSwitchExpr, newSwitchExpr);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : SwitchExpression(com.avaloq.tools.ddk.xtext.expression.expression.SwitchExpression) Expression(com.avaloq.tools.ddk.xtext.expression.expression.Expression) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 13 with Expression

use of com.avaloq.tools.ddk.xtext.expression.expression.Expression in project dsl-devkit by dsldevkit.

the class ExpressionsExtentionsTest method serialize.

@Test
public final void serialize() throws IOException {
    Expression e = (Expression) getXtextTestUtil().getModel("test.expression." + getXtextTestUtil().getFileExtension(), "let x = 1 : 0");
    assertEquals("Simple serialization works", "let x = 1 : 0", ExpressionExtensions.serialize(e));
}
Also used : Expression(com.avaloq.tools.ddk.xtext.expression.expression.Expression) AbstractXtextTest(com.avaloq.tools.ddk.xtext.test.AbstractXtextTest) Test(org.junit.Test)

Example 14 with Expression

use of com.avaloq.tools.ddk.xtext.expression.expression.Expression in project dsl-devkit by dsldevkit.

the class ScopeJavaValidator method checkScopeRuleUniqueness.

/**
 * Checks that the all local scope rules (i.e. excluding inherited rules) have a unique context (context type, reference,
 * guard).
 *
 * @param context
 *          scoping section to check
 */
@Check
public void checkScopeRuleUniqueness(final ScopeModel context) {
    final Map<String, ScopeRule> profileMap = Maps.newHashMap();
    for (ScopeDefinition def : context.getScopes()) {
        for (ScopeRule rule : def.getRules()) {
            final Expression guard = rule.getContext().getGuard();
            // $NON-NLS-1$ //$NON-NLS-2$
            final String profile = ScopeUtil.getSignature(rule) + ":" + (guard != null ? serializer.serialize(guard) : "");
            final ScopeRule other = profileMap.get(profile);
            if (other != null) {
                errorOnDuplicate(rule, other, Messages.duplicatedScopeRule, ScopePackage.Literals.SCOPE_RULE__CONTEXT);
            } else {
                profileMap.put(profile, rule);
            }
        }
    }
}
Also used : ScopeDefinition(com.avaloq.tools.ddk.xtext.scope.scope.ScopeDefinition) GlobalScopeExpression(com.avaloq.tools.ddk.xtext.scope.scope.GlobalScopeExpression) Expression(com.avaloq.tools.ddk.xtext.expression.expression.Expression) SimpleScopeExpression(com.avaloq.tools.ddk.xtext.scope.scope.SimpleScopeExpression) ScopeRule(com.avaloq.tools.ddk.xtext.scope.scope.ScopeRule) Check(org.eclipse.xtext.validation.Check)

Example 15 with Expression

use of com.avaloq.tools.ddk.xtext.expression.expression.Expression in project dsl-devkit by dsldevkit.

the class GlobalScopeExpressionImpl method basicSetPrefix.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetPrefix(Expression newPrefix, NotificationChain msgs) {
    Expression oldPrefix = prefix;
    prefix = newPrefix;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ScopePackage.GLOBAL_SCOPE_EXPRESSION__PREFIX, oldPrefix, newPrefix);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : GlobalScopeExpression(com.avaloq.tools.ddk.xtext.scope.scope.GlobalScopeExpression) DataExpression(com.avaloq.tools.ddk.xtext.scope.scope.DataExpression) Expression(com.avaloq.tools.ddk.xtext.expression.expression.Expression) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Aggregations

Expression (com.avaloq.tools.ddk.xtext.expression.expression.Expression)36 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)33 GlobalScopeExpression (com.avaloq.tools.ddk.xtext.scope.scope.GlobalScopeExpression)4 IfExpression (com.avaloq.tools.ddk.xtext.expression.expression.IfExpression)3 DataExpression (com.avaloq.tools.ddk.xtext.scope.scope.DataExpression)3 ChainExpression (com.avaloq.tools.ddk.xtext.expression.expression.ChainExpression)2 CollectionExpression (com.avaloq.tools.ddk.xtext.expression.expression.CollectionExpression)2 LetExpression (com.avaloq.tools.ddk.xtext.expression.expression.LetExpression)2 SwitchExpression (com.avaloq.tools.ddk.xtext.expression.expression.SwitchExpression)2 SimpleScopeExpression (com.avaloq.tools.ddk.xtext.scope.scope.SimpleScopeExpression)2 InterfaceExpression (com.avaloq.tools.ddk.xtext.export.export.InterfaceExpression)1 CastedExpression (com.avaloq.tools.ddk.xtext.expression.expression.CastedExpression)1 TypeSelectExpression (com.avaloq.tools.ddk.xtext.expression.expression.TypeSelectExpression)1 FactoryExpression (com.avaloq.tools.ddk.xtext.scope.scope.FactoryExpression)1 NamingExpression (com.avaloq.tools.ddk.xtext.scope.scope.NamingExpression)1 ScopeDefinition (com.avaloq.tools.ddk.xtext.scope.scope.ScopeDefinition)1 ScopeExpression (com.avaloq.tools.ddk.xtext.scope.scope.ScopeExpression)1 ScopeRule (com.avaloq.tools.ddk.xtext.scope.scope.ScopeRule)1 AbstractXtextTest (com.avaloq.tools.ddk.xtext.test.AbstractXtextTest)1 Check (org.eclipse.xtext.validation.Check)1