From a5afc90b9b398d9d6932b9290134af8faec48cd5 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sat, 20 Apr 2013 14:59:49 +0400 Subject: [PATCH] Return false from eat() on error and true on success --- parse_engine.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/parse_engine.php b/parse_engine.php index a7a9691..6d4f217 100644 --- a/parse_engine.php +++ b/parse_engine.php @@ -343,6 +343,7 @@ class parse_engine { if ($this->has_step_for($type)) { $this->eat($type, $semantic); } + return false; } else { // If that didn't work, give up: throw new parse_error('Parse Error: ' . $this->descr($type, $semantic) . ' not expected, expected one of ' . implode(', ', $expected)); @@ -351,6 +352,7 @@ class parse_engine { default: throw new parse_bug("Bad parse table instruction " . htmlspecialchars($opcode)); } + return true; } private function descr($type, $semantic) {