Parse the mappings in a string in to a data structure which we can easily query (the ordered arrays in the `this.__generatedMappings` and
`this.__originalMappings` properties).
420249
@Override
    void _parseMappings(String aStr, String aSourceRoot) {
        this.__generatedMappings = new ArrayList<>();
        this.__originalMappings = new ArrayList<>();
        for (int i = 0; i < this._sections.size(); i++) {
            ParsedSection section = this._sections.get(i);
            List<ParsedMapping> sectionMappings = section.consumer._generatedMappings();
            for (int j = 0; j < sectionMappings.size(); j++) {
                ParsedMapping mapping = sectionMappings.get(j);

                String source = section.consumer._sources.at(mapping.source);
                if (section.consumer.sourceRoot != null) {
                    source = Util.join(section.consumer.sourceRoot, source);
                }
                this._sources.add(source);
                Integer source_ = this._sources.indexOf(source);

                String name = section.consumer._names.at(mapping.name);
                this._names.add(name);
                Integer name_ = this._names.indexOf(name);

                // The mappings coming from the consumer for the section have
                // generated positions relative to the start of the section, so we
                // need to offset them to be relative to the start of the concatenated
                // generated file.
                ParsedMapping adjustedMapping = new ParsedMapping(mapping.generatedLine + (section.generatedOffset.generatedLine - 1),
                        mapping.generatedColumn + ((section.generatedOffset.generatedLine == mapping.generatedLine)
                                ? section.generatedOffset.generatedColumn - 1 : 0),
                        mapping.originalLine, mapping.originalColumn, source_, name_);

                this.__generatedMappings.add(adjustedMapping);
                if (adjustedMapping.originalLine != null) {
                    this.__originalMappings.add(adjustedMapping);
                }
            }
        }

        Collections.sort(this.__generatedMappings, Util::compareByGeneratedPositionsDeflated);
        Collections.sort(this.__originalMappings, Util::compareByOriginalPositions);
    }
214994
def from_maps(*maps):
        
        result = StringValueMap()
        
        if maps == None or len(maps) == 0:
            return result

        for map in maps:
            for (k, v) in map.items():
                key = StringConverter.to_string(k)
                result.put(key, v)

        return result
1045548
@Override
    protected void _parseMappings(String aStr, String aSourceRoot) {
        int generatedLine = 1;
        int previousGeneratedColumn = 0;
        int previousOriginalLine = 0;
        int previousOriginalColumn = 0;
        int previousSource = 0;
        int previousName = 0;
        int length = aStr.length();
        int index = 0;
        Map<String, List<Integer>> cachedSegments = new HashMap<>();
        Base64VLQResult temp;
        List<ParsedMapping> originalMappings = new ArrayList<>();
        List<ParsedMapping> generatedMappings = new ArrayList<>();
        ParsedMapping mapping;
        String str;
        List<Integer> segment;
        int end;
        int value;

        while (index < length) {
            if (aStr.charAt(index) == ';') {
                generatedLine++;
                index++;
                previousGeneratedColumn = 0;
            } else if (aStr.charAt(index) == ',') {
                index++;
            } else {
                mapping = new ParsedMapping();
                mapping.generatedLine = generatedLine;

                // Because each offset is encoded relative to the previous one,
                // many segments often have the same encoding. We can exploit this
                // fact by caching the parsed variable length fields of each segment,
                // allowing us to avoid a second parse if we encounter the same
                // segment again.
                for (end = index; end < length; end++) {
                    if (this._charIsMappingSeparator(aStr, end)) {
                        break;
                    }
                }
                str = aStr.substring(index, end);

                segment = cachedSegments.get(str);
                if (segment != null) {
                    index += str.length();
                } else {
                    segment = new ArrayList<>();
                    while (index < end) {
                        temp = Base64VLQ.decode(aStr, index);
                        value = temp.value;
                        index = temp.rest;
                        segment.add(value);
                    }

                    if (segment.size() == 2) {
                        throw new Error("Found a source, but no line and column");
                    }

                    if (segment.size() == 3) {
                        throw new Error("Found a source and line, but no column");
                    }

                    cachedSegments.put(str, segment);
                }

                // Generated column.
                mapping.generatedColumn = previousGeneratedColumn + segment.get(0);
                previousGeneratedColumn = mapping.generatedColumn;

                if (segment.size() > 1) {
                    // Original source.
                    mapping.source = previousSource + segment.get(1);
                    previousSource += segment.get(1);

                    // Original line.
                    mapping.originalLine = previousOriginalLine + segment.get(2);
                    previousOriginalLine = mapping.originalLine;
                    // Lines are stored 0-based
                    mapping.originalLine += 1;

                    // Original column.
                    mapping.originalColumn = previousOriginalColumn + segment.get(3);
                    previousOriginalColumn = mapping.originalColumn;

                    if (segment.size() > 4) {
                        // Original name.
                        mapping.name = previousName + segment.get(4);
                        previousName += segment.get(4);
                    }
                }

                generatedMappings.add(mapping);
                if (mapping.originalLine != null) {
                    originalMappings.add(mapping);
                }
            }
        }

        Collections.sort(generatedMappings, Util::compareByGeneratedPositionsDeflated);
        this.__generatedMappings = generatedMappings;

        Collections.sort(originalMappings, Util::compareByOriginalPositions);
        this.__originalMappings = originalMappings;
    }
