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) {
...
@@ -4819,6 +4819,7 @@ parserFormula.prototype.setFormula = function(formula) {
this
.
operand_expected
=
true
;
this
.
operand_expected
=
true
;
var
wasLeftParentheses
=
false
,
wasRigthParentheses
=
false
,
found_operand
=
null
,
_3DRefTmp
=
null
,
_tableTMP
=
null
;
var
wasLeftParentheses
=
false
,
wasRigthParentheses
=
false
,
found_operand
=
null
,
_3DRefTmp
=
null
,
_tableTMP
=
null
;
cFormulaList
=
(
local
&&
AscCommonExcel
.
cFormulaFunctionLocalized
)
?
AscCommonExcel
.
cFormulaFunctionLocalized
:
cFormulaFunction
;
cFormulaList
=
(
local
&&
AscCommonExcel
.
cFormulaFunctionLocalized
)
?
AscCommonExcel
.
cFormulaFunctionLocalized
:
cFormulaFunction
;
var
leftParentArgumentsCurrentArr
=
[];
var
t
=
this
;
var
t
=
this
;
var
parseOperators
=
function
(){
var
parseOperators
=
function
(){
...
@@ -4892,6 +4893,7 @@ parserFormula.prototype.setFormula = function(formula) {
...
@@ -4892,6 +4893,7 @@ parserFormula.prototype.setFormula = function(formula) {
found_operand
=
null
;
found_operand
=
null
;
t
.
elemArr
.
push
(
new
cFormulaOperators
[
t
.
operand_str
]());
t
.
elemArr
.
push
(
new
cFormulaOperators
[
t
.
operand_str
]());
t
.
f
.
push
(
new
cFormulaOperators
[
t
.
operand_str
]());
t
.
f
.
push
(
new
cFormulaOperators
[
t
.
operand_str
]());
leftParentArgumentsCurrentArr
[
t
.
elemArr
.
length
-
1
]
=
1
;
if
(
startSumproduct
){
if
(
startSumproduct
){
counterSumproduct
++
;
counterSumproduct
++
;
...
@@ -4906,12 +4908,15 @@ parserFormula.prototype.setFormula = function(formula) {
...
@@ -4906,12 +4908,15 @@ parserFormula.prototype.setFormula = function(formula) {
t
.
f
.
push
(
new
cFormulaOperators
[
t
.
operand_str
]());
t
.
f
.
push
(
new
cFormulaOperators
[
t
.
operand_str
]());
wasRigthParentheses
=
true
;
wasRigthParentheses
=
true
;
var
top_elem
=
null
;
var
top_elem
=
null
;
var
top_elem_arg_count
=
null
;
if
(
0
!==
t
.
elemArr
.
length
&&
(
(
top_elem
=
t
.
elemArr
[
t
.
elemArr
.
length
-
1
]).
name
===
'
(
'
)
&&
if
(
0
!==
t
.
elemArr
.
length
&&
(
(
top_elem
=
t
.
elemArr
[
t
.
elemArr
.
length
-
1
]).
name
===
'
(
'
)
&&
t
.
operand_expected
)
{
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
());
t
.
outStack
.
push
(
new
cEmpty
());
}
else
{
}
else
{
top_elem
.
DecrementArguments
();
leftParentArgumentsCurrentArr
[
t
.
elemArr
.
length
-
1
]
--
;
top_elem_arg_count
=
leftParentArgumentsCurrentArr
[
t
.
elemArr
.
length
-
1
];
}
}
}
else
{
}
else
{
while
(
0
!==
t
.
elemArr
.
length
&&
while
(
0
!==
t
.
elemArr
.
length
&&
...
@@ -4924,6 +4929,7 @@ parserFormula.prototype.setFormula = function(formula) {
...
@@ -4924,6 +4929,7 @@ parserFormula.prototype.setFormula = function(formula) {
}
}
t
.
outStack
.
push
(
t
.
elemArr
.
pop
());
t
.
outStack
.
push
(
t
.
elemArr
.
pop
());
}
}
top_elem_arg_count
=
leftParentArgumentsCurrentArr
[
t
.
elemArr
.
length
-
1
];
}
}
if
(
0
===
t
.
elemArr
.
length
||
null
===
top_elem
/* && !wasLeftParentheses */
)
{
if
(
0
===
t
.
elemArr
.
length
||
null
===
top_elem
/* && !wasLeftParentheses */
)
{
...
@@ -4938,15 +4944,15 @@ parserFormula.prototype.setFormula = function(formula) {
...
@@ -4938,15 +4944,15 @@ parserFormula.prototype.setFormula = function(formula) {
if
(
0
!==
t
.
elemArr
.
length
&&
if
(
0
!==
t
.
elemArr
.
length
&&
(
func
=
t
.
elemArr
[
t
.
elemArr
.
length
-
1
]
).
type
===
cElementType
.
func
)
{
(
func
=
t
.
elemArr
[
t
.
elemArr
.
length
-
1
]
).
type
===
cElementType
.
func
)
{
p
=
t
.
elemArr
.
pop
();
p
=
t
.
elemArr
.
pop
();
if
(
top_elem
.
getArguments
()
>
func
.
argumentsMax
)
{
if
(
top_elem
_arg_count
>
func
.
argumentsMax
)
{
t
.
outStack
=
[];
t
.
outStack
=
[];
t
.
elemArr
=
[];
t
.
elemArr
=
[];
t
.
error
.
push
(
c_oAscError
.
ID
.
FrmlWrongMaxArgument
);
t
.
error
.
push
(
c_oAscError
.
ID
.
FrmlWrongMaxArgument
);
return
false
;
return
false
;
}
else
{
}
else
{
if
(
top_elem
.
getArguments
()
>=
func
.
argumentsMin
)
{
if
(
top_elem
_arg_count
>=
func
.
argumentsMin
)
{
t
.
outStack
.
push
(
top_elem
.
getArguments
()
);
t
.
outStack
.
push
(
top_elem
_arg_count
);
if
(
!
func
.
checkArguments
(
top_elem
.
getArguments
()
))
{
if
(
!
func
.
checkArguments
(
top_elem
_arg_count
))
{
bError
=
true
;
bError
=
true
;
}
}
}
else
{
}
else
{
...
@@ -4991,16 +4997,18 @@ parserFormula.prototype.setFormula = function(formula) {
...
@@ -4991,16 +4997,18 @@ parserFormula.prototype.setFormula = function(formula) {
var
parseCommaAndArgumentsUnion
=
function
(){
var
parseCommaAndArgumentsUnion
=
function
(){
wasLeftParentheses
=
false
;
wasLeftParentheses
=
false
;
wasRigthParentheses
=
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
)
{
if
(
t
.
elemArr
.
length
!=
0
&&
t
.
elemArr
[
stackLength
-
1
].
name
==
"
(
"
&&
t
.
operand_expected
)
{
t
.
outStack
.
push
(
new
cEmpty
());
t
.
outStack
.
push
(
new
cEmpty
());
top_elem
=
t
.
elemArr
[
stackLength
-
1
];
top_elem
=
t
.
elemArr
[
stackLength
-
1
];
top_elem_arg_pos
=
stackLength
-
1
;
wasLeftParentheses
=
true
;
wasLeftParentheses
=
true
;
t
.
operand_expected
=
false
;
t
.
operand_expected
=
false
;
}
else
{
}
else
{
while
(
stackLength
!=
0
)
{
while
(
stackLength
!=
0
)
{
top_elem
=
t
.
elemArr
[
stackLength
-
1
];
top_elem
=
t
.
elemArr
[
stackLength
-
1
];
top_elem_arg_pos
=
stackLength
-
1
;
if
(
top_elem
.
name
==
"
(
"
)
{
if
(
top_elem
.
name
==
"
(
"
)
{
wasLeftParentheses
=
true
;
wasLeftParentheses
=
true
;
break
;
break
;
...
@@ -5024,7 +5032,7 @@ parserFormula.prototype.setFormula = function(formula) {
...
@@ -5024,7 +5032,7 @@ parserFormula.prototype.setFormula = function(formula) {
t
.
elemArr
=
[];
t
.
elemArr
=
[];
return
false
;
return
false
;
}
}
top_elem
.
IncrementArguments
()
;
leftParentArgumentsCurrentArr
[
top_elem_arg_pos
]
++
;
t
.
operand_expected
=
true
;
t
.
operand_expected
=
true
;
return
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