Comparing version 1.2.8 to 1.3.0
/* | ||
Crox v1.2.8 | ||
Crox v1.3.0 | ||
https://github.com/thx/crox | ||
Released under the MIT license | ||
md5: 912613ebf674b2d4a9e47ab63011d26c | ||
md5: 1148cc38533540fc0e33aeaab155c241 | ||
*/ | ||
(function(D){var B=function(){function B(a,f){this.row=a;this.col=f}function G(a,f){var d=a.substring(0,f),c=d.match(/\r\n?|\n/g),g=1;c&&(g+=c.length);d=1+/[^\r\n]*$/.exec(d)[0].length;return new B(g,d)}function D(a){return'"'+a.replace(/[\x00-\x1f"\\\u2028\u2029]/g,function(f){switch(f){case '"':return'\\"';case "\\":return"\\\\";case "\b":return"\\b";case "\f":return"\\f";case "\n":return"\\n";case "\r":return"\\r";case "\t":return"\\t"}return"\\u"+("000"+f.charCodeAt(0).toString(16)).slice(-4)})+ | ||
'"'}function H(a){return eval(a)}function t(a){return a.replace(/^_+/,"$&$&")}function K(a){function f(b,e,g,k){this.tag=b;this.text=e;this.index=g;this.subMatches=k}function d(){}function c(b){for(var e=1,g=[],k=[1],f=[],a=0;a<b.length;++a)k.push(e+=RegExp("|"+b[a][0].source).exec("").length),f.push(b[a][1]||d),g.push("("+b[a][0].source+")");return[RegExp(g.join("|")+"|","g"),k,f]}f.prototype.toString=function(){return this.text};var g=a.$||"$",b={},k;for(k in a)"$"!=k.charAt(0)&&(b[k]=c(a[k])); | ||
return function(k){var e=k.length,a=0,c=[""],d={text:"",index:0,source:k,pushState:function(b){c.push(b)},popState:function(){c.pop()},retract:function(b){a-=b}};return{scan:function(){do{var l;a:{var r=b[c[c.length-1]],p=r[0];p.lastIndex=a;l=p.exec(k);if(""==l[0]){if(a<e)throw Error("lexer error: "+G(k,a)+"\n"+k.slice(a,a+50));l=new f(g,"",a)}else{d.index=a;a=p.lastIndex;for(var p=r[1],q=0;q<p.length;++q)if(l[p[q]]){r=r[2][q].apply(d,l.slice(p[q],p[q+1]));l=new f(r,l[0],d.index,l.slice(p[q]+1,p[q+ | ||
1]));break a}l=void 0}}}while(null==l.tag);return l},getPos:function(b){return G(k,b)}}}}function x(a){var f;a:{switch(a){case "id":case "lit":f=!0;break a}f=!1}return f||"."==a||"[]"==a}function m(a){return x(a)||"!"==a||"u-"==a}function y(a){if(m(a))return!0;switch(a){case "*":case "/":case "%":return!0}return!1}function z(a){if(y(a))return!0;switch(a){case "+":case "-":return!0}return!1}function A(a){if(z(a))return!0;switch(a){case "<":case ">":case "<=":case ">=":return!0}return!1}function C(a){if(A(a))return!0; | ||
switch(a){case "eq":case "ne":return!0}return!1}function E(a){return C(a)||"&&"==a}function I(a){return E(a)||"||"==a}function L(a,f,d){function c(b){e+=b}function g(b){for(var e=0;e<b.length;++e){var a=b[e];switch(a[0]){case "if":c("if("+k(a[1])+"){");g(a[2]);c("}");a[3]&&(c("else{"),g(a[3]),c("}"));break;case "each":var l=a[3]?t(a[3]):"_"+s++,r=k(a[1]);if(/^\w+$/.test(r))var p=r;else p="_"+s++,c("var "+p+" = "+r+";");a[5]?c("for(var "+l+"=0;"+l+"<"+p+".length;"+l+"++){"):c("for(var "+l+" in "+p+ | ||
") {");c("var "+a[4]+" = "+p+"["+l+"];");g(a[2]);c("}");break;case "set":c("var "+t(a[1])+"="+k(a[2])+";");break;case "eval":l=k(a[1]);/^\w+$/.test(l)?r=l:(r="_t",c("_t = "+l+";"));c("if("+r+" !=null)_s += "+((d?!a[2]:a[2])?f+"("+r+")":r)+";");break;case "text":c("_s += "+D(a[1])+";");break;case "inc":break;default:throw Error("unknown stmt: "+a[0]);}}}function b(b,a){var e=k(b);a&&!a(b[0])&&(e="("+e+")");return e}function k(a){switch(a[0]){case "id":return t(a[1]);case "lit":return"string"==typeof a[1]? | ||
D(a[1]):String(a[1]);case ".":return b(a[1],x)+"."+a[2];case "[]":return b(a[1],x)+"["+k(a[2])+"]";case "!":return"!"+b(a[1],m);case "u-":return"- "+b(a[1],m);case "*":case "/":case "%":return b(a[1],y)+a[0]+b(a[2],m);case "+":case "-":return b(a[1],z)+a[0]+" "+b(a[2],y);case "<":case ">":case "<=":case ">=":return b(a[1],A)+a[0]+b(a[2],z);case "==":case "!=":case "===":case "!==":return b(a[1],C)+a[0]+b(a[2],A);case "&&":return b(a[1],E)+"&&"+b(a[2],C);case "||":return b(a[1],I)+"||"+b(a[2],E);default:throw Error("unknown expr: "+ | ||
a[0]);}}var s=0,e="";g(a[1]);return e}function F(a){return M(N(a))}function J(a,f){var d=F(a),c;f&&(c=f.htmlEncode);a=L(d,c||"_htmlEncode",!0);d="";c||(d="var _obj = { '<': '<', '>': '>', '&': '&', '\"': '"' };\tfunction _htmlEncode(s) {\t\treturn String(s).replace(/[<>&\"]/g, function(c) {\t\t\treturn _obj[c];\t\t});\t}");return Function("root",d+("var _t,_s = '';"+a+"return _s;"))}function O(a,f){function d(a){for(var c=0;c<a.length;++c){var e=a[c];switch(e[0]){case "if":var u="if("+ | ||
g(e[1])+"){";b+=u;d(e[2]);b+="}";e[3]&&(b+="else{",d(e[3]),b+="}");break;case "each":u="foreach("+g(e[1])+" as "+(e[3]?"$crox_"+t(e[3])+"=>":"")+("$crox_"+t(e[4]))+")";b+=u;b+="{";d(e[2]);b+="}";break;case "set":e="$crox_"+t(e[1])+" = "+g(e[2])+";";b+=e;break;case "eval":u=g(e[1]);b+="crox_echo("+u+", "+(f?!e[2]:e[2])+");";break;case "text":u=e[1];/<\?(?:php)?|\?>/.test(u)?(e="echo "+("'"+String(e[1]).replace(/['\\]/g,"\\$&")+"'")+";",b+=e):b+="?>"+u+"<?php ";break;case "inc":e="include '"+e[1].replace(/\.\w+$/, | ||
".php")+"';";b+=e;break;default:throw Error("unknown stmt: "+e[0]);}}}function c(a,b){var e=g(a);b&&!b(a[0])&&(e="("+e+")");return e}function g(a){switch(a[0]){case "id":return"$crox_"+t(a[1]);case "lit":return"string"==typeof a[1]?"'"+String(a[1]).replace(/['\\]/g,"\\$&")+"'":String(a[1]);case ".":return c(a[1],x)+"->"+a[2];case "[]":return c(a[1],x)+"["+g(a[2])+"]";case "!":return"!crox_ToBoolean("+c(a[1],m)+")";case "u-":return"- "+c(a[1],m);case "*":case "/":case "%":return c(a[1],y)+a[0]+c(a[2], | ||
m);case "+":return"crox_plus("+c(a[1],null)+", "+c(a[2],null)+")";case "-":return c(a[1],z)+"- "+c(a[2],y);case "<":case ">":case "<=":case ">=":return c(a[1],A)+a[0]+c(a[2],z);case "==":case "!=":case "===":case "!==":return c(a[1],C)+a[0]+c(a[2],A);case "&&":return"crox_logical_and("+c(a[1],null)+", "+c(a[2],null)+")";case "||":return"crox_logical_or("+c(a[1],null)+", "+c(a[2],null)+")";default:throw Error("unknown expr: "+a[0]);}}var b="";d(a[1]);b="?>"==b.slice(0,2)?b.slice(2):"<?php "+b;return b= | ||
"<?php "==b.slice(-6)?b.slice(0,-6):b+"?>"}function P(a){function f(a){return"$crox_"+t(a)}function d(a){s+=a}function c(a){for(var g=0;g<a.length;++g){var h=a[g];switch(h[0]){case "if":d("#if("+b(h[1])+")");c(h[2]);h[3]&&(d("#{else}"),c(h[3]));d("#{end}");break;case "each":++k;var s=b(h[1]);if(/^$\w+$/.test(s))var l=s;else l="$list"+(1==k?"":k),d("#set ("+l+" = "+s+")");h[5]?(d("#foreach("+f(h[4])+" in "+l+")"),h[3]&&d("#set("+f(h[3])+" = $velocityCount - 1)")):h[3]?(d("#foreach("+f(h[3])+" in "+ | ||
l+".keySet())"),d("#set("+f(h[4])+" ="+l+".get("+f(h[3])+"))")):d("#foreach("+f(h[4])+" in "+l+")");c(h[2]);d("#{end}");--k;break;case "set":d("#set ("+f(h[1])+"="+b(h[2])+")");break;case "eval":h=b(h[1]);/^$\w+$/.test(h)?d("$!{"+h.slice(1)+"}"):d("#set($t = "+h+")$!{t}");break;case "text":d(h[1].replace(/\$/g,"$${dollar}").replace(/#/g,"$${sharp}"));break;case "inc":d("#parse('"+h[1].replace(/\.\w+$/,".vm")+"')");break;default:throw Error("unknown stmt: "+h[0]);}}}function g(a,g){var f=b(a);g&&!g(a[0])&& | ||
(f="("+f+")");return f}function b(a){switch(a[0]){case "id":return f(a[1]);case "lit":return"string"==typeof a[1]?(a=a[1],a=-1==a.indexOf("'")?"'"+a+"'":"('"+a.split("'").join("'+\"'\"+'")+"')",a):String(a[1]);case ".":return g(a[1],x)+"."+a[2];case "[]":return g(a[1],x)+"["+b(a[2])+"]";case "!":return"!"+g(a[1],m);case "u-":if("u-"==a[1][0])throw Error("\u7981\u6b62\u4e24\u4e2a\u8d1f\u53f7\u8fde\u7528");return"-"+g(a[1],m);case "*":case "/":case "%":return g(a[1],y)+a[0]+g(a[2],m);case "+":case "-":return g(a[1], | ||
z)+a[0]+" "+g(a[2],y);case "<":case ">":case "<=":case ">=":return g(a[1],A)+a[0]+g(a[2],z);case "==":case "!=":case "===":case "!==":return g(a[1],C)+a[0].slice(0,2)+g(a[2],A);case "&&":return g(a[1],E)+"&&"+g(a[2],C);case "||":return g(a[1],I)+"||"+g(a[2],E);default:throw Error("unknown expr: "+a[0]);}}var k=0,s="#set($dollar='$')#set($sharp='#')";c(a[1]);return s}B.prototype.toString=function(){return"("+this.row+","+this.col+")"};var N=function(){var a=[[/\s+/],[/\/\/[^\r\n]*|\/\*[\s\S]*?\*\//], | ||
[/[A-Za-z_]\w*/,function(a){switch(a){case "true":case "false":return"boolean";case "set":case "include":return a;default:if(-1!=" abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends final finally float for function goto if implements import in instanceof int interface let long native new package private protected public return short static super switch synchronized this throw throws transient try typeof var void volatile while with yield ".indexOf(" "+ | ||
a+" ")||"null"==a)throw Error("Reserved: "+a+" "+G(this.source,this.index));return"realId"}}],[/"(?:[^"\\]|\\[\s\S])*"|'(?:[^'\\]|\\[\s\S])*'/,function(a){return"string"}],[/\d+(?:\.\d+)?(?:e-?\d+)?/,function(a){return"number"}],[function(a){a.sort().reverse();for(var d=0;d<a.length;++d)a[d]=a[d].replace(/[()*+?.[\]|]/g,"\\$&");return RegExp(a.join("|"))}("! % && ( ) * + - . / < <= = > >= [ ] || === !== == !=".split(" ")),function(a){return/[*/%]/.test(a)?"mul":/[<>]/.test(a)?"rel":/[!=]=/.test(a)? | ||
"eq":a}]];return K({"":[[/(?:(?!{{)[\s\S])+/,function(a){return"text"}],[/{{{/,function(a){this.pushState(a);return a}],[/{{(?:\/if|else|\/each|\/forin|\/raw)}}/,function(a){return a}],[/{{#raw}}/,function(a){this.pushState("raw");return a}],[/{{(?:#(?:if|each|forin)(?=\s))?/,function(a){this.pushState("{{");return a}]],raw:[[/(?:(?!{{\/raw}})[\s\S])+/,function(a){this.popState();return"rawtext"}]],"{{":a.concat([[/}}/,function(a){this.popState();return a}]]),"{{{":a.concat([[/}}}/,function(a){this.popState(); | ||
return a}]])})}(),M=function(){return function(a){function f(a,b){return k[a][b]}for(var d=a.nStart,c=a.tSymbols,g={},b=0;b<c.length;++b)g[c[b]]=b;var k=a.tAction,s=a.tGoto,e=a.tRules,u=a.tFuncs,h=a.actionIndex;h&&(f=function(a,b){var g=k[h[a]];return g[b]||g._});return function(a,b){function k(b){throw Error("Syntax error: "+a.getPos(m.index)+(b?"\n"+b:""));}var h=0,q=[0],m=a.scan(),v=[],t={get:function(a){return v[v.length+a]},set:function(a,b){v[v.length+a]=b}};if(b)for(var n in b)t[n]=b[n];for(;;)if(n= | ||
f(h,g[m.tag]))if(0<n)q.push(h=n),v.push(m),m=a.scan();else if(0>n&&-32768<n){n=-n;var h=e[n],w=h.length-1;q.length-=w;h=s[q[q.length-1]][h[0]-d];q.push(h);u[n]?(n=u[n].apply(t,v.splice(v.length-w,w)),v.push(n)):1!=w&&v.splice(v.length-w,w,null)}else return m.tag!=c[0]&&k(),v[0];else{n=[];for(w=0;w<d;++w)f(h,w)&&n.push(c[w]);k("find "+m.tag+"\nexpect "+n.join(" "))}}}({nStart:36,tSymbols:"$ ! && ( ) + - . = [ ] boolean eq include mul number rawtext realId rel set string text {{ {{#each {{#forin {{#if {{#raw}} {{/each}} {{/forin}} {{/if}} {{/raw}} {{else}} {{{ || }} }}} AdditiveExpression EqualityExpression LogicalAndExpression LogicalOrExpression MemberExpression MultiplicativeExpression PrimaryExpression RelationalExpression UnaryExpression _text epsilon expr id name program statement statements texts".split(" "), | ||
(function(C){var A=function(){function A(a,g){this.row=a;this.col=g}function F(a,g){var f=a.substring(0,g),d=f.match(/\r\n?|\n/g),e=1;d&&(e+=d.length);f=1+/[^\r\n]*$/.exec(f)[0].length;return new A(e,f)}function C(a){return'"'+a.replace(/[\x00-\x1f"\\\u2028\u2029]/g,function(g){switch(g){case '"':return'\\"';case "\\":return"\\\\";case "\b":return"\\b";case "\f":return"\\f";case "\n":return"\\n";case "\r":return"\\r";case "\t":return"\\t"}return"\\u"+("000"+g.charCodeAt(0).toString(16)).slice(-4)})+ | ||
'"'}function G(a){return eval(a)}function t(a){return a.replace(/^_+/,"$&$&")}function J(a){function g(b,c,k,e){this.tag=b;this.text=c;this.index=k;this.subMatches=e}function f(){}function d(b){for(var c=1,k=[],e=[1],h=[],g=0;g<b.length;++g)e.push(c+=RegExp("|"+b[g][0].source).exec("").length),h.push(b[g][1]||f),k.push("("+b[g][0].source+")");return[RegExp(k.join("|")+"|","g"),e,h]}g.prototype.toString=function(){return this.text};var e=a.$||"$",b={},h;for(h in a)"$"!=h.charAt(0)&&(b[h]=d(a[h])); | ||
return function(h){var c=h.length,k=0,a=[""],d={text:"",index:0,source:h,pushState:function(b){a.push(b)},popState:function(){a.pop()},retract:function(b){k-=b}};return{scan:function(){do{var f;a:{var r=b[a[a.length-1]],l=r[0];l.lastIndex=k;f=l.exec(h);if(""==f[0]){if(k<c)throw Error("lexer error: "+F(h,k)+"\n"+h.slice(k,k+50));f=new g(e,"",k)}else{d.index=k;k=l.lastIndex;for(var l=r[1],q=0;q<l.length;++q)if(f[l[q]]){r=r[2][q].apply(d,f.slice(l[q],l[q+1]));f=new g(r,f[0],d.index,f.slice(l[q]+1,l[q+ | ||
1]));break a}f=void 0}}}while(null==f.tag);return f},getPos:function(b){return F(h,b)}}}}function w(a){var g;a:{switch(a){case "id":case "lit":g=!0;break a}g=!1}return g||"."==a||"[]"==a}function m(a){return w(a)||"!"==a||"u-"==a}function x(a){if(m(a))return!0;switch(a){case "*":case "/":case "%":return!0}return!1}function y(a){if(x(a))return!0;switch(a){case "+":case "-":return!0}return!1}function z(a){if(y(a))return!0;switch(a){case "<":case ">":case "<=":case ">=":return!0}return!1}function B(a){if(z(a))return!0; | ||
switch(a){case "eq":case "ne":return!0}return!1}function D(a){return B(a)||"&&"==a}function H(a){return D(a)||"||"==a}function K(a,g,f){function d(b){c+=b}function e(b){for(var c=0;c<b.length;++c){var a=b[c];switch(a[0]){case "if":d("if("+h(a[1])+"){");e(a[2]);d("}");a[3]&&(d("else{"),e(a[3]),d("}"));break;case "each":var p=a[3]?t(a[3]):"_"+s++,r=h(a[1]);if(/^\w+$/.test(r))var l=r;else l="_"+s++,d("var "+l+" = "+r+";");a[5]?d("for(var "+p+"=0;"+p+"<"+l+".length;"+p+"++){"):d("for(var "+p+" in "+l+ | ||
") {");d("var "+a[4]+" = "+l+"["+p+"];");e(a[2]);d("}");break;case "set":d("var "+t(a[1])+"="+h(a[2])+";");break;case "eval":p=h(a[1]);/^\w+$/.test(p)?r=p:(r="_t",d("_t = "+p+";"));d("if("+r+" !=null)_s += "+((f?!a[2]:a[2])?g+"("+r+")":r)+";");break;case "text":d("_s += "+C(a[1])+";");break;case "inc":break;default:throw Error("unknown stmt: "+a[0]);}}}function b(b,c){var a=h(b);c&&!c(b[0])&&(a="("+a+")");return a}function h(c){switch(c[0]){case "id":return t(c[1]);case "lit":return"string"==typeof c[1]? | ||
C(c[1]):String(c[1]);case ".":return b(c[1],w)+"."+c[2];case "[]":return b(c[1],w)+"["+h(c[2])+"]";case "()":var a=[];if(c[2])for(var e=0;e<c[2].length;++e)a.push(h(c[2][e]));return b(c[1],w)+"("+a.join(",")+")";case "!":return"!"+b(c[1],m);case "u-":return"- "+b(c[1],m);case "*":case "/":case "%":return b(c[1],x)+c[0]+b(c[2],m);case "+":case "-":return b(c[1],y)+c[0]+" "+b(c[2],x);case "<":case ">":case "<=":case ">=":return b(c[1],z)+c[0]+b(c[2],y);case "==":case "!=":case "===":case "!==":return b(c[1], | ||
B)+c[0]+b(c[2],z);case "&&":return b(c[1],D)+"&&"+b(c[2],B);case "||":return b(c[1],H)+"||"+b(c[2],D);default:throw Error("unknown expr: "+c[0]);}}var s=0,c="";e(a[1]);return c}function E(a){return L(M(a))}function I(a,g){var f=E(a),d;g&&(d=g.htmlEncode);a=K(f,d||"_htmlEncode",!0);f="";d||(f="var _obj = { '<': '<', '>': '>', '&': '&', '\"': '"' };\tfunction _htmlEncode(s) {\t\treturn String(s).replace(/[<>&\"]/g, function(c) {\t\t\treturn _obj[c];\t\t});\t}");return Function("root", | ||
f+("var _t,_s = '';"+a+"return _s;"))}function N(a,g){function f(a){for(var d=0;d<a.length;++d){var c=a[d];switch(c[0]){case "if":var k="if("+e(c[1])+"){";b+=k;f(c[2]);b+="}";c[3]&&(b+="else{",f(c[3]),b+="}");break;case "each":k="foreach("+e(c[1])+" as "+(c[3]?"$crox_"+t(c[3])+"=>":"")+("$crox_"+t(c[4]))+")";b+=k;b+="{";f(c[2]);b+="}";break;case "set":c="$crox_"+t(c[1])+" = "+e(c[2])+";";b+=c;break;case "eval":k=e(c[1]);b+="crox_echo("+k+", "+(g?!c[2]:c[2])+");";break;case "text":k=c[1];/<\?(?:php)?|\?>/.test(k)? | ||
(c="echo "+("'"+String(c[1]).replace(/['\\]/g,"\\$&")+"'")+";",b+=c):b+="?>"+k+"<?php ";break;case "inc":c="include '"+c[1].replace(/\.\w+$/,".php")+"';";b+=c;break;default:throw Error("unknown stmt: "+c[0]);}}}function d(b,a){var c=e(b);a&&!a(b[0])&&(c="("+c+")");return c}function e(b){switch(b[0]){case "id":return"$crox_"+t(b[1]);case "lit":return"string"==typeof b[1]?"'"+String(b[1]).replace(/['\\]/g,"\\$&")+"'":String(b[1]);case ".":return d(b[1],w)+"->"+b[2];case "[]":return d(b[1],w)+"["+e(b[2])+ | ||
"]";case "!":return"!crox_ToBoolean("+d(b[1],m)+")";case "u-":return"- "+d(b[1],m);case "*":case "/":case "%":return d(b[1],x)+b[0]+d(b[2],m);case "+":return"crox_plus("+d(b[1],null)+", "+d(b[2],null)+")";case "-":return d(b[1],y)+"- "+d(b[2],x);case "<":case ">":case "<=":case ">=":return d(b[1],z)+b[0]+d(b[2],y);case "==":case "!=":case "===":case "!==":return d(b[1],B)+b[0]+d(b[2],z);case "&&":return"crox_logical_and("+d(b[1],null)+", "+d(b[2],null)+")";case "||":return"crox_logical_or("+d(b[1], | ||
null)+", "+d(b[2],null)+")";default:throw Error("unknown expr: "+b[0]);}}var b="";f(a[1]);b="?>"==b.slice(0,2)?b.slice(2):"<?php "+b;return b="<?php "==b.slice(-6)?b.slice(0,-6):b+"?>"}function O(a){function g(b){return"$crox_"+t(b)}function f(b){s+=b}function d(c){for(var a=0;a<c.length;++a){var e=c[a];switch(e[0]){case "if":f("#if("+b(e[1])+")");d(e[2]);e[3]&&(f("#{else}"),d(e[3]));f("#{end}");break;case "each":++h;var s=b(e[1]);if(/^$\w+$/.test(s))var p=s;else p="$list"+(1==h?"":h),f("#set ("+ | ||
p+" = "+s+")");e[5]?(f("#foreach("+g(e[4])+" in "+p+")"),e[3]&&f("#set("+g(e[3])+" = $velocityCount - 1)")):e[3]?(f("#foreach("+g(e[3])+" in "+p+".keySet())"),f("#set("+g(e[4])+" ="+p+".get("+g(e[3])+"))")):f("#foreach("+g(e[4])+" in "+p+")");d(e[2]);f("#{end}");--h;break;case "set":f("#set ("+g(e[1])+"="+b(e[2])+")");break;case "eval":e=b(e[1]);/^$\w+$/.test(e)?f("$!{"+e.slice(1)+"}"):f("#set($t = "+e+")$!{t}");break;case "text":f(e[1].replace(/\$/g,"$${dollar}").replace(/#/g,"$${sharp}"));break; | ||
case "inc":f("#parse('"+e[1].replace(/\.\w+$/,".vm")+"')");break;default:throw Error("unknown stmt: "+e[0]);}}}function e(c,e){var a=b(c);e&&!e(c[0])&&(a="("+a+")");return a}function b(c){switch(c[0]){case "id":return g(c[1]);case "lit":return"string"==typeof c[1]?(c=c[1],c=-1==c.indexOf("'")?"'"+c+"'":"('"+c.split("'").join("'+\"'\"+'")+"')",c):String(c[1]);case ".":return e(c[1],w)+"."+c[2];case "[]":return e(c[1],w)+"["+b(c[2])+"]";case "!":return"!"+e(c[1],m);case "u-":if("u-"==c[1][0])throw Error("\u7981\u6b62\u4e24\u4e2a\u8d1f\u53f7\u8fde\u7528"); | ||
return"-"+e(c[1],m);case "*":case "/":case "%":return e(c[1],x)+c[0]+e(c[2],m);case "+":case "-":return e(c[1],y)+c[0]+" "+e(c[2],x);case "<":case ">":case "<=":case ">=":return e(c[1],z)+c[0]+e(c[2],y);case "==":case "!=":case "===":case "!==":return e(c[1],B)+c[0].slice(0,2)+e(c[2],z);case "&&":return e(c[1],D)+"&&"+e(c[2],B);case "||":return e(c[1],H)+"||"+e(c[2],D);default:throw Error("unknown expr: "+c[0]);}}var h=0,s="#set($dollar='$')#set($sharp='#')";d(a[1]);return s}A.prototype.toString= | ||
function(){return"("+this.row+","+this.col+")"};var M=function(){var a=[[/\s+/],[/\/\/[^\r\n]*|\/\*[\s\S]*?\*\//],[/[A-Za-z_]\w*/,function(a){switch(a){case "true":case "false":return"boolean";case "set":case "include":return a;default:if(-1!=" abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends final finally float for function goto if implements import in instanceof int interface let long native new package private protected public return short static super switch synchronized this throw throws transient try typeof var void volatile while with yield ".indexOf(" "+ | ||
a+" ")||"null"==a)throw Error("Reserved: "+a+" "+F(this.source,this.index));return"realId"}}],[/"(?:[^"\\]|\\[\s\S])*"|'(?:[^'\\]|\\[\s\S])*'/,function(a){return"string"}],[/\d+(?:\.\d+)?(?:e-?\d+)?/,function(a){return"number"}],[function(a){a.sort().reverse();for(var f=0;f<a.length;++f)a[f]=a[f].replace(/[()*+?.[\]|]/g,"\\$&");return RegExp(a.join("|"))}("! % && ( ) * + - . / < <= = > >= [ ] || === !== == != ,".split(" ")),function(a){return/[*/%]/.test(a)?"mul":/[<>]/.test(a)?"rel":/[!=]=/.test(a)? | ||
"eq":a}]];return J({"":[[/(?:(?!{{)[\s\S])+/,function(a){return"text"}],[/{{{/,function(a){this.pushState(a);return a}],[/{{(?:\/if|else|\/each|\/forin|\/raw)}}/,function(a){return a}],[/{{#raw}}/,function(a){this.pushState("raw");return a}],[/{{(?:#(?:if|each|forin)(?=\s))?/,function(a){this.pushState("{{");return a}]],raw:[[/(?:(?!{{\/raw}})[\s\S])+/,function(a){this.popState();return"rawtext"}]],"{{":a.concat([[/}}/,function(a){this.popState();return a}]]),"{{{":a.concat([[/}}}/,function(a){this.popState(); | ||
return a}]])})}(),L=function(){return function(a){function g(b,a){return h[b][a]}for(var f=a.nStart,d=a.tSymbols,e={},b=0;b<d.length;++b)e[d[b]]=b;var h=a.tAction,s=a.tGoto,c=a.tRules,k=a.tFuncs,m=a.actionIndex;m&&(g=function(b,a){var c=h[m[b]];return c[a]||c._});return function(b,a){function h(a){throw Error("Syntax error: "+b.getPos(m.index)+(a?"\n"+a:""));}var l=0,q=[0],m=b.scan(),u=[],t={get:function(a){return u[u.length+a]},set:function(a,b){u[u.length+a]=b}};if(a)for(var n in a)t[n]=a[n];for(;;)if(n= | ||
g(l,e[m.tag]))if(0<n)q.push(l=n),u.push(m),m=b.scan();else if(0>n&&-32768<n){n=-n;var l=c[n],v=l.length-1;q.length-=v;l=s[q[q.length-1]][l[0]-f];q.push(l);k[n]?(n=k[n].apply(t,u.splice(u.length-v,v)),u.push(n)):1!=v&&u.splice(u.length-v,v,null)}else return m.tag!=d[0]&&h(),u[0];else{n=[];for(v=0;v<f;++v)g(l,v)&&n.push(d[v]);h("find "+m.tag+"\nexpect "+n.join(" "))}}}({nStart:36,tSymbols:"$ ! && ( ) + - . = [ ] boolean eq include mul number rawtext realId rel set string text {{ {{#each {{#forin {{#if {{#raw}} {{/each}} {{/forin}} {{/if}} {{/raw}} {{else}} {{{ || }} }}} AdditiveExpression EqualityExpression LogicalAndExpression LogicalOrExpression MemberExpression MultiplicativeExpression PrimaryExpression RelationalExpression UnaryExpression _text epsilon expr id name program statement statements texts".split(" "), | ||
tAction:[{_:-2},{_:-32768},{21:3,22:4,23:5,24:6,25:7,26:8,32:9,_:-1},{_:-19},{1:13,3:14,6:15,11:16,13:17,15:18,17:19,19:20,20:21,_:0},{1:13,3:14,6:15,11:16,13:33,15:18,17:19,19:34,20:21,_:0},{16:38,_:0},{_:-17},{_:-3},{21:3,26:8,_:-13},{_:-26},{20:44,_:-23},{_:-25},{_:-21},{13:33,17:19,19:34,_:-22},{_:-24},{5:46,6:47,_:-40},{12:48,_:-44},{2:49,_:-46},{33:50,_:-48},{7:51,9:52,_:-32},{14:53,_:-37},{_:-29},{18:54,_:-42},{_:-35},{34:55,_:0},{_:-27},{_:-23},{_:-22},{13:33,17:19,19:34,20:56,_:0},{34:60, | ||
@@ -34,5 +34,5 @@ _:0},{30:61,_:0},{35:62,_:0},{_:-18},{_:-33},{4:63,_:0},{_:-34},{34:64,_:0},{8:65,_:0},{13:33,17:19,19:34,_:0},{_:-11},{_:-15},{_:-16},{13:33,17:19,19:34,20:56,_:-49},{_:-20},{_:-12},{_:-28},{_:-14},{14:53,_:-38},{14:53,_:-39},{18:54,_:-43},{12:48,_:-45},{2:49,_:-47},{_:-30},{10:81,_:0},{_:-36},{5:46,6:47,_:-41},{34:82,_:0},{34:83,_:0},{34:84,_:0},{34:85,_:0},{21:3,22:4,23:5,24:6,25:7,26:8,29:86,31:87,32:9,_:0},{34:88,_:0},{_:-31},{_:-4},{_:-10},{21:3,22:4,23:5,24:6,25:7,26:8,27:94,32:9,_:0},{21:3, | ||
17:12},{9:10,15:11,17:12},{9:10,15:11,17:12},{9:10,15:11,17:12},{9:10,15:11,17:12}],tRules:[[54,50],[50,52],[52],[52,52,51],[51,25,47,34,52,29],[51,25,47,34,52,31,52,29],[51,23,47,49,46,34,52,27],[51,23,47,49,49,34,52,27],[51,24,47,49,46,34,52,28],[51,24,47,49,49,34,52,28],[51,22,19,48,8,47,34],[51,22,47,34],[51,32,47,35],[51,53],[51,22,13,20,34],[49,20],[49,48],[53,45],[53,53,45],[45,21],[45,26,16,30],[48,17],[48,19],[48,13],[42,20],[42,15],[42,11],[42,48],[42,3,47,4],[40,42],[40,40,7,48],[40,40, | ||
9,47,10],[44,40],[44,1,44],[44,6,44],[41,44],[41,41,14,44],[36,41],[36,36,5,41],[36,36,6,41],[43,36],[43,43,18,36],[37,43],[37,37,12,43],[38,37],[38,38,2,37],[39,38],[39,39,33,38],[47,39],[46]],tFuncs:function(){function a(a,b,c,d,e,f,h){return["each",b,f,d,c,!0]}function f(a,b,c,d,e,f,h){return["each",b,f,d,c,!1]}function d(a){return a.text}function c(a,b,c){return[b.text,a,c]}return[,function(a){return["prog",a]},function(){return[]},function(a,b){a.push(b);return a},function(a,b,c,d,e){return["if", | ||
b,d]},function(a,b,c,d,e,f,h){return["if",b,d,f]},a,a,f,f,function(a,b,c,d,e,f){return["set",c.text,e]},function(a,b,c){return["eval",b,!1]},function(a,b,c){return["eval",b,!0]},function(a){return["text",a]},function(a,b,c,d){return["inc",H(c.text)]},function(a){return H(a.text)},d,function(a){return a},function(a,b){return a+b},d,function(a,b,c){return b.text},,,,function(a){return["lit",H(a.text)]},function(a){return["lit",+a.text]},function(a){return["lit","true"==a.text]},function(a){return["id", | ||
a.text]},function(a,b,c){return b},,function(a,b,c){return[".",a,c.text]},function(a,b,c,d){return["[]",a,c]},,function(a,b){return["!",b]},function(a,b){return["u-",b]},,c,,c,c,,c,,c,,c,,c]}()})}();return{parse:F,compile:J,render:function(a,f){return J(a)(f)},compileToPhp:function(a){return O(F(a),!0)},compileToVM:function(a,f){return P(F(a))},version:"1.2.8"}}();"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=B:"function"==typeof define&&(define.amd||define.cmd)? | ||
define(function(){return B}):"undefined"!=typeof KISSY&&KISSY.add(function(){return B});D&&(D.Crox=B)})(this); | ||
9,47,10],[44,40],[44,1,44],[44,6,44],[41,44],[41,41,14,44],[36,41],[36,36,5,41],[36,36,6,41],[43,36],[43,43,18,36],[37,43],[37,37,12,43],[38,37],[38,38,2,37],[39,38],[39,39,33,38],[47,39],[46]],tFuncs:function(){function a(a,b,d,f,c,g,m){return["each",b,g,f,d,!0]}function g(a,b,d,f,c,g,m){return["each",b,g,f,d,!1]}function f(a){return a.text}function d(a,b,d){return[b.text,a,d]}return[,function(a){return["prog",a]},function(){return[]},function(a,b){a.push(b);return a},function(a,b,d,f,c){return["if", | ||
b,f]},function(a,b,d,f,c,g,m){return["if",b,f,g]},a,a,g,g,function(a,b,d,f,c,g){return["set",d.text,c]},function(a,b,d){return["eval",b,!1]},function(a,b,d){return["eval",b,!0]},function(a){return["text",a]},function(a,b,d,f){return["inc",G(d.text)]},function(a){return G(a.text)},f,function(a){return a},function(a,b){return a+b},f,function(a,b,d){return b.text},,,,function(a){return["lit",G(a.text)]},function(a){return["lit",+a.text]},function(a){return["lit","true"==a.text]},function(a){return["id", | ||
a.text]},function(a,b,d){return b},,function(a,b,d){return[".",a,d.text]},function(a,b,d,f){return["[]",a,d]},,function(a,b){return["!",b]},function(a,b){return["u-",b]},,d,,d,d,,d,,d,,d,,d]}()})}();return{parse:E,compile:I,render:function(a,g){return I(a)(g)},compileToPhp:function(a){return N(E(a),!0)},compileToVM:function(a,g){return O(E(a))},version:"1.3.0"}}();"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=A:"function"==typeof define&&(define.amd||define.cmd)? | ||
define(function(){return A}):"undefined"!=typeof KISSY&&KISSY.add(function(){return A});C&&(C.Crox=A)})(this); |
/** | ||
* @preserve Crox v1.2.8 | ||
* @preserve Crox v1.3.0 | ||
* https://github.com/thx/crox | ||
* | ||
* Released under the MIT license | ||
* md5: 912613ebf674b2d4a9e47ab63011d26c | ||
* md5: 1148cc38533540fc0e33aeaab155c241 | ||
*/ | ||
@@ -277,3 +277,3 @@ (function(root) {var Crox = (function() { | ||
return RegExp(a.join('|')); | ||
}(["!", "%", "&&", "(", ")", "*", "+", "-", ".", "/", "<", "<=", "=", ">", ">=", "[", "]", "||", "===", "!==", "==", "!="]), function(a) { | ||
}(["!", "%", "&&", "(", ")", "*", "+", "-", ".", "/", "<", "<=", "=", ">", ">=", "[", "]", "||", "===", "!==", "==", "!=", ","]), function(a) { | ||
return /[*/%]/.test(a) ? 'mul' : /[<>]/.test(a) ? 'rel' : /[!=]=/.test(a) ? 'eq' : a; | ||
@@ -556,2 +556,8 @@ }] | ||
return exprToStr(x[1], isMember) + '[' + exprGen(x[2]) + ']'; | ||
case '()': | ||
var a = []; | ||
if (x[2]) | ||
for (var i = 0; i < x[2].length; ++i) | ||
a.push(exprGen(x[2][i])); | ||
return exprToStr(x[1], isMember) + '(' + a.join(',') + ')'; | ||
case '!': | ||
@@ -896,2 +902,2 @@ return '!' + exprToStr(x[1], isUnary); | ||
Crox.version = "1.2.8";return Crox;})();if ( typeof module == "object" && module && typeof module.exports == "object" ) module.exports = Crox;else if (typeof define == "function" && (define.amd || define.cmd) ) define(function () { return Crox; } );else if (typeof KISSY != "undefined") KISSY.add(function(){ return Crox; });if (root) root.Crox = Crox; })(this); | ||
Crox.version = "1.3.0";return Crox;})();if ( typeof module == "object" && module && typeof module.exports == "object" ) module.exports = Crox;else if (typeof define == "function" && (define.amd || define.cmd) ) define(function () { return Crox; } );else if (typeof KISSY != "undefined") KISSY.add(function(){ return Crox; });if (root) root.Crox = Crox; })(this); |
/* | ||
Crox v1.2.8 | ||
Crox v1.3.0 | ||
https://github.com/thx/crox | ||
Released under the MIT license | ||
md5: 4cc066add7e894810ec32787c137d023 | ||
md5: ccaeb97e72a966a9a914f39b4073c00e | ||
*/ | ||
(function(t){var n=function(){function n(a,c){this.row=a;this.col=c}function y(a,c){var e=a.substring(0,c),d=e.match(/\r\n?|\n/g),m=1;d&&(m+=d.length);e=1+/[^\r\n]*$/.exec(e)[0].length;return new n(m,e)}function t(a){return'"'+a.replace(/[\x00-\x1f"\\\u2028\u2029]/g,function(c){switch(c){case '"':return'\\"';case "\\":return"\\\\";case "\b":return"\\b";case "\f":return"\\f";case "\n":return"\\n";case "\r":return"\\r";case "\t":return"\\t"}return"\\u"+("000"+c.charCodeAt(0).toString(16)).slice(-4)})+ | ||
'"'}function z(a){return eval(a)}function I(a){function c(c,a,k,m){this.tag=c;this.text=a;this.index=k;this.subMatches=m}function e(){}function d(c){for(var a=1,k=[],m=[1],b=[],f=0;f<c.length;++f)m.push(a+=RegExp("|"+c[f][0].source).exec("").length),b.push(c[f][1]||e),k.push("("+c[f][0].source+")");return[RegExp(k.join("|")+"|","g"),m,b]}c.prototype.toString=function(){return this.text};var m=a.$||"$",b={},h;for(h in a)"$"!=h.charAt(0)&&(b[h]=d(a[h]));return function(a){var d=a.length,k=0,h=[""], | ||
l={text:"",index:0,source:a,pushState:function(a){h.push(a)},popState:function(){h.pop()},retract:function(a){k-=a}};return{scan:function(){do{var f;a:{var e=b[h[h.length-1]],g=e[0];g.lastIndex=k;f=g.exec(a);if(""==f[0]){if(k<d)throw Error("lexer error: "+y(a,k)+"\n"+a.slice(k,k+50));f=new c(m,"",k)}else{l.index=k;k=g.lastIndex;for(var g=e[1],q=0;q<g.length;++q)if(f[g[q]]){e=e[2][q].apply(l,f.slice(g[q],g[q+1]));f=new c(e,f[0],l.index,f.slice(g[q]+1,g[q+1]));break a}f=void 0}}}while(null==f.tag); | ||
return f},getPos:function(c){return y(a,c)}}}}function A(a){var c;a:{switch(a){case "id":case "lit":c=!0;break a}c=!1}return c||"."==a||"[]"==a}function x(a){return A(a)||"!"==a||"u-"==a}function B(a){if(x(a))return!0;switch(a){case "*":case "/":case "%":return!0}return!1}function C(a){if(B(a))return!0;switch(a){case "+":case "-":return!0}return!1}function D(a){if(C(a))return!0;switch(a){case "<":case ">":case "<=":case ">=":return!0}return!1}function E(a){if(D(a))return!0;switch(a){case "eq":case "ne":return!0}return!1} | ||
function F(a){return E(a)||"&&"==a}function J(a){return F(a)||"||"==a}function K(a,c,e){function d(a){v+=a}function m(a){for(var b=0;b<a.length;++b){var l=a[b];switch(l[0]){case "if":d("if("+h(l[1])+"){");m(l[2]);d("}");l[3]&&(d("else{"),m(l[3]),d("}"));break;case "each":var f=l[3]?l[3].replace(/^_+/,"$&$&"):"_"+w++,u=h(l[1]);if(/^\w+$/.test(u))var g=u;else g="_"+w++,d("var "+g+" = "+u+";");l[5]?d("for(var "+f+"=0;"+f+"<"+g+".length;"+f+"++){"):d("for(var "+f+" in "+g+") {");d("var "+l[4]+" = "+g+ | ||
"["+f+"];");m(l[2]);d("}");break;case "set":d("var "+l[1].replace(/^_+/,"$&$&")+"="+h(l[2])+";");break;case "eval":f=h(l[1]);/^\w+$/.test(f)?u=f:(u="_t",d("_t = "+f+";"));d("if("+u+" !=null)_s += "+((e?!l[2]:l[2])?c+"("+u+")":u)+";");break;case "text":d("_s += "+t(l[1])+";");break;case "inc":break;default:throw Error("unknown stmt: "+l[0]);}}}function b(a,c){var b=h(a);c&&!c(a[0])&&(b="("+b+")");return b}function h(a){switch(a[0]){case "id":return a[1].replace(/^_+/,"$&$&");case "lit":return"string"== | ||
typeof a[1]?t(a[1]):String(a[1]);case ".":return b(a[1],A)+"."+a[2];case "[]":return b(a[1],A)+"["+h(a[2])+"]";case "!":return"!"+b(a[1],x);case "u-":return"- "+b(a[1],x);case "*":case "/":case "%":return b(a[1],B)+a[0]+b(a[2],x);case "+":case "-":return b(a[1],C)+a[0]+" "+b(a[2],B);case "<":case ">":case "<=":case ">=":return b(a[1],D)+a[0]+b(a[2],C);case "==":case "!=":case "===":case "!==":return b(a[1],E)+a[0]+b(a[2],D);case "&&":return b(a[1],F)+"&&"+b(a[2],E);case "||":return b(a[1],J)+"||"+ | ||
b(a[2],F);default:throw Error("unknown expr: "+a[0]);}}var w=0,v="";m(a[1]);return v}function G(a){return L(M(a))}function H(a,c){var e=G(a),d;c&&(d=c.htmlEncode);a=K(e,d||"_htmlEncode",!0);e="";d||(e="var _obj = { '<': '<', '>': '>', '&': '&', '\"': '"' };\tfunction _htmlEncode(s) {\t\treturn String(s).replace(/[<>&\"]/g, function(c) {\t\t\treturn _obj[c];\t\t});\t}");return Function("root",e+("var _t,_s = '';"+a+"return _s;"))}n.prototype.toString=function(){return"("+this.row+","+ | ||
this.col+")"};var M=function(){var a=[[/\s+/],[/\/\/[^\r\n]*|\/\*[\s\S]*?\*\//],[/[A-Za-z_]\w*/,function(a){switch(a){case "true":case "false":return"boolean";case "set":case "include":return a;default:if(-1!=" abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends final finally float for function goto if implements import in instanceof int interface let long native new package private protected public return short static super switch synchronized this throw throws transient try typeof var void volatile while with yield ".indexOf(" "+ | ||
a+" ")||"null"==a)throw Error("Reserved: "+a+" "+y(this.source,this.index));return"realId"}}],[/"(?:[^"\\]|\\[\s\S])*"|'(?:[^'\\]|\\[\s\S])*'/,function(a){return"string"}],[/\d+(?:\.\d+)?(?:e-?\d+)?/,function(a){return"number"}],[function(a){a.sort().reverse();for(var e=0;e<a.length;++e)a[e]=a[e].replace(/[()*+?.[\]|]/g,"\\$&");return RegExp(a.join("|"))}("! % && ( ) * + - . / < <= = > >= [ ] || === !== == !=".split(" ")),function(a){return/[*/%]/.test(a)?"mul":/[<>]/.test(a)?"rel":/[!=]=/.test(a)? | ||
(function(t){var n=function(){function n(a,c){this.row=a;this.col=c}function z(a,c){var e=a.substring(0,c),d=e.match(/\r\n?|\n/g),k=1;d&&(k+=d.length);e=1+/[^\r\n]*$/.exec(e)[0].length;return new n(k,e)}function t(a){return'"'+a.replace(/[\x00-\x1f"\\\u2028\u2029]/g,function(c){switch(c){case '"':return'\\"';case "\\":return"\\\\";case "\b":return"\\b";case "\f":return"\\f";case "\n":return"\\n";case "\r":return"\\r";case "\t":return"\\t"}return"\\u"+("000"+c.charCodeAt(0).toString(16)).slice(-4)})+ | ||
'"'}function A(a){return eval(a)}function I(a){function c(c,a,g,b){this.tag=c;this.text=a;this.index=g;this.subMatches=b}function e(){}function d(c){for(var a=1,g=[],b=[1],k=[],f=0;f<c.length;++f)b.push(a+=RegExp("|"+c[f][0].source).exec("").length),k.push(c[f][1]||e),g.push("("+c[f][0].source+")");return[RegExp(g.join("|")+"|","g"),b,k]}c.prototype.toString=function(){return this.text};var k=a.$||"$",b={},l;for(l in a)"$"!=l.charAt(0)&&(b[l]=d(a[l]));return function(a){var d=a.length,g=0,l=[""], | ||
m={text:"",index:0,source:a,pushState:function(a){l.push(a)},popState:function(){l.pop()},retract:function(a){g-=a}};return{scan:function(){do{var f;a:{var e=b[l[l.length-1]],h=e[0];h.lastIndex=g;f=h.exec(a);if(""==f[0]){if(g<d)throw Error("lexer error: "+z(a,g)+"\n"+a.slice(g,g+50));f=new c(k,"",g)}else{m.index=g;g=h.lastIndex;for(var h=e[1],q=0;q<h.length;++q)if(f[h[q]]){e=e[2][q].apply(m,f.slice(h[q],h[q+1]));f=new c(e,f[0],m.index,f.slice(h[q]+1,h[q+1]));break a}f=void 0}}}while(null==f.tag); | ||
return f},getPos:function(c){return z(a,c)}}}}function x(a){var c;a:{switch(a){case "id":case "lit":c=!0;break a}c=!1}return c||"."==a||"[]"==a}function y(a){return x(a)||"!"==a||"u-"==a}function B(a){if(y(a))return!0;switch(a){case "*":case "/":case "%":return!0}return!1}function C(a){if(B(a))return!0;switch(a){case "+":case "-":return!0}return!1}function D(a){if(C(a))return!0;switch(a){case "<":case ">":case "<=":case ">=":return!0}return!1}function E(a){if(D(a))return!0;switch(a){case "eq":case "ne":return!0}return!1} | ||
function F(a){return E(a)||"&&"==a}function J(a){return F(a)||"||"==a}function K(a,c,e){function d(a){v+=a}function k(a){for(var b=0;b<a.length;++b){var m=a[b];switch(m[0]){case "if":d("if("+l(m[1])+"){");k(m[2]);d("}");m[3]&&(d("else{"),k(m[3]),d("}"));break;case "each":var f=m[3]?m[3].replace(/^_+/,"$&$&"):"_"+w++,u=l(m[1]);if(/^\w+$/.test(u))var h=u;else h="_"+w++,d("var "+h+" = "+u+";");m[5]?d("for(var "+f+"=0;"+f+"<"+h+".length;"+f+"++){"):d("for(var "+f+" in "+h+") {");d("var "+m[4]+" = "+h+ | ||
"["+f+"];");k(m[2]);d("}");break;case "set":d("var "+m[1].replace(/^_+/,"$&$&")+"="+l(m[2])+";");break;case "eval":f=l(m[1]);/^\w+$/.test(f)?u=f:(u="_t",d("_t = "+f+";"));d("if("+u+" !=null)_s += "+((e?!m[2]:m[2])?c+"("+u+")":u)+";");break;case "text":d("_s += "+t(m[1])+";");break;case "inc":break;default:throw Error("unknown stmt: "+m[0]);}}}function b(a,c){var b=l(a);c&&!c(a[0])&&(b="("+b+")");return b}function l(a){switch(a[0]){case "id":return a[1].replace(/^_+/,"$&$&");case "lit":return"string"== | ||
typeof a[1]?t(a[1]):String(a[1]);case ".":return b(a[1],x)+"."+a[2];case "[]":return b(a[1],x)+"["+l(a[2])+"]";case "()":var c=[];if(a[2])for(var k=0;k<a[2].length;++k)c.push(l(a[2][k]));return b(a[1],x)+"("+c.join(",")+")";case "!":return"!"+b(a[1],y);case "u-":return"- "+b(a[1],y);case "*":case "/":case "%":return b(a[1],B)+a[0]+b(a[2],y);case "+":case "-":return b(a[1],C)+a[0]+" "+b(a[2],B);case "<":case ">":case "<=":case ">=":return b(a[1],D)+a[0]+b(a[2],C);case "==":case "!=":case "===":case "!==":return b(a[1], | ||
E)+a[0]+b(a[2],D);case "&&":return b(a[1],F)+"&&"+b(a[2],E);case "||":return b(a[1],J)+"||"+b(a[2],F);default:throw Error("unknown expr: "+a[0]);}}var w=0,v="";k(a[1]);return v}function G(a){return L(M(a))}function H(a,c){var e=G(a),d;c&&(d=c.htmlEncode);a=K(e,d||"_htmlEncode",!0);e="";d||(e="var _obj = { '<': '<', '>': '>', '&': '&', '\"': '"' };\tfunction _htmlEncode(s) {\t\treturn String(s).replace(/[<>&\"]/g, function(c) {\t\t\treturn _obj[c];\t\t});\t}");return Function("root", | ||
e+("var _t,_s = '';"+a+"return _s;"))}n.prototype.toString=function(){return"("+this.row+","+this.col+")"};var M=function(){var a=[[/\s+/],[/\/\/[^\r\n]*|\/\*[\s\S]*?\*\//],[/[A-Za-z_]\w*/,function(a){switch(a){case "true":case "false":return"boolean";case "set":case "include":return a;default:if(-1!=" abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends final finally float for function goto if implements import in instanceof int interface let long native new package private protected public return short static super switch synchronized this throw throws transient try typeof var void volatile while with yield ".indexOf(" "+ | ||
a+" ")||"null"==a)throw Error("Reserved: "+a+" "+z(this.source,this.index));return"realId"}}],[/"(?:[^"\\]|\\[\s\S])*"|'(?:[^'\\]|\\[\s\S])*'/,function(a){return"string"}],[/\d+(?:\.\d+)?(?:e-?\d+)?/,function(a){return"number"}],[function(a){a.sort().reverse();for(var e=0;e<a.length;++e)a[e]=a[e].replace(/[()*+?.[\]|]/g,"\\$&");return RegExp(a.join("|"))}("! % && ( ) * + - . / < <= = > >= [ ] || === !== == != ,".split(" ")),function(a){return/[*/%]/.test(a)?"mul":/[<>]/.test(a)?"rel":/[!=]=/.test(a)? | ||
"eq":a}]];return I({"":[[/(?:(?!{{)[\s\S])+/,function(a){return"text"}],[/{{{/,function(a){this.pushState(a);return a}],[/{{(?:\/if|else|\/each|\/forin|\/raw)}}/,function(a){return a}],[/{{#raw}}/,function(a){this.pushState("raw");return a}],[/{{(?:#(?:if|each|forin)(?=\s))?/,function(a){this.pushState("{{");return a}]],raw:[[/(?:(?!{{\/raw}})[\s\S])+/,function(a){this.popState();return"rawtext"}]],"{{":a.concat([[/}}/,function(a){this.popState();return a}]]),"{{{":a.concat([[/}}}/,function(a){this.popState(); | ||
return a}]])})}(),L=function(){return function(a){function c(a,b){return h[a][b]}for(var e=a.nStart,d=a.tSymbols,m={},b=0;b<d.length;++b)m[d[b]]=b;var h=a.tAction,w=a.tGoto,v=a.tRules,k=a.tFuncs,n=a.actionIndex;n&&(c=function(a,b){var m=h[n[a]];return m[b]||m._});return function(a,b){function h(b){throw Error("Syntax error: "+a.getPos(n.index)+(b?"\n"+b:""));}var g=0,q=[0],n=a.scan(),r=[],t={get:function(a){return r[r.length+a]},set:function(a,b){r[r.length+a]=b}};if(b)for(var p in b)t[p]=b[p];for(;;)if(p= | ||
c(g,m[n.tag]))if(0<p)q.push(g=p),r.push(n),n=a.scan();else if(0>p&&-32768<p){p=-p;var g=v[p],s=g.length-1;q.length-=s;g=w[q[q.length-1]][g[0]-e];q.push(g);k[p]?(p=k[p].apply(t,r.splice(r.length-s,s)),r.push(p)):1!=s&&r.splice(r.length-s,s,null)}else return n.tag!=d[0]&&h(),r[0];else{p=[];for(s=0;s<e;++s)c(g,s)&&p.push(d[s]);h("find "+n.tag+"\nexpect "+p.join(" "))}}}({nStart:36,tSymbols:"$ ! && ( ) + - . = [ ] boolean eq include mul number rawtext realId rel set string text {{ {{#each {{#forin {{#if {{#raw}} {{/each}} {{/forin}} {{/if}} {{/raw}} {{else}} {{{ || }} }}} AdditiveExpression EqualityExpression LogicalAndExpression LogicalOrExpression MemberExpression MultiplicativeExpression PrimaryExpression RelationalExpression UnaryExpression _text epsilon expr id name program statement statements texts".split(" "), | ||
return a}]])})}(),L=function(){return function(a){function c(a,b){return l[a][b]}for(var e=a.nStart,d=a.tSymbols,k={},b=0;b<d.length;++b)k[d[b]]=b;var l=a.tAction,w=a.tGoto,v=a.tRules,g=a.tFuncs,n=a.actionIndex;n&&(c=function(a,b){var k=l[n[a]];return k[b]||k._});return function(a,b){function l(b){throw Error("Syntax error: "+a.getPos(n.index)+(b?"\n"+b:""));}var h=0,q=[0],n=a.scan(),r=[],t={get:function(a){return r[r.length+a]},set:function(a,b){r[r.length+a]=b}};if(b)for(var p in b)t[p]=b[p];for(;;)if(p= | ||
c(h,k[n.tag]))if(0<p)q.push(h=p),r.push(n),n=a.scan();else if(0>p&&-32768<p){p=-p;var h=v[p],s=h.length-1;q.length-=s;h=w[q[q.length-1]][h[0]-e];q.push(h);g[p]?(p=g[p].apply(t,r.splice(r.length-s,s)),r.push(p)):1!=s&&r.splice(r.length-s,s,null)}else return n.tag!=d[0]&&l(),r[0];else{p=[];for(s=0;s<e;++s)c(h,s)&&p.push(d[s]);l("find "+n.tag+"\nexpect "+p.join(" "))}}}({nStart:36,tSymbols:"$ ! && ( ) + - . = [ ] boolean eq include mul number rawtext realId rel set string text {{ {{#each {{#forin {{#if {{#raw}} {{/each}} {{/forin}} {{/if}} {{/raw}} {{else}} {{{ || }} }}} AdditiveExpression EqualityExpression LogicalAndExpression LogicalOrExpression MemberExpression MultiplicativeExpression PrimaryExpression RelationalExpression UnaryExpression _text epsilon expr id name program statement statements texts".split(" "), | ||
tAction:[{_:-2},{_:-32768},{21:3,22:4,23:5,24:6,25:7,26:8,32:9,_:-1},{_:-19},{1:13,3:14,6:15,11:16,13:17,15:18,17:19,19:20,20:21,_:0},{1:13,3:14,6:15,11:16,13:33,15:18,17:19,19:34,20:21,_:0},{16:38,_:0},{_:-17},{_:-3},{21:3,26:8,_:-13},{_:-26},{20:44,_:-23},{_:-25},{_:-21},{13:33,17:19,19:34,_:-22},{_:-24},{5:46,6:47,_:-40},{12:48,_:-44},{2:49,_:-46},{33:50,_:-48},{7:51,9:52,_:-32},{14:53,_:-37},{_:-29},{18:54,_:-42},{_:-35},{34:55,_:0},{_:-27},{_:-23},{_:-22},{13:33,17:19,19:34,20:56,_:0},{34:60, | ||
@@ -27,5 +27,5 @@ _:0},{30:61,_:0},{35:62,_:0},{_:-18},{_:-33},{4:63,_:0},{_:-34},{34:64,_:0},{8:65,_:0},{13:33,17:19,19:34,_:0},{_:-11},{_:-15},{_:-16},{13:33,17:19,19:34,20:56,_:-49},{_:-20},{_:-12},{_:-28},{_:-14},{14:53,_:-38},{14:53,_:-39},{18:54,_:-43},{12:48,_:-45},{2:49,_:-47},{_:-30},{10:81,_:0},{_:-36},{5:46,6:47,_:-41},{34:82,_:0},{34:83,_:0},{34:84,_:0},{34:85,_:0},{21:3,22:4,23:5,24:6,25:7,26:8,29:86,31:87,32:9,_:0},{34:88,_:0},{_:-31},{_:-4},{_:-10},{21:3,22:4,23:5,24:6,25:7,26:8,27:94,32:9,_:0},{21:3, | ||
17:12},{9:10,15:11,17:12},{9:10,15:11,17:12},{9:10,15:11,17:12},{9:10,15:11,17:12}],tRules:[[54,50],[50,52],[52],[52,52,51],[51,25,47,34,52,29],[51,25,47,34,52,31,52,29],[51,23,47,49,46,34,52,27],[51,23,47,49,49,34,52,27],[51,24,47,49,46,34,52,28],[51,24,47,49,49,34,52,28],[51,22,19,48,8,47,34],[51,22,47,34],[51,32,47,35],[51,53],[51,22,13,20,34],[49,20],[49,48],[53,45],[53,53,45],[45,21],[45,26,16,30],[48,17],[48,19],[48,13],[42,20],[42,15],[42,11],[42,48],[42,3,47,4],[40,42],[40,40,7,48],[40,40, | ||
9,47,10],[44,40],[44,1,44],[44,6,44],[41,44],[41,41,14,44],[36,41],[36,36,5,41],[36,36,6,41],[43,36],[43,43,18,36],[37,43],[37,37,12,43],[38,37],[38,38,2,37],[39,38],[39,39,33,38],[47,39],[46]],tFuncs:function(){function a(a,b,h,c,d,e,n){return["each",b,e,c,h,!0]}function c(a,b,c,d,e,k,n){return["each",b,k,d,c,!1]}function e(a){return a.text}function d(a,b,c){return[b.text,a,c]}return[,function(a){return["prog",a]},function(){return[]},function(a,b){a.push(b);return a},function(a,b,c,d,e){return["if", | ||
b,d]},function(a,b,c,d,e,k,n){return["if",b,d,k]},a,a,c,c,function(a,b,c,d,e,k){return["set",c.text,e]},function(a,b,c){return["eval",b,!1]},function(a,b,c){return["eval",b,!0]},function(a){return["text",a]},function(a,b,c,d){return["inc",z(c.text)]},function(a){return z(a.text)},e,function(a){return a},function(a,b){return a+b},e,function(a,b,c){return b.text},,,,function(a){return["lit",z(a.text)]},function(a){return["lit",+a.text]},function(a){return["lit","true"==a.text]},function(a){return["id", | ||
a.text]},function(a,b,c){return b},,function(a,b,c){return[".",a,c.text]},function(a,b,c,d){return["[]",a,c]},,function(a,b){return["!",b]},function(a,b){return["u-",b]},,d,,d,d,,d,,d,,d,,d]}()})}();return{parse:G,compile:H,render:function(a,c){return H(a)(c)},version:"1.2.8"}}();"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=n:"function"==typeof define&&(define.amd||define.cmd)?define(function(){return n}):"undefined"!=typeof KISSY&&KISSY.add(function(){return n}); | ||
9,47,10],[44,40],[44,1,44],[44,6,44],[41,44],[41,41,14,44],[36,41],[36,36,5,41],[36,36,6,41],[43,36],[43,43,18,36],[37,43],[37,37,12,43],[38,37],[38,38,2,37],[39,38],[39,39,33,38],[47,39],[46]],tFuncs:function(){function a(a,b,c,d,e,g,n){return["each",b,g,d,c,!0]}function c(a,b,c,d,e,g,n){return["each",b,g,d,c,!1]}function e(a){return a.text}function d(a,b,c){return[b.text,a,c]}return[,function(a){return["prog",a]},function(){return[]},function(a,b){a.push(b);return a},function(a,b,c,d,e){return["if", | ||
b,d]},function(a,b,c,d,e,g,n){return["if",b,d,g]},a,a,c,c,function(a,b,c,d,e,g){return["set",c.text,e]},function(a,b,c){return["eval",b,!1]},function(a,b,c){return["eval",b,!0]},function(a){return["text",a]},function(a,b,c,d){return["inc",A(c.text)]},function(a){return A(a.text)},e,function(a){return a},function(a,b){return a+b},e,function(a,b,c){return b.text},,,,function(a){return["lit",A(a.text)]},function(a){return["lit",+a.text]},function(a){return["lit","true"==a.text]},function(a){return["id", | ||
a.text]},function(a,b,c){return b},,function(a,b,c){return[".",a,c.text]},function(a,b,c,d){return["[]",a,c]},,function(a,b){return["!",b]},function(a,b){return["u-",b]},,d,,d,d,,d,,d,,d,,d]}()})}();return{parse:G,compile:H,render:function(a,c){return H(a)(c)},version:"1.3.0"}}();"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=n:"function"==typeof define&&(define.amd||define.cmd)?define(function(){return n}):"undefined"!=typeof KISSY&&KISSY.add(function(){return n}); | ||
t&&(t.Crox=n)})(this); |
/** | ||
* @preserve Crox v1.2.8 | ||
* @preserve Crox v1.3.0 | ||
* https://github.com/thx/crox | ||
* | ||
* Released under the MIT license | ||
* md5: 4cc066add7e894810ec32787c137d023 | ||
* md5: ccaeb97e72a966a9a914f39b4073c00e | ||
*/ | ||
@@ -277,3 +277,3 @@ (function(root) {var Crox = (function() { | ||
return RegExp(a.join('|')); | ||
}(["!", "%", "&&", "(", ")", "*", "+", "-", ".", "/", "<", "<=", "=", ">", ">=", "[", "]", "||", "===", "!==", "==", "!="]), function(a) { | ||
}(["!", "%", "&&", "(", ")", "*", "+", "-", ".", "/", "<", "<=", "=", ">", ">=", "[", "]", "||", "===", "!==", "==", "!=", ","]), function(a) { | ||
return /[*/%]/.test(a) ? 'mul' : /[<>]/.test(a) ? 'rel' : /[!=]=/.test(a) ? 'eq' : a; | ||
@@ -556,2 +556,8 @@ }] | ||
return exprToStr(x[1], isMember) + '[' + exprGen(x[2]) + ']'; | ||
case '()': | ||
var a = []; | ||
if (x[2]) | ||
for (var i = 0; i < x[2].length; ++i) | ||
a.push(exprGen(x[2][i])); | ||
return exprToStr(x[1], isMember) + '(' + a.join(',') + ')'; | ||
case '!': | ||
@@ -628,2 +634,2 @@ return '!' + exprToStr(x[1], isUnary); | ||
Crox.version = "1.2.8";return Crox;})();if ( typeof module == "object" && module && typeof module.exports == "object" ) module.exports = Crox;else if (typeof define == "function" && (define.amd || define.cmd) ) define(function () { return Crox; } );else if (typeof KISSY != "undefined") KISSY.add(function(){ return Crox; });if (root) root.Crox = Crox; })(this); | ||
Crox.version = "1.3.0";return Crox;})();if ( typeof module == "object" && module && typeof module.exports == "object" ) module.exports = Crox;else if (typeof define == "function" && (define.amd || define.cmd) ) define(function () { return Crox; } );else if (typeof KISSY != "undefined") KISSY.add(function(){ return Crox; });if (root) root.Crox = Crox; })(this); |
/* | ||
Crox v1.2.8 | ||
Crox v1.3.0 | ||
https://github.com/thx/crox | ||
Released under the MIT license | ||
md5: 6f741f9675dcf102446d5d0c76810a08 | ||
md5: 58c139cd4c3c2574fadaec9e51db2e90 | ||
*/ | ||
KISSY.add("crox",function(){function v(b,a){this.row=b;this.col=a}function r(b,a){var c=b.substring(0,a),f=c.match(/\r\n?|\n/g),l=1;f&&(l+=f.length);c=1+/[^\r\n]*$/.exec(c)[0].length;return new v(l,c)}function z(b){return'"'+b.replace(/[\x00-\x1f"\\\u2028\u2029]/g,function(a){switch(a){case '"':return'\\"';case "\\":return"\\\\";case "\b":return"\\b";case "\f":return"\\f";case "\n":return"\\n";case "\r":return"\\r";case "\t":return"\\t"}return"\\u"+("000"+a.charCodeAt(0).toString(16)).slice(-4)})+ | ||
'"'}function A(b){return eval(b)}function B(b){function a(a,d,b,c){this.tag=a;this.text=d;this.index=b;this.subMatches=c}function c(){}function f(a){for(var d=1,b=[],e=[1],s=[],g=0;g<a.length;++g)e.push(d+=RegExp("|"+a[g][0].source).exec("").length),s.push(a[g][1]||c),b.push("("+a[g][0].source+")");return[RegExp(b.join("|")+"|","g"),e,s]}a.prototype.toString=function(){return this.text};var l=b.$||"$",e={},d;for(d in b)"$"!=d.charAt(0)&&(e[d]=f(b[d]));return function(d){var b=d.length,c=0,f=[""], | ||
s={text:"",index:0,source:d,pushState:function(d){f.push(d)},popState:function(){f.pop()},retract:function(d){c-=d}};return{scan:function(){do{var g;a:{var t=e[f[f.length-1]],h=t[0];h.lastIndex=c;g=h.exec(d);if(""==g[0]){if(c<b)throw Error("lexer error: "+r(d,c)+"\n"+d.slice(c,c+50));g=new a(l,"",c)}else{s.index=c;c=h.lastIndex;for(var h=t[1],m=0;m<h.length;++m)if(g[h[m]]){t=t[2][m].apply(s,g.slice(h[m],h[m+1]));g=new a(t,g[0],s.index,g.slice(h[m]+1,h[m+1]));break a}g=void 0}}}while(null==g.tag); | ||
return g},getPos:function(a){return r(d,a)}}}}function x(b,a,c,f,l){var e="";c=c?c.replace(/^_+/,"$&$&"):"_"+u++;if(/^\w+$/.test(b))var d=b;else d="_"+u++,e="var "+d+" = "+b+";";return e+("for(var "+c+(l?"=0;"+c+"<"+d+".length; ++"+c:" in "+d)+"){var "+f+" = "+d+"["+c+"];"+a+"}")}function y(b){u=0;return E(F(b))}v.prototype.toString=function(){return"("+this.row+","+this.col+")"};var F=function(){var b=[[/\s+/],[/\/\/[^\r\n]*|\/\*[\s\S]*?\*\//],[/[A-Za-z_]\w*/,function(a){switch(a){case "true":case "false":return"boolean"; | ||
KISSY.add("crox",function(){function v(b,a){this.row=b;this.col=a}function r(b,a){var c=b.substring(0,a),f=c.match(/\r\n?|\n/g),g=1;f&&(g+=f.length);c=1+/[^\r\n]*$/.exec(c)[0].length;return new v(g,c)}function z(b){return'"'+b.replace(/[\x00-\x1f"\\\u2028\u2029]/g,function(a){switch(a){case '"':return'\\"';case "\\":return"\\\\";case "\b":return"\\b";case "\f":return"\\f";case "\n":return"\\n";case "\r":return"\\r";case "\t":return"\\t"}return"\\u"+("000"+a.charCodeAt(0).toString(16)).slice(-4)})+ | ||
'"'}function A(b){return eval(b)}function B(b){function a(a,e,b,c){this.tag=a;this.text=e;this.index=b;this.subMatches=c}function c(){}function f(a){for(var e=1,b=[],d=[1],s=[],h=0;h<a.length;++h)d.push(e+=RegExp("|"+a[h][0].source).exec("").length),s.push(a[h][1]||c),b.push("("+a[h][0].source+")");return[RegExp(b.join("|")+"|","g"),d,s]}a.prototype.toString=function(){return this.text};var g=b.$||"$",d={},e;for(e in b)"$"!=e.charAt(0)&&(d[e]=f(b[e]));return function(e){var b=e.length,c=0,f=[""], | ||
s={text:"",index:0,source:e,pushState:function(a){f.push(a)},popState:function(){f.pop()},retract:function(a){c-=a}};return{scan:function(){do{var h;a:{var t=d[f[f.length-1]],k=t[0];k.lastIndex=c;h=k.exec(e);if(""==h[0]){if(c<b)throw Error("lexer error: "+r(e,c)+"\n"+e.slice(c,c+50));h=new a(g,"",c)}else{s.index=c;c=k.lastIndex;for(var k=t[1],m=0;m<k.length;++m)if(h[k[m]]){t=t[2][m].apply(s,h.slice(k[m],k[m+1]));h=new a(t,h[0],s.index,h.slice(k[m]+1,k[m+1]));break a}h=void 0}}}while(null==h.tag); | ||
return h},getPos:function(a){return r(e,a)}}}}function x(b,a,c,f,g){var d="";c=c?c.replace(/^_+/,"$&$&"):"_"+u++;if(/^\w+$/.test(b))var e=b;else e="_"+u++,d="var "+e+" = "+b+";";return d+("for(var "+c+(g?"=0;"+c+"<"+e+".length; ++"+c:" in "+e)+"){var "+f+" = "+e+"["+c+"];"+a+"}")}function y(b){u=0;return E(F(b))}v.prototype.toString=function(){return"("+this.row+","+this.col+")"};var F=function(){var b=[[/\s+/],[/\/\/[^\r\n]*|\/\*[\s\S]*?\*\//],[/[A-Za-z_]\w*/,function(a){switch(a){case "true":case "false":return"boolean"; | ||
case "set":case "include":return a;default:if(-1!=" abstract boolean break byte case catch char class const continue debugger default delete do double else enum export extends final finally float for function goto if implements import in instanceof int interface let long native new package private protected public return short static super switch synchronized this throw throws transient try typeof var void volatile while with yield ".indexOf(" "+a+" ")||"null"==a)throw Error("Reserved: "+a+" "+r(this.source, | ||
this.index));return"realId"}}],[/"(?:[^"\\]|\\[\s\S])*"|'(?:[^'\\]|\\[\s\S])*'/,function(a){return"string"}],[/\d+(?:\.\d+)?(?:e-?\d+)?/,function(a){return"number"}],[function(a){a.sort().reverse();for(var b=0;b<a.length;++b)a[b]=a[b].replace(/[()*+?.[\]|]/g,"\\$&");return RegExp(a.join("|"))}("! % && ( ) * + - . / < <= = > >= [ ] || === !== == != ,".split(" ")),function(a){return/[*/%]/.test(a)?"mul":/[<>]/.test(a)?"rel":/[!=]=/.test(a)?"eq":a}]];return B({"":[[/(?:(?!{{)[\s\S])+/,function(a){return"text"}], | ||
[/{{{/,function(a){this.pushState(a);return a}],[/{{(?:\/if|else|\/each|\/forin)}}/,function(a){return a}],[/{{(?:#(?:if|each|forin)(?=\s))?/,function(a){this.pushState("{{");return a}]],"{{":b.concat([[/}}/,function(a){this.popState();return a}]]),"{{{":b.concat([[/}}}/,function(a){this.popState();return a}]])})}(),E=function(){return function(b){function a(a,b){return d[a][b]}for(var c=b.nStart,f=b.tSymbols,l={},e=0;e<f.length;++e)l[f[e]]=e;var d=b.tAction,C=b.tGoto,D=b.tRules,w=b.tFuncs,q=b.actionIndex; | ||
q&&(a=function(a,b){var c=d[q[a]];return c[b]||c._});return function(d,b){function e(a){throw Error("Syntax error: "+d.getPos(q.index)+(a?"\n"+a:""));}var h=0,m=[0],q=d.scan(),n=[],r={get:function(d){return n[n.length+d]},set:function(d,a){n[n.length+d]=a}};if(b)for(var k in b)r[k]=b[k];for(;;)if(k=a(h,l[q.tag]))if(0<k)m.push(h=k),n.push(q),q=d.scan();else if(0>k&&-32768<k){k=-k;var h=D[k],p=h.length-1;m.length-=p;h=C[m[m.length-1]][h[0]-c];m.push(h);w[k]?(k=w[k].apply(r,n.splice(n.length-p,p)),n.push(k)): | ||
1!=p&&n.splice(n.length-p,p,null)}else return q.tag!=f[0]&&e(),n[0];else{k=[];for(p=0;p<c;++p)a(h,p)&&k.push(f[p]);e("find "+q.tag+"\nexpect "+k.join(" "))}}}({nStart:34,tSymbols:"$ ! && ( ) + , - . = [ ] boolean eq include mul number realId rel set string text {{ {{#each {{#forin {{#if {{/each}} {{/forin}} {{/if}} {{else}} {{{ || }} }}} AdditiveExpression EqualityExpression LogicalAndExpression LogicalOrExpression MemberExpression MultiplicativeExpression PrimaryExpression RelationalExpression UnaryExpression args elsepart epsilon expr id name program statement statements".split(" "), | ||
[/{{{/,function(a){this.pushState(a);return a}],[/{{(?:\/if|else|\/each|\/forin|\/raw)}}/,function(a){return a}],[/{{#raw}}/,function(a){this.pushState("raw");return a}],[/{{(?:#(?:if|each|forin)(?=\s))?/,function(a){this.pushState("{{");return a}]],raw:[[/(?:(?!{{\/raw}})[\s\S])+/,function(a){this.popState();return"rawtext"}]],"{{":b.concat([[/}}/,function(a){this.popState();return a}]]),"{{{":b.concat([[/}}}/,function(a){this.popState();return a}]])})}(),E=function(){return function(b){function a(a, | ||
b){return e[a][b]}for(var c=b.nStart,f=b.tSymbols,g={},d=0;d<f.length;++d)g[f[d]]=d;var e=b.tAction,C=b.tGoto,D=b.tRules,w=b.tFuncs,q=b.actionIndex;q&&(a=function(a,b){var c=e[q[a]];return c[b]||c._});return function(e,b){function d(a){throw Error("Syntax error: "+e.getPos(q.index)+(a?"\n"+a:""));}var k=0,m=[0],q=e.scan(),n=[],r={get:function(a){return n[n.length+a]},set:function(a,e){n[n.length+a]=e}};if(b)for(var l in b)r[l]=b[l];for(;;)if(l=a(k,g[q.tag]))if(0<l)m.push(k=l),n.push(q),q=e.scan(); | ||
else if(0>l&&-32768<l){l=-l;var k=D[l],p=k.length-1;m.length-=p;k=C[m[m.length-1]][k[0]-c];m.push(k);w[l]?(l=w[l].apply(r,n.splice(n.length-p,p)),n.push(l)):1!=p&&n.splice(n.length-p,p,null)}else return q.tag!=f[0]&&d(),n[0];else{l=[];for(p=0;p<c;++p)a(k,p)&&l.push(f[p]);d("find "+q.tag+"\nexpect "+l.join(" "))}}}({nStart:34,tSymbols:"$ ! && ( ) + , - . = [ ] boolean eq include mul number realId rel set string text {{ {{#each {{#forin {{#if {{/each}} {{/forin}} {{/if}} {{else}} {{{ || }} }}} AdditiveExpression EqualityExpression LogicalAndExpression LogicalOrExpression MemberExpression MultiplicativeExpression PrimaryExpression RelationalExpression UnaryExpression args elsepart epsilon expr id name program statement statements".split(" "), | ||
tAction:[{_:-2},{_:-32768},{21:3,22:4,23:5,24:6,25:7,30:8,_:-1},{_:-13},{1:10,3:11,7:12,12:13,14:14,16:15,17:16,19:17,20:18,_:0},{1:10,3:11,7:12,12:13,14:14,16:15,17:16,19:30,20:18,_:0},{_:-3},{_:-22},{_:-19},{_:-21},{_:-17},{14:14,17:16,19:30,_:-18},{_:-20},{5:39,7:40,_:-40},{13:41,_:-44},{2:42,_:-46},{31:43,_:-48},{3:44,8:45,10:46,_:-32},{15:47,_:-37},{_:-25},{18:48,_:-42},{_:-35},{32:49,_:0},{_:-23},{_:-18},{14:14,17:16,19:30,20:50,_:0},{32:54,_:0},{33:55,_:0},{_:-33},{4:56,_:0},{_:-34},{9:57, | ||
@@ -23,5 +23,5 @@ _:0},{1:10,3:11,7:12,12:13,14:14,16:15,17:16,19:30,20:18,_:-49},{14:14,17:16,19:30,_:0},{_:-11},{_:-15},{_:-16},{14:14,17:16,19:30,20:50,_:-49},{_:-12},{_:-24},{15:47,_:-38},{15:47,_:-39},{18:48,_:-43},{13:41,_:-45},{2:42,_:-47},{4:76,6:77,_:0},{4:78,_:0},{_:-30},{_:-26},{11:79,_:0},{_:-36},{5:39,7:40,_:-41},{32:80,_:0},{32:81,_:0},{32:82,_:0},{32:83,_:0},{21:3,22:4,23:5,24:6,25:7,29:84,30:8,_:-49},{32:87,_:0},{_:-29},{_:-28},{_:-27},{28:94,_:0},{28:95,_:0},{_:-10},{_:-31},{21:3,22:4,23:5,24:6,25:7, | ||
11:86,16:9},,,{0:19,1:20,2:21,3:22,4:23,5:24,6:25,7:26,8:27,12:88,13:29},,,{17:89},{17:90},{17:91},{17:92},{17:93},,,,,{16:9},{16:9},{16:9},{16:9},{16:9}],tRules:[[52,49],[49,51],[51],[51,51,50],[50,25,46,32,51,45,28],[50,25,46,32,51,44,28],[50,23,46,48,45,32,51,26],[50,23,46,48,48,32,51,26],[50,24,46,48,45,32,51,27],[50,24,46,48,48,32,51,27],[50,22,19,47,9,46,32],[50,22,46,32],[50,30,46,33],[50,21],[44,29,51],[48,20],[48,47],[47,17],[47,19],[47,14],[40,20],[40,16],[40,12],[40,47],[40,3,46,4],[38, | ||
40],[38,38,8,47],[38,38,10,46,11],[38,38,3,45,4],[38,38,3,43,4],[43,46],[43,43,6,46],[42,38],[42,1,42],[42,7,42],[39,42],[39,39,15,42],[34,39],[34,34,5,39],[34,34,7,39],[41,34],[41,41,18,34],[35,41],[35,35,13,41],[36,35],[36,36,2,35],[37,36],[37,37,31,36],[46,37],[45]],tFuncs:function(){function b(d,a,b,c,e,f){return"if("+a+"){"+c+"}"+(e||"")}function a(d,a,b,c,e,f,g){return x(a,f,c,b,!1)}function c(a,b,c,e,f,l,g){return x(b,l,e,c,!1)}function f(a){return a.text}function l(a,b,c,e){return a+"("+(c|| | ||
"")+")"}function e(a,b,c){return a+b.text+c}return[,function(a){return Function("root","var _obj = { '<': '<', '>': '>', '&': '&', '\"': '"' };\tfunction _htmlEncode(s) {\t\treturn String(s).replace(/[<>&\"]/g, function(c) {\t\t\treturn _obj[c];\t\t});\t}var _t,_s = '';function _print(s,e){if(s!=null){if(e)s=_htmlEncode(s);_s+=s;}}"+a+"return _s;")},function(){return""},function(a,b){return a+b},b,b,a,a,c,c,function(a,b,c,e,f,l){return"var "+c.text.replace(/^_+/,"$&$&")+"="+f+";"}, | ||
function(a,b,c){return"_print("+b+",1);"},function(a,b,c){return"_print("+b+");"},function(a){return"_print("+z(a.text)+");"},function(a,b){return"else{"+b+"}"},function(a){return A(a.text)},f,,,,f,f,f,function(a){return a.text.replace(/^_+/,"$&$&")},function(a,b,c){return"("+b+")"},,function(a,b,c){return a+"."+c},function(a,b,c,e){return a+"["+c+"]"},l,l,function(a){return a},function(a,b,c){return a+","+c},,function(a,b){return"!"+b},function(a,b){return"- "+b},,e,,e,function(a,b,c){return a+"- "+ | ||
c},,e,,e,,e,,e]}()})}(),u=0;return{compile:y,render:function(b,a){return y(b)(a)}}}); | ||
40],[38,38,8,47],[38,38,10,46,11],[38,38,3,45,4],[38,38,3,43,4],[43,46],[43,43,6,46],[42,38],[42,1,42],[42,7,42],[39,42],[39,39,15,42],[34,39],[34,34,5,39],[34,34,7,39],[41,34],[41,41,18,34],[35,41],[35,35,13,41],[36,35],[36,36,2,35],[37,36],[37,37,31,36],[46,37],[45]],tFuncs:function(){function b(a,b,c,d,f,g){return"if("+b+"){"+d+"}"+(f||"")}function a(a,b,c,d,f,g,h){return x(b,g,d,c,!1)}function c(a,b,c,d,f,g,h){return x(b,g,d,c,!1)}function f(a){return a.text}function g(a,b,c,d){return a+"("+(c|| | ||
"")+")"}function d(a,b,c){return a+b.text+c}return[,function(a){return Function("root","var _obj = { '<': '<', '>': '>', '&': '&', '\"': '"' };\tfunction _htmlEncode(s) {\t\treturn String(s).replace(/[<>&\"]/g, function(c) {\t\t\treturn _obj[c];\t\t});\t}var _t,_s = '';function _print(s,e){if(s!=null){if(e)s=_htmlEncode(s);_s+=s;}}"+a+"return _s;")},function(){return""},function(a,b){return a+b},b,b,a,a,c,c,function(a,b,c,d,f,g){return"var "+c.text.replace(/^_+/,"$&$&")+"="+f+";"}, | ||
function(a,b,c){return"_print("+b+",1);"},function(a,b,c){return"_print("+b+");"},function(a){return"_print("+z(a.text)+");"},function(a,b){return"else{"+b+"}"},function(a){return A(a.text)},f,,,,f,f,f,function(a){return a.text.replace(/^_+/,"$&$&")},function(a,b,c){return"("+b+")"},,function(a,b,c){return a+"."+c},function(a,b,c,d){return a+"["+c+"]"},g,g,function(a){return a},function(a,b,c){return a+","+c},,function(a,b){return"!"+b},function(a,b){return"- "+b},,d,,d,function(a,b,c){return a+"- "+ | ||
c},,d,,d,,d,,d]}()})}(),u=0;return{compile:y,render:function(b,a){return y(b)(a)}}}); |
/** | ||
* @preserve Crox v1.2.8 | ||
* @preserve Crox v1.3.0 | ||
* https://github.com/thx/crox | ||
* | ||
* Released under the MIT license | ||
* md5: 6f741f9675dcf102446d5d0c76810a08 | ||
* md5: 58c139cd4c3c2574fadaec9e51db2e90 | ||
*/ | ||
@@ -290,5 +290,9 @@ KISSY.add("crox", function(){function Class(base, constructor, methods) { | ||
}], | ||
[/{{(?:\/if|else|\/each|\/forin)}}/, function(a) { | ||
[/{{(?:\/if|else|\/each|\/forin|\/raw)}}/, function(a) { | ||
return a; | ||
}], | ||
[/{{#raw}}/, function(a) { | ||
this.pushState('raw'); | ||
return a; | ||
}], | ||
[/{{(?:#(?:if|each|forin)(?=\s))?/, function(a) { | ||
@@ -299,2 +303,8 @@ this.pushState('{{'); | ||
], | ||
raw: [ | ||
[/(?:(?!{{\/raw}})[\s\S])+/, function(a) { | ||
this.popState(); | ||
return 'rawtext'; | ||
}] | ||
], | ||
'{{': code.concat([ | ||
@@ -301,0 +311,0 @@ [/}}/, function(a) { |
{ | ||
"name": "crox", | ||
"version": "1.2.8", | ||
"version": "1.3.0", | ||
"description": "Crox is a high performance cross-language template engine, written by the JavaScript.", | ||
@@ -5,0 +5,0 @@ "homepage": "http://thx.github.io/crox/", |
126024
2537