Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
37934681
Commit
37934681
authored
Oct 26, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace IncrementArguments/DecrementArguments/getArguments call into parse function
parent
87371906
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
cell/model/FormulaObjects/parserFormula.js
cell/model/FormulaObjects/parserFormula.js
+16
-8
No files found.
cell/model/FormulaObjects/parserFormula.js
View file @
37934681
...
...
@@ -4819,6 +4819,7 @@ parserFormula.prototype.setFormula = function(formula) {
this
.
operand_expected
=
true
;
var
wasLeftParentheses
=
false
,
wasRigthParentheses
=
false
,
found_operand
=
null
,
_3DRefTmp
=
null
,
_tableTMP
=
null
;
cFormulaList
=
(
local
&&
AscCommonExcel
.
cFormulaFunctionLocalized
)
?
AscCommonExcel
.
cFormulaFunctionLocalized
:
cFormulaFunction
;
var
leftParentArgumentsCurrentArr
=
[];
var
t
=
this
;
var
parseOperators
=
function
(){
...
...
@@ -4892,6 +4893,7 @@ parserFormula.prototype.setFormula = function(formula) {
found_operand
=
null
;
t
.
elemArr
.
push
(
new
cFormulaOperators
[
t
.
operand_str
]());
t
.
f
.
push
(
new
cFormulaOperators
[
t
.
operand_str
]());
leftParentArgumentsCurrentArr
[
t
.
elemArr
.
length
-
1
]
=
1
;
if
(
startSumproduct
){
counterSumproduct
++
;
...
...
@@ -4906,12 +4908,15 @@ parserFormula.prototype.setFormula = function(formula) {
t
.
f
.
push
(
new
cFormulaOperators
[
t
.
operand_str
]());
wasRigthParentheses
=
true
;
var
top_elem
=
null
;
var
top_elem_arg_count
=
null
;
if
(
0
!==
t
.
elemArr
.
length
&&
(
(
top_elem
=
t
.
elemArr
[
t
.
elemArr
.
length
-
1
]).
name
===
'
(
'
)
&&
t
.
operand_expected
)
{
if
(
top_elem
.
getArguments
()
>
1
)
{
top_elem_arg_count
=
leftParentArgumentsCurrentArr
[
t
.
elemArr
.
length
-
1
];
if
(
top_elem_arg_count
>
1
)
{
t
.
outStack
.
push
(
new
cEmpty
());
}
else
{
top_elem
.
DecrementArguments
();
leftParentArgumentsCurrentArr
[
t
.
elemArr
.
length
-
1
]
--
;
top_elem_arg_count
=
leftParentArgumentsCurrentArr
[
t
.
elemArr
.
length
-
1
];
}
}
else
{
while
(
0
!==
t
.
elemArr
.
length
&&
...
...
@@ -4924,6 +4929,7 @@ parserFormula.prototype.setFormula = function(formula) {
}
t
.
outStack
.
push
(
t
.
elemArr
.
pop
());
}
top_elem_arg_count
=
leftParentArgumentsCurrentArr
[
t
.
elemArr
.
length
-
1
];
}
if
(
0
===
t
.
elemArr
.
length
||
null
===
top_elem
/* && !wasLeftParentheses */
)
{
...
...
@@ -4938,15 +4944,15 @@ parserFormula.prototype.setFormula = function(formula) {
if
(
0
!==
t
.
elemArr
.
length
&&
(
func
=
t
.
elemArr
[
t
.
elemArr
.
length
-
1
]
).
type
===
cElementType
.
func
)
{
p
=
t
.
elemArr
.
pop
();
if
(
top_elem
.
getArguments
()
>
func
.
argumentsMax
)
{
if
(
top_elem
_arg_count
>
func
.
argumentsMax
)
{
t
.
outStack
=
[];
t
.
elemArr
=
[];
t
.
error
.
push
(
c_oAscError
.
ID
.
FrmlWrongMaxArgument
);
return
false
;
}
else
{
if
(
top_elem
.
getArguments
()
>=
func
.
argumentsMin
)
{
t
.
outStack
.
push
(
top_elem
.
getArguments
()
);
if
(
!
func
.
checkArguments
(
top_elem
.
getArguments
()
))
{
if
(
top_elem
_arg_count
>=
func
.
argumentsMin
)
{
t
.
outStack
.
push
(
top_elem
_arg_count
);
if
(
!
func
.
checkArguments
(
top_elem
_arg_count
))
{
bError
=
true
;
}
}
else
{
...
...
@@ -4991,16 +4997,18 @@ parserFormula.prototype.setFormula = function(formula) {
var
parseCommaAndArgumentsUnion
=
function
(){
wasLeftParentheses
=
false
;
wasRigthParentheses
=
false
;
var
stackLength
=
t
.
elemArr
.
length
,
top_elem
=
null
;
var
stackLength
=
t
.
elemArr
.
length
,
top_elem
=
null
,
top_elem_arg_pos
;
if
(
t
.
elemArr
.
length
!=
0
&&
t
.
elemArr
[
stackLength
-
1
].
name
==
"
(
"
&&
t
.
operand_expected
)
{
t
.
outStack
.
push
(
new
cEmpty
());
top_elem
=
t
.
elemArr
[
stackLength
-
1
];
top_elem_arg_pos
=
stackLength
-
1
;
wasLeftParentheses
=
true
;
t
.
operand_expected
=
false
;
}
else
{
while
(
stackLength
!=
0
)
{
top_elem
=
t
.
elemArr
[
stackLength
-
1
];
top_elem_arg_pos
=
stackLength
-
1
;
if
(
top_elem
.
name
==
"
(
"
)
{
wasLeftParentheses
=
true
;
break
;
...
...
@@ -5024,7 +5032,7 @@ parserFormula.prototype.setFormula = function(formula) {
t
.
elemArr
=
[];
return
false
;
}
top_elem
.
IncrementArguments
()
;
leftParentArgumentsCurrentArr
[
top_elem_arg_pos
]
++
;
t
.
operand_expected
=
true
;
return
true
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment