code: public static String parseUnicodeIdentifier(String str, int[] pos) {
          // assert(pos[0] < str.length());
          StringBuilder buf = new StringBuilder();
          int p = pos[0];
          while (p < str.length()) {
              int ch = Character.codePointAt(str, p);
              if (buf.length() == 0) {
                  if (UCharacter.isUnicodeIdentifierStart(ch)) {
                      buf.appendCodePoint(ch);
                  } else {
                      return null;
                  }
              } else {
                  if (UCharacter.isUnicodeIdentifierPart(ch)) {
                      buf.appendCodePoint(ch);
                  } else {
                      break;
                  }
              }
              p += UTF16.getCharCount(ch);
          }
          pos[0] = p;
          return buf.toString();
      }
docs: Parse a Unicode identifier from the given string at the given
  position.  Return the identifier, or null if there is no
  identifier.
  @param str the string to parse
  @param pos INPUT-OUPUT parameter.  On INPUT, pos[0] is the
  first character to examine.  It must be less than str.length(),
  and it must not point to a whitespace character.  That is, must
  have pos[0] < str.length().  On
  OUTPUT, the position after the last parsed character.
  @return the Unicode identifier, or null if there is no valid
  identifier at pos[0].