diff --git a/lime.php b/lime.php index ff4020b..6adb559 100755 --- a/lime.php +++ b/lime.php @@ -1348,6 +1348,9 @@ if ($_SERVER['argv']) { } array_shift($_SERVER['argv']); // Strip out the program name. + + $timer = microtime(true); + foreach ($_SERVER['argv'] as $path) { $code .= parse_lime_grammar($path); } @@ -1370,4 +1373,8 @@ if ($_SERVER['argv']) { */ {$code} CODE; + +echo PHP_EOL + . '// Time: ' . (microtime(true) - $timer) . ' seconds' . PHP_EOL + . '// Memory: ' . memory_get_peak_usage() . ' bytes' . PHP_EOL; } diff --git a/parse_engine.php b/parse_engine.php index 17c79d2..1fd108c 100644 --- a/parse_engine.php +++ b/parse_engine.php @@ -42,7 +42,7 @@ class parse_unexpected_token extends parse_error { class parse_premature_eof extends parse_error { public function __construct(array $expect) { - parent::__construct('Premature EOF, expected {' . implode(', ', $expect) . '}'); + parent::__construct('Premature EOF'); } } @@ -267,6 +267,12 @@ class parse_engine { private function get_steps() { $out = array(); foreach($this->current_row() as $type => $row) { + foreach($this->rule as $rule) { + if ($rule['symbol'] == $type) { + continue 2; + } + } + list($opcode) = explode(' ', $row, 2); if ($opcode != 'e') { $out[] = $type;