protected function getTokensUntilClosingScope(bool $includeScope = false, int $openToken = T::TOKEN_BRACE_OPEN, int $closeToken = T::TOKEN_BRACE_CLOSE) : array
    {
        if ($this->currentToken()->getType() !== $openToken)
        {
            throw $this->errorUnexpectedToken($this->currentToken());
        }

        $tokens = array();

        // include the opening scope
        if ($includeScope) {
            $tokens[] = $this->currentToken();
        }
        
        $this->skipToken();

       
        $currentLevel = 0;

        while($this->currentToken() && !($this->currentToken()->getType() === $closeToken && $currentLevel === 0))
        {
            if ($this->currentToken()->getType() === $openToken)
            {
                $currentLevel++;
            }

            if ($this->currentToken()->getType() === $closeToken)
            {
                $currentLevel--;
            }

            $tokens[] = $this->currentToken();
            $this->skipToken();
        }

        // include the closing scope
        if ($includeScope) {
            $tokens[] = $this->currentToken();
        }

        // skip the closing scope
        $this->skipToken();

        return $tokens;
    }