internal override void AppendCodeString(StringBuilder res, PythonAst ast, CodeFormattingOptions format, string leadingWhiteSpace) { var kwOnlyText = this.GetExtraVerbatimText(ast); if (kwOnlyText != null) { if (leadingWhiteSpace != null) { res.Append(leadingWhiteSpace); res.Append(kwOnlyText.TrimStart()); leadingWhiteSpace = null; } else { res.Append(kwOnlyText); } } var writeName = true; switch (Kind) { case ParameterKind.Dictionary: res.Append(leadingWhiteSpace ?? this.GetPreceedingWhiteSpaceDefaultNull(ast) ?? string.Empty); leadingWhiteSpace = null; res.Append("**"); break; case ParameterKind.List: res.Append(leadingWhiteSpace ?? this.GetPreceedingWhiteSpaceDefaultNull(ast) ?? string.Empty); leadingWhiteSpace = null; res.Append('*'); break; case ParameterKind.PositionalOnly: case ParameterKind.Normal: if (this.IsAltForm(ast)) { res.Append(leadingWhiteSpace ?? this.GetPreceedingWhiteSpaceDefaultNull(ast) ?? string.Empty); leadingWhiteSpace = null; res.Append('('); AppendParameterName(res, ast, format, leadingWhiteSpace); if (!this.IsMissingCloseGrouping(ast)) { res.Append(this.GetSecondWhiteSpace(ast)); res.Append(')'); } writeName = false; } break; case ParameterKind.KeywordOnly: break; case ParameterKind.PositionalOnlyMarker: res.Append(leadingWhiteSpace ?? this.GetPreceedingWhiteSpaceDefaultNull(ast) ?? string.Empty); leadingWhiteSpace = null; res.Append('/'); break; default: throw new InvalidOperationException(); } if (writeName) { AppendParameterName(res, ast, format, leadingWhiteSpace); } if (Annotation != null) { res.Append(this.GetThirdWhiteSpaceDefaultNull(ast) ?? ""); res.Append(':'); Annotation.AppendCodeString(res, ast, format); } if (DefaultValue != null) { format.Append( res, format.SpaceAroundDefaultValueEquals, " ", string.Empty, NodeAttributes.GetWhiteSpace(this, ast, WhitespacePrecedingAssign) ); res.Append('='); if (format.SpaceAroundDefaultValueEquals != null) { DefaultValue.AppendCodeString(res, ast, format, format.SpaceAroundDefaultValueEquals.Value ? " " : string.Empty); } else { DefaultValue.AppendCodeString(res, ast, format); } } }