mirror of https://github.com/vitalif/lime
Merge branch 'master' into ns
commit
1b7c30f7b8
7
lime.php
7
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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue