https://bz.apache.org/ooo/show_bug.cgi?id=128585

--- Comment #4 from dam...@apache.org ---
In light of the fact that it's Expression() that fails, we can avoid calling it
for ocClose with this kind of patch:

---snip---
diff --git a/main/formula/source/core/api/FormulaCompiler.cxx
b/main/formula/source/core/api/FormulaCompiler.cxx
index d5554e30c0..b1d7384d2c 100644
--- a/main/formula/source/core/api/FormulaCompiler.cxx
+++ b/main/formula/source/core/api/FormulaCompiler.cxx
@@ -1096,8 +1096,9 @@ void FormulaCompiler::Factor()
             {
                 if ( ++nJumpCount <= nJumpMax )
                     pFacToken->GetJump()[nJumpCount] = pc-1;
-                NextToken();
-                eOp = Expression();
+                eOp = NextToken();
+                if (eOp != ocClose)
+                    eOp = Expression();
                 // ocSep or ocClose terminate the subexpression
                 PutCode( pToken );
             }
---snip---

and that gets these results:

                                |          Condition
IF formula                      |TRUE           | FALSE
--------------------------------+---------------+------
IF(condition)                   |TRUE           |FALSE
IF(condition;)                  |#NULL!         |FALSE
IF(condition;IfTrue)            |IfTrue         |FALSE
IF(condition;;)                 |Err:518        |#NULL!
IF(condition;;IfFalse)          |Err:518        |IfFalse
IF(condition;IfTrue;)           |IfTrue         |#NULL!
IF(condition;IfTrue;IfFalse)    |IfTrue         |IfFalse

which is slightly better, but still needs further fixes.

It also gets:
=CHOICE(1;2;)
to show "2" instead of "Err:511", as the same code is used to parse ocIf and
ocChoice. Google Sheets and LO also display "2".

However I also note that for Google Sheets and LO:
=OR(TRUE;) returns TRUE
=AND(TRUE;) returns TRUE
but for us, those are Err:511.

Thus Expression() needs to be fixed for other tokens too, not just ocIf and
ocChoice.

-- 
You are receiving this mail because:
You are the assignee for the issue.

Reply via email to