Resolves: tdf#131424 separator in TableRef column specifier is valid

Even only a separator or any operator single character.

Change-Id: I102dd7fd49c1a6a7f1d8c39f4a6139a51dbebe51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97535
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
(cherry picked from commit f02207acc00787f29bc9e8992b1e2f3a182de43c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97506
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 9cdc0c8..6e12d81 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2106,6 +2106,8 @@ sal_Int32 ScCompiler::NextSymbol(bool bInArray)
                case ssSkipString:
                case ssGetReference:
                case ssSkipReference:
                case ssGetTableRefItem:
                case ssGetTableRefColumn:
                    break;
                default:
                    if (eState == ssGetChar)
@@ -4265,12 +4267,20 @@ bool ScCompiler::NextNewToken( bool bInArray )
        bMayBeFuncName = ScGlobal::getCharClassPtr()->isLetter( aTmpStr, 0 );
        bAsciiNonAlnum = false;
    }
    if (bAsciiNonAlnum && cSymbol[1] == 0)

    // Within a TableRef anything except an unescaped '[' or ']' is an item
    // or a column specifier, do not attempt to recognize any other single
    // operator there so even [,] or [+] for a single character column
    // specifier works. Note that space between two ocTableRefOpen is not
    // supported (Table[ [ColumnSpec]]), not only here. Note also that Table[]
    // without any item or column specifier is valid.
    if (bAsciiNonAlnum && cSymbol[1] == 0 && (eLastOp != ocTableRefOpen || cSymbol[0] == '[' || cSymbol[0] == ']'))
    {
        // Shortcut for operators and separators that need no further checks or upper.
        if (IsOpCode( OUString( cSymbol), bInArray ))
            return true;
    }

    if ( bMayBeFuncName )
    {
        // a function name must be followed by a parenthesis