From: Nuno Lopes Date: Tue, 8 Jul 2008 15:24:25 +0000 (+0000) Subject: MFB: fix remaining # comments issues X-Git-Tag: BEFORE_HEAD_NS_CHANGE~1345 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6c844a9d1cad8a5fc59e297b452cf5482c7cd3e4;p=php MFB: fix remaining # comments issues --- diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 4858257a47..69ab6ce4c1 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -1336,6 +1336,25 @@ yymore_restart: 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 @@ NOWDOC_CHARS ({NEWLINE}*(([^a-zA-Z_\x7f-\xff\n\r][^\n\r]*)|({LABEL}[^a-zA-Z0-9_ 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 @@ NOWDOC_CHARS ({NEWLINE}*(([^a-zA-Z_\x7f-\xff\n\r][^\n\r]*)|({LABEL}[^a-zA-Z0-9_ 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 @@ NOWDOC_CHARS ({NEWLINE}*(([^a-zA-Z_\x7f-\xff\n\r][^\n\r]*)|({LABEL}[^a-zA-Z0-9_ 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 @@ NOWDOC_CHARS ({NEWLINE}*(([^a-zA-Z_\x7f-\xff\n\r][^\n\r]*)|({LABEL}[^a-zA-Z0-9_ ""#".+ {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 @@ inline_char_handler: } 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 (). this condition is not optimal though */ + if (YYCURSOR < YYLIMIT && (*YYCURSOR == '?' || *YYCURSOR == '%' || *YYCURSOR == 's')) { --YYCURSOR; yyleng = YYCURSOR - SCNG(yy_text); break;