Search in sources :

Example 41 with Expr

use of com.rockwellcollins.atc.agree.agree.Expr in project AGREE by loonwerks.

the class AgreeValidator method checkWheneverOccursStatement.

@Check(CheckType.FAST)
public void checkWheneverOccursStatement(WheneverOccursStatement whenever) {
    Expr cause = whenever.getCause();
    Expr effect = whenever.getEffect();
    checkExprIsIdentifier(cause);
    checkExprIsIdentifier(effect);
    TypeDef type = AgreeTypeSystem.infer(cause);
    if (!AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.BoolTypeDef, type)) {
        error(cause, "The cause of the 'whenever' statement is of type '" + type + "' " + "but must be of type 'bool'");
    }
    type = AgreeTypeSystem.infer(effect);
    if (!AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.BoolTypeDef, type)) {
        error(effect, "The effect of the 'whenever' statement is of type '" + type + "' " + "but must be of type 'bool'");
    }
}
Also used : EnumLitExpr(com.rockwellcollins.atc.agree.agree.EnumLitExpr) IndicesExpr(com.rockwellcollins.atc.agree.agree.IndicesExpr) TimeRiseExpr(com.rockwellcollins.atc.agree.agree.TimeRiseExpr) FlatmapExpr(com.rockwellcollins.atc.agree.agree.FlatmapExpr) TimeFallExpr(com.rockwellcollins.atc.agree.agree.TimeFallExpr) RealLitExpr(com.rockwellcollins.atc.agree.agree.RealLitExpr) GetPropertyExpr(com.rockwellcollins.atc.agree.agree.GetPropertyExpr) TimeOfExpr(com.rockwellcollins.atc.agree.agree.TimeOfExpr) PrevExpr(com.rockwellcollins.atc.agree.agree.PrevExpr) FoldRightExpr(com.rockwellcollins.atc.agree.agree.FoldRightExpr) TagExpr(com.rockwellcollins.atc.agree.agree.TagExpr) EventExpr(com.rockwellcollins.atc.agree.agree.EventExpr) LatchedExpr(com.rockwellcollins.atc.agree.agree.LatchedExpr) NamedElmExpr(com.rockwellcollins.atc.agree.agree.NamedElmExpr) SelectionExpr(com.rockwellcollins.atc.agree.agree.SelectionExpr) IfThenElseExpr(com.rockwellcollins.atc.agree.agree.IfThenElseExpr) ArraySubExpr(com.rockwellcollins.atc.agree.agree.ArraySubExpr) PreExpr(com.rockwellcollins.atc.agree.agree.PreExpr) RecordLitExpr(com.rockwellcollins.atc.agree.agree.RecordLitExpr) BinaryExpr(com.rockwellcollins.atc.agree.agree.BinaryExpr) UnaryExpr(com.rockwellcollins.atc.agree.agree.UnaryExpr) ExistsExpr(com.rockwellcollins.atc.agree.agree.ExistsExpr) FoldLeftExpr(com.rockwellcollins.atc.agree.agree.FoldLeftExpr) RecordUpdateExpr(com.rockwellcollins.atc.agree.agree.RecordUpdateExpr) ForallExpr(com.rockwellcollins.atc.agree.agree.ForallExpr) Expr(com.rockwellcollins.atc.agree.agree.Expr) ArrayUpdateExpr(com.rockwellcollins.atc.agree.agree.ArrayUpdateExpr) BoolLitExpr(com.rockwellcollins.atc.agree.agree.BoolLitExpr) NodeBodyExpr(com.rockwellcollins.atc.agree.agree.NodeBodyExpr) IntLitExpr(com.rockwellcollins.atc.agree.agree.IntLitExpr) CallExpr(com.rockwellcollins.atc.agree.agree.CallExpr) ArrayLiteralExpr(com.rockwellcollins.atc.agree.agree.ArrayLiteralExpr) AgreeTypeSystem.nameOfTypeDef(com.rockwellcollins.atc.agree.AgreeTypeSystem.nameOfTypeDef) ArrayTypeDef(com.rockwellcollins.atc.agree.AgreeTypeSystem.ArrayTypeDef) RecordTypeDef(com.rockwellcollins.atc.agree.AgreeTypeSystem.RecordTypeDef) TypeDef(com.rockwellcollins.atc.agree.AgreeTypeSystem.TypeDef) Check(org.eclipse.xtext.validation.Check)

