@Override
  public @NotNull MatchResult getRoot() {
    if (parent == null) return this;
    MatchResultImpl root = parent;
    while (root.parent != null) {
      root = root.parent;
    }
    return root;
  }
@Override
  public @NotNull MatchResult getRoot()