used to generate results for various methods by scanning through an input string
 @!visibility private
501815
def pump(string, inject_with: :+, initial: nil, with_size: false)
      substring = string
      results   = Array(initial)

      patterns.each do |pattern|
        result, size = yield(pattern, substring)
        return unless result
        results << result
        size    ||= result
        substring = substring[size..-1]
      end

      results = results.inject(inject_with)
      with_size ? [results, string.size - substring.size] : results
    end
618930
function methodMatch(part) {
    let maxMatch = null
    let maxMatchCount = 0

    // Go through each mapper and check if the name matches. Then, take the highest match to avoid matching
    // 'any', if 'any character' was given, and so on.
    Object.keys(mapper).forEach((key) => {
        const regex = new RegExp(`^(${key.replace(' ', ') (')})`, 'i')
        const matches = part.match(regex)

        const count = matches ? matches.length : 0

        if (count > maxMatchCount) {
            maxMatchCount = count
            maxMatch = key
        }
    })

    if (maxMatch) {
        // We've got a match. Create the desired object and populate it.
        const item = mapper[maxMatch]
        return new item['class'](maxMatch, item.method, buildQuery)
    }

    throw new SyntaxException(`Invalid method: ${part}`)
}
956784
private void inspectGetters(Method method)
    {
        String methodName = method.getName();
        int prefixLength = 0;
        if (methodName.startsWith(GET_PREFIX)) {
            prefixLength = GET_PREFIX.length();
        }

        if (methodName.startsWith(IS_PREIX)) {
            prefixLength = IS_PREIX.length();
        }
        if(prefixLength == 0)
        {
            return;
        }

        String name = decapitalize(methodName.substring(prefixLength));
        if(!isValidProperty(name))
        {
            return;
        }

        // Check that the return type is not null or void
        Class propertyType = method.getReturnType();

        if (propertyType == null || propertyType == void.class)
        {
            return;
        }

        // isXXX return boolean
        if (prefixLength == 2)
        {
            if (!(propertyType == boolean.class))
            {
                return;
            }
        }

        // validate parameter types
        Class[] paramTypes = method.getParameterTypes();
        if (paramTypes.length > 1 ||
           (paramTypes.length == 1 && paramTypes[0] != int.class))
        {
            return;
        }

        if (!method.isAnnotationPresent(UriTransient.class) && !"class".equals(name))
        {
            Object value = getValue(method);

            if (method.isAnnotationPresent(VarName.class))
            {
                name = method.getAnnotation(VarName.class).value();
            }
            if (value != null)
            {
                pairs.put(name, value);
            }
        }
    }
1321686
function(method) {
   
      // convert the method parameters into a json-schema :
      var schemaIdentifierMap = {};
      schemaIdentifierMap[method.name] = {
          id: method.name,
          type:'object',
          properties:{}
      };
      for(var i = 0 ; i < method._parameters.length ; i++) {
         var p = method._parameters[i];
         schemaIdentifierMap[method.name].properties[p.name] = p;
      }
   
      // Use the builder to build an inputEx form from the json-schema
      var builder = new inputEx.JsonSchema.Builder({
   	  'schemaIdentifierMap': schemaIdentifierMap,
   	  'defaultOptions':{
   	     'showMsg':true
   	  }
      });
   	var options = builder.schemaToInputEx(schemaIdentifierMap[method.name]);
	
   	return options;
   }
1097648
private void genGetAllMethod(SourceWriter sw, JMethod[] methods,
      TreeLogger treeLogger) {
    sw.println("public DeferredSelector[] getAllSelectors() {return ds;}");
    sw.println("private final DeferredSelector[] ds = new DeferredSelector[] {");
    sw.indent();
    for (JMethod m : methods) {
      Selector selectorAnnotation = m.getAnnotation(Selector.class);
      if (selectorAnnotation == null) {
        continue;
      }
      String selector = selectorAnnotation.value();

      sw.println("new DeferredSelector() {");
      sw.indent();
      sw
          .println("public String getSelector() { return \"" + selector
              + "\"; }");
      sw
          .println("public NodeList<Element> runSelector(Node ctx) { return " +
              (m.getName() + (m.getParameters().length == 0 ? "()" : "(ctx)")) +
              ("NodeList".equals(m.getReturnType().getSimpleSourceName()) ? "" : ".get()") + ";}"
          );
      sw.outdent();
      sw.println("},");
    }
    sw.outdent();
    sw.println("};");
  }
