summaryrefslogtreecommitdiff
path: root/formula
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2018-07-17 11:38:40 +0200
committerLuboš Luňák <l.lunak@collabora.com>2018-07-31 16:00:45 +0200
commit3c15daa2a11d675a37b2d75a3f9952cfd60b3e98 (patch)
treeaaee45f1b03ae9235d39ac35877f46795f8f0002 /formula
parent0522251d5bf21185b907acb068619dbfc3ac4684 (diff)
even more implicit intersection computation
This extends 60c5ca1b87 to do implicit intersection while generating RPN code for even more opcodes. This will serve as a basis for making it possible to know when ScGroupTokenConverter can convert svDoubleRef to a matrix without the problems mentioned in its convert() method. Change-Id: I8dfeefc026418bd5644bd266ad94c31f670e811c Reviewed-on: https://gerrit.libreoffice.org/57958 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'formula')
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx64
1 files changed, 64 insertions, 0 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 964c38cdb69d..8e79e5ca68dd 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1873,6 +1873,11 @@ void FormulaCompiler::UnaryLine()
FormulaTokenRef p = mpToken;
NextToken();
UnaryLine();
+ if (mbComputeII && IsIIOpCode(p->GetOpCode()))
+ {
+ FormulaToken** pArg = pCode - 1;
+ HandleIIOpCode(p->GetOpCode(), p->GetInForceArray(), &pArg, 1);
+ }
PutCode( p );
}
else
@@ -1884,6 +1889,11 @@ void FormulaCompiler::PostOpLine()
UnaryLine();
while ( mpToken->GetOpCode() == ocPercentSign )
{ // this operator _follows_ its operand
+ if (mbComputeII && IsIIOpCode(mpToken->GetOpCode()))
+ {
+ FormulaToken** pArg = pCode - 1;
+ HandleIIOpCode(mpToken->GetOpCode(), mpToken->GetInForceArray(), &pArg, 1);
+ }
PutCode( mpToken );
NextToken();
}
@@ -1895,8 +1905,17 @@ void FormulaCompiler::PowLine()
while (mpToken->GetOpCode() == ocPow)
{
FormulaTokenRef p = mpToken;
+ bool bDoIICompute = mbComputeII && IsIIOpCode(p->GetOpCode());
+ FormulaToken** pArgArray[2];
+ if (bDoIICompute)
+ pArgArray[0] = pCode - 1; // Add first argument
NextToken();
PostOpLine();
+ if (bDoIICompute)
+ {
+ pArgArray[1] = pCode - 1; // Add second argument
+ HandleIIOpCode(p->GetOpCode(), p->GetInForceArray(), pArgArray, 2);
+ }
PutCode(p);
}
}
@@ -1907,8 +1926,17 @@ void FormulaCompiler::MulDivLine()
while (mpToken->GetOpCode() == ocMul || mpToken->GetOpCode() == ocDiv)
{
FormulaTokenRef p = mpToken;
+ bool bDoIICompute = mbComputeII && IsIIOpCode(p->GetOpCode());
+ FormulaToken** pArgArray[2];
+ if (bDoIICompute)
+ pArgArray[0] = pCode - 1; // Add first argument
NextToken();
PowLine();
+ if (bDoIICompute)
+ {
+ pArgArray[1] = pCode - 1; // Add second argument
+ HandleIIOpCode(p->GetOpCode(), p->GetInForceArray(), pArgArray, 2);
+ }
PutCode(p);
}
}
@@ -1919,8 +1947,17 @@ void FormulaCompiler::AddSubLine()
while (mpToken->GetOpCode() == ocAdd || mpToken->GetOpCode() == ocSub)
{
FormulaTokenRef p = mpToken;
+ bool bDoIICompute = mbComputeII && IsIIOpCode(p->GetOpCode());
+ FormulaToken** pArgArray[2];
+ if (bDoIICompute)
+ pArgArray[0] = pCode - 1; // Add first argument
NextToken();
MulDivLine();
+ if (bDoIICompute)
+ {
+ pArgArray[1] = pCode - 1; // Add second argument
+ HandleIIOpCode(p->GetOpCode(), p->GetInForceArray(), pArgArray, 2);
+ }
PutCode(p);
}
}
@@ -1931,8 +1968,17 @@ void FormulaCompiler::ConcatLine()
while (mpToken->GetOpCode() == ocAmpersand)
{
FormulaTokenRef p = mpToken;
+ bool bDoIICompute = mbComputeII && IsIIOpCode(p->GetOpCode());
+ FormulaToken** pArgArray[2];
+ if (bDoIICompute)
+ pArgArray[0] = pCode - 1; // Add first argument
NextToken();
AddSubLine();
+ if (bDoIICompute)
+ {
+ pArgArray[1] = pCode - 1; // Add second argument
+ HandleIIOpCode(p->GetOpCode(), p->GetInForceArray(), pArgArray, 2);
+ }
PutCode(p);
}
}
@@ -1943,8 +1989,17 @@ void FormulaCompiler::CompareLine()
while (mpToken->GetOpCode() >= ocEqual && mpToken->GetOpCode() <= ocGreaterEqual)
{
FormulaTokenRef p = mpToken;
+ bool bDoIICompute = mbComputeII && IsIIOpCode(p->GetOpCode());
+ FormulaToken** pArgArray[2];
+ if (bDoIICompute)
+ pArgArray[0] = pCode - 1; // Add first argument
NextToken();
ConcatLine();
+ if (bDoIICompute)
+ {
+ pArgArray[1] = pCode - 1; // Add second argument
+ HandleIIOpCode(p->GetOpCode(), p->GetInForceArray(), pArgArray, 2);
+ }
PutCode(p);
}
}
@@ -1963,8 +2018,17 @@ OpCode FormulaCompiler::Expression()
{
FormulaTokenRef p = mpToken;
mpToken->SetByte( 2 ); // 2 parameters!
+ bool bDoIICompute = mbComputeII && IsIIOpCode(p->GetOpCode());
+ FormulaToken** pArgArray[2];
+ if (bDoIICompute)
+ pArgArray[0] = pCode - 1; // Add first argument
NextToken();
CompareLine();
+ if (bDoIICompute)
+ {
+ pArgArray[1] = pCode - 1; // Add second argument
+ HandleIIOpCode(p->GetOpCode(), p->GetInForceArray(), pArgArray, 2);
+ }
PutCode(p);
}
return mpToken->GetOpCode();