From 7a40498cb462ac3efbc8bf838a7d10fbc3eeff3e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 19 Apr 2015 18:12:56 +0200 Subject: [PATCH] Regenerate parser Also drop the error() parser macro. --- grammar/rebuildParser.php | 6 ------ grammar/zend_language_parser.phpy | 3 ++- lib/PhpParser/Parser.php | 5 +++-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/grammar/rebuildParser.php b/grammar/rebuildParser.php index 96f9fea..2e7b9c5 100644 --- a/grammar/rebuildParser.php +++ b/grammar/rebuildParser.php @@ -102,12 +102,6 @@ function resolveMacros($code) { $matches['args'] ); - if ('error' == $name) { - assertArgs(1, $args, $name); - - return 'throw new Error(' . $args[0] . ')'; - } - if ('init' == $name) { return '$$ = array(' . implode(', ', $args) . ')'; } diff --git a/grammar/zend_language_parser.phpy b/grammar/zend_language_parser.phpy index e36f4b6..5947594 100644 --- a/grammar/zend_language_parser.phpy +++ b/grammar/zend_language_parser.phpy @@ -175,7 +175,8 @@ inner_statement: statement { $$ = $1; } | function_declaration_statement { $$ = $1; } | class_declaration_statement { $$ = $1; } - | T_HALT_COMPILER { error('__HALT_COMPILER() can only be used from the outermost scope'); } + | T_HALT_COMPILER + { throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $attributes); } ; statement: diff --git a/lib/PhpParser/Parser.php b/lib/PhpParser/Parser.php index 7935b30..77f98e0 100644 --- a/lib/PhpParser/Parser.php +++ b/lib/PhpParser/Parser.php @@ -14,7 +14,8 @@ class Parser extends ParserAbstract protected $actionTableSize = 1118; protected $gotoTableSize = 573; - protected $invalidToken = 156; + protected $invalidSymbol = 156; + protected $errorSymbol = 1; protected $defaultAction = -32766; protected $unexpectedTokenRule = 32767; @@ -1143,7 +1144,7 @@ class Parser extends ParserAbstract } protected function reduceRule32($attributes) { - throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $attributes); + throw new Error('__HALT_COMPILER() can only be used from the outermost scope', $attributes); } protected function reduceRule33($attributes) {