Search in sources :

Example 31 with Expr

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

the class AgreeValidator method checkArrayUpdateExpr.

@Check(CheckType.FAST)
public void checkArrayUpdateExpr(ArrayUpdateExpr arrup) {
    List<Expr> exprs = arrup.getValueExprs();
    Expr arrExpr = arrup.getArray();
    checkTypeExists(arrExpr);
    TypeDef arrType = AgreeTypeSystem.infer(arrExpr);
    if (arrType instanceof ArrayTypeDef) {
        TypeDef t = ((ArrayTypeDef) arrType).stemType;
        TypeDef elmType = AgreeTypeSystem.infer(exprs.get(0));
        if (!AgreeTypeSystem.typesEqual(elmType, t)) {
            error(exprs.get(0), "type of element must be " + nameOfTypeDef(elmType) + ", but has type " + nameOfTypeDef(t));
        }
    } else {
        error(arrExpr, "expression must evaluate to an array");
    }
}
Also used : ArrayTypeDef(com.rockwellcollins.atc.agree.AgreeTypeSystem.ArrayTypeDef) 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 32 with Expr

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

the class AgreeValidator method checkAssume.

@Check(CheckType.FAST)
public void checkAssume(AssumeStatement assume) {
    Classifier comp = assume.getContainingClassifier();
    if (!(comp instanceof ComponentType)) {
        error(assume, "Assume statements are allowed only in component types");
    }
    // the expression could be null if a pattern is used
    Expr expr = assume.getExpr();
    if (expr != null) {
        TypeDef exprType = AgreeTypeSystem.infer(expr);
        if (!AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.BoolTypeDef, exprType)) {
            error(assume, "Expression for assume statement is of type '" + nameOfTypeDef(exprType) + "' but must be of type 'bool'");
        }
    }
    if (assume.getName() == null) {
        info(assume, "It is recommended that assume statements be named." + " (Hint: an identifier may be placed between the \"assume\" keyword and the quoted description.)");
    }
}
Also used : ComponentType(org.osate.aadl2.ComponentType) 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) ComponentClassifier(org.osate.aadl2.ComponentClassifier) Classifier(org.osate.aadl2.Classifier) Check(org.eclipse.xtext.validation.Check)

Example 33 with Expr

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

the class AgreeValidator method checkConstStatement.

@Check(CheckType.FAST)
public void checkConstStatement(ConstStatement constStat) {
    TypeDef expected = AgreeTypeSystem.typeDefFromType(constStat.getType());
    TypeDef actual = AgreeTypeSystem.infer(constStat.getExpr());
    if (!AgreeTypeSystem.typesEqual(expected, actual)) {
        error(constStat, "The assumed type of constant statement '" + constStat.getName() + "' is '" + expected + "' but the actual type is '" + actual + "'");
    }
    // check for constant cycles
    Set<ConstStatement> constClosure = new HashSet<>();
    Set<ConstStatement> prevClosure;
    constClosure.add(constStat);
    // quick and dirty cycle check
    do {
        prevClosure = new HashSet<>(constClosure);
        for (ConstStatement constFrontElem : prevClosure) {
            List<SelectionExpr> nestIds = EcoreUtil2.getAllContentsOfType(constFrontElem, SelectionExpr.class);
            for (Expr nestId : nestIds) {
                while (nestId instanceof SelectionExpr) {
                    NamedElement base = ((SelectionExpr) nestId).getField();
                    if (base instanceof ConstStatement) {
                        ConstStatement closConst = (ConstStatement) base;
                        if (closConst.equals(constStat)) {
                            error(constStat, "The expression for constant statment '" + constStat.getName() + "' is part of a cyclic definition");
                            break;
                        }
                        constClosure.add(closConst);
                    }
                    nestId = ((SelectionExpr) nestId).getTarget();
                }
                NamedElement base = ((NamedElmExpr) nestId).getElm();
                if (base instanceof ConstStatement) {
                    ConstStatement closConst = (ConstStatement) base;
                    if (closConst.equals(constStat)) {
                        error(constStat, "The expression for constant statment '" + constStat.getName() + "' is part of a cyclic definition");
                        break;
                    }
                    constClosure.add(closConst);
                }
            }
        }
    } while (!prevClosure.equals(constClosure));
    for (Expr e : EcoreUtil2.getAllContentsOfType(constStat.getExpr(), Expr.class)) {
        if (!exprIsConstant(e)) {
            error(e, "Non-constant expression in constant declaration");
            return;
        }
    }
}
Also used : ConstStatement(com.rockwellcollins.atc.agree.agree.ConstStatement) 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) 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) SelectionExpr(com.rockwellcollins.atc.agree.agree.SelectionExpr) NamedElement(org.osate.aadl2.NamedElement) HashSet(java.util.HashSet) NamedElmExpr(com.rockwellcollins.atc.agree.agree.NamedElmExpr) Check(org.eclipse.xtext.validation.Check)

Example 34 with Expr

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

the class AgreeValidator method checkBinaryExpr.

@Check(CheckType.FAST)
public void checkBinaryExpr(BinaryExpr binExpr) {
    checkTypeExists(binExpr.getLeft());
    checkTypeExists(binExpr.getRight());
    TypeDef typeLeft = AgreeTypeSystem.infer(binExpr.getLeft());
    TypeDef typeRight = AgreeTypeSystem.infer(binExpr.getRight());
    String op = binExpr.getOp();
    Expr rightSide = binExpr.getRight();
    Expr leftSide = binExpr.getLeft();
    boolean isInLinearizationBodyExpr = isInLinearizationBody(binExpr);
    boolean rightSideConst = exprIsConst(rightSide);
    boolean leftSideConst = exprIsConst(leftSide);
    switch(op) {
        case "->":
            if (isInLinearizationBodyExpr) {
                error(binExpr, "Arrow '->' expressions are not allowed in linearization body expressions.");
            } else {
                if (!AgreeTypeSystem.typesEqual(typeRight, typeLeft)) {
                    error(binExpr, "left and right sides of binary expression '" + op + "' are of type '" + nameOfTypeDef(typeLeft) + "' and '" + nameOfTypeDef(typeRight) + "', but must be of the same type");
                }
            }
            return;
        case "=>":
        case "<=>":
        case "and":
        case "or":
            if (isInLinearizationBodyExpr) {
                error(binExpr, "Logical expressions (like '" + op + "') are not allowed in linearization body expressions.");
            } else {
                if (!AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.BoolTypeDef, typeLeft)) {
                    error(binExpr, "left side of binary expression '" + op + "' is of type '" + nameOfTypeDef(typeLeft) + "' but must be of " + "type 'bool'");
                }
                if (!AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.BoolTypeDef, typeRight)) {
                    error(binExpr, "right side of binary expression '" + op + "' is of type '" + nameOfTypeDef(typeRight) + "' but must be of" + " type 'bool'");
                }
            }
            return;
        case "=":
        case "<>":
        case "!=":
            if (isInLinearizationBodyExpr) {
                error(binExpr, "Logical comparison expressions (like '" + op + "') are not allowed in linearization body expressions.");
            } else {
                if (!AgreeTypeSystem.typesEqual(typeRight, typeLeft)) {
                    error(binExpr, "left and right sides of binary expression '" + op + "' are of type '" + nameOfTypeDef(typeLeft) + "' and '" + nameOfTypeDef(typeRight) + "', but must be of the same type");
                }
            }
            return;
        case "<":
        case "<=":
        case ">":
        case ">=":
            if (isInLinearizationBodyExpr) {
                error(binExpr, "Comparison expressions (like '" + op + "') are not allowed in linearization body expressions.");
            } else {
                if (!AgreeTypeSystem.typesEqual(typeRight, typeLeft)) {
                    error(binExpr, "left and right sides of binary expression '" + op + "' are of type '" + nameOfTypeDef(typeLeft) + "' and '" + nameOfTypeDef(typeRight) + "', but must be of the same type");
                }
                if (!AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.IntTypeDef, typeLeft) && !AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.RealTypeDef, typeLeft)) {
                    error(binExpr, "left side of binary expression '" + op + "' is of type '" + nameOfTypeDef(typeLeft) + "' but must be of type" + "'int' or 'real'");
                }
                if (!AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.IntTypeDef, typeRight) && !AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.RealTypeDef, typeRight)) {
                    error(binExpr, "right side of binary expression '" + op + "' is of type '" + nameOfTypeDef(typeRight) + "' but must be of type" + "'int' or 'real'");
                }
            }
            return;
        case "+":
        case "-":
        case "*":
            if (!AgreeTypeSystem.typesEqual(typeRight, typeLeft)) {
                error(binExpr, "left and right sides of binary expression '" + op + "' are of type '" + nameOfTypeDef(typeLeft) + "' and '" + nameOfTypeDef(typeRight) + "', but must be of the same type");
            }
            if (!AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.IntTypeDef, typeLeft) && !AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.RealTypeDef, typeLeft)) {
                error(binExpr, "left side of binary expression '" + op + "' is of type '" + nameOfTypeDef(typeLeft) + "' but must be of type" + "'int' or 'real'");
            }
            if (!AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.IntTypeDef, typeRight) && !AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.RealTypeDef, typeRight)) {
                error(binExpr, "right side of binary expression '" + op + "' is of type '" + nameOfTypeDef(typeRight) + "' but must be of type" + "'int' or 'real'");
            }
            if (op.equals("*") && !isInLinearizationBodyExpr) {
                if (!rightSideConst && !leftSideConst) {
                    warning(binExpr, "neither the right nor the left side of binary expression '" + op + "' is constant'.  Non-linear expressions are allowed only with z3 and dReal." + " With z3 they are not recomended.");
                }
            }
            return;
        case "mod":
        case "div":
            if (isInLinearizationBodyExpr) {
                error(binExpr, "Integer operation expressions (like '" + op + "') are not allowed in linearization body expressions.");
            } else {
                if (!AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.IntTypeDef, typeLeft)) {
                    error(binExpr, "left side of binary expression '" + op + "' is of type '" + nameOfTypeDef(typeLeft) + "' but must be of type 'int'");
                }
                if (!AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.IntTypeDef, typeRight)) {
                    error(binExpr, "right side of binary expression '" + op + "' is of type '" + nameOfTypeDef(typeRight) + "' but must be of type 'int'");
                }
                if (!rightSideConst) {
                    warning(binExpr, "right side of binary expression '" + op + "' is not constant." + " Non-linear expressions are allowed only with z3." + " Even with z3 they are not recomended...");
                }
            }
            return;
        case "/":
            if (!AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.RealTypeDef, typeLeft)) {
                error(binExpr, "left side of binary expression '" + op + "' is of type '" + nameOfTypeDef(typeLeft) + "' but must be of type 'real'");
            }
            if (!AgreeTypeSystem.typesEqual(AgreeTypeSystem.Prim.RealTypeDef, typeRight)) {
                error(binExpr, "right side of binary expression '" + op + "' is of type '" + nameOfTypeDef(typeRight) + "' but must be of type 'real'");
            }
            if (!rightSideConst && !isInLinearizationBodyExpr) {
                warning(binExpr, "right side of binary expression '" + op + "' is not constant." + " Non-linear expressions are allowed only with z3." + " Even with z3 they are not recomended...");
            }
            return;
        default:
            assert (false);
    }
}
Also used : 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) 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) Check(org.eclipse.xtext.validation.Check)

Example 35 with Expr

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

the class AgreeValidator method checkTimeInterval.

@Check(CheckType.FAST)
public void checkTimeInterval(TimeInterval interval) {
    Expr lower = interval.getLow();
    Expr higher = interval.getHigh();
    if (!(lower instanceof RealLitExpr || isTimingConst(lower))) {
        error(lower, "Lower interval must be a real valued literal");
    }
    if (!(higher instanceof RealLitExpr || isTimingConst(higher))) {
        error(higher, "higher interval must be a real valued literal");
    }
}
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) RealLitExpr(com.rockwellcollins.atc.agree.agree.RealLitExpr) Check(org.eclipse.xtext.validation.Check)

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