Hi Regina Thank you, that's very helpful.
Damjan On Fri, Jan 19, 2024 at 5:03 PM Regina Henschel <rb.hensc...@t-online.de> wrote: > Hi all, > > there exists a tutorial in the Wiki, how to implement new functions. It > might be helpful for changes on an existing function as well. > > https://wiki.openoffice.org/wiki/Calc/Implementation/Spreadsheet_Functions > > Kind regards, > Regina > > bugzi...@apache.org schrieb am 19.01.2024 um 16:35: > > https://bz.apache.org/ooo/show_bug.cgi?id=128585 > > > > --- Comment #2 from dam...@apache.org --- > > Formula parsing seems to work in stages: > > > > In main/sc/source/ui/view/viewfunc.cxx, method ScViewFunc::EnterData() > calls > > ScCompiler::CompileString(), which lexes "=IF(TRUE;)" (the 2nd line in my > > original post) into: > > [ocIf, ocOpen, ocPush, ocSep, ocClose] > > > > This is then passed to ScCompiler::CompileTokenArray() which is > implemented in > > its parent class, FormulaCompiler::CompileTokenArray(), in file > > main/formula/source/core/api/FormulaCompiler.cxx. This then parses the > lexed > > tokens into the correct structure for the formulas. > > > > Eventually that somehow arrives in ScInterpreter::ScIfJump() from file > > main/sc/source/core/tool/interpr1.cxx for actual execution. > > > > The problem happens in FormulaCompiler::Factor(), > > in the "else if (eOp == ocIf || eOp == ocChose)" case, > > where it expects to find an expression for the 2nd parameter, but gets > ocSep > > (";") instead. This generates an error during the call to Expression(). > > > > So the lexing is definitely correct, but we need to patch the parsing and > > possibly the execution. > > > >