private function parseAttributeType(Input $definition): ?string
    {
        $maxLength = self::MAX_ATTRIBUTE_TYPE_LENGTH;

        if ($definition->peek() !== ":") {
            return null;
        }

        $definition->take();

        $type = $definition->takeAllAlphaNumUntil("}");

        if (empty($type)) {
            throw InvalidRoute::emptyAttributeType($definition);
        }

        if (strlen($type) > $maxLength) {
            throw InvalidRoute::longAttributeType($definition, $maxLength);
        }

        return $type;
    }