*/
public static ExprInt toExprInt(Expression expr) {
if(expr instanceof ExprInt) return (ExprInt) expr;
if(expr instanceof Literal) {
Double dbl = ((Literal)expr).getDouble(null);
if(dbl!=null) return new LitInteger((int)dbl.doubleValue(),expr.getStart(),expr.getEnd());
}
return new CastInt(expr);
}