Bug in SerializationVisitor

Oct 21, 2010 at 2:44 PM

Hi

If you try for example the following formula 'SUM([A] + ([D] - [E]) - [F])' with the SerializationVisitor you will notice that the Result will have a right paranthesis missing.

Output: SUM(([A] + ([D] - [E]) - [F])

In the 'Function' and 'LogicalExpression' visit, one character on the right is stripped, but in the 'EncapsulateNoValue' method, no extra space is added for the right paranthesis.

I fixed it by changing the 'EncapsulateNoValue' by this

protected void EncapsulateNoValue(LogicalExpression expression)
{
    if (expression is ValueExpression)
    {
        expression.Accept(this);
    }
    else
    {
        Result.Append("(");
        expression.Accept(this);
        Result.Remove(Result.Length - 1, 1);
        Result.Append(") "); // extra space
    }
 }
 

Coordinator
Oct 21, 2010 at 3:43 PM

Thanks, I pushed a fix in the source code.