underlineTypeVars :: (TypeInfo, StrMap (Array Any)) -> String
772677
function underlineTypeVars(typeInfo, valuesByPath) {
    //  Note: Sorting these keys lexicographically is not "correct", but it
    //  does the right thing for indexes less than 10.
    var paths = Z.map (JSON.parse, sortedKeys (valuesByPath));
    return underline (
      typeInfo,
      K (K (_)),
      function(index) {
        return function(f) {
          return function(t) {
            return function(propPath) {
              var indexedPropPath = Z.concat ([index], propPath);
              return function(s) {
                if (paths.some (isPrefix (indexedPropPath))) {
                  var key = JSON.stringify (indexedPropPath);
                  if (!(hasOwnProperty.call (valuesByPath, key))) return s;
                  if (!(isEmpty (valuesByPath[key]))) return f (s);
                }
                return _ (s);
              };
            };
          };
        };
      }
    );
  }
143364
def linedelimited (inlist,delimiter):
    
    outstr = ''
    for item in inlist:
        if type(item) != StringType:
            item = str(item)
        outstr = outstr + item + delimiter
    outstr = outstr[0:-1]
    return outstr
1134197
function(string, variables, shouldWrap) {
			var instance = this;

			return string.replace(INTERPOLATION_MATCHER, function(variable, variableName) {
				var value;

				// Either return the variable value or the original expression if it doesn't exist
				if (variables[variableName] !== undefined) {
					value = variables[variableName];
				} else if (process.env[variableName] !== undefined) {
					value = process.env[variableName];
				}

				if (value !== undefined) {
					if (shouldWrap) {
						// Escape all double quotes and wrap the value in double quotes
						return instance._wrap(variables[variableName]);
					}

					return value;
				}

				return variable;
			});
		}
809704
def type_string(self):
        """"""
        if self.is_tuple:
            subtypes = [item.type_string for item in self.children]
            return '{}({})'.format(
                '' if self.val_guaranteed else '*',
                ', '.join(subtypes))
        elif self.is_list:
            return '{}[{}]'.format(
                '' if self.val_guaranteed else '*',
                self.children[0].type_string)
        else:
            return '{}{}'.format(
                '' if self.val_guaranteed else '*',
                self.type_.__name__)
826168
function parseVariable(str, line) {
    var tokens = lexer.read(utils.strip(str)),
      parser,
      out;

    parser = new TokenParser(tokens, filters, escape, line, opts.filename);
    out = parser.parse().join('');

    if (parser.state.length) {
      utils.throwError('Unable to parse "' + str + '"', line, opts.filename);
    }

    /**
     * A parsed variable token.
     * @typedef {object} VarToken
     * @property {function} compile Method for compiling this token.
     */
    return {
      compile: function () {
        return '_output += ' + out + ';\n';
      }
    };
  }
427292
function isType(type, string) {
    if (isString(string) || isNumber(string)) {
        if (_regex.regex[type] && type !== 'default') {
            string = String(string);
            return _regex.regex[type].test(string);
        } else {
            throw Error('unknown type ' + type);
        }
    } else {
        throw Error('type should be string or number');
    }
}
180565
function rtrim(str, targetStr) {
    var retStr = "";
    var regStr;

    if (typeof str != "string") {
        return retStr;
    }

    if (typeof targetStr != "string" || !targetStr) {
        targetStr = "\\s";
    }

    regStr = "(.*?)" + targetStr + "*$";
    regStr = new RegExp(regStr);

    str = str.replace(regStr, "$1");
    return str;
}
61849
def infer_typing_typevar_or_newtype(node, context=None):
    """"""
    try:
        func = next(node.func.infer(context=context))
    except InferenceError as exc:
        raise UseInferenceDefault from exc

    if func.qname() not in TYPING_TYPEVARS_QUALIFIED:
        raise UseInferenceDefault
    if not node.args:
        raise UseInferenceDefault

    typename = node.args[0].as_string().strip("'")
    node = extract_node(TYPING_TYPE_TEMPLATE.format(typename))
    return node.infer(context=context)
1350069
def p_subind_strTO(p):
    
    p[0] = (make_typecast(TYPE.uinteger, make_number(0, lineno=p.lineno(2)),
                          p.lineno(1)),
            make_typecast(TYPE.uinteger, p[3], p.lineno(2)))
268071
def coloringfromstring(s):
    
    try:
        AST = compiler.parse(s)
    except SyntaxError:
        return
    else:
        try:
            if len(AST.getChildren()) > 1:
                ST = AST.getChildren()[1]
                if isinstance(ST, Stmt) and isinstance(ST.getChildren()[0],
                                                                     Discard):
                    d = ST.getChildren()[0].asList()[0]
        except (TypeError, AttributeError):
            pass
        else:
            if isinstance(d,Dict) and len(d.items) > 0:
                if all([isctype(i[0],str) for i in d.items]):
                    if all([isinstance(i[1],List) for i in d.items]):
                        if all([all([isctype(j,str) for j in i[1]]) for i in 
                                                                      d.items]):
                            return eval(s)
