Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sys27 committed Jan 27, 2017
1 parent 7823b18 commit e0b065c
Show file tree
Hide file tree
Showing 2 changed files with 488 additions and 9 deletions.
12 changes: 7 additions & 5 deletions xFunc.Maths/Analyzers/Formatters/CommonFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Text;
using xFunc.Maths.Expressions;
Expand Down Expand Up @@ -410,9 +411,10 @@ public string Analyze(Variable exp)
/// </summary>
/// <param name="exp">The expression.</param>
/// <returns>The result of analysis.</returns>
[ExcludeFromCodeCoverage]
public string Analyze(DelegateExpression exp)
{
return exp.ToString();
return "{Delegate Expression}";
}

#endregion Standard
Expand Down Expand Up @@ -1086,7 +1088,7 @@ public string Analyze(DivAssign exp)
/// <returns>The result of analysis.</returns>
public string Analyze(Equal exp)
{
if (exp.Parent is BinaryExpression)
if (exp.Parent is BinaryExpression && !(exp.Parent is While))
return ToString(exp, "({0} == {1})");

return ToString(exp, "{0} == {1}");
Expand All @@ -1109,7 +1111,7 @@ public string Analyze(For exp)
/// <returns>The result of analysis.</returns>
public string Analyze(GreaterOrEqual exp)
{
if (exp.Parent is BinaryExpression)
if (exp.Parent is BinaryExpression && !(exp.Parent is While))
return ToString(exp, "({0} >= {1})");

return ToString(exp, "{0} >= {1}");
Expand Down Expand Up @@ -1155,7 +1157,7 @@ public string Analyze(Inc exp)
/// <returns>The result of analysis.</returns>
public string Analyze(LessOrEqual exp)
{
if (exp.Parent is BinaryExpression)
if (exp.Parent is BinaryExpression && !(exp.Parent is While))
return ToString(exp, "({0} <= {1})");

return ToString(exp, "{0} <= {1}");
Expand Down Expand Up @@ -1191,7 +1193,7 @@ public string Analyze(MulAssign exp)
/// <returns>The result of analysis.</returns>
public string Analyze(NotEqual exp)
{
if (exp.Parent is BinaryExpression)
if (exp.Parent is BinaryExpression && !(exp.Parent is While))
return ToString(exp, "({0} != {1})");

return ToString(exp, "{0} != {1}");
Expand Down
Loading

0 comments on commit e0b065c

Please sign in to comment.