--- Zend/zend_highlight.c 2004-02-25 15:14:47.000000000 +0100 +++ ../php-4.3.4/Zend/zend_highlight.c 2004-06-11 15:33:05.000000000 +0200 @@ -2,11 +2,11 @@ +----------------------------------------------------------------------+ | Zend Engine | +----------------------------------------------------------------------+ - | Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) | + | Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) | +----------------------------------------------------------------------+ | This source file is subject to version 2.00 of the Zend license, | | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | + | available at through the world-wide-web at | | http://www.zend.com/license/2_00.txt. | | If you did not receive a copy of the Zend license and are unable to | | obtain it through the world-wide-web, please send a note to | @@ -17,7 +17,6 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_highlight.c,v 1.43 2004/02/25 14:14:47 derick Exp $ */ #include "zend.h" #include "zend_language_parser.h" @@ -30,7 +29,7 @@ { switch (c) { case '\n': - ZEND_PUTS("
"); + ZEND_PUTS("
 "); break; case '<': ZEND_PUTS("<"); @@ -57,15 +56,14 @@ ZEND_API void zend_html_puts(const char *s, uint len TSRMLS_DC) { const char *ptr=s, *end=s+len; - #ifdef ZEND_MULTIBYTE - char *filtered; - int filtered_len; + char *mbs; + int mblen; if (LANG_SCNG(output_filter)) { - LANG_SCNG(output_filter)(&filtered, &filtered_len, s, len TSRMLS_CC); - ptr = filtered; - end = filtered + filtered_len; + LANG_SCNG(output_filter)(&mbs, &mblen, s, len TSRMLS_CC); + ptr = mbs; + end = mbs+mblen; } #endif /* ZEND_MULTIBYTE */ @@ -79,7 +77,7 @@ zend_html_putc(*ptr); } while ((++ptr < end) && (*ptr==' ')); } else { - ZEND_PUTC(*ptr); + (void) ZEND_PUTC(*ptr); ptr++; } } else { @@ -89,7 +87,7 @@ #ifdef ZEND_MULTIBYTE if (LANG_SCNG(output_filter)) { - efree(filtered); + efree(mbs); } #endif /* ZEND_MULTIBYTE */ } @@ -104,8 +102,8 @@ char *next_color; int in_string=0; - zend_printf(""); - zend_printf("\n", last_color); + zend_printf("\n\n\n\n"); + zend_printf("\n ", last_color); /* highlight stuff coming back from zendlex() */ token.type = 0; while ((token_type=lex_scan(&token TSRMLS_CC))) { @@ -114,7 +112,6 @@ next_color = syntax_highlighter_ini->highlight_html; break; case T_COMMENT: - case T_DOC_COMMENT: next_color = syntax_highlighter_ini->highlight_comment; break; case T_OPEN_TAG: @@ -137,23 +134,25 @@ continue; break; default: - if (in_string) { - next_color = syntax_highlighter_ini->highlight_string; - } else if (token.type == 0) { + if (token.type==0) { next_color = syntax_highlighter_ini->highlight_keyword; } else { - next_color = syntax_highlighter_ini->highlight_default; + if (in_string) { + next_color = syntax_highlighter_ini->highlight_string; + } else { + next_color = syntax_highlighter_ini->highlight_default; + } } break; } if (last_color != next_color) { if (last_color != syntax_highlighter_ini->highlight_html) { - zend_printf(""); + zend_printf(""); } last_color = next_color; if (last_color != syntax_highlighter_ini->highlight_html) { - zend_printf("", last_color); + zend_printf("", last_color); } } switch (token_type) { @@ -172,26 +171,30 @@ case T_CLOSE_TAG: case T_WHITESPACE: case T_COMMENT: - case T_DOC_COMMENT: break; default: efree(token.value.str.val); break; } } else if (token_type == T_END_HEREDOC) { + zend_bool has_semicolon=(strchr(token.value.str.val, ';')?1:0); + efree(token.value.str.val); + if (has_semicolon) { + /* the following semicolon was unput(), ignore it */ + lex_scan(&token TSRMLS_CC); + } } token.type = 0; } if (last_color != syntax_highlighter_ini->highlight_html) { - zend_printf("\n"); + zend_printf("\n"); } - zend_printf("\n"); + zend_printf("\n"); zend_printf(""); } - ZEND_API void zend_strip(TSRMLS_D) { zval token; @@ -208,7 +211,6 @@ } /* lack of break; is intentional */ case T_COMMENT: - case T_DOC_COMMENT: token.type = 0; continue; @@ -237,7 +239,6 @@ case T_CLOSE_TAG: case T_WHITESPACE: case T_COMMENT: - case T_DOC_COMMENT: break; default: @@ -247,13 +248,20 @@ } prev_space = token.type = 0; } +#ifdef ZEND_MULTIBYTE + if (LANG_SCNG(code)) { + efree(LANG_SCNG(code)); + } + if (LANG_SCNG(current_code)) { + efree(LANG_SCNG(current_code)); + } +#endif /* ZEND_MULTIBYTE */ } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 - * indent-tabs-mode: t * End: */