public BinaryTag tag() throws StringTagParseException {
    if (this.depth++ > MAX_DEPTH) {
      throw this.buffer.makeError("Exceeded maximum allowed depth of " + MAX_DEPTH + " when reading tag");
    }
    try {
      final char startToken = this.buffer.skipWhitespace().peek();
      switch (startToken) {
        case Tokens.COMPOUND_BEGIN:
          return this.compound();
        case Tokens.ARRAY_BEGIN:
          // TODO: legacy-format int arrays are ambiguous with new format int lists
          // Maybe add in a legacy-only mode to read those?
          if (this.buffer.hasMore(2) && this.buffer.peek(2) == ';') { // we know we're an array tag
            return this.array(this.buffer.peek(1));
          } else {
            return this.list();
          }
        case Tokens.SINGLE_QUOTE:
        case Tokens.DOUBLE_QUOTE:
          // definitely a string tag
          this.buffer.advance();
          return StringBinaryTag.stringBinaryTag(unescape(this.buffer.takeUntil(startToken).toString()));
        default: // scalar
          return this.scalar();
      }
    } finally {
      this.depth--;
    }
  }
Similar to a list tag in syntax, but returning a single array tag rather than a list of tags.

@param elementType the indicator character for element type
@return array-typed tag
@throws StringTagParseException if the array was not properly terminated
nbt/src/main/java/net/kyori/adventure/nbt/TagStringReader.java