Actually return false from eat() on error for reduce part

master
Vitaliy Filippov 2013-08-26 16:12:51 +04:00
parent a5afc90b9b
commit 52918751c4
1 changed files with 1 additions and 2 deletions

View File

@ -313,9 +313,8 @@ class parse_engine {
case 'r':
if ($this->debug) echo "Reducing $type via rule $operand\n";
$this->reduce($operand);
$this->eat($type, $semantic);
// Yes, this is tail-recursive. It's also the simplest way.
break;
return $this->eat($type, $semantic);
case 'a':
if ($this->stack->occupied()) {
throw new parse_bug('Accept should happen with empty stack.');