Permalink
Browse files

fixed autointent for multiple , in a row

  • Loading branch information...
1 parent 5c0338b commit ef86234a46fb801343510749a8ca79cd81895b6f @joshbtn committed Oct 25, 2012
View
16 excelFormulaUtilities-0.9.4.js
@@ -868,6 +868,8 @@
function applyTokenTemplate(token, options, indent, lineBreak, override) {
var indt = indent;
+
+ var lastToken = typeof arguments[5] === undefined || arguments[5] === null ? null : arguments[5];
var replaceTokenTmpl = function (inStr) {
return inStr.replace(/\{\{token\}\}/gi, "{0}").replace(/\{\{autoindent\}\}/gi, "{1}").replace(/\{\{autolinebreak\}\}/gi, "{2}");
@@ -938,7 +940,11 @@
tokenString = formatStr(replaceTokenTmpl(options.tmplOperandLogical), tokenString, indt, lineBreak);
break;
case "argument":
- tokenString = formatStr(replaceTokenTmpl(options.tmplArgument), tokenString, indt, lineBreak);
+ if(lastToken.type !== "argument"){
+ tokenString = formatStr(replaceTokenTmpl(options.tmplArgument), tokenString, indt, lineBreak);
+ } else {
+ tokenString = formatStr(replaceTokenTmpl("{{autoindent}}"+options.tmplArgument), tokenString, indt, lineBreak);
+ }
break;
case "subexpression":
if (token.subtype.toString() === "start") {
@@ -1063,7 +1069,9 @@
}
return false;
};
-
+
+ var lastToken = null;
+
while (tokens.moveNext()) {
var token = tokens.current();
@@ -1080,7 +1088,7 @@
indt = autoIndent ? indent() : options.tmplIndentSpace,
lineBreak = autoBreak ? options.newLine : "";
- outputFormula += applyTokenTemplate(token, options, indt, lineBreak, options.customTokenRender);
+ outputFormula += applyTokenTemplate(token, options, indt, lineBreak, options.customTokenRender, lastToken);
if (token.subtype.toString() === TOK_SUBTYPE_START) {
indentCount += 1;
@@ -1089,6 +1097,8 @@
isNewLine = autoBreak || matchEndNewLine.test(outputFormula);
isFirstToken = false;
+
+ lastToken = token;
}
outputFormula = options.prefix + trim(outputFormula) + options.postfix;
View
48 excelFormulaUtilities-0.9.4.min.js
@@ -1,25 +1,25 @@
-(function(){"undefined"===typeof window&&(window=root);window.excelFormulaUtilities=window.excelFormulaUtilities||{};var r=window.excelFormulaUtilities.core={};window.excelFormulaUtilities.string=window.excelFormulaUtilities.string||{};window.excelFormulaUtilities.string.formatStr=function(i){for(var m=i,h=1;h<arguments.length;h++)m=m.replace(RegExp("\\{{1}"+(h-1).toString()+"{1}\\}{1}","g"),arguments[h]);return m};window.excelFormulaUtilities.string.trim=function(i){return i.replace(/^\s|\s$/,"")};
-window.excelFormulaUtilities.string.trim=function(i){return i.replace(/^(?:\s|&nbsp;|<\s*br\s*\/*\s*>)*|(?:\s|&nbsp;|<\s*br\s*\/*\s*>)*$/,"")};var u=r.isFunction=function(i){return"function"===typeof i},w=r.isArray=function(i){return"object"===typeof i&&i.length},v=r.isWindow=function(){return obj&&"object"===typeof obj&&"setInterval"in obj},x=r.isPlainObject=function(i){if(!i||("object"!==typeof i||i.nodeType||v(i))||i.constructor&&!hasOwnProperty.call(i,"constructor")&&!hasOwnProperty.call(i.constructor.prototype,
-"isPrototypeOf"))return!1;for(var m in i);return void 0===m||hasOwnProperty.call(i,m)};r.extend=function(){var i,m,h,o,j,k=arguments[0]||{},l=1,n=arguments.length,s=!1;"boolean"===typeof k&&(s=k,k=arguments[1]||{},l=2);"object"!==typeof k&&!u(k)&&(k={});n===l&&(k=this,--l);for(;l<n;l++)if(null!=(i=arguments[l]))for(m in i)h=k[m],o=i[m],k!==o&&(s&&o&&(x(o)||(j=w(o)))?(j?(j=!1,h=h&&w(h)?h:[]):h=h&&x(h)?h:{},k[m]=r.extend(s,h,o)):void 0!==o&&(k[m]=o));return k}})();(function(){function r(g,b,c){this.value=g;this.type=b;this.subtype=c}function u(){this.items=[];this.add=function(g,b,c){c||(c="");g=new r(g,b,c);this.addRef(g);return g};this.addRef=function(g){this.items.push(g)};this.index=-1;this.reset=function(){this.index=-1};this.BOF=function(){return 0>=this.index};this.EOF=function(){return this.index>=this.items.length-1};this.moveNext=function(){if(this.EOF())return!1;this.index+=1;return!0};this.current=function(){return-1===this.index?null:this.items[this.index]};
-this.next=function(){return this.EOF()?null:this.items[this.index+1]};this.previous=function(){return 1>this.index?null:this.items[this.index-1]}}function w(){this.items=[];this.push=function(g){this.items.push(g)};this.pop=function(g){var b=this.items.pop();return new r(g||"",b.type,p)};this.token=function(){return 0<this.items.length?this.items[this.items.length-1]:null};this.value=function(){return this.token()?this.token().value.toString():""};this.type=function(){return this.token()?this.token().type.toString():
-""};this.subtype=function(){return this.token()?this.token().subtype.toString():""}}function v(g){for(var b=new u,c=new w,d=0,e=function(){return g.substr(d,1)},a="",f=!1,i=!1,h=!1,j=!1,m=/^[1-9]{1}(\.[0-9]+)?E{1}$/;0<g.length;)if(" "===g.substr(0,1))g=g.substr(1);else{"="===g.substr(0,1)&&(g=g.substr(1));break}for(;!(d>=g.length);)if(f)'"'===e()?'"'===g.substr(d+1,1)?(a+='"',d+=1):(f=!1,b.add(a,l,H),a=""):a+=e(),d+=1;else if(i)"'"===e()?"'"===g.substr(d+1,1)?(a+="'",d+=1):i=!1:a+=e(),d+=1;else if(h)"]"===
-e()&&(h=!1),a+=e(),d+=1;else if(j)a+=e(),d+=1,-1!==",#NULL!,#DIV/0!,#VALUE!,#REF!,#NAME?,#NUM!,#N/A,".indexOf(","+a+",")&&(j=!1,b.add(a,l,I),a="");else if(-1!=="+-".indexOf(e())&&1<a.length&&a.match(m))a+=e(),d+=1;else if('"'===e())0<a.length&&(b.add(a,y),a=""),f=!0,d+=1;else if("'"===e())0<a.length&&(b.add(a,y),a=""),i=!0,d+=1;else if("["===e())h=!0,a+=e(),d+=1;else if("#"===e())0<a.length&&(b.add(a,y),a=""),j=!0,a+=e(),d+=1;else if("{"===e())0<a.length&&(b.add(a,y),a=""),c.push(b.add("ARRAY",n,
-q)),c.push(b.add("ARRAYROW",n,q)),d+=1;else if(";"===e())0<a.length&&(b.add(a,l),a=""),b.addRef(c.pop()),b.add(",",z),c.push(b.add("ARRAYROW",n,q)),d+=1;else if("}"===e())0<a.length&&(b.add(a,l),a=""),b.addRef(c.pop("ARRAYROWSTOP")),b.addRef(c.pop("ARRAYSTOP")),d+=1;else if(" "===e()){0<a.length&&(b.add(a,l),a="");b.add("",D);for(d+=1;" "===e()&&!(d>=g.length);)d+=1}else-1!==",>=,<=,<>,".indexOf(","+g.substr(d,2)+",")?(0<a.length&&(b.add(a,l),a=""),b.add(g.substr(d,2),t,A),d+=2):(-1!=="+-*/^&=><".indexOf(e())?
-(0<a.length&&(b.add(a,l),a=""),b.add(e(),t)):-1!=="%".indexOf(e())?(0<a.length&&(b.add(a,l),a=""),b.add(e(),B)):"("===e()?0<a.length?(c.push(b.add(a,n,q)),a=""):c.push(b.add("",s,q)):","===e()?(0<a.length&&(b.add(a,l),a=""),c.type()!==n?b.add(e(),t,J):b.add(e(),z)):")"===e()?(0<a.length&&(b.add(a,l),a=""),b.addRef(c.pop())):a+=e(),d+=1);0<a.length&&b.add(a,l);for(c=new u;b.moveNext();)a=b.current(),a.type.toString()===D?(e=(e=(e=b.BOF()||b.EOF())&&(b.previous().type.toString()===n&&b.previous().subtype.toString()===
-p||b.previous().type.toString()===s&&b.previous().subtype.toString()===p||b.previous().type.toString()===l))&&(b.next().type.toString()===n&&b.next().subtype.toString()===q||b.next().type.toString()===s&&b.next().subtype.toString()===q||b.next().type.toString()===l))&&c.add(a.value.toString(),t,K):c.addRef(a);for(;c.moveNext();)a=c.current(),a.type.toString()===t&&"-"===a.value.toString()?c.BOF()?a.type=E.toString():c.previous().type.toString()===n&&c.previous().subtype.toString()===p||c.previous().type.toString()===
-s&&c.previous().subtype.toString()===p||c.previous().type.toString()===B||c.previous().type.toString()===l?a.subtype=C.toString():a.type=E.toString():a.type.toString()===t&&"+"===a.value.toString()?c.BOF()?a.type=k.toString():c.previous().type.toString()===n&&c.previous().subtype.toString()===p||c.previous().type.toString()===s&&c.previous().subtype.toString()===p||c.previous().type.toString()===B||c.previous().type.toString()===l?a.subtype=C.toString():a.type=k.toString():a.type.toString()===t&&
-0===a.subtype.length?a.subtype=-1!=="<>=".indexOf(a.value.substr(0,1))?A.toString():"&"===a.value.toString()?L.toString():C.toString():a.type.toString()===l&&0===a.subtype.length?a.subtype=isNaN(parseFloat(a.value))?"TRUE"===a.value.toString()||"FALSE"===a.value.toString()?A.toString():F.toString():M.toString():a.type.toString()===n&&"@"===a.value.substr(0,1)&&(a.value=a.value.substr(1).toString());c.reset();for(b=new u;c.moveNext();)c.current().type.toString()!==k&&b.addRef(c.current());b.reset();
-return b}function x(g,b,c,d,e){var a=function(a){return a.replace(/\{\{token\}\}/gi,"{0}").replace(/\{\{autoindent\}\}/gi,"{1}").replace(/\{\{autolinebreak\}\}/gi,"{2}")},f="",f="text"===g.subtype||"text"===g.type?g.value.toString():(0===g.value.length?" ":g.value.toString()).split(" ").join("").toString();if("function"===typeof e&&(e=e(f,g,c,d),f=e.tokenString,!e.useTemplate))return f;switch(g.type){case "function":switch(g.value){case "ARRAY":f=h(a(b.tmplFunctionStartArray),f,c,d);break;case "ARRAYROW":f=
-h(a(b.tmplFunctionStartArrayRow),f,c,d);break;default:f="start"===g.subtype.toString()?h(a(b.tmplFunctionStart),f,c,d):h(a(b.tmplFunctionStop),f,c,d)}break;case "operand":switch(g.subtype.toString()){case "error":f=h(a(b.tmplOperandError),f,c,d);break;case "range":f=h(a(b.tmplOperandRange),f,c,d);break;case "number":f=h(a(b.tmplOperandNumber),f,c,d);break;case "text":f=h(a(b.tmplOperandText),f,c,d);break;case "argument":f=h(a(b.tmplArgument),f,c,d)}break;case "operator-infix":case "logical":f=h(a(b.tmplOperandLogical),
-f,c,d);break;case "argument":f=h(a(b.tmplArgument),f,c,d);break;case "subexpression":f="start"===g.subtype.toString()?h(a(b.tmplSubexpressionStart),f,c,d):h(a(b.tmplSubexpressionStop),f,c,d)}return f}"undefined"===typeof window&&(window=root);var i=window.excelFormulaUtilities=window.excelFormulaUtilities||{},m=window.excelFormulaUtilities.core,h=window.excelFormulaUtilities.string.formatStr,o=window.excelFormulaUtilities.string.trim,j={},k=j.TOK_TYPE_NOOP="noop",l=j.TOK_TYPE_OPERAND="operand",n=
-j.TOK_TYPE_FUNCTION="function",s=j.TOK_TYPE_SUBEXPR="subexpression",z=j.TOK_TYPE_ARGUMENT="argument",E=j.TOK_TYPE_OP_PRE="operator-prefix",t=j.TOK_TYPE_OP_IN="operator-infix",B=j.TOK_TYPE_OP_POST="operator-postfix",D=j.TOK_TYPE_WSPACE="white-space",y=j.TOK_TYPE_UNKNOWN="unknown",q=j.TOK_SUBTYPE_START="start",p=j.TOK_SUBTYPE_STOP="stop",H=j.TOK_SUBTYPE_TEXT="text",M=j.TOK_SUBTYPE_NUMBER="number",A=j.TOK_SUBTYPE_LOGICAL="logical",I=j.TOK_SUBTYPE_ERROR="error",F=j.TOK_SUBTYPE_RANGE="range",C=j.TOK_SUBTYPE_MATH=
-"math",L=j.TOK_SUBTYPE_CONCAT="concatenate",K=j.TOK_SUBTYPE_INTERSECT="intersect",J=j.TOK_SUBTYPE_UNION="union";i.parseFormula=function(g,b){var c=0,d=document.getElementById(g),e=v(d.value),a;for(a="<table cellspacing='0' style='border-top: 1px #cecece solid; margin-top: 5px; margin-bottom: 5px'><tr><td class='token' style='font-weight: bold; width: 50px'>index</td><td class='token' style='font-weight: bold; width: 125px'>type</td><td class='token' style='font-weight: bold; width: 125px'>subtype</td><td class='token' style='font-weight: bold; width: 150px'>token</td><td class='token' style='font-weight: bold; width: 300px'>token tree</td></tr>";e.moveNext();){var f=
-e.current();f.subtype===p&&(c-=0<c?1:0);a+="<tr>";a+="<td class='token'>"+(e.index+1)+"</td>";a+="<td class='token'>"+f.type+"</td>";a+="<td class='token'>"+(0===f.subtype.length?"&nbsp;":f.subtype.toString())+"</td>";a+="<td class='token'>"+(0===f.value.length?"&nbsp;":f.value).split(" ").join("&nbsp;")+"</td>";for(var i="|",h=0;h<c;h+=1)i+="&nbsp;&nbsp;&nbsp;|";a+="<td class='token'>"+i+(0===f.value.length?"&nbsp;":f.value).split(" ").join("&nbsp;")+"</td>";a+="</tr>";f.subtype===q&&(c+=1)}document.getElementById(b).innerHTML=
-a+"</table>";d.select();d.focus()};var G=i.formatFormula=function(g,b){for(var c={tmplFunctionStart:"{{autoindent}}{{token}}(\n",tmplFunctionStop:"\n{{autoindent}}{{token}})",tmplOperandError:" {{token}}",tmplOperandRange:"{{autoindent}}{{token}}",tmplOperandLogical:" {{token}}{{autolinebreak}}",tmplOperandNumber:"{{autoindent}}{{token}}",tmplOperandText:'{{autoindent}}"{{token}}"',tmplArgument:"{{token}}\n",tmplFunctionStartArray:"",tmplFunctionStartArrayRow:"{",tmplFunctionStopArrayRow:"}",tmplFunctionStopArray:"",
-tmplSubexpressionStart:"{{autoindent}}(\n",tmplSubexpressionStop:"\n)",tmplIndentTab:"\t",tmplIndentSpace:" ",autoLineBreak:"TOK_TYPE_FUNCTION | TOK_TYPE_ARGUMENT | TOK_SUBTYPE_LOGICAL | TOK_TYPE_OP_IN ",newLine:"\n",customTokenRender:null,prefix:"",postfix:""},b=b?m.extend(!0,c,b):c,c=0,d=v(g),e="",a=b.autoLineBreak.replace(/\s/gi,"").split("|"),f=!0;d.moveNext();){var i=d.current(),h=d.next();i.subtype.toString()===p&&(c-=0<c?1:0);var l=RegExp(b.newLine+"$","");a:{for(var k=0;k<a.length;k+=1)if(null!==
-h&&"undefined"!==typeof h&&(j[a[k]]===h.type.toString()||j[a[k]]===h.subtype.toString())){h=!0;break a}h=!1}if(f){f="";for(k=0;k<c;k+=1)f+=b.tmplIndentTab}else f=b.tmplIndentSpace;e+=x(i,b,f,h?b.newLine:"",b.customTokenRender);i.subtype.toString()===q&&(c+=1);f=h||l.test(e)}return e=b.prefix+o(e)+b.postfix};i.formatFormulaHTML=function(g){return G(g,{tmplFunctionStart:'{{autoindent}}<span class="function">{{token}}</span><span class="function_start">(</span><br />',tmplFunctionStop:'<br />{{autoindent}}{{token}}<span class="function_stop">)</span>',
+(function(){"undefined"===typeof window&&(window=root);window.excelFormulaUtilities=window.excelFormulaUtilities||{};var s=window.excelFormulaUtilities.core={};window.excelFormulaUtilities.string=window.excelFormulaUtilities.string||{};window.excelFormulaUtilities.string.formatStr=function(h){for(var n=h,i=1;i<arguments.length;i++)n=n.replace(RegExp("\\{{1}"+(i-1).toString()+"{1}\\}{1}","g"),arguments[i]);return n};window.excelFormulaUtilities.string.trim=function(h){return h.replace(/^\s|\s$/,"")};
+window.excelFormulaUtilities.string.trim=function(h){return h.replace(/^(?:\s|&nbsp;|<\s*br\s*\/*\s*>)*|(?:\s|&nbsp;|<\s*br\s*\/*\s*>)*$/,"")};var v=s.isFunction=function(h){return"function"===typeof h},x=s.isArray=function(h){return"object"===typeof h&&h.length},w=s.isWindow=function(){return obj&&"object"===typeof obj&&"setInterval"in obj},y=s.isPlainObject=function(h){if(!h||("object"!==typeof h||h.nodeType||w(h))||h.constructor&&!hasOwnProperty.call(h,"constructor")&&!hasOwnProperty.call(h.constructor.prototype,
+"isPrototypeOf"))return!1;for(var n in h);return void 0===n||hasOwnProperty.call(h,n)};s.extend=function(){var h,n,i,p,k,l=arguments[0]||{},m=1,o=arguments.length,t=!1;"boolean"===typeof l&&(t=l,l=arguments[1]||{},m=2);"object"!==typeof l&&!v(l)&&(l={});o===m&&(l=this,--m);for(;m<o;m++)if(null!=(h=arguments[m]))for(n in h)i=l[n],p=h[n],l!==p&&(t&&p&&(y(p)||(k=x(p)))?(k?(k=!1,i=i&&x(i)?i:[]):i=i&&y(i)?i:{},l[n]=s.extend(t,i,p)):void 0!==p&&(l[n]=p));return l}})();(function(){function s(f,b,c){this.value=f;this.type=b;this.subtype=c}function v(){this.items=[];this.add=function(f,b,c){c||(c="");f=new s(f,b,c);this.addRef(f);return f};this.addRef=function(f){this.items.push(f)};this.index=-1;this.reset=function(){this.index=-1};this.BOF=function(){return 0>=this.index};this.EOF=function(){return this.index>=this.items.length-1};this.moveNext=function(){if(this.EOF())return!1;this.index+=1;return!0};this.current=function(){return-1===this.index?null:this.items[this.index]};
+this.next=function(){return this.EOF()?null:this.items[this.index+1]};this.previous=function(){return 1>this.index?null:this.items[this.index-1]}}function x(){this.items=[];this.push=function(f){this.items.push(f)};this.pop=function(f){var b=this.items.pop();return new s(f||"",b.type,q)};this.token=function(){return 0<this.items.length?this.items[this.items.length-1]:null};this.value=function(){return this.token()?this.token().value.toString():""};this.type=function(){return this.token()?this.token().type.toString():
+""};this.subtype=function(){return this.token()?this.token().subtype.toString():""}}function w(f){for(var b=new v,c=new x,d=0,e=function(){return f.substr(d,1)},a="",j=!1,g=!1,h=!1,i=!1,k=/^[1-9]{1}(\.[0-9]+)?E{1}$/;0<f.length;)if(" "===f.substr(0,1))f=f.substr(1);else{"="===f.substr(0,1)&&(f=f.substr(1));break}for(;!(d>=f.length);)if(j)'"'===e()?'"'===f.substr(d+1,1)?(a+='"',d+=1):(j=!1,b.add(a,m,I),a=""):a+=e(),d+=1;else if(g)"'"===e()?"'"===f.substr(d+1,1)?(a+="'",d+=1):g=!1:a+=e(),d+=1;else if(h)"]"===
+e()&&(h=!1),a+=e(),d+=1;else if(i)a+=e(),d+=1,-1!==",#NULL!,#DIV/0!,#VALUE!,#REF!,#NAME?,#NUM!,#N/A,".indexOf(","+a+",")&&(i=!1,b.add(a,m,J),a="");else if(-1!=="+-".indexOf(e())&&1<a.length&&a.match(k))a+=e(),d+=1;else if('"'===e())0<a.length&&(b.add(a,z),a=""),j=!0,d+=1;else if("'"===e())0<a.length&&(b.add(a,z),a=""),g=!0,d+=1;else if("["===e())h=!0,a+=e(),d+=1;else if("#"===e())0<a.length&&(b.add(a,z),a=""),i=!0,a+=e(),d+=1;else if("{"===e())0<a.length&&(b.add(a,z),a=""),c.push(b.add("ARRAY",o,
+r)),c.push(b.add("ARRAYROW",o,r)),d+=1;else if(";"===e())0<a.length&&(b.add(a,m),a=""),b.addRef(c.pop()),b.add(",",A),c.push(b.add("ARRAYROW",o,r)),d+=1;else if("}"===e())0<a.length&&(b.add(a,m),a=""),b.addRef(c.pop("ARRAYROWSTOP")),b.addRef(c.pop("ARRAYSTOP")),d+=1;else if(" "===e()){0<a.length&&(b.add(a,m),a="");b.add("",E);for(d+=1;" "===e()&&!(d>=f.length);)d+=1}else-1!==",>=,<=,<>,".indexOf(","+f.substr(d,2)+",")?(0<a.length&&(b.add(a,m),a=""),b.add(f.substr(d,2),u,B),d+=2):(-1!=="+-*/^&=><".indexOf(e())?
+(0<a.length&&(b.add(a,m),a=""),b.add(e(),u)):-1!=="%".indexOf(e())?(0<a.length&&(b.add(a,m),a=""),b.add(e(),C)):"("===e()?0<a.length?(c.push(b.add(a,o,r)),a=""):c.push(b.add("",t,r)):","===e()?(0<a.length&&(b.add(a,m),a=""),c.type()!==o?b.add(e(),u,K):b.add(e(),A)):")"===e()?(0<a.length&&(b.add(a,m),a=""),b.addRef(c.pop())):a+=e(),d+=1);0<a.length&&b.add(a,m);for(c=new v;b.moveNext();)a=b.current(),a.type.toString()===E?(e=(e=(e=b.BOF()||b.EOF())&&(b.previous().type.toString()===o&&b.previous().subtype.toString()===
+q||b.previous().type.toString()===t&&b.previous().subtype.toString()===q||b.previous().type.toString()===m))&&(b.next().type.toString()===o&&b.next().subtype.toString()===r||b.next().type.toString()===t&&b.next().subtype.toString()===r||b.next().type.toString()===m))&&c.add(a.value.toString(),u,L):c.addRef(a);for(;c.moveNext();)a=c.current(),a.type.toString()===u&&"-"===a.value.toString()?c.BOF()?a.type=F.toString():c.previous().type.toString()===o&&c.previous().subtype.toString()===q||c.previous().type.toString()===
+t&&c.previous().subtype.toString()===q||c.previous().type.toString()===C||c.previous().type.toString()===m?a.subtype=D.toString():a.type=F.toString():a.type.toString()===u&&"+"===a.value.toString()?c.BOF()?a.type=l.toString():c.previous().type.toString()===o&&c.previous().subtype.toString()===q||c.previous().type.toString()===t&&c.previous().subtype.toString()===q||c.previous().type.toString()===C||c.previous().type.toString()===m?a.subtype=D.toString():a.type=l.toString():a.type.toString()===u&&
+0===a.subtype.length?a.subtype=-1!=="<>=".indexOf(a.value.substr(0,1))?B.toString():"&"===a.value.toString()?M.toString():D.toString():a.type.toString()===m&&0===a.subtype.length?a.subtype=isNaN(parseFloat(a.value))?"TRUE"===a.value.toString()||"FALSE"===a.value.toString()?B.toString():G.toString():N.toString():a.type.toString()===o&&"@"===a.value.substr(0,1)&&(a.value=a.value.substr(1).toString());c.reset();for(b=new v;c.moveNext();)c.current().type.toString()!==l&&b.addRef(c.current());b.reset();
+return b}function y(f,b,c,d,e,a){var a=void 0===typeof a||null===a?null:a,j=function(a){return a.replace(/\{\{token\}\}/gi,"{0}").replace(/\{\{autoindent\}\}/gi,"{1}").replace(/\{\{autolinebreak\}\}/gi,"{2}")},g="",g="text"===f.subtype||"text"===f.type?f.value.toString():(0===f.value.length?" ":f.value.toString()).split(" ").join("").toString();if("function"===typeof e&&(e=e(g,f,c,d),g=e.tokenString,!e.useTemplate))return g;switch(f.type){case "function":switch(f.value){case "ARRAY":g=i(j(b.tmplFunctionStartArray),
+g,c,d);break;case "ARRAYROW":g=i(j(b.tmplFunctionStartArrayRow),g,c,d);break;default:g="start"===f.subtype.toString()?i(j(b.tmplFunctionStart),g,c,d):i(j(b.tmplFunctionStop),g,c,d)}break;case "operand":switch(f.subtype.toString()){case "error":g=i(j(b.tmplOperandError),g,c,d);break;case "range":g=i(j(b.tmplOperandRange),g,c,d);break;case "number":g=i(j(b.tmplOperandNumber),g,c,d);break;case "text":g=i(j(b.tmplOperandText),g,c,d);break;case "argument":g=i(j(b.tmplArgument),g,c,d)}break;case "operator-infix":case "logical":g=
+i(j(b.tmplOperandLogical),g,c,d);break;case "argument":g="argument"!==a.type?i(j(b.tmplArgument),g,c,d):i(j("{{autoindent}}"+b.tmplArgument),g,c,d);break;case "subexpression":g="start"===f.subtype.toString()?i(j(b.tmplSubexpressionStart),g,c,d):i(j(b.tmplSubexpressionStop),g,c,d)}return g}"undefined"===typeof window&&(window=root);var h=window.excelFormulaUtilities=window.excelFormulaUtilities||{},n=window.excelFormulaUtilities.core,i=window.excelFormulaUtilities.string.formatStr,p=window.excelFormulaUtilities.string.trim,
+k={},l=k.TOK_TYPE_NOOP="noop",m=k.TOK_TYPE_OPERAND="operand",o=k.TOK_TYPE_FUNCTION="function",t=k.TOK_TYPE_SUBEXPR="subexpression",A=k.TOK_TYPE_ARGUMENT="argument",F=k.TOK_TYPE_OP_PRE="operator-prefix",u=k.TOK_TYPE_OP_IN="operator-infix",C=k.TOK_TYPE_OP_POST="operator-postfix",E=k.TOK_TYPE_WSPACE="white-space",z=k.TOK_TYPE_UNKNOWN="unknown",r=k.TOK_SUBTYPE_START="start",q=k.TOK_SUBTYPE_STOP="stop",I=k.TOK_SUBTYPE_TEXT="text",N=k.TOK_SUBTYPE_NUMBER="number",B=k.TOK_SUBTYPE_LOGICAL="logical",J=k.TOK_SUBTYPE_ERROR=
+"error",G=k.TOK_SUBTYPE_RANGE="range",D=k.TOK_SUBTYPE_MATH="math",M=k.TOK_SUBTYPE_CONCAT="concatenate",L=k.TOK_SUBTYPE_INTERSECT="intersect",K=k.TOK_SUBTYPE_UNION="union";h.parseFormula=function(f,b){var c=0,d=document.getElementById(f),e=w(d.value),a;for(a="<table cellspacing='0' style='border-top: 1px #cecece solid; margin-top: 5px; margin-bottom: 5px'><tr><td class='token' style='font-weight: bold; width: 50px'>index</td><td class='token' style='font-weight: bold; width: 125px'>type</td><td class='token' style='font-weight: bold; width: 125px'>subtype</td><td class='token' style='font-weight: bold; width: 150px'>token</td><td class='token' style='font-weight: bold; width: 300px'>token tree</td></tr>";e.moveNext();){var j=
+e.current();j.subtype===q&&(c-=0<c?1:0);a+="<tr>";a+="<td class='token'>"+(e.index+1)+"</td>";a+="<td class='token'>"+j.type+"</td>";a+="<td class='token'>"+(0===j.subtype.length?"&nbsp;":j.subtype.toString())+"</td>";a+="<td class='token'>"+(0===j.value.length?"&nbsp;":j.value).split(" ").join("&nbsp;")+"</td>";for(var g="|",h=0;h<c;h+=1)g+="&nbsp;&nbsp;&nbsp;|";a+="<td class='token'>"+g+(0===j.value.length?"&nbsp;":j.value).split(" ").join("&nbsp;")+"</td>";a+="</tr>";j.subtype===r&&(c+=1)}document.getElementById(b).innerHTML=
+a+"</table>";d.select();d.focus()};var H=h.formatFormula=function(f,b){for(var c={tmplFunctionStart:"{{autoindent}}{{token}}(\n",tmplFunctionStop:"\n{{autoindent}}{{token}})",tmplOperandError:" {{token}}",tmplOperandRange:"{{autoindent}}{{token}}",tmplOperandLogical:" {{token}}{{autolinebreak}}",tmplOperandNumber:"{{autoindent}}{{token}}",tmplOperandText:'{{autoindent}}"{{token}}"',tmplArgument:"{{token}}\n",tmplFunctionStartArray:"",tmplFunctionStartArrayRow:"{",tmplFunctionStopArrayRow:"}",tmplFunctionStopArray:"",
+tmplSubexpressionStart:"{{autoindent}}(\n",tmplSubexpressionStop:"\n)",tmplIndentTab:"\t",tmplIndentSpace:" ",autoLineBreak:"TOK_TYPE_FUNCTION | TOK_TYPE_ARGUMENT | TOK_SUBTYPE_LOGICAL | TOK_TYPE_OP_IN ",newLine:"\n",customTokenRender:null,prefix:"",postfix:""},b=b?n.extend(!0,c,b):c,c=0,d=w(f),e="",a=b.autoLineBreak.replace(/\s/gi,"").split("|"),j=!0,g=null;d.moveNext();){var h=d.current(),i=d.next();h.subtype.toString()===q&&(c-=0<c?1:0);var m=RegExp(b.newLine+"$","");a:{for(var l=0;l<a.length;l+=
+1)if(null!==i&&"undefined"!==typeof i&&(k[a[l]]===i.type.toString()||k[a[l]]===i.subtype.toString())){i=!0;break a}i=!1}if(j){j="";for(l=0;l<c;l+=1)j+=b.tmplIndentTab}else j=b.tmplIndentSpace;e+=y(h,b,j,i?b.newLine:"",b.customTokenRender,g);h.subtype.toString()===r&&(c+=1);j=i||m.test(e);g=h}return e=b.prefix+p(e)+b.postfix};h.formatFormulaHTML=function(f){return H(f,{tmplFunctionStart:'{{autoindent}}<span class="function">{{token}}</span><span class="function_start">(</span><br />',tmplFunctionStop:'<br />{{autoindent}}{{token}}<span class="function_stop">)</span>',
tmplOperandError:"{{token}}",tmplOperandRange:"{{autoindent}}{{token}}",tmplOperandLogical:" {{token}}{{autolinebreak}}",tmplOperandNumber:"{{autoindent}}{{token}}",tmplOperandText:'{{autoindent}}<span class="quote_mark">"</span><span class="text">{{token}}</span><span class="quote_mark">"</span>',tmplArgument:"{{token}}<br />",tmplFunctionStartArray:"",tmplFunctionStartArrayRow:"{",tmplFunctionStopArrayRow:"}",tmplFunctionStopArray:"",tmplSubexpressionStart:"{{autoindent}}(",tmplSubexpressionStop:" )",
-tmplIndentTab:'<span class="tabbed">&nbsp;&nbsp;&nbsp;&nbsp;</span>',tmplIndentSpace:"&nbsp;",newLine:"<br />",autoLineBreak:"TOK_TYPE_FUNCTION | TOK_TYPE_ARGUMENT | TOK_SUBTYPE_LOGICAL | TOK_TYPE_OP_IN ",trim:!0,prefix:"=",customTokenRender:null})};var N=i.formula2CSharp=function(g){var b=[];return G(g,{tmplFunctionStart:"{{token}}(",tmplFunctionStop:"{{token}})",tmplOperandError:"{{token}}",tmplOperandRange:"{{token}}",tmplOperandLogical:"{{token}}",tmplOperandNumber:"{{token}}",tmplOperandText:'"{{token}}"',
-tmplArgument:"{{token}}",tmplFunctionStartArray:"",tmplFunctionStartArrayRow:"{",tmplFunctionStopArrayRow:"}",tmplFunctionStopArray:"",tmplSubexpressionStart:"(",tmplSubexpressionStop:")",tmplIndentTab:"\t",tmplIndentSpace:" ",autoLineBreak:"TOK_SUBTYPE_STOP | TOK_SUBTYPE_START | TOK_TYPE_ARGUMENT",trim:!0,customTokenRender:function(c,d){var e="",a={"=":"==","<>":"!=",MIN:"Math.Min",MAX:"Math.Max",ABS:"Math.ABS",SUM:"",IF:"","&":"+"},f=b[b.length-1],g=!1;switch(d.type.toString()){case n:switch(d.subtype){case q:b.push({name:c,
-argumentNumber:0});e="string"===typeof a[c.toUpperCase()]?a[c.toUpperCase()]:c;g=!0;break;case p:g=!0;switch(f.name.toLowerCase()){case "if":e=")";g=!1;break;default:e="string"===typeof a[c.toUpperCase()]?a[c.toUpperCase()]:c}b.pop()}break;case z:switch(f.name.toLowerCase()){case "if":switch(f.argumentNumber){case 0:e="?";break;case 1:e=":"}break;case "sum":e="+";break;default:e="string"===typeof a[c.toUpperCase()]?a[c.toUpperCase()]:c,g=!0}f.argumentNumber+=1;break;case l:switch(d.subtype){case F:switch(f.name.toLowerCase()){case "sum":if(/\w{1,4}\d+:\w{1,4}\d+/gi.test("A1:B2"))throw"This is not a valid range: "+
-c;ranges=c.split(":");startRow=range[0].match(/[0-9]+/gi)[0];startCol=range[0].match(/[A-Z]+/gi)[0];endRow=range[1].match(/[0-9]+/gi)[0];endCol=range[1].match(/[A-Z]+/gi)[0];debugger}break}default:e="string"===typeof a[c.toUpperCase()]?a[c.toUpperCase()]:c,g=!0}return{tokenString:e,useTemplate:g}}})};i.formula2JavaScript=function(g){return N(g).replace("==","===")};i.getTokens=v})();
+tmplIndentTab:'<span class="tabbed">&nbsp;&nbsp;&nbsp;&nbsp;</span>',tmplIndentSpace:"&nbsp;",newLine:"<br />",autoLineBreak:"TOK_TYPE_FUNCTION | TOK_TYPE_ARGUMENT | TOK_SUBTYPE_LOGICAL | TOK_TYPE_OP_IN ",trim:!0,prefix:"=",customTokenRender:null})};var O=h.formula2CSharp=function(f){var b=[];return H(f,{tmplFunctionStart:"{{token}}(",tmplFunctionStop:"{{token}})",tmplOperandError:"{{token}}",tmplOperandRange:"{{token}}",tmplOperandLogical:"{{token}}",tmplOperandNumber:"{{token}}",tmplOperandText:'"{{token}}"',
+tmplArgument:"{{token}}",tmplFunctionStartArray:"",tmplFunctionStartArrayRow:"{",tmplFunctionStopArrayRow:"}",tmplFunctionStopArray:"",tmplSubexpressionStart:"(",tmplSubexpressionStop:")",tmplIndentTab:"\t",tmplIndentSpace:" ",autoLineBreak:"TOK_SUBTYPE_STOP | TOK_SUBTYPE_START | TOK_TYPE_ARGUMENT",trim:!0,customTokenRender:function(c,d){var e="",a={"=":"==","<>":"!=",MIN:"Math.Min",MAX:"Math.Max",ABS:"Math.ABS",SUM:"",IF:"","&":"+"},f=b[b.length-1],g=!1;switch(d.type.toString()){case o:switch(d.subtype){case r:b.push({name:c,
+argumentNumber:0});e="string"===typeof a[c.toUpperCase()]?a[c.toUpperCase()]:c;g=!0;break;case q:g=!0;switch(f.name.toLowerCase()){case "if":e=")";g=!1;break;default:e="string"===typeof a[c.toUpperCase()]?a[c.toUpperCase()]:c}b.pop()}break;case A:switch(f.name.toLowerCase()){case "if":switch(f.argumentNumber){case 0:e="?";break;case 1:e=":"}break;case "sum":e="+";break;default:e="string"===typeof a[c.toUpperCase()]?a[c.toUpperCase()]:c,g=!0}f.argumentNumber+=1;break;case m:switch(d.subtype){case G:switch(f.name.toLowerCase()){case "sum":if(/\w{1,4}\d+:\w{1,4}\d+/gi.test("A1:B2"))throw"This is not a valid range: "+
+c;ranges=c.split(":");startRow=range[0].match(/[0-9]+/gi)[0];startCol=range[0].match(/[A-Z]+/gi)[0];endRow=range[1].match(/[0-9]+/gi)[0];endCol=range[1].match(/[A-Z]+/gi)[0];debugger}break}default:e="string"===typeof a[c.toUpperCase()]?a[c.toUpperCase()]:c,g=!0}return{tokenString:e,useTemplate:g}}})};h.formula2JavaScript=function(f){return O(f).replace("==","===")};h.getTokens=w})();
View
16 src/ExcelFormulaUtilities.js
@@ -693,6 +693,8 @@
function applyTokenTemplate(token, options, indent, lineBreak, override) {
var indt = indent;
+
+ var lastToken = typeof arguments[5] === undefined || arguments[5] === null ? null : arguments[5];
var replaceTokenTmpl = function (inStr) {
return inStr.replace(/\{\{token\}\}/gi, "{0}").replace(/\{\{autoindent\}\}/gi, "{1}").replace(/\{\{autolinebreak\}\}/gi, "{2}");
@@ -763,7 +765,11 @@
tokenString = formatStr(replaceTokenTmpl(options.tmplOperandLogical), tokenString, indt, lineBreak);
break;
case "argument":
- tokenString = formatStr(replaceTokenTmpl(options.tmplArgument), tokenString, indt, lineBreak);
+ if(lastToken.type !== "argument"){
+ tokenString = formatStr(replaceTokenTmpl(options.tmplArgument), tokenString, indt, lineBreak);
+ } else {
+ tokenString = formatStr(replaceTokenTmpl("{{autoindent}}"+options.tmplArgument), tokenString, indt, lineBreak);
+ }
break;
case "subexpression":
if (token.subtype.toString() === "start") {
@@ -888,7 +894,9 @@
}
return false;
};
-
+
+ var lastToken = null;
+
while (tokens.moveNext()) {
var token = tokens.current();
@@ -905,7 +913,7 @@
indt = autoIndent ? indent() : options.tmplIndentSpace,
lineBreak = autoBreak ? options.newLine : "";
- outputFormula += applyTokenTemplate(token, options, indt, lineBreak, options.customTokenRender);
+ outputFormula += applyTokenTemplate(token, options, indt, lineBreak, options.customTokenRender, lastToken);
if (token.subtype.toString() === TOK_SUBTYPE_START) {
indentCount += 1;
@@ -914,6 +922,8 @@
isNewLine = autoBreak || matchEndNewLine.test(outputFormula);
isFirstToken = false;
+
+ lastToken = token;
}
outputFormula = options.prefix + trim(outputFormula) + options.postfix;
View
16 test/ExcelFormulaUtilities.test.js
@@ -22,20 +22,16 @@ test("formatFormula", function() {
inputFormula = '(AC6+AD6+IF(H6="Yes",1,IF(J6="Yes",1,0)))+IF(X6="Yes",1,0)'
excpected = '(\n\tAC6 + AD6 +\n\tIF(\n\t\tH6 = \"Yes\",\n\t\t1,\n\t\tIF(\n\t\t\tJ6 = \"Yes\",\n\t\t\t1,\n\t\t\t0\n\t\t)\n\t)\n) +\nIF(\n\tX6 = \"Yes\",\n\t1,\n\t0\n)';
equal(excelFormulaUtilities.formatFormula(inputFormula), excpected, "Encapsulation spacing.");
+
+ inputFormula = 'TEST(1,,,1)';
+ excpected = 'TEST(\n\t1,\n\t,\n\t,\n\t1\n)';
+ equal(excelFormulaUtilities.formatFormula(inputFormula), excpected, "multiple commas.");
});
-test("formatFormulaHTML", function() {
- var inputFormula = 'IF("foo" = "foo", "foo", "bar")';
- var excpected = '<span class="function">IF</span><br /><span class="function_start">(</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="quote_mark">"</span><span class="text">foo</span><span class="quote_mark">"</span> =&nbsp;<span class="quote_mark">"</span><span class="text">foo</span><span class="quote_mark">"</span>,<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="quote_mark">"</span><span class="text">foo</span><span class="quote_mark">"</span>,<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="quote_mark">"</span><span class="text">bar</span><span class="quote_mark">"</span><br /><span class="function_stop">)</span>';
-
- equal(window.excelFormulaUtilities.formatFormulaHTML(inputFormula), excpected, "Simple formating example.");
+/*test("formatFormulaHTML", function() {
- inputFormula = 'IF(R[39]C[11]>65,R[25]C[42],ROUND((R[11]C[11]*IF(OR(AND(R[39]C[11]>=55, R[40]C[11]>=20),AND(R[40]C[11]>=20,R11C3="YES")),R[44]C[11],R[43]C[11]))+(R[14]C[11] *IF(OR(AND(R[39]C[11]>=55,R[40]C[11]>=20),AND(R[40]C[11]>=20,R11C3="YES")), R[45]C[11],R[43]C[11])),0))'
- excpected = '<span class="function">IF</span><br /><span class="function_start">(</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span>R[39]C[11] >&nbsp;65,<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span>R[25]C[42],<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function">ROUND</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_start">(</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span>(&nbsp;R[11]C[11] *<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function">IF</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_start">(</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function">OR</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_start">(</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function">AND</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_start">(</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span>R[39]C[11] >=&nbsp;55,<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span>R[40]C[11] >=&nbsp;20<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_stop">)</span>,<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function">AND</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_start">(</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span>R[40]C[11] >=&nbsp;20,<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span>R11C3 =&nbsp;<span class="quote_mark">"</span><span class="text">YES</span><span class="quote_mark">"</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_stop">)</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_stop">)</span>,<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span>R[44]C[11],<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span>R[43]C[11]<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_stop">)</span> ) +&nbsp;(&nbsp;R[14]C[11] *<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function">IF</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_start">(</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function">OR</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_start">(</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function">AND</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_start">(</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span>R[39]C[11] >=&nbsp;55,<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span>R[40]C[11] >=&nbsp;20<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_stop">)</span>,<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function">AND</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_start">(</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span>R[40]C[11] >=&nbsp;20,<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span>R11C3 =&nbsp;<span class="quote_mark">"</span><span class="text">YES</span><span class="quote_mark">"</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_stop">)</span><br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_stop">)</span>,<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span>R[45]C[11],<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span>R[43]C[11]<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_stop">)</span> ),<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span>0<br /><span class="tabs">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="function_stop">)</span><br /><span class="function_stop">)</span>';
- equal(excelFormulaUtilities.formatFormulaHTML(inputFormula), excpected, "advanced example.");
-
-});
+});*/
QUnit.module("convert");
View
0 testapp.js
No changes.

0 comments on commit ef86234

Please sign in to comment.