// NOTE: This file is generated by the templates/template.rb script and should not
// be modified manually. See /home/runner/work/herb/herb/templates/src/analyze/transform.c.erb

#include "../include/analyze/analyze.h"
#include "../include/visitor.h"

bool transform_erb_nodes(const AST_NODE_T* node, void* data) {
  analyze_ruby_context_T* context = (analyze_ruby_context_T*) data;
  context->parent = (AST_NODE_T*) node;

  if (node->type == AST_DOCUMENT_NODE) {
    AST_DOCUMENT_NODE_T* document_node = (AST_DOCUMENT_NODE_T*) node;
    hb_array_T* old_array = document_node->children;
    document_node->children = rewrite_node_array((AST_NODE_T*) node, document_node->children, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_HTML_OPEN_TAG_NODE) {
    AST_HTML_OPEN_TAG_NODE_T* html_open_tag_node = (AST_HTML_OPEN_TAG_NODE_T*) node;
    hb_array_T* old_array = html_open_tag_node->children;
    html_open_tag_node->children = rewrite_node_array((AST_NODE_T*) node, html_open_tag_node->children, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_HTML_CLOSE_TAG_NODE) {
    AST_HTML_CLOSE_TAG_NODE_T* html_close_tag_node = (AST_HTML_CLOSE_TAG_NODE_T*) node;
    hb_array_T* old_array = html_close_tag_node->children;
    html_close_tag_node->children = rewrite_node_array((AST_NODE_T*) node, html_close_tag_node->children, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_HTML_ELEMENT_NODE) {
    AST_HTML_ELEMENT_NODE_T* html_element_node = (AST_HTML_ELEMENT_NODE_T*) node;
    hb_array_T* old_array = html_element_node->body;
    html_element_node->body = rewrite_node_array((AST_NODE_T*) node, html_element_node->body, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_HTML_CONDITIONAL_ELEMENT_NODE) {
    AST_HTML_CONDITIONAL_ELEMENT_NODE_T* html_conditional_element_node = (AST_HTML_CONDITIONAL_ELEMENT_NODE_T*) node;
    hb_array_T* old_array = html_conditional_element_node->body;
    html_conditional_element_node->body = rewrite_node_array((AST_NODE_T*) node, html_conditional_element_node->body, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_HTML_ATTRIBUTE_VALUE_NODE) {
    AST_HTML_ATTRIBUTE_VALUE_NODE_T* html_attribute_value_node = (AST_HTML_ATTRIBUTE_VALUE_NODE_T*) node;
    hb_array_T* old_array = html_attribute_value_node->children;
    html_attribute_value_node->children = rewrite_node_array((AST_NODE_T*) node, html_attribute_value_node->children, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_HTML_ATTRIBUTE_NAME_NODE) {
    AST_HTML_ATTRIBUTE_NAME_NODE_T* html_attribute_name_node = (AST_HTML_ATTRIBUTE_NAME_NODE_T*) node;
    hb_array_T* old_array = html_attribute_name_node->children;
    html_attribute_name_node->children = rewrite_node_array((AST_NODE_T*) node, html_attribute_name_node->children, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_OPEN_TAG_NODE) {
    AST_ERB_OPEN_TAG_NODE_T* erb_open_tag_node = (AST_ERB_OPEN_TAG_NODE_T*) node;
    hb_array_T* old_array = erb_open_tag_node->children;
    erb_open_tag_node->children = rewrite_node_array((AST_NODE_T*) node, erb_open_tag_node->children, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_HTML_COMMENT_NODE) {
    AST_HTML_COMMENT_NODE_T* html_comment_node = (AST_HTML_COMMENT_NODE_T*) node;
    hb_array_T* old_array = html_comment_node->children;
    html_comment_node->children = rewrite_node_array((AST_NODE_T*) node, html_comment_node->children, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_HTML_DOCTYPE_NODE) {
    AST_HTML_DOCTYPE_NODE_T* html_doctype_node = (AST_HTML_DOCTYPE_NODE_T*) node;
    hb_array_T* old_array = html_doctype_node->children;
    html_doctype_node->children = rewrite_node_array((AST_NODE_T*) node, html_doctype_node->children, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_XML_DECLARATION_NODE) {
    AST_XML_DECLARATION_NODE_T* xml_declaration_node = (AST_XML_DECLARATION_NODE_T*) node;
    hb_array_T* old_array = xml_declaration_node->children;
    xml_declaration_node->children = rewrite_node_array((AST_NODE_T*) node, xml_declaration_node->children, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_CDATA_NODE) {
    AST_CDATA_NODE_T* cdata_node = (AST_CDATA_NODE_T*) node;
    hb_array_T* old_array = cdata_node->children;
    cdata_node->children = rewrite_node_array((AST_NODE_T*) node, cdata_node->children, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_ELSE_NODE) {
    AST_ERB_ELSE_NODE_T* erb_else_node = (AST_ERB_ELSE_NODE_T*) node;
    hb_array_T* old_array = erb_else_node->statements;
    erb_else_node->statements = rewrite_node_array((AST_NODE_T*) node, erb_else_node->statements, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_IF_NODE) {
    AST_ERB_IF_NODE_T* erb_if_node = (AST_ERB_IF_NODE_T*) node;
    hb_array_T* old_array = erb_if_node->statements;
    erb_if_node->statements = rewrite_node_array((AST_NODE_T*) node, erb_if_node->statements, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_BLOCK_NODE) {
    AST_ERB_BLOCK_NODE_T* erb_block_node = (AST_ERB_BLOCK_NODE_T*) node;
    hb_array_T* old_array = erb_block_node->body;
    erb_block_node->body = rewrite_node_array((AST_NODE_T*) node, erb_block_node->body, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_WHEN_NODE) {
    AST_ERB_WHEN_NODE_T* erb_when_node = (AST_ERB_WHEN_NODE_T*) node;
    hb_array_T* old_array = erb_when_node->statements;
    erb_when_node->statements = rewrite_node_array((AST_NODE_T*) node, erb_when_node->statements, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_CASE_NODE) {
    AST_ERB_CASE_NODE_T* erb_case_node = (AST_ERB_CASE_NODE_T*) node;
    hb_array_T* old_array = erb_case_node->children;
    erb_case_node->children = rewrite_node_array((AST_NODE_T*) node, erb_case_node->children, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_CASE_NODE) {
    AST_ERB_CASE_NODE_T* erb_case_node = (AST_ERB_CASE_NODE_T*) node;
    hb_array_T* old_array = erb_case_node->conditions;
    erb_case_node->conditions = rewrite_node_array((AST_NODE_T*) node, erb_case_node->conditions, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_CASE_MATCH_NODE) {
    AST_ERB_CASE_MATCH_NODE_T* erb_case_match_node = (AST_ERB_CASE_MATCH_NODE_T*) node;
    hb_array_T* old_array = erb_case_match_node->children;
    erb_case_match_node->children = rewrite_node_array((AST_NODE_T*) node, erb_case_match_node->children, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_CASE_MATCH_NODE) {
    AST_ERB_CASE_MATCH_NODE_T* erb_case_match_node = (AST_ERB_CASE_MATCH_NODE_T*) node;
    hb_array_T* old_array = erb_case_match_node->conditions;
    erb_case_match_node->conditions = rewrite_node_array((AST_NODE_T*) node, erb_case_match_node->conditions, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_WHILE_NODE) {
    AST_ERB_WHILE_NODE_T* erb_while_node = (AST_ERB_WHILE_NODE_T*) node;
    hb_array_T* old_array = erb_while_node->statements;
    erb_while_node->statements = rewrite_node_array((AST_NODE_T*) node, erb_while_node->statements, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_UNTIL_NODE) {
    AST_ERB_UNTIL_NODE_T* erb_until_node = (AST_ERB_UNTIL_NODE_T*) node;
    hb_array_T* old_array = erb_until_node->statements;
    erb_until_node->statements = rewrite_node_array((AST_NODE_T*) node, erb_until_node->statements, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_FOR_NODE) {
    AST_ERB_FOR_NODE_T* erb_for_node = (AST_ERB_FOR_NODE_T*) node;
    hb_array_T* old_array = erb_for_node->statements;
    erb_for_node->statements = rewrite_node_array((AST_NODE_T*) node, erb_for_node->statements, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_RESCUE_NODE) {
    AST_ERB_RESCUE_NODE_T* erb_rescue_node = (AST_ERB_RESCUE_NODE_T*) node;
    hb_array_T* old_array = erb_rescue_node->statements;
    erb_rescue_node->statements = rewrite_node_array((AST_NODE_T*) node, erb_rescue_node->statements, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_ENSURE_NODE) {
    AST_ERB_ENSURE_NODE_T* erb_ensure_node = (AST_ERB_ENSURE_NODE_T*) node;
    hb_array_T* old_array = erb_ensure_node->statements;
    erb_ensure_node->statements = rewrite_node_array((AST_NODE_T*) node, erb_ensure_node->statements, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_BEGIN_NODE) {
    AST_ERB_BEGIN_NODE_T* erb_begin_node = (AST_ERB_BEGIN_NODE_T*) node;
    hb_array_T* old_array = erb_begin_node->statements;
    erb_begin_node->statements = rewrite_node_array((AST_NODE_T*) node, erb_begin_node->statements, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_UNLESS_NODE) {
    AST_ERB_UNLESS_NODE_T* erb_unless_node = (AST_ERB_UNLESS_NODE_T*) node;
    hb_array_T* old_array = erb_unless_node->statements;
    erb_unless_node->statements = rewrite_node_array((AST_NODE_T*) node, erb_unless_node->statements, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_RENDER_NODE) {
    AST_ERB_RENDER_NODE_T* erb_render_node = (AST_ERB_RENDER_NODE_T*) node;
    hb_array_T* old_array = erb_render_node->locals;
    erb_render_node->locals = rewrite_node_array((AST_NODE_T*) node, erb_render_node->locals, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_STRICT_LOCALS_NODE) {
    AST_ERB_STRICT_LOCALS_NODE_T* erb_strict_locals_node = (AST_ERB_STRICT_LOCALS_NODE_T*) node;
    hb_array_T* old_array = erb_strict_locals_node->locals;
    erb_strict_locals_node->locals = rewrite_node_array((AST_NODE_T*) node, erb_strict_locals_node->locals, context);
    hb_array_free(&old_array);
  }

  if (node->type == AST_ERB_IN_NODE) {
    AST_ERB_IN_NODE_T* erb_in_node = (AST_ERB_IN_NODE_T*) node;
    hb_array_T* old_array = erb_in_node->statements;
    erb_in_node->statements = rewrite_node_array((AST_NODE_T*) node, erb_in_node->statements, context);
    hb_array_free(&old_array);
  }

  herb_visit_child_nodes(node, transform_erb_nodes, data);

  return false;
}
