From: Dmitry Stogov Date: Thu, 24 May 2007 08:56:50 +0000 (+0000) Subject: Impoved error reporting on parser errors (Matt, Dmitry) X-Git-Tag: RELEASE_1_4~86 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=89a13e70fe55485e5a88b5d86a1effa369f86f9b;p=php Impoved error reporting on parser errors (Matt, Dmitry) --- diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 718867bda4..e252411c13 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -2186,14 +2186,17 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ return ']'; } -{TOKENS}|[{}] { +{TOKENS}|[{}"`] { /* Only '[' can be valid, but returning other tokens will allow a more explicit parse error */ return yytext[0]; } -[ \n\r\t'"`\\#] { +[ \n\r\t\\'#] { + /* Invalid rule to return a more explicit parse error with proper line number */ yyless(0); yy_pop_state(TSRMLS_C); + ZVAL_EMPTY_TEXT(zendlval); /* Empty since it won't be used */ + return T_ENCAPSED_AND_WHITESPACE; } {LABEL} { @@ -2483,8 +2486,8 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ return T_ENCAPSED_AND_WHITESPACE; } } else { - /* Go back to end of label, so there's something to match again in case - * there's a variable at the beginning of the next line */ + /* Go back to end of label, so the next match works correctly in case of + * a variable or another label at the beginning of the next line */ yyless(yyleng - 1); yymore(); }