https://bz.apache.org/ooo/show_bug.cgi?id=3879
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- Latest|--- |4.2.0-dev Confirmation in| | CC| |[email protected] Severity|Trivial |Major --- Comment #34 from [email protected] --- This catastrophic bug has existed since 2002 and had at least 6 duplicates we know of, breaks both XLS and ODF formulas, and is needed for ODF >= 1.3. The problem is that the formula module (main/formula) doesn't really support empty first and last parameters, only empty middle parameters, eg. while “;;” does generate [ocSep, ocMissing, ocSep] it breaks on “(;” [ocOpen, ocSep] and “;)” [ocSep, ocClose]. We could change the parser to handle those cases, or change the lexer to add ocMissing which is easier. Changing the lexer (patch below) to add ocMissing between [ocOpen, ocSep] and [ocSep, ocClose] does fix the (;x) and (x;) cases for OR and AND, possibly others, but gets error 518 for "IF" :-(. ---snip--- diff --git a/main/sc/source/core/tool/compiler.cxx b/main/sc/source/core/tool/compiler.cxx index 2e740236df..d8f8341f7f 100644 --- a/main/sc/source/core/tool/compiler.cxx +++ b/main/sc/source/core/tool/compiler.cxx @@ -3868,14 +3868,16 @@ ScTokenArray* ScCompiler::CompileString( const String& rFormula ) default: break; } - if( (eLastOp == ocSep || + if( (eLastOp == ocOpen && eOp == ocSep) || + (eLastOp == ocSep && eOp == ocClose) || + ( (eLastOp == ocSep || eLastOp == ocArrayRowSep || eLastOp == ocArrayColSep || eLastOp == ocArrayOpen) && (eOp == ocSep || eOp == ocArrayRowSep || eOp == ocArrayColSep || - eOp == ocArrayClose) ) + eOp == ocArrayClose) ) ) { // FIXME: should we check for known functions with optional empty // args so the correction dialog can do better? ---snip--- -- You are receiving this mail because: You are on the CC list for the issue. You are the assignee for the issue.
