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

Incorrect counts when multi-line pattern has the single-line pattern as a prefix. #25

Closed
jswrenn opened this issue Oct 26, 2016 · 1 comment · Fixed by #29
Closed

Incorrect counts when multi-line pattern has the single-line pattern as a prefix. #25

jswrenn opened this issue Oct 26, 2016 · 1 comment · Fixed by #29
Labels

Comments

@jswrenn
Copy link
Contributor

jswrenn commented Oct 26, 2016

For example, broken.lua:

--[[ This
     is
     a
     multi-line
     comment,
     not
     code. ]]

Expected output:

---------------------------------------------------------------------------------
 Language              Files        Lines        Blank      Comment         Code
---------------------------------------------------------------------------------
 Lua                       1            7            0            7           0

Actual output:

---------------------------------------------------------------------------------
 Language              Files        Lines        Blank      Comment         Code
---------------------------------------------------------------------------------
 Lua                       1            7            0            1            6

This occurs because the opening character sequence of a multi-line comment has the character sequence of a single-line comment as its prefix:

    Lua => SM("--", "--[[", "]]"),

I ran into this bug while adding the comment patterns for a language which uses # for single-line comments, and #| and |# for multi-line comments.

@cgag
Copy link
Owner

cgag commented Oct 26, 2016

Oh, very interesting. Good catch. I may have to rethink some things.

@cgag cgag added the bug label Oct 28, 2016
@cgag cgag mentioned this issue Nov 2, 2016
@cgag cgag closed this as completed in #29 Nov 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants