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

Fix: End of JavaScript comments are not parsed #83

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

anseki
Copy link

@anseki anseki commented Jul 19, 2015

Issue:
#77 (comment)

In JavaScript code, that regexp stops reading immediately it found * without checking */ or end of line, etc..
Because that regexp accepts these as the end of the directive:

  1. **
  2. */
  3. Nothing

That regexp accepts "Nothing". And * as the parameters is not accepted.

For example:

console.log(
  require('preprocess').preprocess(
    'foo/* @if SIZE * 1024 > MEM */ BIG/* @endif */ bar',
    {SIZE: 2, MEM: 1024},
    {type: 'js'}
  )
);

Result:

foo* 1024 > MEM */ BIG bar

This PR fixes this bug, and puts common patterns into the variables.

@anseki
Copy link
Author

anseki commented Jul 19, 2015

I renamed vars because those are not good naming.
If I should do it, I do rebase to a one commit.

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.

1 participant