Parses both legacy 1.8 style and newer 9.0.4 style
553660
private static int parseDotted(String javaVersion) {
    try {
      String[] parts = javaVersion.split("[._]");
      int firstVer = Integer.parseInt(parts[0]);
      if (firstVer == 1 && parts.length > 1) {
        return Integer.parseInt(parts[1]);
      } else {
        return firstVer;
      }
    } catch (NumberFormatException e) {
      return -1;
    }
  }
233985
function parseProperties(text, parsedPropertiesCallback) {
      var dictionary = {};

      // token expressions
      var reBlank = /^\s*|\s*$/;
      var reComment = /^\s*#|^\s*$/;
      var reSection = /^\s*\[(.*)\]\s*$/;
      var reImport = /^\s*@import\s+url\((.*)\)\s*$/i;
      var reSplit = /^([^=\s]*)\s*=\s*(.+)$/; // TODO: escape EOLs with '\'

      // parse the *.properties file into an associative array
      function parseRawLines(rawText, extendedSyntax, parsedRawLinesCallback) {
        var entries = rawText.replace(reBlank, '').split(/[\r\n]+/);
        var currentLang = '*';
        var genericLang = lang.split('-', 1)[0];
        var skipLang = false;
        var match = '';

        function nextEntry() {
          // Use infinite loop instead of recursion to avoid reaching the
          // maximum recursion limit for content with many lines.
          while (true) {
            if (!entries.length) {
              parsedRawLinesCallback();
              return;
            }
            var line = entries.shift();

            // comment or blank line?
            if (reComment.test(line))
              continue;

            // the extended syntax supports [lang] sections and @import rules
            if (extendedSyntax) {
              match = reSection.exec(line);
              if (match) { // section start?
                // RFC 4646, section 4.4, "All comparisons MUST be performed
                // in a case-insensitive manner."

                currentLang = match[1].toLowerCase();
                skipLang = (currentLang !== '*') &&
                    (currentLang !== lang) && (currentLang !== genericLang);
                continue;
              } else if (skipLang) {
                continue;
              }
              match = reImport.exec(line);
              if (match) { // @import rule?
                loadImport(baseURL + match[1], nextEntry);
                return;
              }
            }

            // key-value pair
            var tmp = line.match(reSplit);
            if (tmp && tmp.length == 3) {
              dictionary[tmp[1]] = evalString(tmp[2]);
            }
          }
        }
        nextEntry();
      }

      // import another *.properties file
      function loadImport(url, callback) {
        xhrLoadText(url, function(content) {
          parseRawLines(content, false, callback); // don't allow recursive imports
        }, null);
      }

      // fill the dictionary
      parseRawLines(text, true, function() {
        parsedPropertiesCallback(dictionary);
      });
    }
947857
def parse(scanner, rules, scope = ParserScope.empty)
      rules.inherited_rule(rule_name).parse(scanner, rules, scope)
    end
652015
private int[] parse(String version) {
        final Matcher m = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)-?(SNAPSHOT)?\\.?(\\d*)?").matcher(version);
        if (!m.matches()) {
            throw new IllegalArgumentException("Malformed version string: " + version);
        }

        return new int[] {Integer.parseInt(m.group(1)),   // major
                Integer.parseInt(m.group(2)),             // minor
                Integer.parseInt(m.group(3)),             // revision
                m.group(4) == null ? 0                    // no SNAPSHOT suffix
                        : m.group(5).isEmpty() ? 0        // "SNAPSHOT"
                        : Integer.parseInt(m.group(5)),   // "SNAPSHOT.123"
        };
    }
132874
def parse_obsolete(l1, l3):
    '''
        
    '''
    return {
        'annee': l1.text.split('.')[2].split()[2],
        'siren valide': ''.join(
            l1.text.split('.')[2].split(u'\xab')[0].split()[-4:-1]),
        'categorie': ' '.join(
            l1.text.split('.')[2].split(u'\xab')[1].split()[:-1]),
        'raison sociale': l3.text.split(' : ')[1][:-1],
        'statut': 'obsolete'}
84592
function ANSIState(legacy) {

    var feed = '',
        last_match = '',
        stream_match = [],
        _this = this;

    PassThrough.call(this);

    this.attrs = {};
    this.reset();
    this.is_reset = false;
    this.setEncoding('utf8');

    this.on('data', function(chunk) {
        feed += chunk;
        if (feed.indexOf('\033') === -1) {
            feed = '';
        } else {
            stream_match = feed.match(color_regex);
            if (stream_match.length > 0) {
                last_match = stream_match[stream_match.length - 1];
                feed = feed.slice(feed.lastIndexOf(last_match) + last_match.length);
                _this.updateWithArray(stream_match);
            }
        }
    });

    if (legacy !== undefined) {
        this.update(legacy);
    }
}
1357358
function parseVersion(versionString) {
  versionString = versionString.toLowerCase().replace('-', '.')
  const versionList = []
  versionString.split('.').forEach(versionPart => {
    const parsedPart = /(\d*)([a-z]*)(\d*)/.exec(versionPart)
    if (parsedPart[1]) {
      versionList.push(parseInt(parsedPart[1]))
    }
    if (parsedPart[2]) {
      let weight
      // calculate weight as a negative number
      // 'rc' > 'pre' > 'beta' > 'alpha' > any other value
      switch (parsedPart[2]) {
        case 'alpha':
        case 'beta':
        case 'pre':
        case 'rc':
          weight = (parsedPart[2].charCodeAt(0) - 128) * 100
          break
        default:
          weight = -10000
      }
      // add positive number, i.e. 'beta5' > 'beta2'
      weight += parseInt(parsedPart[3]) || 0
      versionList.push(weight)
    }
  })
  return versionList
}
93936
private void parseOutgoingVersion(Map<Object, Object> props) {
        String value = getProp(props, HttpConfigConstants.PROPNAME_OUTGOING_VERSION);
        if ("1.0".equals(value)) {
            this.outgoingHttpVersion = VersionValues.V10;
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Config: Outgoing version is " + getOutgoingVersion().getName());
            }
        }
    }
