logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

cvs: ZendEngine2(PHP_5_1) / zend_highlight.c zend_language_scanner.l /test: msg#00039

Subject: cvs: ZendEngine2(PHP_5_1) / zend_highlight.c zend_language_scanner.l /tests bug35655.phpt
iliaa           Tue Dec 13 20:55:02 2005 EDT

  Added files:                 (Branch: PHP_5_1)
    /ZendEngine2/tests  bug35655.phpt 

  Modified files:              
    /ZendEngine2        zend_highlight.c zend_language_scanner.l 
  Log:
  Fixed bug #35655 (whitespace following end of heredoc is lost).
  
  
http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_highlight.c?r1=1.49.2.1&r2=1.49.2.2&diff_format=u
Index: ZendEngine2/zend_highlight.c
diff -u ZendEngine2/zend_highlight.c:1.49.2.1 
ZendEngine2/zend_highlight.c:1.49.2.2
--- ZendEngine2/zend_highlight.c:1.49.2.1       Sun Nov 27 06:39:28 2005
+++ ZendEngine2/zend_highlight.c        Tue Dec 13 20:55:02 2005
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_highlight.c,v 1.49.2.1 2005/11/27 06:39:28 iliaa Exp $ */
+/* $Id: zend_highlight.c,v 1.49.2.2 2005/12/13 20:55:02 iliaa Exp $ */
 
 #include "zend.h"
 #include <zend_language_parser.h>
@@ -94,7 +94,7 @@
        int token_type;
        char *last_color = syntax_highlighter_ini->highlight_html;
        char *next_color;
-       int in_string=0, post_heredoc = 0;
+       int in_string=0;
 
        zend_printf("<code>");
        zend_printf("<span style=\"color: %s\">\n", last_color);
@@ -151,14 +151,9 @@
                switch (token_type) {
                        case T_END_HEREDOC:
                                zend_html_puts(token.value.str.val, 
token.value.str.len TSRMLS_CC);
-                               post_heredoc = 1;
                                break;
                        default:
                                zend_html_puts(LANG_SCNG(yy_text), 
LANG_SCNG(yy_leng) TSRMLS_CC);
-                               if (post_heredoc) {
-                                        zend_html_putc('\n');
-                                        post_heredoc = 0;
-                               }
                                break;
                }
 
@@ -215,19 +210,18 @@
                        case EOF:
                                return;
                        
-                       case T_END_HEREDOC: {
-                                       char *ptr = LANG_SCNG(yy_text);
-
-                                       zend_write(ptr, LANG_SCNG(yy_leng) - 1);
-                                       /* The ensure that we only write one ; 
and that it followed by the required newline */
-                                       zend_write("\n", sizeof("\n") - 1);
-                                       if (ptr[LANG_SCNG(yy_leng) - 1] == ';') 
{
-                                               lex_scan(&token TSRMLS_CC);
-                                       }
-                                       efree(token.value.str.val);
+                       case T_END_HEREDOC:
+                               zend_write(LANG_SCNG(yy_text), 
LANG_SCNG(yy_leng));
+                               efree(token.value.str.val);
+                               /* read the following character, either newline 
or ; */
+                               if (lex_scan(&token TSRMLS_CC) != T_WHITESPACE) 
{
+                                       zend_write(LANG_SCNG(yy_text), 
LANG_SCNG(yy_leng));
                                }
-                               break;
-                       
+                               zend_write("\n", sizeof("\n") - 1);
+                               prev_space = 1;
+                               token.type = 0;
+                               continue;
+
                        default:
                                zend_write(LANG_SCNG(yy_text), 
LANG_SCNG(yy_leng));
                                break;
http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_language_scanner.l?r1=1.131.2.7&r2=1.131.2.8&diff_format=u
Index: ZendEngine2/zend_language_scanner.l
diff -u ZendEngine2/zend_language_scanner.l:1.131.2.7 
ZendEngine2/zend_language_scanner.l:1.131.2.8
--- ZendEngine2/zend_language_scanner.l:1.131.2.7       Thu Dec  8 03:09:14 2005
+++ ZendEngine2/zend_language_scanner.l Tue Dec 13 20:55:02 2005
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_language_scanner.l,v 1.131.2.7 2005/12/08 03:09:14 iliaa Exp $ */
+/* $Id: zend_language_scanner.l,v 1.131.2.8 2005/12/13 20:55:02 iliaa Exp $ */
 
 #define yyleng SCNG(yy_leng)
 #define yytext SCNG(yy_text)
@@ -1733,7 +1733,6 @@
 
 <ST_HEREDOC>^{LABEL}(";")?{NEWLINE} {
        int label_len;
-       unsigned char unput_semicolon;
 
        CG(zend_lineno)++;
        if (yytext[yyleng-2]=='\r') {
@@ -1744,17 +1743,12 @@
 
        if (yytext[label_len-1]==';') {
                label_len--;
-               unput_semicolon=1;
-       } else{
-               unput_semicolon=0;
        }
 
        if (label_len==CG(heredoc_len) && !memcmp(yytext, CG(heredoc), 
label_len)) {
                zendlval->value.str.val = estrndup(yytext, label_len); /* unput 
destroys yytext */
                zendlval->value.str.len = label_len;
-               if (unput_semicolon) {
-                       unput(';');
-               }
+               yyless(yyleng - (yyleng - label_len));
                efree(CG(heredoc));
                CG(heredoc)=NULL;
                CG(heredoc_len)=0;

http://cvs.php.net/viewcvs.cgi/ZendEngine2/tests/bug35655.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/bug35655.phpt
+++ ZendEngine2/tests/bug35655.phpt

-- 
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>