The one thing you possibly could do is still add a leading `#` to the `\t#comment` line, e.g. "if line is an indented comment, add a documentation comment prefix", but that might be an overly specific case to warrant it, and special cases have a tendency to come back to bite you…
Wait, if we don't need to handle leading whitespaces (which we don't *need* AFAIK, although it might be nice), the logic is merely `if (*line && *line != '[' && *line != '#') comment();`, isn't it?