diff options
author | Dmitry Stogov <dmitry@php.net> | 2007-05-24 08:56:35 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2007-05-24 08:56:35 +0000 |
commit | 9bca44df220878fb8659ecb5914b4885e34c8209 (patch) | |
tree | 814153b6b501c8f2b9c53faa7e429dc4b81a2b98 /Zend | |
parent | 6f694fab9a0c7e232be40e909a7560c228c9a304 (diff) | |
download | php-git-9bca44df220878fb8659ecb5914b4885e34c8209.tar.gz |
Impoved error reporting on parser errors (Matt, Dmitry)
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/zend_language_scanner.l | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 351d3b137f..cc7eb42d44 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -1648,14 +1648,17 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ return ']'; } -<ST_VAR_OFFSET>{TOKENS}|[{}] { +<ST_VAR_OFFSET>{TOKENS}|[{}"`] { /* Only '[' can be valid, but returning other tokens will allow a more explicit parse error */ return yytext[0]; } -<ST_VAR_OFFSET>[ \n\r\t'"`\\#] { +<ST_VAR_OFFSET>[ \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_STRING(zendlval); /* Empty since it won't be used */ + return T_ENCAPSED_AND_WHITESPACE; } <ST_IN_SCRIPTING,ST_VAR_OFFSET>{LABEL} { @@ -1935,8 +1938,8 @@ HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({ zend_scan_escape_string(zendlval, yytext, len, 0 TSRMLS_CC); 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(); } |