Example 42 with Expr

use of com.rockwellcollins.atc.agree.agree.Expr in project AGREE by loonwerks.

the class AgreeValidator method checkArrayLiteralExpr.

@Check(CheckType.FAST)
public void checkArrayLiteralExpr(ArrayLiteralExpr alit) {
    // =======
    // public void checkRecordType(RecordType recType) {
    // DoubleDotRef recId = recType.getRecord();
    // NamedElement finalId = recId.getElm();
    // >>>>>>> origin/develop
    List<Expr> exprs = alit.getElems();
    if (exprs.size() == 0) {
        error(alit, "Array literal must have at least one element");
    }
    Expr target = exprs.get(0);
    checkTypeExists(target);
    TypeDef t1 = AgreeTypeSystem.infer(target);
    for (Expr e : exprs) {
        checkTypeExists(e);
        TypeDef t2 = AgreeTypeSystem.infer(e);
        if (!AgreeTypeSystem.typesEqual(t1, t2)) {
            error(e, "type of element must be " + nameOfTypeDef(t1) + ", but has type " + nameOfTypeDef(t2));
        }
    }
}
Also used : EnumLitExpr(com.rockwellcollins.atc.agree.agree.EnumLitExpr) IndicesExpr(com.rockwellcollins.atc.agree.agree.IndicesExpr) TimeRiseExpr(com.rockwellcollins.atc.agree.agree.TimeRiseExpr) FlatmapExpr(com.rockwellcollins.atc.agree.agree.FlatmapExpr) TimeFallExpr(com.rockwellcollins.atc.agree.agree.TimeFallExpr) RealLitExpr(com.rockwellcollins.atc.agree.agree.RealLitExpr) GetPropertyExpr(com.rockwellcollins.atc.agree.agree.GetPropertyExpr) TimeOfExpr(com.rockwellcollins.atc.agree.agree.TimeOfExpr) PrevExpr(com.rockwellcollins.atc.agree.agree.PrevExpr) FoldRightExpr(com.rockwellcollins.atc.agree.agree.FoldRightExpr) TagExpr(com.rockwellcollins.atc.agree.agree.TagExpr) EventExpr(com.rockwellcollins.atc.agree.agree.EventExpr) LatchedExpr(com.rockwellcollins.atc.agree.agree.LatchedExpr) NamedElmExpr(com.rockwellcollins.atc.agree.agree.NamedElmExpr) SelectionExpr(com.rockwellcollins.atc.agree.agree.SelectionExpr) IfThenElseExpr(com.rockwellcollins.atc.agree.agree.IfThenElseExpr) ArraySubExpr(com.rockwellcollins.atc.agree.agree.ArraySubExpr) PreExpr(com.rockwellcollins.atc.agree.agree.PreExpr) RecordLitExpr(com.rockwellcollins.atc.agree.agree.RecordLitExpr) BinaryExpr(com.rockwellcollins.atc.agree.agree.BinaryExpr) UnaryExpr(com.rockwellcollins.atc.agree.agree.UnaryExpr) ExistsExpr(com.rockwellcollins.atc.agree.agree.ExistsExpr) FoldLeftExpr(com.rockwellcollins.atc.agree.agree.FoldLeftExpr) RecordUpdateExpr(com.rockwellcollins.atc.agree.agree.RecordUpdateExpr) ForallExpr(com.rockwellcollins.atc.agree.agree.ForallExpr) Expr(com.rockwellcollins.atc.agree.agree.Expr) ArrayUpdateExpr(com.rockwellcollins.atc.agree.agree.ArrayUpdateExpr) BoolLitExpr(com.rockwellcollins.atc.agree.agree.BoolLitExpr) NodeBodyExpr(com.rockwellcollins.atc.agree.agree.NodeBodyExpr) IntLitExpr(com.rockwellcollins.atc.agree.agree.IntLitExpr) CallExpr(com.rockwellcollins.atc.agree.agree.CallExpr) ArrayLiteralExpr(com.rockwellcollins.atc.agree.agree.ArrayLiteralExpr) AgreeTypeSystem.nameOfTypeDef(com.rockwellcollins.atc.agree.AgreeTypeSystem.nameOfTypeDef) ArrayTypeDef(com.rockwellcollins.atc.agree.AgreeTypeSystem.ArrayTypeDef) RecordTypeDef(com.rockwellcollins.atc.agree.AgreeTypeSystem.RecordTypeDef) TypeDef(com.rockwellcollins.atc.agree.AgreeTypeSystem.TypeDef) Check(org.eclipse.xtext.validation.Check)

Example 43 with Expr

use of com.rockwellcollins.atc.agree.agree.Expr in project AGREE by loonwerks.

the class WheneverImpliesStatementImpl method basicSetLhs.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetLhs(Expr newLhs, NotificationChain msgs) {
    Expr oldLhs = lhs;
    lhs = newLhs;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AgreePackage.WHENEVER_IMPLIES_STATEMENT__LHS, oldLhs, newLhs);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : Expr(com.rockwellcollins.atc.agree.agree.Expr) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 44 with Expr

use of com.rockwellcollins.atc.agree.agree.Expr in project AGREE by loonwerks.

the class WheneverStatementImpl method basicSetCause.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetCause(Expr newCause, NotificationChain msgs) {
    Expr oldCause = cause;
    cause = newCause;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AgreePackage.WHENEVER_STATEMENT__CAUSE, oldCause, newCause);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : Expr(com.rockwellcollins.atc.agree.agree.Expr) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 45 with Expr

use of com.rockwellcollins.atc.agree.agree.Expr in project AGREE by loonwerks.

the class UnaryExprImpl method basicSetExpr.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetExpr(Expr newExpr, NotificationChain msgs) {
    Expr oldExpr = expr;
    expr = newExpr;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AgreePackage.UNARY_EXPR__EXPR, oldExpr, newExpr);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : UnaryExpr(com.rockwellcollins.atc.agree.agree.UnaryExpr) Expr(com.rockwellcollins.atc.agree.agree.Expr) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Aggregations

Expr (com.rockwellcollins.atc.agree.agree.Expr)103 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)69 BinaryExpr (com.rockwellcollins.atc.agree.agree.BinaryExpr)34 BoolLitExpr (com.rockwellcollins.atc.agree.agree.BoolLitExpr)34 IfThenElseExpr (com.rockwellcollins.atc.agree.agree.IfThenElseExpr)34 NamedElmExpr (com.rockwellcollins.atc.agree.agree.NamedElmExpr)34 RealLitExpr (com.rockwellcollins.atc.agree.agree.RealLitExpr)34 UnaryExpr (com.rockwellcollins.atc.agree.agree.UnaryExpr)34 IntLitExpr (com.rockwellcollins.atc.agree.agree.IntLitExpr)33 EventExpr (com.rockwellcollins.atc.agree.agree.EventExpr)32 PreExpr (com.rockwellcollins.atc.agree.agree.PreExpr)32 SelectionExpr (com.rockwellcollins.atc.agree.agree.SelectionExpr)32 CallExpr (com.rockwellcollins.atc.agree.agree.CallExpr)31 EnumLitExpr (com.rockwellcollins.atc.agree.agree.EnumLitExpr)31 NodeBodyExpr (com.rockwellcollins.atc.agree.agree.NodeBodyExpr)31 PrevExpr (com.rockwellcollins.atc.agree.agree.PrevExpr)31 RecordLitExpr (com.rockwellcollins.atc.agree.agree.RecordLitExpr)31 FoldLeftExpr (com.rockwellcollins.atc.agree.agree.FoldLeftExpr)30 FoldRightExpr (com.rockwellcollins.atc.agree.agree.FoldRightExpr)30 ArraySubExpr (com.rockwellcollins.atc.agree.agree.ArraySubExpr)29