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.
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: ([\'\"\ s]*([^\ '\"]*)[ \'\"\s] *,.*?function. *?[\'\" \s]*[0- 9\.]*[\ '\"\s]* ({[^{}a- zA-Z]*( use|requires| optional| after|supersede s|omit| skinnable) ?[^a-zA- Z]*[\s\ '\":]*[ ^{}]*}) \);
YUI\.add\
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: /bitbucket. org/mvantelling en/pyjsparser/ src
https:/
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.