anchor.diff:  
       // If the first character is the abbreviation for a non-flag option, then
       // the rest is the value.
  -    var lettersAndDigits = current.substring(1, index);
  -    var rest = current.substring(index);
  +    var lettersAndDigits = _current.substring(1, index);
  +    var rest = _current.substring(index);
       if (rest.contains('\n') || rest.contains('\r')) return false;
  -
  +    return _handleAbbreviation(lettersAndDigits, rest, innermostCommand);
  +  }
  +
  +  bool _handleAbbreviation(
  +      String lettersAndDigits, String rest, Parser innermostCommand) {
       var c = lettersAndDigits.substring(0, 1);
  -    var first = grammar.findByAbbreviation(c);
  +    var first = _grammar.findByAbbreviation(c);
       if (first == null) {
         // Walk up to the parent command if possible.
  -      validate(
  -          parent != null, 'Could not find an option with short name "-$c".');
  -      return parent!.parseAbbreviation(innermostCommand);
  +      _validate(
  +          _parent != null, 'Could not find an option with short name "-$c".');
  +      return _parent!
  +          ._handleAbbreviation(lettersAndDigits, rest, innermostCommand);
       } else if (!first.isFlag) {
         // The first character is a non-flag option, so the rest must be the
         // value.
         var value = '${lettersAndDigits.substring(1)}$rest';
  -      setOption(results, first, value);
  +      _setOption(_results, first, value);
       } else {
         // If we got some non-flag characters, then it must be a value, but
         // if we got here, it's a flag, which is wrong.
  -      validate(
  +      _validate(
             rest == '',
             'Option "-$c" is a flag and cannot handle value '
             '"${lettersAndDigits.substring(1)}$rest".');
  
positive.code:       // letters.
        for (var i = 0; i < lettersAndDigits.length; i++) {
          var c = lettersAndDigits.substring(i, i + 1);
          innermostCommand.parseShortFlag(c);
        }
      }
  
      args.removeFirst();
      return true;
    }
  
    void parseShortFlag(String c) {
      var option = grammar.findByAbbreviation(c);
      if (option == null) {
        // Walk up to the parent command if possible.
        validate(
            parent != null, 'Could not find an option with short name "-$c".');
        parent!.parseShortFlag(c);
        return;
      }
  
      // In a list of short options, only the first can be a non-flag. If
      // we get here we've checked that already.
      validate(
          option.isFlag, 'Option "-$c" must be a flag to be in a collapsed "-".');
  
      setFlag(results, option, true);
    }
  
    /// Tries to parse the current argument as a long-form named option, which
    /// may include a value like "--mode=release" or "--mode release".
    bool parseLongOption() {
      // Hand coded regexp: r'^--([a-zA-Z\-_0-9]+)(=(.*))?$'
      // Two hyphens then at least one letter/digit/hyphen, optionally an equal
      // sign followed by zero or more anything-but-newlines.
  
      if (!current.startsWith('--')) return false;
  
      var index = current.indexOf('=');
      var name = index == -1 ? current.substring(2) : current.substring(2, index);
      for (var i = 0; i != name.length; ++i) {
        if (!_isLetterDigitHyphenOrUnderscore(name.codeUnitAt(i))) return false;
      }
      var value = index == -1 ? null : current.substring(index + 1);
      if (value != null && (value.contains('\n') || value.contains('\r'))) {
        return false;
      }
  
      var option = grammar.findByNameOrAlias(name);
      if (option != null) {
        args.removeFirst();
        if (option.isFlag) {
          validate(
              value == null, 'Flag option "$name" should not be given a value.');
  
          setFlag(results, option, true);
        } else if (value != null) {
          // We have a value like --foo=bar.
          setOption(results, option, value);
        } else {
          // Option like --foo, so look for the value as the next arg.
          readNextArgAsValue(option);
        }
      } else if (name.startsWith('no-')) {
        // See if it's a negated flag.
        name = name.substring('no-'.length);
        option = grammar.findByNameOrAlias(name);
        if (option == null) {
          // Walk up to the parent command if possible.
          validate(parent != null, 'Could not find an option named "$name".');
          return parent!.parseLongOption();
        }
  
        args.removeFirst();
        validate(option.isFlag, 'Cannot negate non-flag option "$name".');
        validate(option.negatable!, 'Cannot negate option "$name".');
  
        setFlag(results, option, false);
      } else {
        // Walk up to the parent command if possible.
        validate(parent != null, 'Could not find an option named "$name".');
        return parent!.parseLongOption();
      }
  
      return true;
  
negative.code:   /// Called during parsing to validate the arguments.
    ///
    /// Throws an [ArgParserException] if [condition] is `false`.
    void _validate(bool condition, String message) {
      if (!condition) throw ArgParserException(message);
    }
  
    /// Validates and stores [value] as the value for [option], which must not be
    /// a flag.
    void _setOption(Map results, Option option, String value) {
      assert(!option.isFlag);
  
      if (!option.isMultiple) {
  