parseUri 1.2.2 (c) Steven Levithan <stevenlevithan.com> MIT License
168651
function(str) {
            var o   = parseUri.options,
            m   = o.parser.exec(str),
            uri = {},
            i   = 14;

            while (i--) if (m[i]) uri[o.key[i]] = m[i];

            if (uri[o.key[12]]) {
                uri[o.q.name] = {};
                uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
                    if ($1) uri[o.q.name][$1] = $2;
                });
            }
            // member functions
            uri.toString = toString;
            uri.validate = validate;
            uri.normalize = normalize;
            uri.contains = contains;
            uri.originOnly = originOnly;
            return uri;
        }
856579
function checkUri2(i) {
  const start = i;
  let l;

  while (i < tokensLength) {
    if (l = checkSC(i)) i += l;
    else if (l = checkString(i)) i += l;
    else if (l = checkFunction(i)) i += l;
    else if (l = checkUnary(i)) i += l;
    else if (l = checkIdentOrInterpolation(i)) i += l;
    else if (l = checkVariable(i)) i += l;
    else break;
  }

  // Check that we are at the end of the uri
  if (i < tokens[start - 1].right) return 0;

  tokens[start].uri_end = i;

  return i - start;
}
1333818
function matchLicense (licenseString) {
  // Find all textual matches on license text.
  var normalized = normalizeText(licenseString)
  var matchingLicenses = []

  var license

  // Check matches of normalized license content against signatures.
  for (var i = 0; i < licenses.length; i++) {
    license = licenses[i]
    var match = false
    for (var j = 0; j < license.signatures.length; j++) {
      if (normalized.indexOf(license.signatures[j]) >= 0) {
        match = true
        break
      }
    }
    if (match) {
      matchingLicenses.push(license)
    }
  }
  // For single-line license, check if it's a known license id.
  if (matchingLicenses.length === 0 && !/[\n\f\r]/.test(licenseString) && licenseString.length < 100) {
    var licenseName = normalizeText(licenseString)
    // If there's an extra "license" on the end of the name, drop it ("MIT License" -> "MIT").
    license = licenseIndex[licenseName] || licenseIndex[licenseName.replace(/ licen[sc]e$/, '')]
    if (!license) {
      license = {name: licenseName, id: null}
    }
    matchingLicenses.push(license)
  }
  if (matchingLicenses.length === 0) {
    return null
  }
  if (matchingLicenses.length > 1) {
    console.warn('Multiple matching licenses: ' + matchingLicenses.length, [licenseString, matchingLicenses])
  }
  return matchingLicenses[0]
}
102943
function parseSource( errBuf ) {
	var parsers = {
			monolith: function(){
				return require( './monolith-parser.js' );
			},
			category: function(){
				return require( './category-parser.js' );
			},
			language: function(){
				return require( './language-parser.js' );
			}
		},
		args = argv.parseArgs(),
		file = path.resolve( path.extname( args.file ) ? args.file : args.file + '.json' ),
		source;

	if ( fs.existsSync( file ) ) {
		try {
			source = JSON.parse( fs.readFileSync( file, 'utf8' ) );
		} catch (e) {
			errBuf.push( 'Error (source): wrong format for "' + file + '"' );
			return false;
		} // try..catch

		if ( commons.validateMeta( source.meta || source, errBuf ) ) {
			return parsers[ (source.meta || source).format ]().parse( source, errBuf );
		} // if
	} else {
		errBuf.push( 'Error (source): unable to open "' + file + '"' );
		return false;
	} // if..else
}
685592
function (parser, compiler, actions, scope, state) {
	this.state    = state || {};
	this.scope    = scope;
	this.parser   = parser;
	this.actions  = actions;
	this.compiler = compiler;
}
1127863
static BaseTypeSignature parse(final Parser parser) {
        switch (parser.peek()) {
        case 'B':
            parser.next();
            return new BaseTypeSignature("byte");
        case 'C':
            parser.next();
            return new BaseTypeSignature("char");
        case 'D':
            parser.next();
            return new BaseTypeSignature("double");
        case 'F':
            parser.next();
            return new BaseTypeSignature("float");
        case 'I':
            parser.next();
            return new BaseTypeSignature("int");
        case 'J':
            parser.next();
            return new BaseTypeSignature("long");
        case 'S':
            parser.next();
            return new BaseTypeSignature("short");
        case 'Z':
            parser.next();
            return new BaseTypeSignature("boolean");
        case 'V':
            parser.next();
            return new BaseTypeSignature("void");
        default:
            return null;
        }
    }
196212
function parseRequirements(file) {
  if (!file) {
    return {};
  }
  file = file.trim();
  if (file === '') {
    return {};
  }
  const versions = {};
  file.split('\n').forEach((line) => {
    line = line.trim();

    if (line.startsWith('-e')) {
      // editable special dependency
      const branchSeparator = line.indexOf('@');
      const name = line.slice(0, branchSeparator).trim();
      versions[name] = line.slice(branchSeparator).trim();
      return;
    }

    if (line.startsWith('#') || line.startsWith('-')) {
      return; // skip
    }
    const versionSeparator = line.search(/[\^~=>!]/);
    if (versionSeparator >= 0) {
      const name = line.slice(0, versionSeparator).trim();
      versions[name] = line.slice(versionSeparator).trim();
    } else {
      versions[line] = '';
    }
  });
  return versions;
}
790151
protected void setURI() {
        // set _uri
        StringBuffer buf = new StringBuffer();
        // ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
        if (_scheme != null) {
            buf.append(_scheme);
            buf.append(':');
        }
        if (_is_net_path) {
            buf.append("//");
            if (_authority != null) { // has_authority
                buf.append(_authority);
            }
        }
        if (_opaque != null && _is_opaque_part) {
            buf.append(_opaque);
        } else if (_path != null) {
            // _is_hier_part or _is_relativeURI
            if (_path.length != 0) {
                buf.append(_path);
            }
        }
        if (_query != null) { // has_query
            buf.append('?');
            buf.append(_query);
        }
        // ignore the fragment identifier
        _uri = buf.toString().toCharArray();
        hash = 0;
    }
479013
function parseUri(uri) {
  if (uri instanceof Array) {
    uri = eut(uri[0], uri[1]);
  }

  return baseUrl + uri;
}
45440
def provider_parser(subparser):
    """"""
    subparser.add_argument("--auth-access-key",
                           help="specify ACCESS_KEY for authentication")
    subparser.add_argument("--auth-access-secret",
                           help="specify ACCESS_SECRET for authentication")
    subparser.add_argument(
        "--private-zone",
        help=("indicates what kind of hosted zone to use. If true, use "
              "only private zones. If false, use only public zones"))

    # TODO: these are only required for testing, we should figure out
    # a way to remove them & update the integration tests
    # to dynamically populate the auth credentials that are required.
    subparser.add_argument(
        "--auth-username", help="alternative way to specify the ACCESS_KEY for authentication")
    subparser.add_argument(
        "--auth-token", help="alternative way to specify the ACCESS_SECRET for authentication")
617356
private Pair<ParserRuleContext, CommonTokenStream> prepareUri(final String input) {
		UriLexer lexer = new UriLexer(CharStreams.fromString(input));
		CommonTokenStream tokens = new CommonTokenStream(lexer);
		UriParser parser = new UriParser(tokens);

		parser.removeErrorListeners();
		parser.addErrorListener(new ContentUriBaseErrorListener() {
			@Override
			public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) {
				AssertKripton.assertTrue(false, "unespected char at pos %s of URI '%s'", charPositionInLine, input);
			}

			@Override
			public void reportAmbiguity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, boolean exact, BitSet ambigAlts, ATNConfigSet configs) {
				AssertKripton.assertTrue(false, "ambiguity syntax at pos %s of URI '%s'", startIndex, input);
			}

			@Override
			public void reportAttemptingFullContext(Parser recognizer, DFA dfa, int startIndex, int stopIndex, BitSet conflictingAlts, ATNConfigSet configs) {
				AssertKripton.assertTrue(false, "error at pos %s of URI '%s'", startIndex, input);
			}

			@Override
			public void reportContextSensitivity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, int prediction, ATNConfigSet configs) {
				AssertKripton.assertTrue(false, "context eror at pos %s of URI '%s'", startIndex, input);
			}

		});

		ParserRuleContext context = parser.uri();
		return new Pair<>(context, tokens);
	}
