示例#1
0
 public override bool Walk(DelStatement node)
 {
     foreach (var expr in node.Expressions) {
         DefineExpr(expr);
     }
     return false;
 }
示例#2
0
文件: Parser.cs 项目: borota/JTVS
        // 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;
        }
示例#3
0
 // DelStmt
 public override void PostWalk(DelStatement node)
 {
     foreach (Expression e in node.Expressions) {
         e.Walk(_fdel);
     }
 }
示例#4
0
 public override bool Walk(DelStatement node)
 {
     UpdateChildRanges(node);
     return base.Walk(node);
 }
示例#5
0
 // DelStatement
 public override bool Walk(DelStatement node)
 {
     return ShouldWalkWorker(node);
 }
示例#6
0
 public override void PostWalk(DelStatement node)
 {
     PostWalkWorker(node);
 }