This reverts commit 27ef872f852833ab68fad3a0de523830320473fe.
Kevin Lin authored on 2014/12/10 00:57:59... | ... |
@@ -758,9 +758,7 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag |
758 | 758 |
ptr++; |
759 | 759 |
} |
760 | 760 |
while (*ptr) { |
761 |
- /* allow the javascript normalization to handle newlines: * |
|
762 |
- * for finding the end of single-line comments (bb#11217) */ |
|
763 |
- if (!in_script && !binary && *ptr == '\n') { |
|
761 |
+ if (!binary && *ptr == '\n') { |
|
764 | 762 |
/* Convert it to a space and re-process */ |
765 | 763 |
*ptr = ' '; |
766 | 764 |
continue; |
... | ... |
@@ -525,8 +525,7 @@ static int replace_token_range(struct tokens *dst, size_t start, size_t end, con |
525 | 525 |
{ |
526 | 526 |
const size_t len = with ? with->cnt : 0; |
527 | 527 |
size_t i; |
528 |
- cli_dbgmsg(MODULE "Replacing tokens %lu - %lu with %lu tokens\n", (long unsigned)start, |
|
529 |
- (long unsigned)end, (long unsigned)len); |
|
528 |
+ cli_dbgmsg(MODULE "Replacing tokens %lu - %lu with %lu tokens\n",start, end, len); |
|
530 | 529 |
if(start >= dst->cnt || end > dst->cnt) |
531 | 530 |
return -1; |
532 | 531 |
for(i=start;i<end;i++) { |
... | ... |
@@ -548,7 +547,7 @@ static int append_tokens(struct tokens *dst, const struct tokens *src) |
548 | 548 |
return CL_ENULLARG; |
549 | 549 |
if(tokens_ensure_capacity(dst, dst->cnt + src->cnt)) |
550 | 550 |
return CL_EMEM; |
551 |
- cli_dbgmsg(MODULE "Appending %lu tokens\n", (long unsigned)src->cnt); |
|
551 |
+ cli_dbgmsg(MODULE "Appending %lu tokens\n", src->cnt); |
|
552 | 552 |
memcpy(&dst->data[dst->cnt], src->data, src->cnt * sizeof(dst->data[0])); |
553 | 553 |
dst->cnt += src->cnt; |
554 | 554 |
return CL_SUCCESS; |
... | ... |
@@ -1111,7 +1110,7 @@ void cli_js_process_buffer(struct parser_state *state, const char *buf, size_t n |
1111 | 1111 |
TOKEN_SET(&val, scope, state->current); |
1112 | 1112 |
break; |
1113 | 1113 |
case TOK_StringLiteral: |
1114 |
- if(state->tokens.cnt > 1 && state->tokens.data[state->tokens.cnt-1].type == TOK_PLUS) { |
|
1114 |
+ if(state->tokens.cnt > 0 && state->tokens.data[state->tokens.cnt-1].type == TOK_PLUS) { |
|
1115 | 1115 |
/* see if can fold */ |
1116 | 1116 |
yystype *prev_string = &state->tokens.data[state->tokens.cnt-2]; |
1117 | 1117 |
if(prev_string->type == TOK_StringLiteral) { |
... | ... |
@@ -1545,8 +1544,9 @@ static int yylex(YYSTYPE *lvalp, yyscan_t scanner) |
1545 | 1545 |
return parseNumber(lvalp, scanner); |
1546 | 1546 |
case SinglelineComment: |
1547 | 1547 |
while(scanner->pos < scanner->insize) { |
1548 |
- /* htmlnorm no longer converts \n to space */ |
|
1549 |
- if(in[scanner->pos] == '\n') |
|
1548 |
+ /* htmlnorm converts \n to space, so |
|
1549 |
+ * stop on space too */ |
|
1550 |
+ if(in[scanner->pos] == '\n' || in[scanner->pos] == ' ') |
|
1550 | 1551 |
break; |
1551 | 1552 |
scanner->pos++; |
1552 | 1553 |
} |