UNPKG

@yeonpm/react

Version:

A library that collects frequently used components and custom hooks in react projects

3 lines (2 loc) 2.16 kB
"use strict";var e=require("./Enum.js"),a=require("./Utility.js"),r=require("./Tokenizer.js");function s(e,i,l,o,u,f,p,d,b){for(var k=0,m=0,h=p,x=0,w=0,v=0,E=1,T=1,g=1,j=0,q="",z=u,A=f,C=o,L=q;T;)switch(v=j,j=r.next()){case 40:if(108!=v&&58==a.charat(L,h-1)){-1!=a.indexof(L+=a.replace(r.delimit(j),"&","&\f"),"&\f")&&(g=-1);break}case 34:case 39:case 91:L+=r.delimit(j);break;case 9:case 10:case 13:case 32:L+=r.whitespace(v);break;case 92:L+=r.escaping(r.caret()-1,7);continue;case 47:switch(r.peek()){case 42:case 47:a.append(t(r.commenter(r.next(),r.caret()),i,l),b);break;default:L+="/"}break;case 123*E:d[k++]=a.strlen(L)*g;case 125*E:case 59:case 0:switch(j){case 0:case 125:T=0;case 59+m:-1==g&&(L=a.replace(L,/\f/g,"")),w>0&&a.strlen(L)-h&&a.append(w>32?n(L+";",o,l,h-1):n(a.replace(L," ","")+";",o,l,h-2),b);break;case 59:L+=";";default:if(a.append(C=c(L,i,l,k,m,u,d,q,z=[],A=[],h),f),123===j)if(0===m)s(L,i,C,C,z,f,h,d,A);else switch(99===x&&110===a.charat(L,3)?100:x){case 100:case 108:case 109:case 115:s(e,C,C,o&&a.append(c(e,C,C,0,0,u,d,q,u,z=[],h),A),u,A,h,d,o?z:A);break;default:s(L,C,C,C,[""],A,0,d,A)}}k=m=w=0,E=g=1,q=L="",h=p;break;case 58:h=1+a.strlen(L),w=v;default:if(E<1)if(123==j)--E;else if(125==j&&0==E++&&125==r.prev())continue;switch(L+=a.from(j),j*E){case 38:g=m>0?1:(L+="\f",-1);break;case 44:d[k++]=(a.strlen(L)-1)*g,g=1;break;case 64:45===r.peek()&&(L+=r.delimit(r.next())),x=r.peek(),m=h=a.strlen(q=L+=r.identifier(r.caret())),j++;break;case 45:45===v&&2==a.strlen(L)&&(E=0)}}return f}function c(s,c,t,n,i,l,o,u,f,p,d){for(var b=i-1,k=0===i?l:[""],m=a.sizeof(k),h=0,x=0,w=0;h<n;++h)for(var v=0,E=a.substr(s,b+1,b=a.abs(x=o[h])),T=s;v<m;++v)(T=a.trim(x>0?k[v]+" "+E:a.replace(E,/&\f/g,k[v])))&&(f[w++]=T);return r.node(s,c,t,0===i?e.RULESET:u,f,p,d)}function t(s,c,t){return r.node(s,c,t,e.COMMENT,a.from(r.char()),a.substr(s,2,-2),0)}function n(s,c,t,n){return r.node(s,c,t,e.DECLARATION,a.substr(s,0,n),a.substr(s,n+1,-1),n)}exports.comment=t,exports.compile=function(e){return r.dealloc(s("",null,null,null,[""],e=r.alloc(e),0,[0],e))},exports.declaration=n,exports.parse=s,exports.ruleset=c; //# sourceMappingURL=Parser.js.map