Comment 1 for bug 828070

Revision history for this message
Richard Harding (rharding) wrote :

I tried like mad to get the regex right, but if you allow for {} then the test for the test_extract_metadata_not_metadata fails.

Tested Regex:
YUI\.add\([\'\"\s]*([^\'\"]*)[\'\"\s]*,.*?function.*?[\'\"\s]*[0-9\.]*[\'\"\s]*({[^{}a-zA-Z]*(use|requires|optional|after|supersedes|omit|skinnable)?[^a-zA-Z]*[\s\'\":]*[^{}]*})\);

I wonder if using a true parse would make life easier. In particular this seems to work well for a couple of test snippets of code:
https://bitbucket.org/mvantellingen/pyjsparser/src

which seems to have been forked and better maintained over here: https://github.com/nullie/pyjsparser

Note that speed seems to be pretty slow in test cases though.