Exemple #1
0
 //while_stmt: 'while' expression ':' suite ['else' ':' suite]
 private WhileStatement ParseWhileStmt()
 {
     Eat(TokenKind.KeywordWhile);
     string whileWhiteSpace = _tokenWhiteSpace;
     var start = GetStart();
     Expression expr = ParseExpression();
     var mid = GetEnd();
     Statement body = ParseLoopSuite();
     Statement else_ = null;
     string elseWhiteSpace = null;
     int end = body.EndIndex;
     if (MaybeEat(TokenKind.KeywordElse)) {
         elseWhiteSpace = _tokenWhiteSpace;
         else_ = ParseSuite();
         end = else_.EndIndex;
     }
     WhileStatement ret = new WhileStatement(expr, body, else_);
     ret.SetLoc(start, mid, end);
     if (_verbatim) {
         AddPreceedingWhiteSpace(ret, whileWhiteSpace);
         if (elseWhiteSpace != null) {
             AddSecondPreceedingWhiteSpace(ret, elseWhiteSpace);
         }
     }
     return ret;
 }
Exemple #2
0
 public override bool Walk(WhileStatement node)
 {
     UpdateChildRanges(node);
     return base.Walk(node);
 }
Exemple #3
0
        // WhileStmt
        public override bool Walk(WhileStatement node)
        {
            // Walk the expression
            node.Test.Walk(this);

            BitArray opte = node.ElseStatement != null ? new BitArray(_bits) : null;
            BitArray exit = new BitArray(_bits.Length, true);

            PushLoop(exit);
            node.Body.Walk(this);
            PopLoop();

            _bits.And(exit);

            if (node.ElseStatement != null) {
                // Flow the else
                BitArray save = _bits;
                _bits = opte;
                node.ElseStatement.Walk(this);
                // Restore the bits
                _bits = save;

                // Intersect
                _bits.And(opte);
            }

            return false;
        }
Exemple #4
0
 // WhileStatement
 public override bool Walk(WhileStatement node)
 {
     return ShouldWalkWorker(node);
 }
Exemple #5
0
 public override void PostWalk(WhileStatement node)
 {
     PostWalkWorker(node);
 }
Exemple #6
0
 public override bool Walk(WhileStatement node)
 {
     WalkLoop(node.Body, node.ElseStatement);
     return false;
 }
Exemple #7
0
 public override bool Walk(WhileStatement node)
 {
     if (node.Test != null) {
         node.Test.Walk(this);
     }
     if (node.Body != null) {
         bool oldInLoop = _inLoop;
         _inLoop = true;
         node.Body.Walk(this);
         _inLoop = oldInLoop;
     }
     if (node.ElseStatement != null) {
         node.ElseStatement.Walk(this);
     }
     return false;
 }
Exemple #8
0
 public override bool Walk(WhileStatement node)
 {
     return false;
 }