protected function expect(string $kind): Token
    {
        $token = $this->lexer->getToken();

        if ($kind === $token->getKind()) {
            $this->lexer->advance();
            return $token;
        }

        throw $this->lexer->createSyntaxErrorException(\sprintf('Expected %s, found %s.', $kind, $token));
    }