code: private boolean matchesTemplateShape(Node template, Node ast) {
      while (template != null) {
        if (ast == null || !matchesNodeShape(template, ast)) {
          return false;
        }
        template = template.getNext();
        ast = ast.getNext();
      }
      return true;
    }
docs: Returns whether the template matches an AST structure node starting with
  node, taking into account the template parameters that were provided to
  this matcher.
  Here only the template shape is checked, template local declarations and
  parameters are checked later.