-
Notifications
You must be signed in to change notification settings - Fork 1
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
lightparse: improve the detection of regexp #16
Comments
Looks complicate to implement with the current implementation. Also using narcissus function declarations and named function expressions could be properly distinguished (not sure it would matter here, though), and - more important - automatic semi-colon "insertion" would be supported. Mmmm humbling lesson. Maybe I'll just switch the lightparse.js internal implementation to narcissus, while still offering the same interface to the outside. |
Note: Using narcissus would require to make it extendable so that it recognizes metaret, metafun and inline. |
Found several other issues which become difficult to solve using lightparse. Again narcissus would be desirable here (or any equivalent). In particular, lightparse callArr does not distinguish between function declarations / expressions / actual calls. Another complication: add support for dotted function declaration names (for metaparse etc.). Maybe for the time being we can just stop trying to shorten local names using lightparse, and do it separately afterwards. |
acorn looks like a good candidate for a parser : small yet complete implementation. |
When re-parsing minified code false positive detections of regexps are triggered by a division sign because the current strategy is still too naive. This is a problem if we want to reparse the minified code - where most newlines have been removed - to e.g. further shorten it.
-> false positive with the current implementation: / y ..... bar / detected as a regexp because the identifier x is not taken into account.
Task: reject such false positive regexps.
Difficulty: we want to try to keep lightparse "light" i.e. without a full tokenizer (mmm maybe I won't avoid it in the long term, but for now this way if it goes). So we should not only reject the simple false positives but also prevent introducing false negatives:
See also the remarks at the beginning of section 7 of the ECMAscript 5 spec:
The text was updated successfully, but these errors were encountered: