Exemplo n.º 1
0
        public override void PostWalk(ListComprehensionFor node)
        {
            string list = Content();
            string variable = Content();
            string predicate = Content();

            Content(String.Format("Python.comprehensionFor({0}, function({1}) {{ return {2}; }})",
                list,
                variable,
                predicate
            ));

            CommonPostWalk(node, true);
        }
Exemplo n.º 2
0
        // list_for: 'for' target_list 'in' old_expression_list [list_iter]
        private ListComprehensionFor ParseListCompFor() {
            Eat(TokenKind.KeywordFor);
            SourceLocation start = GetStart();
            bool trailingComma;
            List<Expression> l = ParseTargetList(out trailingComma);

            // expr list is something like:
            //  ()
            //  a
            //  a,b
            //  a,b,c
            // we either want just () or a or we want (a,b) and (a,b,c)
            // so we can do tupleExpr.EmitSet() or loneExpr.EmitSet()

            Expression lhs = MakeTupleOrExpr(l, trailingComma);
            Eat(TokenKind.KeywordIn);

            Expression list = null;
            list = ParseOldExpressionListAsExpr();

            ListComprehensionFor ret = new ListComprehensionFor(lhs, list);

            ret.SetLoc(start, GetEnd());
            return ret;
        }
Exemplo n.º 3
0
 public void Analyze(ListComprehensionFor lcf)
 {
     this.lcf = lcf;
     lcf.Left.Walk(this);
 }
Exemplo n.º 4
0
 public override bool Walk(ListComprehensionFor node)
 {
     CommonWalk(node);
     return true;
 }
 // ListComprehensionFor
 public bool Walk(ListComprehensionFor node)
 {
     return Process(node);
 }
Exemplo n.º 6
0
 // ListCompFor
 public override bool Walk(ListComprehensionFor node)
 {
     lcfAnalyzer.Analyze(node);
     return true;
 }
Exemplo n.º 7
0
 // ListComprehensionFor
 public override bool Walk(ListComprehensionFor node) {
     node.Left.Walk(_define);
     return true;
 }
 public void PostWalk(ListComprehensionFor node)
 {
     PostProcess(node);
 }
 public ListCompForDefinition(ListComprehensionFor listCompFor)
 {
     this.listCompFor = listCompFor;
 }
Exemplo n.º 10
0
 public virtual void PostWalk(ListComprehensionFor node)
 {
 }
Exemplo n.º 11
0
 // ListComprehensionFor
 public virtual bool Walk(ListComprehensionFor node)
 {
     return true;
 }
Exemplo n.º 12
0
 // ListComprehensionFor
 public override bool Walk(ListComprehensionFor node)
 {
     node.Parent = _currentScope;
     node.Left.Walk(_define);
     return(true);
 }
Exemplo n.º 13
0
        // list_for: 'for' exprlist 'in' testlist_safe [list_iter]
        private ListComprehensionFor ParseListCompFor()
        {
            Eat(TokenKind.KeywordFor);
            Location start = GetStart();
            List<Expression> l = ParseExprList();

            // expr list is something like:
            //  ()
            //  a
            //  a,b
            //  a,b,c
            // we either want just () or a or we want (a,b) and (a,b,c)
            // so we can do tupleExpr.EmitSet() or loneExpr.EmitSet()

            Expression lhs = MakeTupleOrExpr(l, false);
            Eat(TokenKind.KeywordIn);

            Expression list = null;
            if (Options.Python25 == true) {
                list = ParseTestListAsSafeExpr();
            } else {
                list = ParseTestListAsExpr(false);
            }

            ListComprehensionFor ret = new ListComprehensionFor(lhs, list);

            ret.SetLoc(GetExternal(), start, GetEnd());
            return ret;
        }