Closed Siorki closed 2 years ago
A function from the provided source is defined over two lines, using only the newline break as a separator between two instructions (there is no semicolon at the end of the line) :
function Q(x,y,z,S,D){T={};T.B=[];T.S=S;T.H=D;b={};b.M=x;b.N=y;b.A=z;b.K=b.G=PI-.01;b.l=25;b.C=b.M+sin(b.K)*sin(b.G)*25
b.q=b.N+cos(b.G)*25;b.n=b.A+cos(b.K)*sin(b.G)*25;b.D=1;T.B.push(b);H(T.B[0],S,D,PI/4-cos(F/35)*PI/4.1);return T;}
RegPack performs a light minification, removing unneeded spaces and line breaks before preprocessing. With this example, the line break is eliminated, so the two instructions are merged, leading to an incorrect syntax.
To solve the issue, RegPack needs to better understand when line breaks can actually be dropped. Replacing them with ;
and merging duplicate semicolons can be a solution. See also #68 regarding the relevance of removing spaces / line breaks, and consider the use of a real JS parser.
Corrupted characters reported by @c4ntelope
http://codepen.io/cantelope/pen/pRXaae