fix return\n/regex/ without bang comments

This commit is contained in:
ndparker 2015-10-18 20:30:15 +02:00
parent efeb82263a
commit 781acf213d

View File

@ -101,6 +101,7 @@ rjsmin(const rchar *source, rchar *target, Py_ssize_t length,
if (RJSMIN_IS_DULL(c)) { if (RJSMIN_IS_DULL(c)) {
if (post_regex) post_regex = 0; if (post_regex) post_regex = 0;
if (pctoken) pctoken = NULL; if (pctoken) pctoken = NULL;
if (spaced == U('\n')) spaced = U(' ');
*target++ = c; *target++ = c;
continue; continue;
@ -111,6 +112,7 @@ rjsmin(const rchar *source, rchar *target, Py_ssize_t length,
case U('\''): case U('"'): case U('\''): case U('"'):
if (post_regex) post_regex = 0; if (post_regex) post_regex = 0;
if (pctoken) pctoken = NULL; if (pctoken) pctoken = NULL;
if (spaced == U('\n')) spaced = U(' ');
reset = source; reset = source;
*target++ = quote = c; *target++ = quote = c;
@ -145,6 +147,7 @@ rjsmin(const rchar *source, rchar *target, Py_ssize_t length,
if (!(source < sentinel)) { if (!(source < sentinel)) {
if (post_regex) post_regex = 0; if (post_regex) post_regex = 0;
if (pctoken) pctoken = NULL; if (pctoken) pctoken = NULL;
if (spaced == U('\n')) spaced = U(' ');
*target++ = c; *target++ = c;
} }
@ -175,13 +178,14 @@ rjsmin(const rchar *source, rchar *target, Py_ssize_t length,
/* Regex */ /* Regex */
if (post_regex) post_regex = 0; if (post_regex) post_regex = 0;
reset = source; if (pctoken) pctoken = NULL;
if (pctoken) { reset = source;
pctoken = NULL; if (spaced == U('\n')) {
if (spaced == U('\n')) *target++ = U('\n');
*target++ = U('\n'); spaced = U(' ');
} }
*target++ = U('/'); *target++ = U('/');
while (source < sentinel) { while (source < sentinel) {
c = *source++; c = *source++;
@ -232,6 +236,7 @@ rjsmin(const rchar *source, rchar *target, Py_ssize_t length,
/* Just a slash */ /* Just a slash */
if (post_regex) post_regex = 0; if (post_regex) post_regex = 0;
if (pctoken) pctoken = NULL; if (pctoken) pctoken = NULL;
if (spaced == U('\n')) spaced = U(' ');
*target++ = c; *target++ = c;
} }