From 175c1b90824e05469dbcde72b3d1650d48801d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Sun, 15 Mar 2009 07:33:06 +0000 Subject: [PATCH] * Src/PrettyPrinter/CSharp/OutputFormatter.cs: * Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs: * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Added some formatting options. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3854 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../CSharp/CSharpOutputVisitor.cs | 187 +++++++++++++++++- .../PrettyPrinter/CSharp/OutputFormatter.cs | 7 + .../CSharp/PrettyPrintOptions.cs | 171 +++++++++++++++- 3 files changed, 355 insertions(+), 10 deletions(-) diff --git a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs index de90bc649b..a70ac4eac5 100644 --- a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs +++ b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs @@ -6,6 +6,7 @@ // using System; +using System.Linq; using System.Collections; using System.Collections.Generic; using System.Diagnostics; @@ -243,6 +244,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter { outputFormatter.PrintIdentifier(attribute.Name); outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } this.AppendCommaSeparatedList(attribute.PositionalArguments); if (attribute.NamedArguments != null && attribute.NamedArguments.Count > 0) { @@ -256,6 +260,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter } } } + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -480,7 +487,14 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + bool withinParentheses = this.prettyPrintOptions.WithinMethodDeclarationParentheses && delegateDeclaration.Parameters.Any (); + if (withinParentheses) { + outputFormatter.Space(); + } AppendCommaSeparatedList(delegateDeclaration.Parameters); + if (withinParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); foreach (TemplateDefinition templateDefinition in delegateDeclaration.Templates) { TrackVisit(templateDefinition, data); @@ -719,11 +733,18 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + bool withinParentheses = this.prettyPrintOptions.WithinMethodDeclarationParentheses && methodDeclaration.Parameters.Any (); + if (withinParentheses) { + outputFormatter.Space(); + } if (methodDeclaration.IsExtensionMethod) { outputFormatter.PrintToken(Tokens.This); outputFormatter.Space(); } AppendCommaSeparatedList(methodDeclaration.Parameters); + if (withinParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); foreach (TemplateDefinition templateDefinition in methodDeclaration.Templates) { TrackVisit(templateDefinition, null); @@ -860,7 +881,14 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + bool withinParentheses = this.prettyPrintOptions.WithinMethodDeclarationParentheses && constructorDeclaration.Parameters.Any (); + if (withinParentheses) { + outputFormatter.Space(); + } AppendCommaSeparatedList(constructorDeclaration.Parameters); + if (withinParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); TrackVisit(constructorDeclaration.ConstructorInitializer, data); OutputBlock(constructorDeclaration.Body, this.prettyPrintOptions.ConstructorBraceStyle); @@ -881,7 +909,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.PrintToken(Tokens.This); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } AppendCommaSeparatedList(constructorInitializer.Arguments); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -1210,7 +1244,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinIfParentheses) { + outputFormatter.Space(); + } TrackVisit(ifElseStatement.Condition, data); + if (this.prettyPrintOptions.WithinIfParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); PrintIfSection(ifElseStatement.TrueStatement); @@ -1257,7 +1297,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinIfParentheses) { + outputFormatter.Space(); + } TrackVisit(elseIfSection.Condition, data); + if (this.prettyPrintOptions.WithinIfParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); WriteEmbeddedStatement(elseIfSection.EmbeddedStatement); @@ -1272,6 +1318,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinForParentheses) { + outputFormatter.Space(); + } outputFormatter.DoIndent = false; outputFormatter.DoNewLine = false; outputFormatter.EmitSemicolon = false; @@ -1307,6 +1356,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter } } } + if (this.prettyPrintOptions.WithinForParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); outputFormatter.EmitSemicolon = true; outputFormatter.DoNewLine = true; @@ -1353,7 +1405,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinSwitchParentheses) { + outputFormatter.Space(); + } TrackVisit(switchStatement.SwitchExpression, data); + if (this.prettyPrintOptions.WithinSwitchParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); outputFormatter.Space(); outputFormatter.PrintToken(Tokens.OpenCurlyBrace); @@ -1498,6 +1556,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinWhileParentheses) { + outputFormatter.Space(); + } if (doLoopStatement.ConditionType == ConditionType.Until) { outputFormatter.PrintToken(Tokens.Not); @@ -1513,6 +1574,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter if (doLoopStatement.ConditionType == ConditionType.Until) { outputFormatter.PrintToken(Tokens.CloseParenthesis); } + if (this.prettyPrintOptions.WithinWhileParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); } @@ -1547,6 +1611,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinForEachParentheses) { + outputFormatter.Space(); + } TrackVisit(foreachStatement.TypeReference, data); outputFormatter.Space(); outputFormatter.PrintIdentifier(foreachStatement.VariableName); @@ -1554,6 +1621,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.PrintToken(Tokens.In); outputFormatter.Space(); TrackVisit(foreachStatement.Expression, data); + if (this.prettyPrintOptions.WithinForEachParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); WriteEmbeddedStatement(foreachStatement.EmbeddedStatement); @@ -1568,7 +1638,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinLockParentheses) { + outputFormatter.Space(); + } TrackVisit(lockStatement.LockExpression, data); + if (this.prettyPrintOptions.WithinLockParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); WriteEmbeddedStatement(lockStatement.EmbeddedStatement); @@ -1583,7 +1659,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (prettyPrintOptions.WithinUsingParentheses) { + outputFormatter.Space(); + } PrintStatementInline(usingStatement.ResourceAcquisition, data); + if (prettyPrintOptions.WithinUsingParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); WriteEmbeddedStatement(usingStatement.EmbeddedStatement); @@ -1635,11 +1717,17 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinCatchParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintIdentifier(catchClause.TypeReference.Type); if (catchClause.VariableName.Length > 0) { outputFormatter.Space(); outputFormatter.PrintIdentifier(catchClause.VariableName); } + if (this.prettyPrintOptions.WithinCatchParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); } WriteEmbeddedStatement(catchClause.StatementBlock); @@ -1664,7 +1752,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { + outputFormatter.Space(); + } PrintStatementInline(fixedStatement.PointerDeclaration, data); + if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); WriteEmbeddedStatement(fixedStatement.EmbeddedStatement); @@ -1711,6 +1805,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.PrintToken(Tokens.For); outputFormatter.Space(); outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinForParentheses) { + outputFormatter.Space(); + } if (forNextStatement.LoopVariableExpression.IsNull) { if (!forNextStatement.TypeReference.IsNull) { TrackVisit(forNextStatement.TypeReference, data); @@ -1757,6 +1854,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); TrackVisit(forNextStatement.Step, data); } + if (this.prettyPrintOptions.WithinForParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); WriteEmbeddedStatement(forNextStatement.EmbeddedStatement); @@ -1922,9 +2022,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } TrackVisit(binaryOperatorExpression.Left, data); PrintFormattedComma(); TrackVisit(binaryOperatorExpression.Right, data); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; case BinaryOperatorType.DictionaryAccess: @@ -2058,11 +2164,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter case BinaryOperatorType.Equality: case BinaryOperatorType.ReferenceEquality: - if (prettyPrintOptions.AroundRelationalOperatorParentheses) { + if (prettyPrintOptions.AroundEqualityOperatorParentheses) { outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.Equal); - if (prettyPrintOptions.AroundRelationalOperatorParentheses) { + if (prettyPrintOptions.AroundEqualityOperatorParentheses) { outputFormatter.Space(); } break; @@ -2086,11 +2192,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter break; case BinaryOperatorType.InEquality: case BinaryOperatorType.ReferenceInequality: - if (prettyPrintOptions.AroundRelationalOperatorParentheses) { + if (prettyPrintOptions.AroundEqualityOperatorParentheses) { outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.NotEqual); - if (prettyPrintOptions.AroundRelationalOperatorParentheses) { + if (prettyPrintOptions.AroundEqualityOperatorParentheses) { outputFormatter.Space(); } break; @@ -2133,7 +2239,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter public override object TrackedVisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) { outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinParentheses) { + outputFormatter.Space(); + } TrackVisit(parenthesizedExpression.Expression, data); + if (this.prettyPrintOptions.WithinParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -2147,7 +2259,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } AppendCommaSeparatedList(invocationExpression.Arguments); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -2287,7 +2405,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinSizeOfParentheses) { + outputFormatter.Space(); + } TrackVisit(sizeOfExpression.TypeReference, data); + if (this.prettyPrintOptions.WithinSizeOfParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -2299,7 +2423,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinTypeOfParentheses) { + outputFormatter.Space(); + } TrackVisit(typeOfExpression.TypeReference, data); + if (this.prettyPrintOptions.WithinTypeOfParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -2311,7 +2441,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinTypeOfParentheses) { + outputFormatter.Space(); + } TrackVisit(defaultValueExpression.TypeReference, data); + if (this.prettyPrintOptions.WithinTypeOfParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -2338,7 +2474,14 @@ namespace ICSharpCode.NRefactory.PrettyPrinter if (anonymousMethodExpression.Parameters.Count > 0 || anonymousMethodExpression.HasParameterList) { outputFormatter.PrintToken(Tokens.OpenParenthesis); + bool withinParentheses = this.prettyPrintOptions.WithinMethodDeclarationParentheses && anonymousMethodExpression.Parameters.Any (); + if (withinParentheses) { + outputFormatter.Space(); + } AppendCommaSeparatedList(anonymousMethodExpression.Parameters); + if (withinParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); } OutputBlockAllowInline(anonymousMethodExpression.Body, this.prettyPrintOptions.MethodBraceStyle, false); @@ -2352,7 +2495,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.PrintIdentifier(lambdaExpression.Parameters[0].ParameterName); } else { outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinParentheses) { + outputFormatter.Space(); + } AppendCommaSeparatedList(lambdaExpression.Parameters); + if (this.prettyPrintOptions.WithinParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); } outputFormatter.Space(); @@ -2375,7 +2524,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { + outputFormatter.Space(); + } TrackVisit(checkedExpression.Expression, data); + if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -2387,7 +2542,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { + outputFormatter.Space(); + } TrackVisit(uncheckedExpression.Expression, data); + if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); return null; } @@ -2420,7 +2581,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter TrackVisit(castExpression.CastTo, data); } else { outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (prettyPrintOptions.WithinCastParentheses) { + outputFormatter.Space(); + } TrackVisit(castExpression.CastTo, data); + if (prettyPrintOptions.WithinCastParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); if (this.prettyPrintOptions.SpacesAfterTypecast) { outputFormatter.Space(); @@ -2485,7 +2652,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter outputFormatter.Space(); } outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } AppendCommaSeparatedList(objectCreateExpression.Parameters); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); } if (!objectCreateExpression.ObjectInitializer.IsNull) { @@ -2537,9 +2710,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter if (target is BinaryOperatorExpression || target is CastExpression) { outputFormatter.PrintToken(Tokens.OpenParenthesis); + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } } TrackVisit(target, data); if (target is BinaryOperatorExpression || target is CastExpression) { + if (this.prettyPrintOptions.WithinMethodCallParentheses) { + outputFormatter.Space(); + } outputFormatter.PrintToken(Tokens.CloseParenthesis); } outputFormatter.PrintToken(Tokens.Dot); diff --git a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs index d3edca2b68..6b1217e658 100644 --- a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs +++ b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs @@ -52,6 +52,12 @@ namespace ICSharpCode.NRefactory.PrettyPrinter if (indent) ++IndentationLevel; break; + case BraceStyle.EndOfLineWithoutSpace: + PrintToken(Tokens.OpenCurlyBrace); + NewLine(); + if (indent) + ++IndentationLevel; + break; case BraceStyle.NextLine: NewLine(); Indent(); @@ -86,6 +92,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter BraceStyle style = (BraceStyle)braceStack.Pop(); switch (style) { case BraceStyle.EndOfLine: + case BraceStyle.EndOfLineWithoutSpace: case BraceStyle.NextLine: if (indent) --IndentationLevel; diff --git a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs index 4ebe9242ee..46945b0671 100644 --- a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs +++ b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs @@ -9,6 +9,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter { public enum BraceStyle { EndOfLine, + EndOfLineWithoutSpace, NextLine, NextLineShifted, NextLineShifted2 @@ -339,6 +340,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter #endregion + #region Spaces + #region Before Parentheses bool beforeMethodCallParentheses = false; bool beforeDelegateDeclarationParentheses = false; @@ -590,6 +593,159 @@ namespace ICSharpCode.NRefactory.PrettyPrinter } #endregion + #region WithinParentheses + bool withinCheckedExpressionParantheses = false; + public bool WithinCheckedExpressionParantheses { + get { + return withinCheckedExpressionParantheses; + } + set { + withinCheckedExpressionParantheses = value; + } + } + + bool withinTypeOfParentheses = false; + public bool WithinTypeOfParentheses { + get { + return withinTypeOfParentheses; + } + set { + withinTypeOfParentheses = value; + } + } + + bool withinSizeOfParentheses = false; + public bool WithinSizeOfParentheses { + get { + return withinSizeOfParentheses; + } + set { + withinSizeOfParentheses = value; + } + } + + bool withinCastParentheses = false; + public bool WithinCastParentheses { + get { + return withinCastParentheses; + } + set { + withinCastParentheses = value; + } + } + + bool withinUsingParentheses = false; + public bool WithinUsingParentheses { + get { + return withinUsingParentheses; + } + set { + withinUsingParentheses = value; + } + } + + bool withinLockParentheses = false; + public bool WithinLockParentheses { + get { + return withinLockParentheses; + } + set { + withinLockParentheses = value; + } + } + + bool withinSwitchParentheses = false; + public bool WithinSwitchParentheses { + get { + return withinSwitchParentheses; + } + set { + withinSwitchParentheses = value; + } + } + + bool withinCatchParentheses = false; + public bool WithinCatchParentheses { + get { + return withinCatchParentheses; + } + set { + withinCatchParentheses = value; + } + } + + bool withinForEachParentheses = false; + public bool WithinForEachParentheses { + get { + return withinForEachParentheses; + } + set { + withinForEachParentheses = value; + } + } + + bool withinForParentheses = false; + public bool WithinForParentheses { + get { + return withinForParentheses; + } + set { + withinForParentheses = value; + } + } + + bool withinWhileParentheses = false; + public bool WithinWhileParentheses { + get { + return withinWhileParentheses; + } + set { + withinWhileParentheses = value; + } + } + + bool withinIfParentheses = false; + public bool WithinIfParentheses { + get { + return withinIfParentheses; + } + set { + withinIfParentheses = value; + } + } + + bool withinMethodDeclarationParentheses = false; + public bool WithinMethodDeclarationParentheses { + get { + return withinMethodDeclarationParentheses; + } + set { + withinMethodDeclarationParentheses = value; + } + } + + bool withinMethodCallParentheses = false; + public bool WithinMethodCallParentheses { + get { + return withinMethodCallParentheses; + } + set { + withinMethodCallParentheses = value; + } + } + + bool withinParentheses = false; + public bool WithinParentheses { + get { + return withinParentheses; + } + set { + withinParentheses = value; + } + } + + #endregion + #region SpacesInConditionalOperator bool conditionalOperatorBeforeConditionSpace = true; bool conditionalOperatorAfterConditionSpace = true; @@ -632,12 +788,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter #endregion #region OtherSpaces - bool spacesWithinBrackets = false; bool spacesAfterComma = true; - bool spacesBeforeComma = false; - bool spacesAfterSemicolon = true; - bool spacesAfterTypecast = false; - public bool SpacesAfterComma { get { return spacesAfterComma; @@ -646,6 +797,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter spacesAfterComma = value; } } + + bool spacesAfterSemicolon = true; public bool SpacesAfterSemicolon { get { return spacesAfterSemicolon; @@ -654,6 +807,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter spacesAfterSemicolon = value; } } + + bool spacesAfterTypecast = false; public bool SpacesAfterTypecast { get { return spacesAfterTypecast; @@ -662,6 +817,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter spacesAfterTypecast = value; } } + + bool spacesBeforeComma = false; public bool SpacesBeforeComma { get { return spacesBeforeComma; @@ -670,6 +827,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter spacesBeforeComma = value; } } + + bool spacesWithinBrackets = false; public bool SpacesWithinBrackets { get { return spacesWithinBrackets; @@ -679,6 +838,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter } } #endregion - + #endregion } } \ No newline at end of file