Commit 99d7b92f authored by GoshaZotov's avatar GoshaZotov

formatted assembleLocale function

parent 00882207
...@@ -5626,38 +5626,40 @@ parserFormula.prototype.setFormula = function(formula) { ...@@ -5626,38 +5626,40 @@ parserFormula.prototype.setFormula = function(formula) {
} }
}; };
/* Сборка функции в инфиксную форму */ /* Сборка функции в инфиксную форму */
parserFormula.prototype.assembleLocale = function(locale, digitDelim) { parserFormula.prototype.assembleLocale = function (locale, digitDelim) {
if (this.outStack.length == 1 && this.outStack[this.outStack.length - 1] instanceof cError) { if (this.outStack.length == 1 && this.outStack[this.outStack.length - 1] instanceof cError) {
return this.Formula; return this.Formula;
} }
var currentElement = null, _count = this.outStack.length, elemArr = new Array(_count), res = undefined, _count_arg; var currentElement = null, _count = this.outStack.length, elemArr = new Array(_count), res = undefined,
for (var i = 0, j = 0; i < _count; i++, j++) { _count_arg;
currentElement = this.outStack[i]; for (var i = 0, j = 0; i < _count; i++, j++) {
currentElement = this.outStack[i];
if(currentElement.type === cElementType.specialFunctionStart || currentElement.type === cElementType.specialFunctionEnd){ if (currentElement.type === cElementType.specialFunctionStart ||
continue; currentElement.type === cElementType.specialFunctionEnd) {
} continue;
}
if (currentElement.type == cElementType.operator || currentElement.type == cElementType.func) { if (currentElement.type == cElementType.operator || currentElement.type == cElementType.func) {
_count_arg = currentElement.getArguments(); _count_arg = currentElement.getArguments();
res = currentElement.Assemble2Locale(elemArr, j - _count_arg, _count_arg, locale, digitDelim); res = currentElement.Assemble2Locale(elemArr, j - _count_arg, _count_arg, locale, digitDelim);
j -= _count_arg; j -= _count_arg;
elemArr[j] = res; elemArr[j] = res;
} else { } else {
if (currentElement instanceof cString) { if (currentElement instanceof cString) {
currentElement = new cString("\"" + currentElement.toLocaleString(digitDelim) + "\""); currentElement = new cString("\"" + currentElement.toLocaleString(digitDelim) + "\"");
} }
res = currentElement; res = currentElement;
elemArr[j] = res; elemArr[j] = res;
} }
} }
if (res != undefined && res != null) { if (res != undefined && res != null) {
return res.toLocaleString(digitDelim); return res.toLocaleString(digitDelim);
} else { } else {
return this.Formula; return this.Formula;
} }
}; };
parserFormula.prototype.buildDependencies = function() { parserFormula.prototype.buildDependencies = function() {
if (this.isInDependencies) { if (this.isInDependencies) {
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment