Skip to content

Commit

Permalink
Chore
Browse files Browse the repository at this point in the history
  • Loading branch information
KennedyTedesco committed Dec 16, 2024
1 parent b654872 commit fc16bc8
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/Monkey/Repl/ReplManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use MonkeyLang\Monkey\Exceptions\MonkeyRuntimeException;
use MonkeyLang\Monkey\IO\InputReader;
use MonkeyLang\Monkey\IO\OutputFormatter;
use MonkeyLang\Monkey\Performance\PerformanceTracker;
use Symfony\Component\Console\Helper\Table;
use Throwable;

Expand Down Expand Up @@ -69,7 +68,7 @@ public function start(Configuration $config): int
}

try {
$result = $this->evaluate($input, $config);
$result = $this->evaluate($input);

$this->outputFormatter->writeOutput($result, $this->debugMode);
} catch (MonkeyRuntimeException $e) {
Expand All @@ -95,15 +94,8 @@ public function start(Configuration $config): int
}
}

private function evaluate(string $input, Configuration $config): MonkeyObject
private function evaluate(string $input): MonkeyObject
{
$parserPerformanceTracker = null;

if ($config->hasStats()) {
$parserPerformanceTracker = new PerformanceTracker('Parser');
$parserPerformanceTracker->start();
}

$lexer = new Lexer($input);
$parser = new Parser($lexer);

Expand All @@ -117,11 +109,6 @@ private function evaluate(string $input, Configuration $config): MonkeyObject

$program = new ProgramParser()($parser);

if ($config->hasStats()) {
$metrics = $parserPerformanceTracker->stop();
$this->outputFormatter->writePerformanceStats($metrics);
}

return $this->evaluator->eval($program, $this->environment);
}

Expand Down

0 comments on commit fc16bc8

Please sign in to comment.