public static Segment parse(String content, int offset) {
            if (content.length() >= 2 && content.charAt(0) == '{' && content.charAt(content.length() - 1) == '}') {
                Type labelType = content.charAt(content.length() - 2) == '+' ? Type.GREEDY_LABEL : Type.LABEL;
                content = labelType == Type.GREEDY_LABEL
                        ? content.substring(1, content.length() - 2)
                        : content.substring(1, content.length() - 1);
                return new Segment(content, labelType, offset);
            } else {
                return new Segment(content, Type.LITERAL, offset);
            }
        }
Parse a segment from the given offset.

@param content Content of the segment.
@param offset Character offset where the segment starts in the containing pattern.
@return Returns the created segment.
@throws InvalidPatternException if the segment is invalid.
smithy-model/src/main/java/software/amazon/smithy/model/pattern/SmithyPattern.java