code: private int parseScript() {
          if (!atTerminator()) {
              int oldIndex = index; // save original index
              ++index;
  
              int oldBlen = buffer.length(); // get before append hyphen, if we truncate everything is undone
              char c;
              boolean firstPass = true;
              while(!isTerminatorOrIDSeparator(c = next()) && AsciiUtil.isAlpha(c)) {
                  if (firstPass) {
                      addSeparator();
                      append(AsciiUtil.toUpper(c));
                      firstPass = false;
                  } else {
                      append(AsciiUtil.toLower(c));
                  }
              }
              --index; // unget
  
              /* If it's not exactly 4 characters long, then it's not a script. */
              if (index - oldIndex != 5) { // +1 to account for separator
                  index = oldIndex;
                  buffer.delete(oldBlen, buffer.length());
              } else {
                  oldBlen++; // index past hyphen, for clients who want to extract just the script
              }
  
              return oldBlen;
          }
          return buffer.length();
      }
docs: Advance index past script, and accumulate normalized script in buffer.
  Index must be immediately after the language.
  If the item at this position is not a script (is not four characters
  long) leave index and buffer unchanged.  Otherwise index is left at
  a terminator or id separator.  Returns the start of the script code
  in the buffer (this may be equal to the buffer length, if there is no
  script).