internal Print(PrintStatement stmt) : this() { if (stmt.Destination != null) _dest = Convert(stmt.Destination); _values = PythonOps.MakeEmptyList(stmt.Expressions.Count); foreach (Compiler.Ast.Expression expr in stmt.Expressions) _values.Add(Convert(expr)); _nl = !stmt.TrailingComma; }
//print_stmt: 'print' ( [ expression (',' expression)* [','] ] | '>>' expression [ (',' expression)+ [','] ] ) private PrintStatement ParsePrintStmt() { Eat(TokenKind.KeywordPrint); var start = GetStart(); Expression dest = null; PrintStatement ret; bool needNonEmptyTestList = false; if (MaybeEat(TokenKind.RightShift)) { dest = ParseExpression(); if (MaybeEat(TokenKind.Comma)) { needNonEmptyTestList = true; } else { ret = new PrintStatement(dest, new Expression[0], false); ret.SetLoc(_globalParent, start, GetEnd()); return ret; } } bool trailingComma; List<Expression> l = ParseExpressionList(out trailingComma); if (needNonEmptyTestList && l.Count == 0) { ReportSyntaxError(_lookahead); } Expression[] exprs = l.ToArray(); ret = new PrintStatement(dest, exprs, trailingComma); ret.SetLoc(_globalParent, start, GetEnd()); return ret; }
public override void PostWalk(PrintStatement node) { List<string> statements = new List<string>(); for (int i = 0; i < node.Expressions.Count; i++) { statements.Add(Content()); } statements.Reverse(); Content("print([{0}])", String.Join(", ", statements)); CommonPostWalk(node); }
public override bool Walk(PrintStatement node) { node.Parent = _currentScope; return base.Walk(node); }
// PrintStatement public bool Walk(PrintStatement node) { return Process(node); }
public override bool Walk(PrintStatement node) { CommonWalk(node); return true; }
// PrintStatement public override bool Walk(PrintStatement node) { node.Parent = _currentScope; return(base.Walk(node)); }
public void PostWalk(PrintStatement node) { PostProcess(node); }
public override bool Walk(PrintStatement node) { Emit(node); return false; }
public virtual void PostWalk(PrintStatement node) { }
// PrintStatement public virtual bool Walk(PrintStatement node) { return true; }
public void Visit(PyAst.PrintStatement node) => throw CreateNotImplementedEx();
public override bool Walk(PrintStatement node) { writer.WriteLine("PrintStatement"); return base.Walk(node); }