cvs: ZendEngine2 / zend_highlight.c

From: Date: Thu, 06 Mar 2003 14:47:13 +0000
Subject: cvs: ZendEngine2 / zend_highlight.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-999@lists.php.net to get a copy of this message
iliaa Thu Mar 6 09:47:13 2003 EDT Modified files: /ZendEngine2 zend_highlight.c Log: Fixed in zend_strip() that corrupted heredoc. Optimized the writing routine by moving from putchar() to fwrite(). Changed hardcoded opcode # to it's defined name. Index: ZendEngine2/zend_highlight.c diff -u ZendEngine2/zend_highlight.c:1.33 ZendEngine2/zend_highlight.c:1.34 --- ZendEngine2/zend_highlight.c:1.33 Fri Jan 31 20:49:14 2003 +++ ZendEngine2/zend_highlight.c Thu Mar 6 09:47:13 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_highlight.c,v 1.33 2003/02/01 01:49:14 sniper Exp $ */ +/* $Id: zend_highlight.c,v 1.34 2003/03/06 14:47:13 iliaa Exp $ */ #include "zend.h" #include "zend_language_parser.h" @@ -202,14 +202,22 @@ } switch (token_type) { - case 349: + case T_CLASS: break; default: { - char c, *ptr=LANG_SCNG(yy_text), *end=LANG_SCNG(yy_text)+LANG_SCNG(yy_leng); - while (ptr<end) { - c = *ptr++; - putchar(c); + char *ptr = LANG_SCNG(yy_text); + + if (token_type != T_END_HEREDOC) { + fwrite(ptr, LANG_SCNG(yy_leng), 1, stdout); + } else { + fwrite(ptr, LANG_SCNG(yy_leng) - 1, 1, stdout); + /* The ensure that we only write one ; and that it followed by the required newline */ + putchar('\n'); + if (ptr[LANG_SCNG(yy_leng) - 1] == ';') { + lex_scan(&token TSRMLS_CC); + } + efree(token.value.str.val); } } break; @@ -227,14 +235,6 @@ 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;

« previous php.zend-engine.cvs (#999) next »