Adding getLeadingComments and getTrailingComments methods to scanner.

Yes, there's a lot of similarity, but factoring into shared logic would make it slower and likely require object allocations for return values or callbacks. Performance is pretty critical for these methods, I think it is worth it to keep them separate.