예제 #1
0
        /// <summary>
        /// Validate a quantified expression.
        /// </summary>
        /// <param name="qex">
        ///            is the quantified expression. </param>
        /// <returns> null. </returns>
        public virtual object visit(QuantifiedExpr qex)
        {
            // lets cheat
            doForExpr(qex.iterator(), qex.expr());

            return(null);
        }
예제 #2
0
 ///
 /// <param name="qex">
 ///            is the Quantified expression. </param>
 /// <returns> qex expression. </returns>
 public virtual object visit(QuantifiedExpr qex)
 {
     for (IEnumerator <VarExprPair> i = qex.iterator(); i.MoveNext();)
     {
         i.Current.expr().accept(this);
     }
     qex.expr().accept(this);
     return(null);
 }
예제 #3
0
        ///
        /// <param name="qex">
        ///            is the Quantified expression. </param>
        /// <returns> qex expression. </returns>
        // XXX: code duplication
        public virtual object visit(QuantifiedExpr qex)
        {
            QuantifiedExpr last  = qex;
            Expr           ret   = qex.expr();
            int            depth = 0;

            for (IEnumerator i = qex.iterator(); i.MoveNext();)
            {
                VarExprPair ve = (VarExprPair)i.Current;

                // ok we got nested fors...
                if (depth > 0)
                {
                    var pairs = new List <VarExprPair>();
                    pairs.Add(ve);

                    QuantifiedExpr qe = new QuantifiedExpr(qex.type(), pairs, ret);
                    last.set_expr(qe);

                    last = qe;
                }

                depth++;
            }

            // normalize return value, and set it to the last for expr
            ret.accept(this);

            // get rid of the pairs in the parent (original) for
            if (depth > 1)
            {
                qex.truncate_pairs();
            }

            return(qex);
        }