Skip to content

Commit

Permalink
Improve token print logic
Browse files Browse the repository at this point in the history
  • Loading branch information
SerafimArts committed Feb 18, 2024
1 parent 4875514 commit 5ed09de
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Token/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Phplrt\Lexer\Token;

use Phplrt\Lexer\Driver\DriverInterface;
use Phplrt\Contracts\Lexer\TokenInterface;

final class Renderer
Expand Down Expand Up @@ -46,7 +45,9 @@ final class Renderer
public function render(TokenInterface $token): string
{
switch (true) {
case $token->getName() === DriverInterface::UNKNOWN_TOKEN_NAME:
case $token instanceof EndOfInput:
return 'end of input';
case $token instanceof UnknownToken:
case $token->getName() === $token->getValue():
return $this->value($token);
}
Expand Down

0 comments on commit 5ed09de

Please sign in to comment.