public function readToken(): Token
    {
        if ($this->isEnd()) {
            throw new LogicException("The end of buffer is reached");
        }
        $token = $this->getTokenAtIndex($this->cursor);
        $this->cursor++;
        return $token;
    }