private static PathSegment parseVariable(Context context, Delimiters delimiters) {
        // Collect characters for 'FieldPath'.
        final StringBuilder fieldPathBuilder = new StringBuilder();
        char c = 0;
        while (context.hasNext()) {
            c = context.peek();
            if (delimiters.contains(c) || c == '=') {
                break;
            }
            fieldPathBuilder.append(context.read());
        }

        final String fieldPath = fieldPathBuilder.toString();
        checkArgument(!fieldPath.isEmpty(),
                      "path: %s (invalid variable part at index %s)", context.path(), context.index());

        if (c == '=') {
            // Consume '='.
            context.read();

            final List<PathSegment> segments = parseSegments(context, delimiters);

            // Replace a single WildcardPathSegment with a new one which has a field name
            // as its identifier in order to make the path variable human-readable.
            if (segments.size() == 1 && segments.get(0) instanceof WildcardPathSegment) {
                return new VariablePathSegment(
                        fieldPath, ImmutableList.of(((WildcardPathSegment) segments.get(0))
                                                            .withParentFieldPath(fieldPath)));
            } else {
                return new VariablePathSegment(fieldPath, segments);
            }
        } else {
            // Treat '{name}' as '{name=*}' to specify a path variable index.
            return new VariablePathSegment(fieldPath,
                                           ImmutableList.of(new WildcardPathSegment(context.nextPathVarIndex(),
                                                                                    fieldPath)));
        }
    }
Parses 'Variable' part.

<p>
Variable = "{" FieldPath [ "=" Segments ] "}"
</p>
grpc/src/main/java/com/linecorp/armeria/server/grpc/HttpJsonTranscodingPathParser.java