public override bool Walk(ListExpression node) { return(true); }
internal List(ListExpression list, expr_context ctx) : this() { _elts = PythonOps.MakeEmptyList(list.Items.Count); foreach (Compiler.Ast.Expression expr in list.Items) _elts.Add(Convert(expr, ctx)); _ctx = ctx; }
// listmaker: expression ( list_for | (',' expression)* [','] ) private Expression FinishListValue() { var oStart = GetStart(); var oEnd = GetEnd(); int grouping = _tokenizer.GroupingLevel; Expression ret; if (MaybeEat(TokenKind.RightBracket)) { ret = new ListExpression(); } else { bool prevAllow = _allowIncomplete; try { _allowIncomplete = true; Expression t0 = ParseExpression(); if (MaybeEat(TokenKind.Comma)) { List<Expression> l = ParseTestList(); Eat(TokenKind.RightBracket); l.Insert(0, t0); ret = new ListExpression(l.ToArray()); } else if (PeekToken(Tokens.KeywordForToken)) { ret = FinishListComp(t0); } else { Eat(TokenKind.RightBracket); ret = new ListExpression(t0); } } finally { _allowIncomplete = prevAllow; } } var cStart = GetStart(); var cEnd = GetEnd(); if (_sink != null) { _sink.MatchPair( new SourceSpan(_tokenizer.IndexToLocation(oStart), _tokenizer.IndexToLocation(oEnd)), new SourceSpan(_tokenizer.IndexToLocation(cStart), _tokenizer.IndexToLocation(cEnd)), grouping ); } ret.SetLoc(_globalParent, oStart, cEnd); return ret; }
public override bool Walk(ListExpression node) { node.Parent = _currentScope; return base.Walk(node); }
public override bool Walk(ListExpression node) { return true; }
public override void PostWalk(ListExpression node) { List<string> items = new List<string>(); for (int i = 0; i < node.Items.Count; i++) { items.Add(Content()); } items.Reverse(); Content("[{0}]", String.Join(", ", items)); CommonPostWalk(node, true); }
// ListExpression public override bool Walk(ListExpression node) { node.Parent = _currentScope; return(base.Walk(node)); }
// ListExpression public bool Walk(ListExpression node) { return Process(node); }
public override bool Walk(ListExpression node) { CommonWalk(node); return true; }
public override bool Walk(ListExpression node) => WalkItems(node.Items);
public void PostWalk(ListExpression node) { PostProcess(node); }
public static string Format(ListExpression node) { return("[" + node.Items.Format() + "]"); }
public virtual void PostWalk(ListExpression node) { }
// ListExpression public virtual bool Walk(ListExpression node) { return true; }
// /* // listmaker: test ( list_for | (',' test)* [','] ) // */ private Expression FinishListValue() { Location oStart = GetStart(); Location oEnd = GetEnd(); int grouping = tokenizer.GroupingLevel; Expression ret; if (MaybeEat(TokenKind.RightBracket)) { ret = new ListExpression(); } else { Expression t0 = ParseTest(); if (MaybeEat(TokenKind.Comma)) { List<Expression> l = ParseTestList(); Eat(TokenKind.RightBracket); l.Insert(0, t0); ret = new ListExpression(l.ToArray()); } else if (PeekToken(Tokens.KeywordForToken)) { ret = FinishListComp(t0); } else { Eat(TokenKind.RightBracket); ret = new ListExpression(t0); } } Location cStart = GetStart(); Location cEnd = GetEnd(); context.Sink.MatchPair(new CodeSpan(oStart, oEnd), new CodeSpan(cStart, cEnd), grouping); ret.SetLoc(GetExternal(), oStart, cEnd); return ret; }
public string Visit(PyAst.ListExpression node) => $"[{ VisitExpressionsList(node.Items)}]";