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

Wrong location for empty inline comment // #126

Closed
fisker opened this issue Oct 27, 2020 · 4 comments
Closed

Wrong location for empty inline comment // #126

fisker opened this issue Oct 27, 2020 · 4 comments

Comments

@fisker
Copy link
Collaborator

fisker commented Oct 27, 2020

require("meriyah").parse('//', {onComment(){console.log(arguments)}})
[Arguments] {
  '0': 'SingleLine',
  '1': '',
  '2': 0,
  '3': 0,
  '4': { start: { line: 1, column: 0 }, end: { line: 1, column: 0 } }
}
``

`arguments` should be `"SingleLine", "", 0, 2`
@KFlash
Copy link
Contributor

KFlash commented Oct 27, 2020

@3cp Look at this gist. It's from my private code https://gist.github.com/KFlash/fa461f7f0cd080e65227eb9a0a683938

If you "adopt" this I guess most of the problems will be solved. Doing parser.pos - parser.columnPos after WS has been skipped gives me number2 as @fisker mentioned.

@3cp 3cp closed this as completed in d62d0b8 Oct 27, 2020
@3cp
Copy link
Member

3cp commented Oct 27, 2020

There was an missing init before loop in my code. Your gist is much bigger change, I will try it for #125.

@KFlash
Copy link
Contributor

KFlash commented Oct 27, 2020

@3cp I'm still experimenting with my gist. Dealing with comments now

@KFlash
Copy link
Contributor

KFlash commented Oct 27, 2020

@3cp Study this gist https://gist.github.com/KFlash/688af509a649aa8180d4cb17e7b9de81

Confirmed it's easy to extract comments

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

No branches or pull requests

3 participants