コード例 #1
0
        internal override void AppendCodeStringStmt(StringBuilder res, PythonAst ast, CodeFormattingOptions format)
        {
            var namesWhiteSpace = this.GetNamesWhiteSpace(ast);

            if (namesWhiteSpace != null)
            {
                ListExpression.AppendItems(res, ast, format, "global", "", this, Names.Count, (i, sb) => {
                    sb.Append(namesWhiteSpace[i]);
                    Names[i].AppendCodeString(res, ast, format);
                });
            }
            else
            {
                ListExpression.AppendItems(res, ast, format, "global", "", this, Names.Count, (i, sb) => Names[i].AppendCodeString(sb, ast, format));
            }
        }
コード例 #2
0
 internal override void AppendCodeStringStmt(StringBuilder res, PythonAst ast, CodeFormattingOptions format)
 {
     format.ReflowComment(res, this.GetPreceedingWhiteSpace(ast));
     res.Append("print");
     if (Destination != null)
     {
         res.Append(this.GetSecondWhiteSpace(ast));
         res.Append(">>");
         Destination.AppendCodeString(res, ast, format);
         if (Expressions.Count > 0)
         {
             res.Append(this.GetThirdWhiteSpace(ast));
             res.Append(',');
         }
     }
     ListExpression.AppendItems(res, ast, format, string.Empty, string.Empty, this, Expressions);
 }
コード例 #3
0
 internal override void AppendCodeString(StringBuilder res, PythonAst ast, CodeFormattingOptions format)
 {
     if (this.IsAltForm(ast))
     {
         ListExpression.AppendItems(res, ast, format, "", "", this, Items);
     }
     else
     {
         if (Items.Count == 0 &&
             format.SpaceWithinEmptyTupleExpression != null)
         {
             format.ReflowComment(res, this.GetPreceedingWhiteSpace(ast));
             res.Append('(');
             format.Append(res, format.SpaceWithinEmptyTupleExpression, " ", "", this.GetSecondWhiteSpaceDefaultNull(ast));
             res.Append(')');
         }
         else
         {
             ListExpression.AppendItems(res, ast, format, "(", this.IsMissingCloseGrouping(ast) ? "" : ")", this, Items, format.SpacesWithinParenthesisedTupleExpression);
         }
     }
 }
コード例 #4
0
 internal override void AppendCodeStringStmt(StringBuilder res, PythonAst ast, CodeFormattingOptions format)
 => ListExpression.AppendItems(res, ast, format, "del", string.Empty, this, Expressions);
コード例 #5
0
 public override bool Walk(ListExpression node) => true;
コード例 #6
0
 internal override void AppendCodeString(StringBuilder res, PythonAst ast, CodeFormattingOptions format) => ListExpression.AppendItems(res, ast, format, "{", this.IsMissingCloseGrouping(ast) ? "" : "}", this, Items);
コード例 #7
0
 public override void PostWalk(ListExpression node)
 {
 }
コード例 #8
0
 // ListExpression
 public override bool Walk(ListExpression node)
 {
     return(false);
 }
コード例 #9
0
 public virtual void PostWalk(ListExpression node)
 {
 }
コード例 #10
0
 // ListExpression
 public virtual bool Walk(ListExpression node)
 {
     return(true);
 }
コード例 #11
0
 // ListExpression
 public override bool Walk(ListExpression node)
 {
     return(Location >= node.StartIndex && Location <= node.EndIndex);
 }