Kaydet (Commit) 47a0e155 authored tarafından Eike Rathke's avatar Eike Rathke

Always set a grammar when constructing ScCompiler

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

Change-Id: Id4c13a5f50e711513a71a7d6cd6f87b4112b1f1d
üst 730622df
......@@ -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;
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment