Always set a grammar when constructing ScCompiler

Otherwise mxSymbols is null, which is rather unexpected as the past has shown,
see commit 63843a9726

Change-Id: Id4c13a5f50e711513a71a7d6cd6f87b4112b1f1d
This commit is contained in:
Eike Rathke 2017-05-18 14:17:05 +02:00
parent 730622df7c
commit 47a0e1554a
2 changed files with 20 additions and 4 deletions

View file

@ -335,11 +335,19 @@ private:
public:
ScCompiler( sc::CompileFormulaContext& rCxt, const ScAddress& rPos );
ScCompiler( ScDocument* pDocument, const ScAddress&);
/** If eGrammar == GRAM_UNSPECIFIED then the grammar of pDocument is used,
if pDocument==nullptr then GRAM_DEFAULT.
*/
ScCompiler( ScDocument* pDocument, const ScAddress&,
formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_UNSPECIFIED );
ScCompiler( sc::CompileFormulaContext& rCxt, const ScAddress& rPos, ScTokenArray& rArr );
ScCompiler( ScDocument* pDocument, const ScAddress&,ScTokenArray& rArr);
/** If eGrammar == GRAM_UNSPECIFIED then the grammar of pDocument is used,
if pDocument==nullptr then GRAM_DEFAULT.
*/
ScCompiler( ScDocument* pDocument, const ScAddress&, ScTokenArray& rArr,
formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_UNSPECIFIED );
virtual ~ScCompiler() override;

View file

@ -1758,7 +1758,8 @@ ScCompiler::ScCompiler( sc::CompileFormulaContext& rCxt, const ScAddress& rPos,
SetGrammar(rCxt.getGrammar());
}
ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos,ScTokenArray& rArr)
ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos, ScTokenArray& rArr,
formula::FormulaGrammar::Grammar eGrammar )
: FormulaCompiler(rArr),
pDoc( pDocument ),
aPos( rPos ),
@ -1774,6 +1775,9 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos,ScTokenArra
mbCloseBrackets( true ),
mbRewind( false )
{
SetGrammar( ((eGrammar == formula::FormulaGrammar::GRAM_UNSPECIFIED) ?
(pDocument ? pDocument->GetGrammar() : formula::FormulaGrammar::GRAM_DEFAULT) :
eGrammar));
nMaxTab = pDoc->GetTableCount() - 1;
}
@ -1796,7 +1800,8 @@ ScCompiler::ScCompiler( sc::CompileFormulaContext& rCxt, const ScAddress& rPos )
SetGrammar(rCxt.getGrammar());
}
ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos)
ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos,
formula::FormulaGrammar::Grammar eGrammar )
:
pDoc( pDocument ),
aPos( rPos ),
@ -1812,6 +1817,9 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos)
mbCloseBrackets( true ),
mbRewind( false )
{
SetGrammar( ((eGrammar == formula::FormulaGrammar::GRAM_UNSPECIFIED) ?
(pDocument ? pDocument->GetGrammar() : formula::FormulaGrammar::GRAM_DEFAULT) :
eGrammar));
nMaxTab = pDoc ? pDoc->GetTableCount() - 1 : 0;
}