Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for whitespaces between comments #31

Closed

Conversation

Ngo-The-Trung
Copy link

This correct counts lines such as

/* comment 1 */ /* comment 2 */

as comments

Otherwise it would count lines with multiple comments as code
@cgag
Copy link
Owner

cgag commented Nov 8, 2016

I commented in the issue, but as is, this has crashes because trimmed.nth(pos) is not equivalent to trimmed[pos], since pos is in bytes and nth is in characters. You can end up doing things like doing nth(pos) where pos is bigger than the number of chars in the string.

I implemented an equivalent in master. The larger issue of needing to handle whitespace here, and the general approach is correct though and I based my solution on it. Thanks again for the pr.

@cgag cgag closed this Nov 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants