- funcRe = QRegExp("var\\s+" + QRegExp::escape(name) + "\\s*=\\s*function\\s*\\([" + jsNameChars + ",\\s]*\\)\\s*\\{[^\\}]+\\}");
- if (funcRe.indexIn(js) == -1) {
- qWarning() << "Cannot capture function" << name;
- return;
+ funcRe = QRegExp("var\\s+" + QRegExp::escape(name) + "\\s*=\\s*function" + argsAndBody);
+ if (funcRe.indexIn(js) != -1) {
+ func = funcRe.cap(0);
+ } else {
+ // try ,gr= function(bar) { };
+ funcRe = QRegExp("[,\\s;}\\.\\)](" + QRegExp::escape(name) + "\\s*=\\s*function" + argsAndBody + ")");
+ if (funcRe.indexIn(js) != -1) {
+ func = funcRe.cap(1);
+ } else {
+ qWarning() << "Cannot capture function" << name;
+ return;
+ }