summaryrefslogtreecommitdiff
path: root/Zend/zend_language_parser.y
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2015-03-21 20:10:19 +0100
committerNikita Popov <nikic@php.net>2015-04-02 16:31:17 +0200
commita8bf1c5d8f5755b53492e58040cfe88150eb57b6 (patch)
treec3b94b3c9cb7bdf5964a5428673459a78e12edc5 /Zend/zend_language_parser.y
parent83a15801cc8619a1a83307e573bf1b63f0d4b53c (diff)
downloadphp-git-a8bf1c5d8f5755b53492e58040cfe88150eb57b6.tar.gz
Throw ParseException from lexer
Primarily to avoid getting fatal errors from token_get_all(). Implemented using a magic E_ERROR token, which the lexer emits to force a parser failure.
Diffstat (limited to 'Zend/zend_language_parser.y')
-rw-r--r--Zend/zend_language_parser.y5
1 files changed, 4 insertions, 1 deletions
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index 61ae8c5614..8db3fb2f3d 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -226,6 +226,9 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%token T_POW "** (T_POW)"
%token T_POW_EQUAL "**= (T_POW_EQUAL)"
+/* Token used to force a parse error from the lexer */
+%token T_ERROR
+
%type <ast> top_statement namespace_name name statement function_declaration_statement
%type <ast> class_declaration_statement trait_declaration_statement
%type <ast> interface_declaration_statement interface_extends_list
@@ -1227,7 +1230,7 @@ static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr)
return yystrlen(yystr);
}
{
- if (CG(parse_error) == 0) {
+ if (CG(parse_error) == 0) {
char buffer[120];
const unsigned char *end, *str, *tok1 = NULL, *tok2 = NULL;
unsigned int len = 0, toklen = 0, yystr_len;