25 lines
63 KiB
JavaScript
25 lines
63 KiB
JavaScript
|
/*!
|
|||
|
* XRegExp 3.0.0-pre
|
|||
|
* <http://xregexp.com/>
|
|||
|
* Steven Levithan <EFBFBD> 2007-2012 MIT License
|
|||
|
*/
|
|||
|
var XRegExp=(function(i){var k="xregexp",t,j={astral:false,natives:false},y={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},e={},r={},b={},q=[],c="default",n="class",E={"default":/\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??/,"class":/\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|c[A-Za-z]|[\s\S])/},D=/\$(?:{([\w$]+)}|(\d\d?|[\s\S]))/g,v=/^(?:[?*+]|{\d+(?:,\d*)?})\??/,z=y.exec.call(/()??/,"")[1]===i,m=RegExp.prototype.sticky!==i,g=false,C={g:true,i:true,m:true,y:m},s;function B(I,F,H,G){var J;if(H){if(I.__proto__){I.__proto__=t.prototype}else{for(J in t.prototype){I[J]=t.prototype[J]}}}I[k]={captureNames:F,isNative:!!G};return I}function l(F){return y.replace.call(F,/([\s\S])(?=[\s\S]*\1)/g,"")}function x(H,G){if(!t.isRegExp(H)){throw new TypeError("Type RegExp expected")}var F=y.exec.call(/\/([a-z]*)$/i,String(H))[1];G=G||{};if(G.add){F=l(F+G.add)}if(G.remove){F=y.replace.call(F,new RegExp("["+G.remove+"]+","g"),"")}if(H[k]&&!H[k].isNative){H=B(t(H.source,F),H[k].captureNames?H[k].captureNames.slice(0):null,G.addProto)}else{H=B(new RegExp(H.source,F),null,G.addProto,true)}return H}function u(){return{captureNames:null,isNative:true}}function a(I,H){if(Array.prototype.indexOf){return I.indexOf(H)}var F=I.length,G;for(G=0;G<F;++G){if(I[G]===H){return G}}return -1}function f(G,F){return Object.prototype.toString.call(G)==="[object "+F+"]"}function o(F){F=F||{};if(f(F,"String")){F=t.forEach(F,/[^\s,]+/,function(G){this[G]=true},{})}return F}function h(F){if(!/^[\w$]$/.test(F)){throw new Error("Flag must be a single character A-Za-z0-9_$")}C[F]=true}function d(K,G,L,N,F){var I=q.length,O=null,J,M;g=true;try{while(I--){M=q[I];if((M.scope===N||M.scope==="all")&&(!M.flag||G.indexOf(M.flag)>-1)){J=t.exec(K,M.regex,L,"sticky");if(J){O={len:J[0].length,replacement:M.handler.call(F,J,N,G),reparse:M.reparse};break}}}}catch(H){throw H}finally{g=false}return O}function p(F){j.astral=F;if(F){t.cache.flush("patterns")}}function A(F){RegExp.prototype.exec=(F?e:y).exec;RegExp.prototype.test=(F?e:y).test;String.prototype.match=(F?e:y).match;String.prototype.replace=(F?e:y).replace;String.prototype.split=(F?e:y).split;j.natives=F}function w(F){if(F==null){throw new TypeError("Cannot convert null or undefined to object")}return F}t=function(N,H){var K="Cannot supply flags when copying a RegExp",U="Cannot create XRegExp objects within token handler functions",S="Invalid duplicate regex flag ",P="Cannot use flag g or y in mode modifier ",Q="Unknown regex flag ",G="",T=c,F={hasNamedCapture:false,captureNames:[]},O=0,I,M,J,R,L;if(t.isRegExp(N)){if(H!==i){throw new TypeError(K)}return x(N,{addProto:true})}if(g){throw new Error(U)}N=N===i?"":String(N);H=H===i?"":String(H);R=N+"/"+H;if(!b[R]){if(l(H)!==H){throw new SyntaxError(S+H)}N=y.replace.call(N,/^\(\?([\w$]+)\)/,function(W,V){if(y.test.call(/[gy]/,V)){throw new SyntaxError(P+W)}H=l(H+V);return""});for(L=0;L<H.length;++L){if(!C[H.charAt(L)]){throw new SyntaxError(Q+H.charAt(L))}}while(O<N.length){do{I=d(N,H,O,T,F);if(I&&I.reparse){N=N.slice(0,O)+I.replacement+N.slice(O+I.len)}}while(I&&I.reparse);if(I){G+=I.replacement;O+=(I.len||1)}else{M=t.exec(N,E[T],O,"sticky");if(M){G+=M[0];O+=M[0].length}else{J=N.charAt(O);if(J==="["){T=n}else{if(J==="]"){T=c}}G+=J;++O}}}b[R]={pattern:G,flags:y.replace.call(H,/[^gimy]+/g,""),captures:F.hasNamedCapture?F.captureNames:null}}R=b[R];return B(new RegExp(R.pattern,R.flags),R.captures,true)};t.prototype=new RegExp;t.addToken=function(J,I,G){G=G||{};var F=G.optionalFlags,H;if(G.flag){h(G.flag)}if(F){F=y.split.call(F,"");for(H=0;H<F.length;++H){h(F[H])}}q.push({regex:x(J,{add:"g"+(m?"y":"")}),handler:I,scope:G.scope||c,flag:G.flag,reparse:G.reparse});t.cache.flush("patterns")};t.cache=function(H,F){var G=H+"/"+(F||"");return r[G]||(r[G]=t(H,F))};t.cache.flush=function(F){if(F==="patterns"){b={}}else{r={}}};t.escape=function(F){return y.replace.call(w(F),/[-[\]{}(
|
|||
|
* XRegExp Prototypes 3.0.0-pre
|
|||
|
* <http://xregexp.com/>
|
|||
|
* Steven Levithan <EFBFBD> 2012 MIT License
|
|||
|
*/
|
|||
|
(function(b){var a=b.prototype;a.apply=function(d,c){return this.test(c[0])};a.call=function(c,d){return this.test(d)};a.forEach=function(d,e,c){return b.forEach(d,this,e,c)};a.globalize=function(){return b.globalize(this)};a.match=function(d,c){return b.match(d,this,c)};a.xexec=function(d,e,c){return b.exec(d,this,e,c)};a.xtest=function(d,e,c){return b.test(d,this,e,c)}}(XRegExp));/*!
|
|||
|
* XRegExp Unicode Base 3.0.0-pre
|
|||
|
* <http://xregexp.com/>
|
|||
|
* Steven Levithan <EFBFBD> 2008-2012 MIT License
|
|||
|
* Uses Unicode 6.2.0 <http://unicode.org/>
|
|||
|
* Unicode data generated by Mathias Bynens <http://mathiasbynens.be/>
|
|||
|
*/
|
|||
|
(function(h){var a={};function f(l){return l.replace(/[- _]+/g,"").toLowerCase()}function i(l){while(l.length<4){l="0"+l}return l}function d(l){return parseInt(l,16)}function c(l){return parseInt(l,10).toString(16)}function j(m){var l=/^\\[xu](.+)/.exec(m);return l?d(l[1]):m.charCodeAt(m.charAt(0)==="\\"?1:0)}function b(m){var l="",n=-1,o;h.forEach(m,/(\\x..|\\u....|\\?[\s\S])(?:-(\\x..|\\u....|\\?[\s\S]))?/,function(p){o=j(p[1]);if(o>(n+1)){l+="\\u"+i(c(n+1));if(o>(n+2)){l+="-\\u"+i(c(o-1))}}n=j(p[2]||p[1])});if(n<65535){l+="\\u"+i(c(n+1));if(n<65534){l+="-\\uFFFF"}}return l}function e(l){var m="b!";return a[l][m]||(a[l][m]=b(a[l].bmp))}function g(l,m){var o=a[l],n="";if(o.bmp&&!o.isBmpLast){n="["+o.bmp+"]"+(o.astral?"|":"")}if(o.astral){n+=o.astral}if(o.isBmpLast&&o.bmp){n+=(o.astral?"|":"")+"["+o.bmp+"]"}return m?"(?:(?!"+n+")(?:[\uD800-\uDBFF][\uDC00-\uDFFF]|[\0-\uFFFF]))":"(?:"+n+")"}function k(l,m){var n=m?"a!":"a=";return a[l][n]||(a[l][n]=g(l,m))}h.addToken(/\\([pP])(?:{(\^?)([^}]*)}|([A-Za-z]))/,function(s,w,o){var u="Invalid double negation ",p="Unknown Unicode token ",m="Unicode token missing data ",n="Astral mode required for Unicode token ",l="Astral mode does not support Unicode tokens within character classes",t=s[1]==="P"||!!s[2],r=o.indexOf("A")>-1||h.isInstalled("astral"),q=f(s[4]||s[3]),v=a[q];if(s[1]==="P"&&s[2]){throw new SyntaxError(u+s[0])}if(!a.hasOwnProperty(q)){throw new SyntaxError(p+s[0])}if(v.inverseOf){q=f(v.inverseOf);if(!a.hasOwnProperty(q)){throw new ReferenceError(m+s[0]+" -> "+v.inverseOf)}v=a[q];t=!t}if(!(v.bmp||r)){throw new SyntaxError(n+s[0])}if(r){if(w==="class"){throw new SyntaxError(l)}return k(q,t)}return w==="class"?(t?e(q):v.bmp):(t?"[^":"[")+v.bmp+"]"},{scope:"all",optionalFlags:"A"});h.addUnicodeData=function(p){var l="Unicode token requires name",o="Unicode token has no character data ",n,m;for(m=0;m<p.length;++m){n=p[m];if(!n.name){throw new Error(l)}if(!(n.inverseOf||n.bmp||n.astral)){throw new Error(o+n.name)}a[f(n.name)]=n;if(n.alias){a[f(n.alias)]=n}}};h.addUnicodeData([{name:"L",alias:"Letter",bmp:"A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315
|
|||
|
* XRegExp Unicode Categories 3.0.0-pre
|
|||
|
* <http://xregexp.com/>
|
|||
|
* Steven Levithan <EFBFBD> 2010-2012 MIT License
|
|||
|
* Uses Unicode 6.2.0 <http://unicode.org/>
|
|||
|
* Unicode data generated by Mathias Bynens <http://mathiasbynens.be/>
|
|||
|
*/
|
|||
|
(function(a){if(!a.addUnicodeData){throw new ReferenceError("Unicode Base must be loaded before Unicode Categories")}a.addUnicodeData([{name:"C",alias:"Other",isBmpLast:true,bmp:"\0-\x1F\x7F-\x9F\xAD\u0378\u0379\u037F-\u0383\u038B\u038D\u03A2\u0528-\u0530\u0557\u0558\u0560\u0588\u058B-\u058E\u0590\u05C8-\u05CF\u05EB-\u05EF\u05F5-\u0605\u061C\u061D\u06DD\u070E\u070F\u074B\u074C\u07B2-\u07BF\u07FB-\u07FF\u082E\u082F\u083F\u085C\u085D\u085F-\u089F\u08A1\u08AD-\u08E3\u08FF\u0978\u0980\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FC-\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B55\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0C00\u0C04\u0C0D\u0C11\u0C29\u0C34\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5A-\u0C5F\u0C64\u0C65\u0C70-\u0C77\u0C80\u0C81\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0D01\u0D04\u0D0D\u0D11\u0D3B\u0D3C\u0D45\u0D49\u0D4F-\u0D56\u0D58-\u0D5F\u0D64\u0D65\u0D76-\u0D78\u0D80\u0D81\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E86\u0E89\u0E8B\u0E8C\u0E8E-\u0E93\u0E98\u0EA0\u0EA4\u0EA6\u0EA8\u0EA9\u0EAC\u0EBA\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F5-\u13FF\u169D-\u169F\u16F1-\u16FF\u170D\u1715-\u171F\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u180F\u181A-\u181F\u1878-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191D-\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE-\u1AFF\u1B4C-\u1B4F\u1B7D-\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C80-\u1CBF\u1CC8-\u1CCF\u1CF7-\u1CFF\u1DE7-\u1DFB\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u200B-\u200F\u202A-\u202E\u2060-\u206F\u2072\u2073\u208F\u209D-\u209F\u20BB-\u20CF\u20F1-\u20FF\u218A-\u218F\u23F4-\u23FF\u2427-\u243F\u244B-\u245F\u2700\u2B4D-\u2B4F\u2B5A-\u2BFF\u2C2F\u2C5F\u2CF4-\u2CF8\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D71-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E3C-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3040\u3097\u3098\u3100-\u3104\u312E-\u3130\u318F\u31BB-\u31BF\u31E4-\u31EF\u321F\u32FF\u4DB6-\u4DBF\u9FCD-\u9FFF\uA48D-\uA48F\uA4C7-\uA4CF\uA62C-\uA63F\uA698-\uA69E\uA6F8-\uA6FF\uA78F\uA794-\uA79F\uA7AB-\uA7F7\uA82C-\uA82F\uA83A-\uA83F\uA878-\uA87F\uA8C5-\uA8CD\uA8DA-\uA8DF\uA8FC-\uA8FF\uA954-\uA95E\uA97D-\uA97F\uA9CE\uA9DA-\uA9DD\uA9E0-\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A\uAA5B\uAA7C-\uAA7F\uAAC3-\uAADA\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F-\uABBF\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBC2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFE\uFDFF\uFE1A-\uFE1F\uFE27-\uFE2F\uFE53\uFE67\uFE6C-\uFE6F\uFE75\uFEFD-\uFF00\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFFB\uFFFE\uFFFF",astral:"\uD808[\uDF6F-\uDFFF]|\uD809[\uDC63-\uDC6F\uDC74-\uDFFF]|\uD804[\uDC4E-\uDC51\uDC70-\uDC7F\uDCBD\uDCC2-\uDCCF\uDCE9
|