From 52918751c48ea67db45be6ae24b6dae1d49fc237 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Mon, 26 Aug 2013 16:12:51 +0400 Subject: [PATCH] Actually return false from eat() on error for reduce part --- parse_engine.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/parse_engine.php b/parse_engine.php index 6d4f217..bb9d02b 100644 --- a/parse_engine.php +++ b/parse_engine.php @@ -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.');