{"action":"reopened","issue":{"url":"https://api.github.com/repos/Siorki/RegPack/issues/46","repository_url":"https://api.github.com/repos/Siorki/RegPack","labels_url":"https://api.github.com/repos/Siorki/RegPack/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/Siorki/RegPack/issues/46/comments","events_url":"https://api.github.com/repos/Siorki/RegPack/issues/46/events","html_url":"https://github.com/Siorki/RegPack/issues/46","id":135839204,"number":46,"title":"Packing long code crashes the browser","user":{"login":"xem","id":1225909,"avatar_url":"https://avatars.githubusercontent.com/u/1225909?v=3","gravatar_id":"","url":"https://api.github.com/users/xem","html_url":"https://github.com/xem","followers_url":"https://api.github.com/users/xem/followers","following_url":"https://api.github.com/users/xem/following{/other_user}","gists_url":"https://api.github.com/users/xem/gists{/gist_id}","starred_url":"https://api.github.com/users/xem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xem/subscriptions","organizations_url":"https://api.github.com/users/xem/orgs","repos_url":"https://api.github.com/users/xem/repos","events_url":"https://api.github.com/users/xem/events{/privacy}","received_events_url":"https://api.github.com/users/xem/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Siorki/RegPack/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-23T19:33:17Z","updated_at":"2016-02-23T21:34:53Z","closed_at":null,"body":"I've encountered this problem a few times this month.\r\nI have a long minified code (~3kb) containing a lot of repetitions, and when I try to regpack it in any browser, I get no output, and the browser crashes. (Fx, Chrome, Edge, all the same).\r\n\r\nHere's the code I want to pack:\r\n\r\n    b.innerHTML=\"<textarea rows=40 cols=99 id=p>\";oninput=function(){j=p.value;j=j.replace(/([^]*)eval\\(_\\)$/,function(a,m){eval(m);return _});c=[];s=[];r=[];for(d=e=f=g=h=o=0;o!=j;)o=j,\"/\"==(k=j.match(/['\"\\/]/))?(l=j.indexOf(k),n=j.slice(0,l+1),j=j[l+1].match(/[\\/*]$/)?j.replace(/\\/\\/.*|\\/\\*[^]*?\\*\\//,function(a){c.push(a);return\"@C\"+e++ +\"@\"}):!n.match(/([\\d\\)\\]\\}]|true|false|null|undefined|this|@S\\d+@)\\s*(@C\\d+@)*\\s*\\//im)&&n.match(/([-,;=><+%*&|^~!?!:\\[\\(]|delete|typeof|void|in|instanceof|of|case|delete|else|return|throw|yield|debugger|continue|break|throw|return|@D@|^)\\s*(@C\\d+@)*\\s*\\//m)?j.replace(/\\/(\\\\\\\\|\\\\\\/|[^\\/])+?\\/[gimuy]*/,function(a){r.push(a);return\"@R\"+g++ +\"@\"}):j.replace(\"/\",\"@D@\")):j=\"'\"==k?j.replace(/'(\\\\\\\\|\\\\'|[^'])*?'/,function(a){s.push(a);return\"@S\"+h++ +\"@\"}):j.replace(/\"(\\\\\\\\|\\\\\"|[^\"])*?\"/,function(a){s.push(a);return\"@S\"+h++ +\"@\"});j=j.replace(/@D@/g,\"/\");j=j.replace(/ *([-+*%=&|:?<>^/]+) */g,\" $1 \");j=j.replace(/ *, */g,\", \");j=j.replace(/}/g,\"\\n}\");j=j.replace(/ *([;{}]|(case|default).*?:) */g,\"$1\\n\");j=j.replace(/[\\r\\n]+ */g,\"\\n\");j=j.replace(/for\\s*\\([^;]*?;[^;]*?;[^]/g,function(a){return a.replace(/\\n/g,\"\").replace(/;/g,\"; \")});j=j.replace(/.*?([{}])?\\n/g,function(a,m){m+=\"\";if(\"{\"==m[0])return\"  \".repeat(d++)+a;\"}\"==m[0]&&d--;return\"  \".repeat(d)+a});j=j.replace(/\\n+/g,\"\\n\");j=j.replace(/@C(\\d+)@/g,function(a,m){return c[m]});j=j.replace(/@S(\\d+)@/g,function(a,m){return s[m]});j=j.replace(/@R(\\d+)@/g,function(a,m){return r[m]});p.value=j};b.innerHTML=\"<textarea rows=40 cols=99 id=p>\";oninput=function(){j=p.value;j=j.replace(/([^]*)eval\\(_\\)$/,function(a,m){eval(m);return _});c=[];s=[];r=[];for(d=e=f=g=h=o=0;o!=j;)o=j,\"/\"==(k=j.match(/['\"\\/]/))?(l=j.indexOf(k),n=j.slice(0,l+1),j=j[l+1].match(/[\\/*]$/)?j.replace(/\\/\\/.*|\\/\\*[^]*?\\*\\//,function(a){c.push(a);return\"@C\"+e++ +\"@\"}):!n.match(/([\\d\\)\\]\\}]|true|false|null|undefined|this|@S\\d+@)\\s*(@C\\d+@)*\\s*\\//im)&&n.match(/([-,;=><+%*&|^~!?!:\\[\\(]|delete|typeof|void|in|instanceof|of|case|delete|else|return|throw|yield|debugger|continue|break|throw|return|@D@|^)\\s*(@C\\d+@)*\\s*\\//m)?j.replace(/\\/(\\\\\\\\|\\\\\\/|[^\\/])+?\\/[gimuy]*/,function(a){r.push(a);return\"@R\"+g++ +\"@\"}):j.replace(\"/\",\"@D@\")):j=\"'\"==k?j.replace(/'(\\\\\\\\|\\\\'|[^'])*?'/,function(a){s.push(a);return\"@S\"+h++ +\"@\"}):j.replace(/\"(\\\\\\\\|\\\\\"|[^\"])*?\"/,function(a){s.push(a);return\"@S\"+h++ +\"@\"});j=j.replace(/@D@/g,\"/\");j=j.replace(/ *([-+*%=&|:?<>^/]+) */g,\" $1 \");j=j.replace(/ *, */g,\", \");j=j.replace(/}/g,\"\\n}\");j=j.replace(/ *([;{}]|(case|default).*?:) */g,\"$1\\n\");j=j.replace(/[\\r\\n]+ */g,\"\\n\");j=j.replace(/for\\s*\\([^;]*?;[^;]*?;[^]/g,function(a){return a.replace(/\\n/g,\"\").replace(/;/g,\"; \")});j=j.replace(/.*?([{}])?\\n/g,function(a,m){m+=\"\";if(\"{\"==m[0])return\"  \".repeat(d++)+a;\"}\"==m[0]&&d--;return\"  \".repeat(d)+a});j=j.replace(/\\n+/g,\"\\n\");j=j.replace(/@C(\\d+)@/g,function(a,m){return c[m]});j=j.replace(/@S(\\d+)@/g,function(a,m){return s[m]});j=j.replace(/@R(\\d+)@/g,function(a,m){return r[m]});p.value=j}\r\n\r\nI tried to pack it with all the options unchecked, but had the same problem.\r\n\r\nAny idea?\r\n\r\nMaybe the packer creates too many tokens and overflows out of ASCII and breaks everything?\r\n\r\n(PS: I use the online packer regpack 4.0. Couldn't try command-line because... dunno how to install it)\r\n\r\n(PS2: Strangely, this code, just a little shorter, packs well in ~957b:)\r\n\r\n    b.innerHTML=\"<textarea rows=40 cols=99 id=p>\";oninput=function(){j=p.value;c=[];s=[];r=[];for(d=e=f=g=h=o=0;o!=j;)o=j,\"/\"==(k=j.match(/['\"\\/]/))?(l=j.indexOf(k),n=j.slice(0,l+1),j=j[l+1].match(/[\\/*]$/)?j.replace(/\\/\\/.*|\\/\\*[^]*?\\*\\//,function(a){c.push(a);return\"@C\"+e++ +\"@\"}):!n.match(/([\\d\\)\\]\\}]|true|false|null|undefined|this|@S\\d+@)\\s*(@C\\d+@)*\\s*\\//im)&&n.match(/([-,;=><+%*&|^~!?!:\\[\\(]|delete|typeof|void|in|instanceof|of|case|delete|else|return|throw|yield|debugger|continue|break|throw|return|@D@|^)\\s*(@C\\d+@)*\\s*\\//m)?j.replace(/\\/(\\\\\\\\|\\\\\\/|[^\\/])+?\\/[gimuy]*/,function(a){r.push(a);return\"@R\"+g++ +\"@\"}):j.replace(\"/\",\"@D@\")):j=\"'\"==k?j.replace(/'(\\\\\\\\|\\\\'|[^'])*?'/,function(a){s.push(a);return\"@S\"+h++ +\"@\"}):j.replace(/\"(\\\\\\\\|\\\\\"|[^\"])*?\"/,function(a){s.push(a);return\"@S\"+h++ +\"@\"});j=j.replace(/@D@/g,\"/\");j=j.replace(/ *([-+*%=&|:?<>^/]+) */g,\" $1 \");j=j.replace(/ *, */g,\", \");j=j.replace(/}/g,\"\\n}\");j=j.replace(/ *([;{}]|(case|default).*?:) */g,\"$1\\n\");j=j.replace(/[\\r\\n]+ */g,\"\\n\");j=j.replace(/for\\s*\\([^;]*?;[^;]*?;[^]/g,function(a){return a.replace(/\\n/g,\"\").replace(/;/g,\"; \")});j=j.replace(/.*?([{}])?\\n/g,function(a,m){m+=\"\";if(\"{\"==m[0])return\"  \".repeat(d++)+a;\"}\"==m[0]&&d--;return\"  \".repeat(d)+a});j=j.replace(/\\n+/g,\"\\n\");j=j.replace(/@C(\\d+)@/g,function(a,m){return c[m]});j=j.replace(/@S(\\d+)@/g,function(a,m){return s[m]});j=j.replace(/@R(\\d+)@/g,function(a,m){return r[m]});p.value=j};b.innerHTML=\"<textarea rows=40 cols=99 id=p>\";oninput=function(){j=p.value;j=j.replace(/([^]*)eval\\(_\\)$/,function(a,m){eval(m);return _});c=[];s=[];r=[];for(d=e=f=g=h=o=0;o!=j;)o=j,\"/\"==(k=j.match(/['\"\\/]/))?(l=j.indexOf(k),n=j.slice(0,l+1),j=j[l+1].match(/[\\/*]$/)?j.replace(/\\/\\/.*|\\/\\*[^]*?\\*\\//,function(a){c.push(a);return\"@C\"+e++ +\"@\"}):!n.match(/([\\d\\)\\]\\}]|true|false|null|undefined|this|@S\\d+@)\\s*(@C\\d+@)*\\s*\\//im)&&n.match(/([-,;=><+%*&|^~!?!:\\[\\(]|delete|typeof|void|in|instanceof|of|case|delete|else|return|throw|yield|debugger|continue|break|throw|return|@D@|^)\\s*(@C\\d+@)*\\s*\\//m)?j.replace(/\\/(\\\\\\\\|\\\\\\/|[^\\/])+?\\/[gimuy]*/,function(a){r.push(a);return\"@R\"+g++ +\"@\"}):j.replace(\"/\",\"@D@\")):j=\"'\"==k?j.replace(/'(\\\\\\\\|\\\\'|[^'])*?'/,function(a){s.push(a);return\"@S\"+h++ +\"@\"}):j.replace(/\"(\\\\\\\\|\\\\\"|[^\"])*?\"/,function(a){s.push(a);return\"@S\"+h++ +\"@\"});j=j.replace(/@D@/g,\"/\");j=j.replace(/ *([-+*%=&|:?<>^/]+) */g,\" $1 \");j=j.replace(/ *, */g,\", \");j=j.replace(/}/g,\"\\n}\");j=j.replace(/ *([;{}]|(case|default).*?:) */g,\"$1\\n\");j=j.replace(/[\\r\\n]+ */g,\"\\n\");}\r\n"}}