1117729
function(str, methodDec, methodName, method, methodsMap, options){
    var methodValue = getMethodValue(methodDec, methodName, method, methodsMap, options);
    if(str === methodDec) return methodValue;
    return str.replace(methodDec, function(){ return methodValue; });
  }
49121
function(instance) {
      let type = typeof instance;
      if (!instance) {
        return "falsey";
      } else if (Array.isArray(instance)) {
        if (
          instance.length === 2 &&
          typeof instance[0] === "number" &&
          typeof instance[1] === "number"
        ) {
          return "range";
        } else {
          return "array";
        }
      } else if (type === "object") {
        if (instance instanceof RegExp) {
          return "regexp";
        } else if (instance.hasOwnProperty("highlight")) {
          return "custom";
        }
      } else if (type === "function" || type === "string") {
        return type;
      }

      return "other";
    }
1074309
function (checks) {
    this.from = this.char;

    // Move to the next non-space character.
    var start;
    if (/\s/.test(this.peek())) {
      start = this.char;

      while (/\s/.test(this.peek())) {
        this.from += 1;
        this.skip();
      }
    }

    // Methods that work with multi-line structures and move the
    // character pointer.

    var match = this.scanComments() ||
      this.scanStringLiteral(checks) ||
      this.scanTemplateLiteral();

    if (match) {
      return match;
    }

    // Methods that don't move the character pointer.

    match =
      this.scanRegExp() ||
      this.scanPunctuator() ||
      this.scanKeyword() ||
      this.scanIdentifier() ||
      this.scanNumericLiteral();

    if (match) {
      this.skip(match.value.length);
      return match;
    }

    // No token could be matched, give up.

    return null;
  }
496067
function (xxx, results) {
                var o
                ,   r
                ,   lookup = {}
                // map from results to keys
                for (var i = 0, l = results.rows.length; i < l; i++) {
					var rowObj = results.rows.item(i);
                    o = JSON.parse(rowObj.value)
                    var row_key = rowObj.id;
                    lookup[row_key] = o;
                    try{row_key = JSON.parse(row_key);}catch(exc){}
                    //o.key = row_key;
                    o.timestamp = rowObj.timestamp;
                }
                r = args.map(function(row_key) {return lookup[row_key];});
                if (!that.isArray(keyOrArray)) r = r.length ? r[0] : null
                if (cb) that.lambda(cb).call(that, r)
            }
231336
function(param) {

			/**
			 * Reference the instance
			 */
			var rInstance = this;

			if (typeof param !== "undefined") {
				rInstance.text = param.text;
				rInstance.scopes = [].concat(param.scope);
			}


			/**
			 * The required regexp computed using delims in settings
			 * @type {RegExp}
			 */
			var re = new RegExp(['{%(.+?)%}|', this.delimStart, '(.+?)', this.delimEnd].join(''), 'g');

			/**
			 * Save the raw text
			 * @type {String}
			 */
			rInstance.raw = rInstance.text;

			/**
			 * Compute and assign to compiledText property of the same object
			 * @param  {String} _  Matched string
			 * @param  {String} $1 Content of first match group
			 * @param  {String} $2 Content of second match group
			 * @return {String}    Interpolated string
			 */

			rInstance.text = rInstance.text.replace(re, function(_, $1, $2) {
				var computed;

				/**
				 * If escaped value is found, interpolation will not happen
				 */
				if ($1) {
					computed = $1;
				}

				/**
				 * Matched content, let's interpolate
				 */
				if ($2) {

					/**
					 * Break out scope variables out of scope's box and evaluate the expr expression
					 */
					var scopeBox = function(expr, localScope) {
						var variables = '';

						/**
						 * If scope is a window object, no need to scopebox it
						 */
						if (typeof window !== "undefined" ? localScope !== window : true) {
							for(var i in localScope) {
								variables += 'var ' + i + ' = localScope.' + i + '; ';
							}
						}
						var unbox = '(function() { ' + variables + ' try { return eval(expr);} catch(e) {} })()';
						return eval(unbox);
					};

					if (rInstance.scopes.length) {
						var numScopes = rInstance.scopes.length;
						for (var i=0;i<numScopes;i++) {
							/**
							 * Current Scope
							 * @type {String}
							 */
							var scope = rInstance.scopes[i];

							/**
							 * Get the computation
							 * @type {Any}
							 */
							computed = scopeBox($2, scope);

							/**
							 * If the computed property is a function, execute it in the context of the current scope
							 * @type {Unknown}
							 */
							if (typeof computed === "function") {
								computed = computed.call(scope);
							}

							/**
							 * If the computed property is an object, get the string
							 */
							if (typeof computed === "object") {
								computed = computed.toString();
							}
								
							/**
							 * Found what we were looking for, now break the loop
							 */
							if (computed !== undefined)
								break;
						}
					} else {
						/**
						 * If no scope is passed, let us assume the global scope
						 * @type {Any}
						 */
						computed = scopeBox($2, (typeof window !== "undefined" ? window : {}));
					}

					/**
					 * If no computations were found, we return the raw matched value back
					 * @type {String}
					 */
					computed = computed !== undefined ? computed : _;
				}

				/**
				 * Final computed value returned
				 */
				return computed;
			});
			
			/**
			 * Return self for chaining
			 */
			return rInstance;
		}