987361
function parseAuthorization(header) {
  var token = header.split(/\s/).pop()
  var decoded = new Buffer(token, 'base64').toString()
  var components = decoded.split(':')
  if (components.length !== 2) {
    return false }
  else {
    return {
      user: components[0],
      password: components[1] } } }
1106373
function subParse(parser, pos, extensions,parens) {
    var p = new parser.constructor(parser.options, parser.input, pos);
    if (extensions)
        for (var k in extensions)
            p[k] = extensions[k] ;

    var src = parser ;
    var dest = p ;
    ['inFunction','inAsyncFunction','inAsync','inGenerator','inModule'].forEach(function(k){
        if (k in src)
            dest[k] = src[k] ;
    }) ;
    if (parens)
        p.options.preserveParens = true ;
    p.nextToken();
    return p;
}
185666
function cssParseUri(candidate) {
      var string1 = /^\s*["]([^"]*)["]\s*$/;
      var string2 = /^\s*[']([^']*)[']\s*$/;
      var url1 = /^\s*url\s*[(]["]([^"]*)["][)]\s*$/;
      var url2 = /^\s*url\s*[(][']([^']*)['][)]\s*$/;
      // Not officially part of the CSS2.1 grammar
      // but supported by Chrome
      var url3 = /^\s*url\s*[(]([^)]*)[)]\s*$/;
      var match;
      if ((match = string1.exec(candidate))) {
        return match[1];
      } else if ((match = string2.exec(candidate))) {
        return match[1];
      } else if ((match = url1.exec(candidate))) {
        return match[1];
      } else if ((match = url2.exec(candidate))) {
        return match[1];
      } else if ((match = url3.exec(candidate))) {
        return match[1];
      }
      return null;
    }
76198
function partialParser(parse) {
    var parseCache = {};
    return function partialParse(code, args) {
        if (!parseCache[code]) {
            parseCache[code] = parse(code);
        }
        var result = substitute(parseCache[code]);
        return {
            body: result.body,
            expr: result.body[0].type === 'ExpressionStatement' ? result.body[0].expression : null
        };
        /* parse and substitute:
		 * 
		 *    $1      Substitute the specified expression. If $1 occupies a slot which is an array of expressions (e.g arguments, params)
		 *            and the passed argument is an array, subtitute the whole set
		 *    {$:1}   Substitute a single statement 
		 * 
		 */
        function substitute(src, dest) {
            if (Array.isArray(dest) && !Array.isArray(src)) 
                throw new Error("Can't substitute an array for a node");
            dest = dest || {};
            Object.keys(src).forEach(function (k) {
                if (!(src[k] instanceof Object)) 
                    return dest[k] = src[k];
                function moreNodes(v) {
                    if (typeof v === "function") 
                        v = v();
                    dest = dest.concat(v);
                    return dest;
                }
                
                function copyNode(v) {
                    if (typeof v === "function") 
                        v = v();
                    dest[k] = v;
                    return dest;
                }
                
                // The src is an array, so create/grow the destination
                // It could an an array of expressions $1,$2,$3 or statements $:1;$:2;$:3;
                if (Array.isArray(src[k])) 
                    return dest[k] = substitute(src[k], []);
                var p;
                if (Array.isArray(dest)) 
                    p = moreNodes;
                 else 
                    p = copyNode;
                // Substitute a single identifier $.. with an expression (TODO: test provided arg is an expression node)
                if (src[k].type === 'Identifier' && src[k].name[0] === '$') 
                    return p(args[src[k].name.slice(1)]);
                // Substitute a single labeled statement $:.. with a statement (TODO: test provided arg is a statement node)
                if (src[k].type === 'LabeledStatement' && src[k].label.name === '$') {
                    var spec = src[k].body.expression;
                    return p(args[spec.name || spec.value]);
                }
                // Magic label to call a function to modify a statement node  $$method: <statement>
                // The newNode = args.method(oldNode)
                if (src[k].type === 'LabeledStatement' && src[k].label.name.slice(0, 2) === '$$') {
                    return p(args[src[k].label.name.slice(2)](substitute(src[k]).body));
                }
                return p(substitute(src[k]));
            });
            return dest;
        }
    };
}
810740
function parseQuery(str, opts = {}) {
  let _querys = {};
  decodeURIComponent(str || '').replace(/\+/g, ' ')
  // (optional no-capturing & )(key)=(value)
  .replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function ($0, _name, _value) {
    if (_name) {
      let _path, _acc, _tmp, _ref;
      (_path = []).unshift(_name = _name.replace(/\[([^\]]*)]/g, function ($0, _k) {
        _path.push(_k);
        return '';
      }));
      _ref = _querys;
      for (let j = 0; j < _path.length - 1; j++) {
        _acc = _path[j];
        _tmp = _path[j + 1];
        if (!_ref[_acc]) {
          _ref[_acc] = _tmp === '' || /^[0-9]+$/.test(_tmp) ? [] : {};
        }
        _ref = _ref[_acc];
      }
      if (opts.boolval) {
        // first
        if (_value === 'true') {
          _value = true;
        } else if (_value === 'false') {
          _value = false;
        }
      } else if (opts.intval) {
        // skip "true" & "false"
        if (_tmp = parseInt(_value) === _value) {
          _value = _tmp;
        }
      }
      if ((_acc = _path[_path.length - 1]) === '') {
        _ref.push(_value);
      } else {
        _ref[_acc] = _value;
      }
    }
  });
  return _querys;
}
296399
function JsonParserES5(input) {
    // invoke super constructor
    Parser.call(this, input, allTokens, {
            // by default the error recovery / fault tolerance capabilities are disabled
            // use this flag to enable them
            recoveryEnabled: false
        }
    );

    // not mandatory, using <$> (or any other sign) to reduce verbosity (this. this. this. this. .......)
    var $ = this;

    this.RULE("object", function() {
        var object, key

        $.CONSUME(LCurly);

        object = {}

        $.MANY_SEP({
          SEP: Comma, DEF: function () {
            key = $.SUBRULE($.string)
            $.CONSUME(Colon)
            object[key] = $.SUBRULE($.value)
          }
        });

        $.CONSUME(RCurly);

        return object
    });

    this.RULE("array", function() {
        var array

        $.CONSUME(LSquare);

        array = []

        $.MANY_SEP({
          SEP: Comma, DEF: function () {
            array[array.length] = $.SUBRULE($.value);
          }
        });

        $.CONSUME(RSquare);

        return array
    });

    this.RULE("number", function(){
      var result = $.CONSUME(NumberLiteral)
      return Number(result.image)
    })

    this.RULE("string", function(){
      var result = $.CONSUME(StringLiteral)
      return result.image.slice(1, -1)
    })


    this.RULE("value", function() {
        return $.OR([
            {ALT: function() { return $.SUBRULE($.object) }},
            {ALT: function() { return $.SUBRULE($.array) }},
            {ALT: function() { return $.SUBRULE($.string) }},
            {ALT: function() { return $.SUBRULE($.number) }},
            {ALT: function() { $.CONSUME(True) ; return true }},
            {ALT: function() { $.CONSUME(False) ; return false }},
            {ALT: function() { $.CONSUME(Null) ; return null }}
        ]);
    });

    // very important to call this after all the rules have been defined.
    // otherwise the parser may not work correctly as it will lack information
    // derived during the self analysis phase.
    Parser.performSelfAnalysis(this);
}