private BinaryTag scalar() throws StringTagParseException {
    final StringBuilder builder = new StringBuilder();
    while (this.buffer.hasMore()) {
      char current = this.buffer.peek();
      if (current == '\\') { // escape -- we are significantly more lenient than original format at the moment
        this.buffer.advance();
        current = this.buffer.take();
      } else if (Tokens.id(current)) {
        this.buffer.advance();
      } else { // end of value
        break;
      }
      builder.append(current);
    }
    if (builder.length() == 0) {
      throw this.buffer.makeError("Expected a value but got nothing");
    }
    final String original = builder.toString(); // use unmodified string when number parsing fails

    // Start stripping down the string so we can use Java's number parsing instead of having to write our own.
    // Determine the radix and strip its prefix if present
    final int radix = this.extractRadix(builder, original);

    // Check for the sign before removing the type token because of hex number always needing a sign thanks to byte types
    final char last = builder.charAt(builder.length() - 1);
    boolean hasSignToken = false;
    boolean signed = radix != HEX_RADIX; // hex defaults to unsigned
    if (builder.length() > 2) {
      final char signChar = builder.charAt(builder.length() - 2);
      if (signChar == Tokens.TYPE_SIGNED || signChar == Tokens.TYPE_UNSIGNED) {
        hasSignToken = true;
        signed = signChar == Tokens.TYPE_SIGNED;
        builder.deleteCharAt(builder.length() - 2);
      }
    }

    // Check for the type token and make sure we didn't fall into the hex trap (e.g. 0xAB)
    boolean hasTypeToken = false;
    char typeToken = Tokens.TYPE_INT;
    if (Tokens.numericType(last) && (hasSignToken || radix != HEX_RADIX)) {
      hasTypeToken = true;
      typeToken = Character.toLowerCase(last);
      builder.deleteCharAt(builder.length() - 1);
    }

    if (!signed && (typeToken == Tokens.TYPE_FLOAT || typeToken == Tokens.TYPE_DOUBLE)) {
      throw this.buffer.makeError("Cannot create unsigned floating point numbers");
    }

    final String strippedString = builder.toString().replace("_", "");
    if (hasTypeToken) {
      try {
        final NumberBinaryTag tag = this.parseNumberTag(strippedString, typeToken, radix, signed);
        if (tag != null) {
          return tag;
        }
      } catch (final NumberFormatException ignored) {
        // not a numeric tag of the appropriate type
      }
    } else { // default to int or double parsing before falling back to string
      try {
        return IntBinaryTag.intBinaryTag(this.parseInt(strippedString, radix, signed));
      } catch (final NumberFormatException ex) {
        if (strippedString.indexOf('.') != -1) { // see if we have an unsuffixed double; always needs a dot
          try {
            return DoubleBinaryTag.doubleBinaryTag(Double.parseDouble(strippedString));
          } catch (final NumberFormatException ex2) {
            // ignore
          }
        }
      }
    }

    if (original.equalsIgnoreCase(Tokens.LITERAL_TRUE)) {
      return ByteBinaryTag.ONE;
    } else if (original.equalsIgnoreCase(Tokens.LITERAL_FALSE)) {
      return ByteBinaryTag.ZERO;
    }
    return StringBinaryTag.stringBinaryTag(original);
  }
A tag that is definitely some sort of scalar.

<p>Does not detect quoted strings, so those should have been parsed already.</p>

@return a parsed tag
nbt/src/main/java/net/kyori/adventure/nbt/TagStringReader.java