public function prepare(TokenStream $stream) :void
    {
        $this->root = $this->scope = new RootNode();
        $this->stream = $stream;
        $this->lastTokenIndex = max(0, count($this->stream->getTokens()) - 1);
        $this->cursor = 0;
    }