Unfortunately, it's only for #if .* ... #el.* ... #endif. I didn't want to write that much of a parser, so I just push the line number onto a stack if I see a line like /^\s*#if/.
I guess Emacs is using some kind of parser to do syntax highlighting, right? I wonder if it's possible to tap into that...