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

Funny treatment of whitespace #5

Open
tomek-he-him opened this issue Jul 17, 2015 · 3 comments
Open

Funny treatment of whitespace #5

tomek-he-him opened this issue Jul 17, 2015 · 3 comments

Comments

@tomek-he-him
Copy link

getComments('code\n/** comment */\ncode', true)
//» [ { start: 5,
//      end: 19,
//      type: 'Block',
//      loc: { start: [Object], end: [Object] },
//      api: false,
//      value: '* comment ',
//      after: 'code' } ]

getComments('code /** comment */ code', true)
//» []

getComments('code\n/** comment */ code', true)
//» []

getComments('code /** comment */\ncode', true)
//» []

The majority of text parsers I know of – in the web (HTML, JS, CSS) and in Unix (bash and the like) – makes no difference between whitespace characters. It’s enough that there is at least one of the characters [ \n\t] between things so that they are read as separate.

That’s what I’d expect of your tool – and most other users as well, I guess.

@tunnckoCore
Copy link
Owner

Hm. That's strange... it is handled on #L61 and #L78

But all that issues are normal. Try acorn-exctract-comments.

Also want to mention that it's not faster than jonschlinkert/extract-comments

@tomek-he-him
Copy link
Author

Also want to mention that it's not faster than jonschlinkert/extract-comments

Which one do you mean exactly? The acorn thing or yours?

@tunnckoCore
Copy link
Owner

or yours

mine, get-comments

But acorn-extract-comments also is mine, need bench testing.

I'll come back to them (*-comments) soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants