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

Multi-line Comment has incorrect end line and position #12

Closed
atifaziz opened this issue Nov 29, 2019 · 1 comment
Closed

Multi-line Comment has incorrect end line and position #12

atifaziz opened this issue Nov 29, 2019 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@atifaziz
Copy link
Owner

Install version 1.2.0:

Then in PowerShell, try:

PS> echo "/*`ncomment`n*/" | .\csmin.cmd tokens

The output will be:

[
  {
    "kind": "MultiLineComment",
    "span": [[0, 1, 1], [13, 1, 14]],
    "text": "/*\ncomment\n*/"
  },
  {
    "kind": "NewLine",
    "span": [[13, 1, 14], [15, 2, 1]],
    "text": "\r\n"
  }
]

The span for the multi-line comment is reads [[0, 1, 1], [13, 1, 14]]. The second array that's the end offset, line and position has the wrong line number and position. The comment ends on line 3!

It seems as if CR and LF are not handled to affect line numbering when within a multi-line comment.

@atifaziz atifaziz added the bug Something isn't working label Nov 29, 2019
@atifaziz atifaziz self-assigned this Nov 29, 2019
@atifaziz atifaziz added this to the 1.2.1 milestone Nov 29, 2019
atifaziz added a commit that referenced this issue Nov 29, 2019
This is a squashed merge of PR #13 that closes issue #12.
@atifaziz
Copy link
Owner Author

Closed via PR #13 and fcf9c77.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant