class ParboiledAutoComplete {

  @VisibleForTesting
  @Nonnull
  static Set<ParboiledAutoCompleteSuggestion> updateSuggestions(
      List<AutocompleteSuggestion> suggestions,
      boolean escape,
      Anchor.Type anchorType,
      int startIndex) {
    return suggestions.stream()
        .map(
            s ->
                new ParboiledAutoCompleteSuggestion(
                    escape || (isEscapableNameAnchor(anchorType) && nameNeedsEscaping(s.getText()))
                        ? ESCAPE_CHAR + s.getText() + ESCAPE_CHAR
                        : s.getText(),
                    Optional.ofNullable(s.getHint()).orElseGet(anchorType::getHint),
                    startIndex,
                    anchorType,
                    Optional.ofNullable(s.getDescription()).orElse(null)))
        .collect(ImmutableSet.toImmutableSet());
  }

    ParboiledAutoComplete(
      CommonParser parser,
      Grammar grammar,
      Map<String, Anchor.Type> completionTypes,
      String network,
      String snapshot,
      String query,
      int maxSuggestions,
      CompletionMetadata completionMetadata,
      NodeRolesData nodeRolesData,
      ReferenceLibrary referenceLibrary);
    ParboiledAutoComplete(
      Grammar grammar,
      Rule inputRule,
      Map<String, Anchor.Type> completionTypes,
      String network,
      String snapshot,
      String query,
      int maxSuggestions,
      CompletionMetadata completionMetadata,
      NodeRolesData nodeRolesData,
      ReferenceLibrary referenceLibrary);

}