/* try to convert string to function /* it is important that function element MUST start with 'function' keyword
185682
function(str){
                            if (str.trim().substring(0, 8) === 'function'){
                                try {
                                    var func = eval( '(' + str.trim() + ')' );
                                    return func;
                                } catch(e){}
                            }
                        }
1130586
func Func(v map[string]string) func(string) string {
	return func(k string) string {
		return v[k]
	}
}
197698
function getFunctionCalls(call, functionRE) {
  var expressions = []

  var fnRE = typeof functionRE === "string" ? new RegExp("\\b(" + functionRE + ")\\(") : functionRE
  do {
    var searchMatch = fnRE.exec(call)
    if (!searchMatch) {
      return expressions
    }
    if (searchMatch[1] === undefined) {
      throw new Error("Missing the first couple of parenthesis to get the function identifier in " + functionRE)
    }
    var fn = searchMatch[1]
    var startIndex = searchMatch.index
    var matches = balanced("(", ")", call.substring(startIndex))

    if (!matches || matches.start !== searchMatch[0].length - 1) {
      throw new SyntaxError(fn + "(): missing closing ')' in the value '" + call + "'")
    }

    expressions.push({matches: matches, functionIdentifier: fn})
    call = matches.post
  }
  while (fnRE.test(call))

  return expressions
}
207487
func LoadFunctionMap() FunctionMap {
	fm := make(FunctionMap)

	fm.AddFunction("keyMatch", util.KeyMatchFunc)
	fm.AddFunction("keyMatch2", util.KeyMatch2Func)
	fm.AddFunction("regexMatch", util.RegexMatchFunc)
	fm.AddFunction("ipMatch", util.IPMatchFunc)

	return fm
}
1288263
func ShortenFunctionName(f string) string {
	for _, re := range []*regexp.Regexp{goRegExp, javaRegExp, cppRegExp} {
		if matches := re.FindStringSubmatch(f); len(matches) >= 2 {
			return strings.Join(matches[1:], "")
		}
	}
	return f
}
1283174
function _psToFunction(ps) {
    var result = null;
    if (_.isString(ps)) {
        result = function() {
            return ps;
        };
    } else if (_.isFunction(ps)) {
        result = ps;
    } else {
        result = function() {
            return '> ';
        };
    }

    return result;
}
42795
function (_str, _arr, _fun) {
    var _args = [null, null, null],
        _kfun = [
            function (_arg) {
                return _isTypeOf(_arg, 'String');
            },
            function (_arg) {
                return _isTypeOf(_arg, 'Array');
            },
            function (_arg) {
                return _isTypeOf(_arg, 'Function');
            }
        ];
    for (var i = 0, l = arguments.length, _it; i < l; i++) {
        _it = arguments[i];
        for (var j = 0, k = _kfun.length; j < k; j++) {
            if (_kfun[j](_it)) {
                _args[j] = _it;
                break;
            }
        }
    }
    return _args;
}
469537
func functionCompleter(substring string) string {
	found := ""
	for _, fName := range profileFunctionNames {
		if strings.Contains(fName, substring) {
			if found != "" {
				return substring
			}
			found = fName
		}
	}
	if found != "" {
		return found
	}
	return substring
}
984335
function functionParameters(f) {
  assert(typeof f === 'function');
  var matches = functionRegex.exec(f.toString());
  if(!matches || !matches[2].length) {
    return [];
  }
  return matches[2].split(/[,\s]+/).filter(function(str) {
    return str.length;
  });
}
528339
function(func) {
        var found = false;
        var funcString = func.toString();
        var args = funcString.match(/^\s*function\s+(?:\w*\s*)?\((.*?)\)/);
        args = args ? (args[1] ? args[1].trim().split(/\s*,\s*/) : []) : null;

        if (args.length > 0) {
//            var cb;
//            for (var a = 0; a < args.length; ++a) {
//                console.log('......checking ', args[a]);
//                cb = funcString.match(/(callback|cb)\s*\(/g);
//                if (cb) {
//                    //console.log('.......??? ', cb);
//                    return args[a]
//                }
//            }
            return args
        }

        return found
    }
