예제 #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));
            }
        }
 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);
 }
 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);
         }
     }
 }
 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);
 }