summaryrefslogtreecommitdiff
path: root/calc.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2022-03-04 00:44:50 +0800
committerxuri <xuri.me@gmail.com>2022-03-04 00:44:50 +0800
commit129052ae7db0fd2c59b1ea9158df0e75450cad42 (patch)
tree6f38fd9e349f7d568d5cb17c53235479ae8b703a /calc.go
parent3971e8a48b25614dfe685c4766c1bb66cd22fe18 (diff)
This closes #1164, fix nested formula calculation result error
Diffstat (limited to 'calc.go')
-rw-r--r--calc.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/calc.go b/calc.go
index ab205ce..c3b8bf9 100644
--- a/calc.go
+++ b/calc.go
@@ -809,6 +809,17 @@ func (f *File) evalInfixExp(sheet, cell string, tokens []efp.Token) (efp.Token,
}
}
+ if isEndParenthesesToken(token) && isBeginParenthesesToken(opftStack.Peek().(efp.Token)) {
+ if arg := argsStack.Peek().(*list.List).Back(); arg != nil {
+ opfdStack.Push(efp.Token{
+ TType: efp.TokenTypeOperand,
+ TSubType: efp.TokenSubTypeNumber,
+ TValue: arg.Value.(formulaArg).Value(),
+ })
+ argsStack.Peek().(*list.List).Remove(arg)
+ }
+ }
+
// check current token is opft
if err = f.parseToken(sheet, token, opfdStack, opftStack); err != nil {
return efp.Token{}, err