예제 #1
0
 ///
 /// <param name="fex">
 ///            is the For expression. </param>
 /// <returns> fex expression. </returns>
 public virtual object visit(ForExpr fex)
 {
     for (IEnumerator <VarExprPair> i = fex.iterator(); i.MoveNext();)
     {
         i.Current.expr().accept(this);
     }
     fex.expr().accept(this);
     return(null);
 }
예제 #2
0
        ///
        /// <param name="fex">
        ///            is the For expression. </param>
        /// <returns> fex expression. </returns>
        public virtual object visit(ForExpr fex)
        {
            ForExpr last  = fex;
            Expr    ret   = fex.expr();
            int     depth = 0;

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

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

                    ForExpr fe = new ForExpr(pairs, ret);
                    last.set_expr(fe);

                    last = fe;
                }

                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)
            {
                fex.truncate_pairs();
            }

            return(fex);
        }
예제 #3
0
        /// <summary>
        /// Validate a for expression.
        /// </summary>
        /// <param name="fex">
        ///            is the for expression. </param>
        /// <returns> null. </returns>
        public virtual object visit(ForExpr fex)
        {
            doForExpr(fex.iterator(), fex.expr());

            return(null);
        }