code: public PathTemplate parentTemplate() {
      int i = segments.size();
      Segment seg = segments.get(--i);
      if (seg.kind() == SegmentKind.END_BINDING) {
        while (i > 0 && segments.get(--i).kind() != SegmentKind.BINDING) {}
      }
      if (i == 0) {
        throw new ValidationException("template does not have a parent");
      }
      return new PathTemplate(segments.subList(0, i), urlEncoding);
    }
docs: Returns a template for the parent of this template.
  
  @throws ValidationException if the template has no parent.