935758
function (name, f) {
    if (!f) throw new Error('Undefined test function');
    if (!/function[^\(]*\(([^,\)]*)/.test(f.toString())) {
      throw new Error('"' + name + '" test: Test is not a valid Function object');
    }
    this.loopArg = RegExp.$1;
    this.name = name;
    this.f = f;
  }
526148
func makeFunction(attributes []string) func(interface{}) string {
	return func(text interface{}) string {
		return fmt.Sprintf("\033[%sm%s\033[0m", strings.Join(attributes, ";"), text)
	}
}
11280
function (fn) {
    if (!fn || !_.isFunction(fn)) {
      var err = new Error('Please pass a valid function!');
      debug(err);
      throw err;
    }

    if (fn.length === 2) {
      this.getQueryForThisViewBuilder = fn;
      return this;
    }

    this.getQueryForThisViewBuilder = function (evt, callback) {
      callback(null, fn(evt));
    };

    var unwrappedFn = this.getQueryForThisViewBuilder;

    this.getQueryForThisViewBuilder = function (evt, clb) {
      var wrappedCallback = function () {
        try {
          clb.apply(this, _.toArray(arguments));
        } catch (e) {
          debug(e);
          process.emit('uncaughtException', e);
        }
      };

      try {
        unwrappedFn.call(this, evt, wrappedCallback);
      } catch (e) {
        debug(e);
        process.emit('uncaughtException', e);
      }
    };

    return this;
  }
1207768
function stringify(key, value) {
  if (value instanceof RegExp) {
    return value.toString();
  }
  if (value instanceof Function) {
    return '[function]';
  }
  return value;
}
24255
function(s) {
      s = String(s === null ? "" : s);
      return s.replace(/&(?!\w+;)|["'<>\\]/g, function(s) {
        switch(s) {
        case "&": return "&amp;";
        case '"': return '&quot;';
        case "'": return '&#39;';
        case "<": return "&lt;";
        case ">": return "&gt;";
        default: return s;
        }
      });
    }
186812
function handleExtractToFunction() {
        var editor = EditorManager.getActiveEditor();
        var result = new $.Deferred(); // used only for testing purpose

        if (editor.getSelections().length > 1) {
            editor.displayErrorMessageAtCursor(Strings.ERROR_EXTRACTTO_FUNCTION_MULTICURSORS);
            result.resolve(Strings.ERROR_EXTRACTTO_FUNCTION_MULTICURSORS);
            return;
        }
        initializeSession(editor);

        var selection = editor.getSelection(),
            doc       = editor.document,
            retObj    = RefactoringUtils.normalizeText(editor.getSelectedText(), editor.indexFromPos(selection.start), editor.indexFromPos(selection.end)),
            text      = retObj.text,
            start     = retObj.start,
            end       = retObj.end,
            ast,
            scopes,
            expns,
            inlineMenu;

        RefactoringUtils.getScopeData(session, editor.posFromIndex(start)).done(function(scope) {
            ast = RefactoringUtils.getAST(doc.getText());

            var isExpression = false;
            if (!RefactoringUtils.checkStatement(ast, start, end, doc.getText())) {
                isExpression = RefactoringUtils.getExpression(ast, start, end, doc.getText());
                if (!isExpression) {
                    editor.displayErrorMessageAtCursor(Strings.ERROR_EXTRACTTO_FUNCTION_NOT_VALID);
                    result.resolve(Strings.ERROR_EXTRACTTO_FUNCTION_NOT_VALID);
                    return;
                }
            }
            scopes = RefactoringUtils.getAllScopes(ast, scope, doc.getText());

            // if only one scope, extract without menu
            if (scopes.length === 1) {
                extract(ast, text, scopes, scopes[0], scopes[0], start, end, isExpression);
                result.resolve();
                return;
            }

            inlineMenu = new InlineMenu(editor, Strings.EXTRACTTO_FUNCTION_SELECT_SCOPE);

            inlineMenu.open(scopes.filter(RefactoringUtils.isFnScope));

            result.resolve(inlineMenu);

            inlineMenu.onSelect(function (scopeId) {
                extract(ast, text, scopes, scopes[0], scopes[scopeId], start, end, isExpression);
                inlineMenu.close();
            });

            inlineMenu.onClose(function(){
                inlineMenu.close();
            });
        }).fail(function() {
            editor.displayErrorMessageAtCursor(Strings.ERROR_TERN_FAILED);
            result.resolve(Strings.ERROR_TERN_FAILED);
        });

        return result.promise();
    }
942843
func functions(t *cc.TranslationUnit) ([]bg.Declaration, error) {
	filter := func(d *cc.Declarator) bool {
		if d.Type.Kind() != cc.Function {
			return false
		}
		return true
	}
	return bg.Get(t, filter)
}