156698
function handleResults(results) {
    ctrl.matches = results;
    ctrl.hidden  = shouldHide();

    // If loading is in progress, then we'll end the progress. This is needed for example,
    // when the `clear` button was clicked, because there we always show the loading process, to prevent flashing.
    if (ctrl.loading) setLoading(false);

    if ($scope.selectOnMatch) selectItemOnMatch();

    positionDropdown();
    reportMessages(true, ReportType.Count);
  }
36466
function get(method, key) {
    if (exports.results.has(method))
        return exports.results.get(method).get(key);
}
21623
function () {
            var emptyFunction = new RegExp(/(\{\s\})|(\{\})/),
                publicMethods = {};
            for (property in this.settings) {
                if (typeof this.settings[property] == 'function' &&
                    typeof this[property] == 'function') {
                    var method = this.settings[property];
                    if (emptyFunction.test(method)) {
                        publicMethods[property] = this[property];
                    } else {
                        var defaultMethodName = this.createDefaultMethodName(property);
                        publicMethods[property] = this.settings[property];
                        publicMethods[defaultMethodName] = this[property];
                    }
                }
            }

            publicMethods.stylings = this.stylings;

            return publicMethods;
        }
1147465
function(input) {
		var needstesting = !this._matches.length;
		if (needstesting || this._matches.every(function(match) {
			return match.$instanceid !== input.$instanceid;
		})) {
			return this._maybeinput(input);
		}
		return false;
	}
462969
function autoCompleteResults(controller) {
  this._controller = controller;
  this._popup = this.getElement({type: "popup"});
  this._results = this.getElement({type: "results"});
}
995395
function(options, methods){
      options = options || {};

      // Wrap yes/no methods with a success method
      options['success'] = function(result){
        if ( methods['isValidResult'](result) ){
          if (typeof methods['yes'] === "function") methods['yes'](result);
        } else {
          if (typeof methods['no'] === "function") methods['no'](result);
        }
      };

      // Set default error method if one is not provided
      if ( !options['error'] && (typeof methods['error'] === "function") ) {
        options['error'] = methods['error'];
      }

      return options;
    }
76879
function genWeexHandler (params, handlerCode) {
  var innerHandlerCode = handlerCode;
  var exps = params.filter(function (exp) { return simplePathRE.test(exp) && exp !== '$event'; });
  var bindings = exps.map(function (exp) { return ({ '@binding': exp }); });
  var args = exps.map(function (exp, i) {
    var key = "$_" + (i + 1);
    innerHandlerCode = innerHandlerCode.replace(exp, key);
    return key
  });
  args.push('$event');
  return '{\n' +
    "handler:function(" + (args.join(',')) + "){" + innerHandlerCode + "},\n" +
    "params:" + (JSON.stringify(bindings)) + "\n" +
    '}'
}