1269247
function parseMappings(obj) {
        var mapping = {};

        // throw a helpful error when mapTwoWayState is mixed up with mapState
        if (Array.isArray(obj)) {
            error('Invalid arguments for mapTwoWayState. State mapping must be an object in { \'path.to.state\': \'mutationName\' } format.');
        }

        Object.keys(obj).forEach(function (key) {
            var value = obj[key];
            var vmKey = key.slice(key.lastIndexOf('.') + 1);

            if (typeof value === 'string') {
                mapping[vmKey] = { key: key, mutation: value };
            } else {
                mapping[vmKey] = { key: value.key, mutation: value.mutation };
            }
        });

        return mapping;
    }
593731
private List<CmsMetaMapping> parseMetaMappings(I_CmsXmlContentLocation formatterLoc) {

        List<CmsMetaMapping> mappings = new ArrayList<CmsMetaMapping>();
        for (I_CmsXmlContentValueLocation mappingLoc : formatterLoc.getSubValues(N_META_MAPPING)) {
            String key = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_KEY));
            String element = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_ELEMENT));
            String defaultValue = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_DEFAULT));
            String orderStr = CmsConfigurationReader.getString(m_cms, mappingLoc.getSubValue(N_ORDER));
            int order = 1000;
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(orderStr)) {
                try {
                    order = Integer.parseInt(orderStr);
                } catch (NumberFormatException e) {
                    // nothing to do
                }
            }
            CmsMetaMapping mapping = new CmsMetaMapping(key, element, order, defaultValue);
            mappings.add(mapping);
        }
        return mappings;
    }
997669
public static Map<String, Set<String>> parseAssignment(String data) {
        Map<String, Set<String>> ret = new HashMap<>();
        if (data != null) {
            StringTokenizer stringTokenizer = new StringTokenizer(data, String.format("%s%s%s", EQUALITY, COMMA, SEMICOLON), true);
            String key = null;
            Set<String> value = new HashSet<>();
            int counter = 0;
            while (stringTokenizer.hasMoreTokens()) {
                String token = stringTokenizer.nextToken();
                if (isValueDelimiter(token)) {
                    continue;
                } else if (isKeyDelimiter(token) && key != null) {
                    ret.put(key, value);
                    counter = 0;
                    key = null;
                    value = new HashSet<>();
                    continue;
                } else if (counter == 0) {
                    key = token.trim();
                } else {
                    String trimmedValue = token.trim();
                    if (!StringUtils.isEmpty(trimmedValue)) {
                        value.add(trimmedValue);
                    }
                }
                counter++;
            }
            if (key != null) {
                ret.put(key, value);
            }
        }
        return ret;
    }
1061280
public <T> T parse(InputStream in, JsonReaderI<T> mapper) throws ParseException, UnsupportedEncodingException {
		return getPBinStream().parse(in, mapper);
	}
