private static List<PathSegment> parseSegments(Context context, Delimiters delimiters) {
        final Delimiters segmentDelimiters = delimiters.withMoreCharacter('/');
        final ImmutableList.Builder<PathSegment> segments = ImmutableList.builder();
        while (context.hasNext()) {
            final PathSegment parsedSegment = parseSegment(context, segmentDelimiters);
            segments.add(parsedSegment);

            if (!context.hasNext()) {
                return segments.build();
            }

            // Stop parsing if we meet one of the delimiters provided by the caller.
            final char c = context.peek();
            if (delimiters.contains(c)) {
                return segments.build();
            }

            // Check whether the last parsed segment has '**' literal. If so, there must be
            // no more segments.
            checkArgument(!containsDeepWildcardLiteral(parsedSegment),
                          "path: %s (must be no more segments after '**' literal at index %s)",
                          context.path(), context.index());

            // Consume the start symbol '/' of the next segment.
            checkArgument(context.read() == '/',
                          "path: %s (invalid segments part at index %s)", context.path(), context.index());
        }
        return segments.build();
    }
Parses 'Segments' part.

<p>
Segments = Segment { "/" Segment }
</p>
grpc/src/main/java/com/linecorp/armeria/server/grpc/HttpJsonTranscodingPathParser.java