893836
function compilePattern(pattern) {
  // pass estree syntax tree obj
  if (pattern && pattern.type) return pattern;

  if (typeof pattern !== 'string') {
    throw new Error('input pattern is neither a string nor an estree node.');
  }

  let exp = parser(pattern);

  if (exp.type !== 'Program' || !exp.body) {
    throw new Error(`Not a valid expression:  "${pattern}".`);
  }

  if (exp.body.length === 0) {
    throw new Error(`There is no statement in pattern "${pattern}".`);
  }

  if (exp.body.length > 1) {
    throw new Error(`Multiple statements is not supported "${pattern}".`);
  }

  exp = exp.body[0];
  // get the real expression underneath
  if (exp.type === 'ExpressionStatement') exp = exp.expression;
  return exp;
}
1352178
function typeVarPred(arity) {
    var filter = arityGte (arity);
    return function(env) {
      var test2 = _test (env);
      return function(x) {
        var test1 = test2 (x);
        return env.some (function(t) { return filter (t) && test1 (t); });
      };
    };
  }
245800
function indent(str/*: string*/, level/*: number*/ = 1) /*: string*/ {
    if (typeof str === 'number') [ level, str ] = [ str, level ];
    if (typeof level !== 'number') level = 1;
    return (str || '').replace(/^/gm, '  '.repeat(level));
}
575557
function argParser (arg, argName, strictType) {
  let parsedArg
  let argType = getItType(arg)
  const errFormatter = (errString, argType) => {
    return `${errString}\n|argName| = |${argName}|\n|type| = |${argType}|\n|arg| = |#{arg}|`
  }

  switch (argType) {
    case 'STRING':
      try {
        parsedArg = ['REGEXP', RegExp(arg)]
      } catch (e) {
        throw SyntaxError(errFormatter('cant compile this String to RegExp', argType))
      }
      break
    case 'REGEXP':
      parsedArg = ['REGEXP', arg]
      break
    case 'FUNCTION':
      parsedArg = ['FUNCTION', arg]
      break
    default:
      throw TypeError(errFormatter('argument must be String, RegExp or Function, but got', argType))
  }

  if (strictType && parsedArg[0] !== strictType.toUpperCase()) {
    throw TypeError(errFormatter(`argument must be ${strictType}, but got`, argType))
  }
  return parsedArg
}
442049
public void subparam(String type, String name, final Object value, double min, double max, String strPattern, int maxLength, final boolean isNew) throws PageException {

	// check attributes type
	if (type == null) type = "any";
	else type = type.trim().toLowerCase();

	// cast and set value
	if (!"any".equals(type)) {
	    // range
	    if ("range".equals(type)) {
		boolean hasMin = Decision.isValid(min);
		boolean hasMax = Decision.isValid(max);
		double number = Caster.toDoubleValue(value);

		if (!hasMin && !hasMax) throw new ExpressionException("you need to define one of the following attributes [min,max], when type is set to [range]");

		if (hasMin && number < min)
		    throw new ExpressionException("The number [" + Caster.toString(number) + "] is to small, the number must be at least [" + Caster.toString(min) + "]");

		if (hasMax && number > max)
		    throw new ExpressionException("The number [" + Caster.toString(number) + "] is to big, the number cannot be bigger than [" + Caster.toString(max) + "]");

		setVariable(name, Caster.toDouble(number));
	    }
	    // regex
	    else if ("regex".equals(type) || "regular_expression".equals(type)) {
		String str = Caster.toString(value);

		if (strPattern == null) throw new ExpressionException("Missing attribute [pattern]");

		if (!Perl5Util.matches(strPattern, str)) throw new ExpressionException("The value [" + str + "] doesn't match the provided pattern [" + strPattern + "]");
		setVariable(name, str);
	    }
	    else if (type.equals("int") || type.equals("integer")) {

		if (!Decision.isInteger(value)) throw new ExpressionException("The value [" + value + "] is not a valid integer");

		setVariable(name, value);
	    }
	    else {
		if (!Decision.isCastableTo(type, value, true, true, maxLength)) {
		    if (maxLength > -1 && ("email".equalsIgnoreCase(type) || "url".equalsIgnoreCase(type) || "string".equalsIgnoreCase(type))) {
			StringBuilder msg = new StringBuilder(CasterException.createMessage(value, type));
			msg.append(" with a maximum length of " + maxLength + " characters");
			throw new CasterException(msg.toString());
		    }
		    throw new CasterException(value, type);
		}

		setVariable(name, value);
		// REALCAST setVariable(name,Caster.castTo(this,type,value,true));
	    }
	}
	else if (isNew) setVariable(name, value);
    }
941703
private ActionPatternHolder convertStringToPattern(String line) {
        ActionPatternHolder holder = new ActionPatternHolder();
        String[] strs = org.apache.commons.lang.StringUtils.split(line, "|");
        if (strs.length != 2) {
            throw new IllegalArgumentException("illegal expression: " + line);
        }
        Pattern compiledPattern;
        Perl5Compiler compiler = new Perl5Compiler();
        try {
            holder.setActionName(strs[0]);
            compiledPattern = compiler.compile(strs[0], Perl5Compiler.READ_ONLY_MASK);
            holder.setActionPattern(compiledPattern);
        } catch (MalformedPatternException mpe) {
            throw new IllegalArgumentException("Malformed regular expression: " + strs[0]);
        }

        try {
            holder.setMethodName(strs[1]);
            compiledPattern = compiler.compile(strs[1], Perl5Compiler.READ_ONLY_MASK);
            holder.setMethodPattern(compiledPattern);
        } catch (MalformedPatternException mpe) {
            throw new IllegalArgumentException("Malformed regular expression: " + strs[1]);
        }

        return holder;
    }
1091378
private boolean isVarEscaped(char[] array, int currentIndex)
    {
        int i = currentIndex - 1;

        while (i >= 0 && array[i] == '\\') {
            --i;
        }

        return (currentIndex - i) % 2 == 0;
    }