Scope doc comments to a declaration's level with bracket depth
This came up implementing group doc comments (a '##' that documents every declaration below it until a blank line) in a language server. It's hard to decide which comments are 'at the same level' as a declaration without walking every statement list in the AST. A cheap, robust test is to scan the lexer's tokens between the comment's end and the declaration's start. Count opening brackets +1 and closing ones -1. The comment is at the declaration's level iff the depth never goes negative and ends at 0. A depth that ends above 0 means the comment sits outside an enclosing body or parameter list, like a ## over a function versus that function's locals. A depth that dips below 0 means the comment sits inside an earlier sibling's body. Comments aren't tokens and string contents are a single token, so brackets inside them never count.