cvs: ZendEngine2 / zend_language_scanner.l

From: Date: Tue, 08 Jul 2008 15:24:25 +0000
Subject: cvs: ZendEngine2 / zend_language_scanner.l
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-6869@lists.php.net to get a copy of this message
nlopess Tue Jul 8 15:24:25 2008 UTC Modified files: /ZendEngine2 zend_language_scanner.l Log: MFB: fix remaining # comments issues http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_language_scanner.l?r1=1.187&r2=1.188&diff_format=u Index: ZendEngine2/zend_language_scanner.l diff -u ZendEngine2/zend_language_scanner.l:1.187 ZendEngine2/zend_language_scanner.l:1.188 --- ZendEngine2/zend_language_scanner.l:1.187 Sun Jul 6 16:39:44 2008 +++ ZendEngine2/zend_language_scanner.l Tue Jul 8 15:24:25 2008 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_scanner.l,v 1.187 2008/07/06 16:39:44 nlopess Exp $ */ +/* $Id: zend_language_scanner.l,v 1.188 2008/07/08 15:24:25 nlopess Exp $ */ #if 0 # define YYDEBUG(s, c) printf("state: %d char: %c\n", s, c) @@ -1336,6 +1336,25 @@ return 0; } + /* ignore first line when it's started with a # */ + if (YYCURSOR == SCNG(yy_start) && *YYCURSOR == '#') { + while (++YYCURSOR < YYLIMIT) { + if (*YYCURSOR == '\n') { + ++YYCURSOR; + goto restart; + } + + if (*YYCURSOR == '\r') { + if (++YYCURSOR < YYLIMIT && *YYCURSOR == '\n') { /* match \r\n as single newline */ + ++YYCURSOR; + } + goto restart; + } + } + + return 0; /* EOF */ + } + /*!re2c re2c:yyfill:check = 0; LNUM [0-9]+ @@ -2088,10 +2107,7 @@ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG_WITH_ECHO; } else { - Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng); - Z_STRLEN_P(zendlval) = yyleng; - Z_TYPE_P(zendlval) = IS_STRING; - return T_INLINE_HTML; + goto inline_char_handler; } } @@ -2104,10 +2120,7 @@ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG_WITH_ECHO; } else { - Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng); - Z_STRLEN_P(zendlval) = yyleng; - Z_TYPE_P(zendlval) = IS_STRING; - return T_INLINE_HTML; + goto inline_char_handler; } } @@ -2120,10 +2133,7 @@ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } else { - Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng); - Z_STRLEN_P(zendlval) = yyleng; - Z_TYPE_P(zendlval) = IS_STRING; - return T_INLINE_HTML; + goto inline_char_handler; } } @@ -2139,7 +2149,6 @@ <INITIAL>"<?" { - HANDLE_NEWLINES(yytext, yyleng); if (CG(short_tags)) { Z_STRVAL_P(zendlval) = yytext; /* no copying - intentional */ Z_STRLEN_P(zendlval) = yyleng; @@ -2147,19 +2156,6 @@ BEGIN(ST_IN_SCRIPTING); return T_OPEN_TAG; } else { - Z_STRVAL_P(zendlval) = (char *) estrndup(yytext, yyleng); - Z_STRLEN_P(zendlval) = yyleng; - Z_TYPE_P(zendlval) = IS_STRING; - return T_INLINE_HTML; - } -} - -<INITIAL>"#".+ {NEWLINE} { - if ((YYCTYPE*)yytext == SCNG(yy_start)) { - /* ignore first line when it's started with a # */ - goto restart; - } else { - YYCURSOR = yytext+1; goto inline_char_handler; } } @@ -2179,8 +2175,8 @@ } else { YYCURSOR = ptr + 1; - /* if it can be an opening tag, stop */ - if (YYCURSOR < YYLIMIT && (*YYCURSOR == '?' || *YYCURSOR == '%')) { + /* stop if it may be an opening tag (<?, <%, <script>). this condition is not optimal though */ + if (YYCURSOR < YYLIMIT && (*YYCURSOR == '?' || *YYCURSOR == '%' || *YYCURSOR == 's')) { --YYCURSOR; yyleng = YYCURSOR - SCNG(yy_text); break;

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