code: private int parseCountry() {
          if (!atTerminator()) {
              int oldIndex = index;
              ++index;
  
              int oldBlen = buffer.length();
              char c;
              boolean firstPass = true;
              while (!isTerminatorOrIDSeparator(c = next())) {
                  if (firstPass) { // first, add hyphen
                      hadCountry = true; // we have a country, let variant parsing know
                      addSeparator();
                      ++oldBlen; // increment past hyphen
                      firstPass = false;
                  }
                  append(AsciiUtil.toUpper(c));
              }
              --index; // unget
  
              int charsAppended = buffer.length() - oldBlen;
  
              if (charsAppended == 0) {
                  // Do nothing.
              }
              else if (charsAppended < 2 || charsAppended > 3) {
                  // It's not a country, so return index and blen to
                  // their previous values.
                  index = oldIndex;
                  --oldBlen;
                  buffer.delete(oldBlen, buffer.length());
                  hadCountry = false;
              }
              else if (charsAppended == 3) {
                  String region = LocaleIDs.threeToTwoLetterRegion(getString(oldBlen));
                  if (region != null) {
                      set(oldBlen, region);
                  }
              }
  
              return oldBlen;
          }
  
          return buffer.length();
      }
docs: Advance index past country, and accumulate normalized country in buffer.
  Index must be immediately after the script (if there is one, else language)
  and IDSeparator.  Return the start of the country code in the buffer.