The problem was in the way comments were being processed. If any comment contained @name, it was always used for creating a new task section, even if followed by uncommented method. However delimited comments:
/// @name Something
Were not correctly detected as @name comments. The reason was in the regex being used for matching @name: it expected the @name at the start of the comment string. By changing the regex to match in any line, this works correctly. The downside is that section names spanning multiple lines are now ignored (you can delimit @name and first word by new line though). On the other hand, I don't think anybody uses section names in such a way, so it'll probably work just fine.
Proper solution would require using two regexes: one for matching @name before stripping delimiters and one for matching afterwards. Or alternatively strip delimiters immediately after recognizing a comment (at present this is all delayed until needed to make the tool as efficient as possible).