cvs: ZendEngine2(PHP_5_2) / zend_compile.c zend_highlight.c zend_language_scanner.l

[email protected] ("Matt Wilmas") Fri, 08 May 2009 17:50:58 -0000
Newsgroups php.zend-engine.cvs
Message-ID <cvsmattwil1241805058@cvsserver>
mattwil		Fri May  8 17:50:58 2009 UTC

  Modified files:              (Branch: PHP_5_2)
    /ZendEngine2	zend_compile.c zend_highlight.c 
                	zend_language_scanner.l 
  Log:
  MFH: Better fix for bug #42767 (at source instead of workaround); also fixes unclosed comments in tokenizer
  
  - Plus minor cleanup of unnecessary code, to match 5.3...
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.56&r2=1.647.2.27.2.57&diff_format=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.56 ZendEngine2/zend_compile.c:1.647.2.27.2.57
--- ZendEngine2/zend_compile.c:1.647.2.27.2.56	Thu Apr 16 13:52:23 2009
+++ ZendEngine2/zend_compile.c	Fri May  8 17:50:58 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_compile.c,v 1.647.2.27.2.56 2009/04/16 13:52:23 bjori Exp $ */
+/* $Id: zend_compile.c,v 1.647.2.27.2.57 2009/05/08 17:50:58 mattwil Exp $ */
 
 #include <zend_language_parser.h>
 #include "zend.h"
@@ -4192,8 +4192,6 @@
 		case T_END_HEREDOC:
 			efree(Z_STRVAL(zendlval->u.constant));
 			break;
-		case EOF:
-			return EOF;
 	}
 
 	INIT_PZVAL(&zendlval->u.constant);
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_highlight.c?r1=1.49.2.3.2.4&r2=1.49.2.3.2.5&diff_format=u
Index: ZendEngine2/zend_highlight.c
diff -u ZendEngine2/zend_highlight.c:1.49.2.3.2.4 ZendEngine2/zend_highlight.c:1.49.2.3.2.5
--- ZendEngine2/zend_highlight.c:1.49.2.3.2.4	Wed Dec 31 11:17:33 2008
+++ ZendEngine2/zend_highlight.c	Fri May  8 17:50:58 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_highlight.c,v 1.49.2.3.2.4 2008/12/31 11:17:33 sebastian Exp $ */
+/* $Id: zend_highlight.c,v 1.49.2.3.2.5 2009/05/08 17:50:58 mattwil Exp $ */
 
 #include "zend.h"
 #include <zend_language_parser.h>
@@ -148,19 +148,11 @@
 				zend_printf("<span style=\"color: %s\">", last_color);
 			}
 		}
-		switch (token_type) {
-			case T_END_HEREDOC:
-				zend_html_puts(token.value.str.val, token.value.str.len TSRMLS_CC);
-				break;
-			default:
-				zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC);
-				break;
-		}
+
+		zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC);
 
 		if (token.type == IS_STRING) {
 			switch (token_type) {
-				case EOF:
-					goto done;
 				case T_OPEN_TAG:
 				case T_OPEN_TAG_WITH_ECHO:
 				case T_CLOSE_TAG:
@@ -178,19 +170,6 @@
 		token.type = 0;
 	}
 
-	/* handler for trailing comments, see bug #42767 */
-	if (LANG_SCNG(yy_leng) && LANG_SCNG(_yy_more_len)) {
-		if (last_color != syntax_highlighter_ini->highlight_comment) {
-			if (last_color != syntax_highlighter_ini->highlight_html) {
-				zend_printf("</span>");
-			}
-			if (syntax_highlighter_ini->highlight_comment != syntax_highlighter_ini->highlight_html) {
-				zend_printf("<span style=\"color: %s\">", syntax_highlighter_ini->highlight_comment);
-			}
-		}
-		zend_html_puts(LANG_SCNG(yy_text), LANG_SCNG(_yy_more_len) TSRMLS_CC);
-	}
-done:
 	if (last_color != syntax_highlighter_ini->highlight_html) {
 		zend_printf("</span>\n");
 	}
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_language_scanner.l?r1=1.131.2.11.2.17&r2=1.131.2.11.2.18&diff_format=u
Index: ZendEngine2/zend_language_scanner.l
diff -u ZendEngine2/zend_language_scanner.l:1.131.2.11.2.17 ZendEngine2/zend_language_scanner.l:1.131.2.11.2.18
--- ZendEngine2/zend_language_scanner.l:1.131.2.11.2.17	Sat May 10 09:18:27 2008
+++ ZendEngine2/zend_language_scanner.l	Fri May  8 17:50:58 2009
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_language_scanner.l,v 1.131.2.11.2.17 2008/05/10 09:18:27 mattwil Exp $ */
+/* $Id: zend_language_scanner.l,v 1.131.2.11.2.18 2009/05/08 17:50:58 mattwil Exp $ */
 
 #define yyleng SCNG(yy_leng)
 #define yytext SCNG(yy_text)
@@ -2033,7 +2033,9 @@
 
 <ST_COMMENT,ST_DOC_COMMENT><<EOF>> {
 	zend_error(E_COMPILE_WARNING,"Unterminated comment starting line %d", CG(comment_start_line));
-	return 0;
+	yyless(yyleng - 1);
+	BEGIN(ST_IN_SCRIPTING);
+	return T_COMMENT;
 }