892671
public static AsteriskVersion getDetermineVersionFromString(String coreLine)
    {
        for (AsteriskVersion version : knownVersions)
        {
            for (Pattern pattern : version.patterns)
            {
                if (pattern.matcher(coreLine).matches())
                {
                    return version;
                }
            }
        }

        return null;
    }
1293291
function findDeprecatedStylelintRules() {
  if (!argv.deprecated && !argv.unused) {
    return Promise.resolve();
  }

  const isDeprecatedPromises = _.map(rules.stylelintAll, isDDeprecated);

  return Promise.all(isDeprecatedPromises).then(rulesIsDeprecated => {
    rules.stylelintDeprecated = _.filter(
      rules.stylelintAll,
      (rule, index) => rulesIsDeprecated[index]
    );

    // Don't remove, just for testing deprecated rules matching
    if (argv.testDeprecated) {
      rules.stylelintDeprecated.push('color-hex-case', 'color-hex-length');
    }

    if (argv.unused) {
      rules.stylelintNoDeprecated = _.difference(rules.stylelintAll, rules.stylelintDeprecated);
    }

    return rules.stylelintDeprecated;
  });
}
755839
def parse_as_inheritdoc(p)
      tag = {
        :tagname => :inheritdoc,
        :cls => p.ident_chain,
      }

      if p.look(/#\w/)
        p.match(/#/)
        if p.look(/static-/)
          tag[:static] = true
          p.match(/static-/)
        end
        if p.look(JsDuck::MemberRegistry.regex)
          tag[:type] = p.match(/\w+/).to_sym
          p.match(/-/)
        end
        tag[:member] = p.ident
      end

      tag
    end
598852
def get_version():
    """"""
    with io.open('grammar_check/__init__.py', encoding='utf-8') as input_file:
        for line in input_file:
            if line.startswith('__version__'):
                return ast.parse(line).body[0].value.s
188932
function compareDottedVersion(v1, v2) {
  const parts1 = /([0-9.]+)(.*)$/.exec(v1)
  const parts2 = /([0-9.]+)(.*)$/.exec(v2)
  if (parts1 != null && parts2 != null) {
    const numbers1 = parts1[1]
    const numbers2 = parts2[1]
    const distinguisher1 = parts1[2]
    const distinguisher2 = parts2[2]
    const numlist1 = numbers1.split('.').map(e => +e)
    const numlist2 = numbers2.split('.').map(e => +e)
    const cmp = listCompare(numlist1, numlist2)
    if (cmp !== 0) {
      return cmp
    } else {
      return distinguisher1 < distinguisher2
        ? -1
        : distinguisher1 > distinguisher2
        ? 1
        : 0
    }
  }
  return v1 < v2 ? -1 : v1 > v2 ? 1 : 0
}
1355741
private Version parseVersion() {
        int major = intOf(consumeNextToken(NUMERIC).lexeme);
        int minor = 0;
        if (tokens.positiveLookahead(DOT)) {
            tokens.consume();
            minor = intOf(consumeNextToken(NUMERIC).lexeme);
        }
        int patch = 0;
        if (tokens.positiveLookahead(DOT)) {
            tokens.consume();
            patch = intOf(consumeNextToken(NUMERIC).lexeme);
        }
        return versionFor(major, minor, patch);
    }
510974
def parse_version_string(version_string):
    
    components = version_string.split('-') + [None, None]
    version = list(map(int, components[0].split('.')))
    build_tag = components[1] if components[1] else BUILD_TAG
    build_number = int(components[2]) if components[2] else components[2]

    return (version, build_tag, build_number)
700610
private void parse()
    {
        this.elements = new ArrayList<>();

        try {
            for (Tokenizer tokenizer = new Tokenizer(this.rawVersion); tokenizer.next();) {
                Element element = new Element(tokenizer);
                this.elements.add(element);
                if (element.getVersionType() != Type.STABLE) {
                    this.type = element.getVersionType();
                }
            }

            trimPadding(this.elements);
        } catch (Exception e) {
            // Make sure to never fail no matter what
            LOGGER.error("Failed to parse version [" + this.rawVersion + "]", e);
            this.elements.add(new Element(this.rawVersion));
        }
    }
192486
def version
      logger.debug "Parsing version from output using #{description}"
      matches = output.match PARSE_VERSION_FROM_OUTPUT
      raise InvalidFormat.new output if matches.nil?
      matches.captures[0]
    end