private function compactAnnotations($docblock)
    {
        $annotations = array();
        $index = -1;
        $inside = 0;
        $tokens = $this->tokenizer->parse($docblock);

        if (empty($tokens)) {
            return str_repeat("\n", substr_count($docblock, "\n"));
        }

        foreach ($tokens as $token) {
            if ((0 === $inside) && (DocLexer::T_AT === $token[0])) {
                $index++;
            } elseif (DocLexer::T_OPEN_PARENTHESIS === $token[0]) {
                $inside++;
            } elseif (DocLexer::T_CLOSE_PARENTHESIS === $token[0]) {
                $inside--;
            }

            if (!isset($annotations[$index])) {
                $annotations[$index] = array();
            }

            $annotations[$index][] = $token;
        }

        $breaks = substr_count($docblock, "\n");
        $docblock = "/**";

        foreach ($annotations as $annotation) {
            $annotation = new Tokens($annotation);
            $docblock .= "\n" . $this->converter->convert($annotation);
        }

        $breaks -= count($annotations);

        if ($breaks > 0) {
            $docblock .= str_repeat("\n", $breaks - 1);
            $docblock .= "\n*/";
        } else {
            $docblock .= ' */';
        }

        return $docblock;
    }