public @Nullable String nextNameOrNull() {
    int p = peeked;
    if (p == PEEKED_NONE) {
      p = doPeek();
    }
    String result;
    if (p == PEEKED_UNQUOTED_NAME) {
      result = nextUnquotedValue();
    }
    else if (p == PEEKED_SINGLE_QUOTED_NAME) {
      result = nextQuotedValue('\'');
    }
    else if (p == PEEKED_DOUBLE_QUOTED_NAME) {
      result = nextQuotedValue('"');
    }
    else {
      if (p != PEEKED_END_OBJECT && p != PEEKED_END_ARRAY) {
        throw createParseError("Expected a name but was " + peek());
      }
      return null;
    }
    peeked = PEEKED_NONE;
    return result;
  }
public @Nullable String nextNameOrNull()