458998
function _parseParams(params) {
  return params.map((param) => {
    let result;
    switch (param.type) {
      case 'Identifier':
        result = new Param(param.name);
        break;
      case 'AssignmentPattern':
        result = new Param(param.left.name, true);
        break;
      case 'ObjectPattern': {
        const objParams = param.properties.map((objParam) => objParam.value);
        result = new Param('arguments', false, _parseParams(objParams));
        break;
      }
      default:
    }
    return result;
  });
}
587134
private String[][] parsePS(String[] psStrings) {
    String[][] result = new String[psStrings.length-1][NUM_FIELDS];
    for (int i = 1; i < psStrings.length; i++) {
      Matcher matcher = psPattern.matcher(psStrings[i]);
      if (matcher.find()) {
        for (int j = 0; j < NUM_FIELDS; j++) {
          result[i-1][j] = matcher.group(j+1);
        }
      }
    }
    return result;
  }
1216039
private static Map<String, String> parseAttributes(String attrString) throws ParseException {

      AttributeString str = new AttributeString(attrString);
      Map<String, String> attributes = Maps.newLinkedHashMapWithExpectedSize(4); //Preserve order...
      AttrState state = AttrState.NAME;
      String currName = "";
      String currString = "";
      int currPos = 0;
      while((currString = str.nextString()) != null) {
         switch(state) {
            case NAME:
               if(str.ch == '=') {
                  currName = currString;
                  state = AttrState.VALUE;
               } else {
                  attributes.put(String.format("$%d", currPos++), currString);
               }
               break;
            case VALUE:
               attributes.put(currName.toLowerCase(), currString);
               state = AttrState.NAME;
               break;
         }
      }
      return attributes;
   }
826880
def parse_mapping(self, map_path, source=None, dotfiles=None):
        """"""
        include_re = r"""^\s*#include\s+(".+"|'.+')"""
        include_re = re.compile(include_re, re.I)
        mapping_re = r"""^("[^"]+"|\'[^\']+\'|[^\'":]+)\s*(?::\s*(.*)\s*)?$"""
        mapping_re = re.compile(mapping_re)

        filename = None
        map_path = path.realpath(path.expanduser(map_path))

        if path.isfile(map_path):
            filename = map_path

        elif path.isdir(map_path):
            # try finding a mapping in the target directory
            for map_name in '.dotfiles', 'dotfiles':
                candidate = path.join(map_path, map_name)
                if path.isfile(candidate):
                    filename = candidate
                    break

        if filename is None:
            raise ValueError('No dotfile mapping found in %s' % map_path)

        if source is None:
            source = path.dirname(map_path)

        if dotfiles is None:
            dotfiles = OrderedDict()

        lineno = 0

        with open(filename) as fh:
            for line in fh:
                lineno += 1
                content = line.strip()

                match = include_re.match(content)
                if match:
                    include_path = match.group(1).strip('\'"')
                    if (include_path.startswith('/') or
                            include_path.startswith('~')):
                        include_path = path.realpath(
                            path.expanduser(include_path))
                    else:
                        include_path = path.join(path.dirname(filename),
                                                 include_path)

                    if path.exists(include_path):
                        self.log.debug('Recursively parsing mapping in %s',
                                       include_path)
                        dotfiles = self.parse_mapping(include_path,
                                                      dotfiles=dotfiles)
                    else:
                        self.log.warning('Include command points to file or '
                                         'directory that does not exist, "%s",'
                                         ' on line %d', include_path, lineno)

                if not content or content.startswith('#'):
                    # comment line or empty line
                    continue

                match = mapping_re.match(content)
                if match:
                    source_path, target_path = match.groups()
                    source_path = path.join(source, source_path.strip('\'"'))

                    if source_path in dotfiles:
                        self.log.warning('Duplicate dotfile source "%s" '
                                         'on line #%d', lineno)
                        continue

                    if target_path is None:
                        target_path = source_path

                    dotfiles[source_path] = target_path

                else:
                    self.log.warning('Dotfile mapping regex failed on line '
                                     '#%d', lineno)

        return dotfiles
