switch getCommentRanges to use scanner instead of replicating scanner logic