Imperative version of the comment scanner.

Fixed #1002241