1328629
def map_query_string(self):
        
        if (not self.query_key_mapper or
            self.request.method == 'POST'):
            # Nothing to map, don't do anything.
            # return self.request.POST
            return {}

        keys = list(self.query_key_mapper.keys())

        return {self.query_key_mapper.get(k) if k in keys else k: v.strip()
                for k, v in self.request.GET.items()}
237396
function generateSourceMappings(removedNodes) {
  var mappings = '';
  if (!removedNodes || removedNodes.length === '') {
    return mappings;
  }

  var end = {line: 1, column: 0};

  for (var i = 0; i < removedNodes.length; i++) {
    var start = removedNodes[i].loc.start;
    var lineDiff = start.line - end.line;
    var columnDiff = start.column - end.column;
    if (lineDiff) {
      for (var l = 0; l !== lineDiff; l++) {
        mappings += ';';
      }
      mappings += vlq.encode([start.column, 0, lineDiff, columnDiff]);
    } else if (columnDiff) {
      if (i) {
        mappings += ',';
      }
      mappings += vlq.encode([columnDiff, 0, lineDiff, columnDiff]);
    }

    end = removedNodes[i].loc.end;
    mappings += ',';
    mappings += vlq.encode([
      0,
      0,
      end.line - start.line,
      end.column - start.column,
    ]);
  }

  return mappings;
}
581298
public <T> T parse(String in, JsonReaderI<T> mapper) throws ParseException {
		return getPString().parse(in, mapper);
	}
552470
private synchronized Map<String, String[]> parseParameters(String s)
    {
        Map<String, List<String>> parameterMap;
        Map<String, String[]> result;
        StringTokenizer st;

        parameterMap = new HashMap<>();
        result = new HashMap<>();

        if (s == null)
        {
            return result;
        }

        st = new StringTokenizer(s, "&");
        while (st.hasMoreTokens())
        {
            String parameter;
            Matcher parameterMatcher;
            String name;
            String value;
            List<String> values;

            parameter = st.nextToken();
            parameterMatcher = PARAMETER_PATTERN.matcher(parameter);
            if (parameterMatcher.matches())
            {
                try
                {
                    name = URLDecoder.decode(parameterMatcher.group(1), "UTF-8");
                    value = URLDecoder.decode(parameterMatcher.group(2), "UTF-8");
                }
                catch (UnsupportedEncodingException e)
                {
                    logger.error("Unable to decode parameter '" + parameter + "'", e);
                    continue;
                }
            }
            else
            {
                try
                {
                    name = URLDecoder.decode(parameter, "UTF-8");
                    value = "";
                }
                catch (UnsupportedEncodingException e)
                {
                    logger.error("Unable to decode parameter '" + parameter + "'", e);
                    continue;
                }
            }

            if (parameterMap.get(name) == null)
            {
                values = new ArrayList<>();
                values.add(value);
                parameterMap.put(name, values);
            }
            else
            {
                values = parameterMap.get(name);
                values.add(value);
            }
        }

        for (Map.Entry<String, List<String>> entry : parameterMap.entrySet())
        {
            String[] valueArray;

            valueArray = new String[entry.getValue().size()];
            result.put(entry.getKey(), entry.getValue().toArray(valueArray));
        }

        return result;
    }
1005863
private static void parseMimeMappings(final MimeMappingType mimeMappingType, final WebApp webApp) {
		final WebAppMimeMapping mimeMapping = new WebAppMimeMapping();
		mimeMapping.setExtension(mimeMappingType.getExtension().getValue());
		mimeMapping.setMimeType(mimeMappingType.getMimeType().getValue());
		webApp.addMimeMapping(mimeMapping);
	}
751040
public static Map<String, Object> parseData(String data) {
		Map<String, Object> ret = new HashMap<String, Object>();
		String[] split = data.split("&");
		for (String s : split) {
			int idx = s.indexOf('=');
			try {
				if (idx != -1) {
					ret.put(URLDecoder.decode(s.substring(0, idx), "UTF-8"), URLDecoder.decode(s.substring(idx + 1), "UTF-8"));
				} else {
					ret.put(URLDecoder.decode(s, "UTF-8"), "true");
				}
			} catch (UnsupportedEncodingException e) {
				// Why.
			}
		}
		return ret;
	}