Exemple #1
0
        // del_stmt: "del" target_list
        //  for error reporting reasons we allow any expression and then report the bad
        //  delete node when it fails.  This is the reason we don't call ParseTargetList.
        private Statement ParseDelStmt() {
            var curLookahead = _lookahead;
            NextToken();
            string delWhiteSpace = _tokenWhiteSpace;
            var start = GetStart();
            List<string> itemWhiteSpace;

            DelStatement ret;
            if (PeekToken(TokenKind.NewLine) || PeekToken(TokenKind.EndOfFile)) {
                ReportSyntaxError(curLookahead.Span.Start, curLookahead.Span.End, "expected expression after del");
                ret = new DelStatement(new Expression[0]);
            } else {
                List<Expression> l = ParseExprList(out itemWhiteSpace);
                foreach (Expression e in l) {
                    if (e is ErrorExpression) {
                        continue;
                    }
                    string delError = e.CheckDelete();
                    if (delError != null) {
                        ReportSyntaxError(e.StartIndex, e.EndIndex, delError, ErrorCodes.SyntaxError);
                    }
                }

                ret = new DelStatement(l.ToArray());
                if (itemWhiteSpace != null) {
                    AddListWhiteSpace(ret, itemWhiteSpace.ToArray());
                }
            }

            ret.SetLoc(start, GetEnd());
            if (_verbatim) {
                AddPreceedingWhiteSpace(ret, delWhiteSpace);
            }
            return ret;
        }
 public override bool Walk(DelStatement node) {
     CanComplete = IsActualExpression(node.Expressions);
     CommitByDefault = true;
     return base.Walk(node);
 }
Exemple #3
0
        public override bool Walk(DelStatement node) {
            UpdateLineInfo(node);

            return base.Walk(node);
        }
Exemple #4
0
 // DelStatement
 public override bool Walk(DelStatement node) {
     foreach (Expression e in node.Expressions) {
         e.Walk(_delete);
     }
     return true;
 }
Exemple #5
0
 public override bool Walk(DelStatement node) {
     UpdateChildRanges(node);
     return base.Walk(node);
 }
Exemple #6
0
 public override bool Walk(DelStatement node) {
     foreach (var expr in node.Expressions) {
         DefineExpr(expr);
     }
     return false;
 }
Exemple #7
0
 // DelStmt
 public override void PostWalk(DelStatement node) {
     foreach (Expression e in node.Expressions) {
         e.Walk(_fdel);
     }
 }
Exemple #8
0
 public override void PostWalk(DelStatement node) { PostWalkWorker(node); }
Exemple #9
0
 // DelStatement
 public override bool Walk(DelStatement node) { return ShouldWalkWorker(node); }