diff options
author | Eike Rathke <erack@redhat.com> | 2017-05-18 14:17:05 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-05-18 15:02:50 +0200 |
commit | 47a0e1554add5cc10c068275697108a663cd7a9a (patch) | |
tree | 247a3efc376a0688ee7da1ec021a043d8b3df6cd /sc | |
parent | 730622df7c0e97917c3c0d53b1ec03691d0afb74 (diff) |
Always set a grammar when constructing ScCompiler
Otherwise mxSymbols is null, which is rather unexpected as the past has shown,
see commit 63843a97262ccfa38d838a9cbbc3faadba8290a6
Change-Id: Id4c13a5f50e711513a71a7d6cd6f87b4112b1f1d
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/compiler.hxx | 12 | ||||
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 12 |
2 files changed, 20 insertions, 4 deletions
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 7f3f30e798aa..cfd5affb0b8f 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -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; diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index d6f171e7c621..b59b215d21d7 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -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; } |