Add support for nested comments

Fixes #9468.