// 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/include/errors.h.erb

#ifndef HERB_ERRORS_H
#define HERB_ERRORS_H

#include "errors.h"
#include "location/location.h"
#include "location/position.h"
#include "lexer/token.h"
#include "lib/hb_allocator.h"
#include "lib/hb_array.h"
#include "lib/hb_buffer.h"
#include "lib/hb_string.h"

typedef enum {
  UNEXPECTED_ERROR,
  UNEXPECTED_TOKEN_ERROR,
  MISSING_OPENING_TAG_ERROR,
  MISSING_CLOSING_TAG_ERROR,
  TAG_NAMES_MISMATCH_ERROR,
  VOID_ELEMENT_CLOSING_TAG_ERROR,
  UNCLOSED_ELEMENT_ERROR,
  RUBY_PARSE_ERROR,
  ERB_CONTROL_FLOW_SCOPE_ERROR,
  MISSING_ERB_END_TAG_ERROR,
  ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR,
  ERB_CASE_WITH_CONDITIONS_ERROR,
  CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR,
  CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR,
  INVALID_COMMENT_CLOSING_TAG_ERROR,
  OMITTED_CLOSING_TAG_ERROR,
  UNCLOSED_OPEN_TAG_ERROR,
  UNCLOSED_CLOSE_TAG_ERROR,
  UNCLOSED_QUOTE_ERROR,
  MISSING_ATTRIBUTE_VALUE_ERROR,
  UNCLOSED_ERB_TAG_ERROR,
  STRAY_ERB_CLOSING_TAG_ERROR,
  NESTED_ERB_TAG_ERROR,
  RENDER_AMBIGUOUS_LOCALS_ERROR,
  RENDER_MISSING_LOCALS_ERROR,
  RENDER_NO_ARGUMENTS_ERROR,
  RENDER_CONFLICTING_PARTIAL_ERROR,
  RENDER_INVALID_AS_OPTION_ERROR,
  RENDER_OBJECT_AND_COLLECTION_ERROR,
  RENDER_LAYOUT_WITHOUT_BLOCK_ERROR,
  STRICT_LOCALS_POSITIONAL_ARGUMENT_ERROR,
  STRICT_LOCALS_BLOCK_ARGUMENT_ERROR,
  STRICT_LOCALS_SPLAT_ARGUMENT_ERROR,
  STRICT_LOCALS_MISSING_PARENTHESIS_ERROR,
  STRICT_LOCALS_DUPLICATE_DECLARATION_ERROR,
  VOID_ELEMENT_CONTENT_ERROR,
  DOT_NOTATION_CASING_ERROR,
} error_type_T;

typedef struct ERROR_STRUCT {
  error_type_T type;
  location_T location;
  hb_string_T message;
} ERROR_T;


typedef struct {
  ERROR_T base;
  hb_string_T description;
  hb_string_T expected;
  hb_string_T found;
} UNEXPECTED_ERROR_T;

typedef struct {
  ERROR_T base;
  token_type_T expected_type;
  token_T* found;
} UNEXPECTED_TOKEN_ERROR_T;

typedef struct {
  ERROR_T base;
  token_T* closing_tag;
} MISSING_OPENING_TAG_ERROR_T;

typedef struct {
  ERROR_T base;
  token_T* opening_tag;
} MISSING_CLOSING_TAG_ERROR_T;

typedef struct {
  ERROR_T base;
  token_T* opening_tag;
  token_T* closing_tag;
} TAG_NAMES_MISMATCH_ERROR_T;

typedef struct {
  ERROR_T base;
  token_T* tag_name;
  hb_string_T expected;
  hb_string_T found;
} VOID_ELEMENT_CLOSING_TAG_ERROR_T;

typedef struct {
  ERROR_T base;
  token_T* opening_tag;
} UNCLOSED_ELEMENT_ERROR_T;

typedef struct {
  ERROR_T base;
  hb_string_T error_message;
  hb_string_T diagnostic_id;
  hb_string_T level;
} RUBY_PARSE_ERROR_T;

typedef struct {
  ERROR_T base;
  hb_string_T keyword;
} ERB_CONTROL_FLOW_SCOPE_ERROR_T;

typedef struct {
  ERROR_T base;
  hb_string_T keyword;
} MISSING_ERB_END_TAG_ERROR_T;

typedef struct {
  ERROR_T base;
  /* no additional fields */
} ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T;

typedef struct {
  ERROR_T base;
  /* no additional fields */
} ERB_CASE_WITH_CONDITIONS_ERROR_T;

typedef struct {
  ERROR_T base;
  size_t line;
  size_t column;
} CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR_T;

typedef struct {
  ERROR_T base;
  hb_string_T tag_name;
  hb_string_T open_condition;
  size_t open_line;
  size_t open_column;
  hb_string_T close_condition;
  size_t close_line;
  size_t close_column;
} CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR_T;

typedef struct {
  ERROR_T base;
  token_T* closing_tag;
} INVALID_COMMENT_CLOSING_TAG_ERROR_T;

typedef struct {
  ERROR_T base;
  token_T* opening_tag;
  position_T insertion_point;
} OMITTED_CLOSING_TAG_ERROR_T;

typedef struct {
  ERROR_T base;
  token_T* tag_name;
} UNCLOSED_OPEN_TAG_ERROR_T;

typedef struct {
  ERROR_T base;
  token_T* tag_name;
} UNCLOSED_CLOSE_TAG_ERROR_T;

typedef struct {
  ERROR_T base;
  token_T* opening_quote;
} UNCLOSED_QUOTE_ERROR_T;

typedef struct {
  ERROR_T base;
  hb_string_T attribute_name;
} MISSING_ATTRIBUTE_VALUE_ERROR_T;

typedef struct {
  ERROR_T base;
  token_T* opening_tag;
} UNCLOSED_ERB_TAG_ERROR_T;

typedef struct {
  ERROR_T base;
  /* no additional fields */
} STRAY_ERB_CLOSING_TAG_ERROR_T;

typedef struct {
  ERROR_T base;
  token_T* opening_tag;
  size_t nested_tag_line;
  size_t nested_tag_column;
} NESTED_ERB_TAG_ERROR_T;

typedef struct {
  ERROR_T base;
  hb_string_T partial;
} RENDER_AMBIGUOUS_LOCALS_ERROR_T;

typedef struct {
  ERROR_T base;
  hb_string_T partial;
  hb_string_T keywords;
} RENDER_MISSING_LOCALS_ERROR_T;

typedef struct {
  ERROR_T base;
  /* no additional fields */
} RENDER_NO_ARGUMENTS_ERROR_T;

typedef struct {
  ERROR_T base;
  hb_string_T positional_partial;
  hb_string_T keyword_partial;
} RENDER_CONFLICTING_PARTIAL_ERROR_T;

typedef struct {
  ERROR_T base;
  hb_string_T as_value;
} RENDER_INVALID_AS_OPTION_ERROR_T;

typedef struct {
  ERROR_T base;
  /* no additional fields */
} RENDER_OBJECT_AND_COLLECTION_ERROR_T;

typedef struct {
  ERROR_T base;
  hb_string_T layout;
} RENDER_LAYOUT_WITHOUT_BLOCK_ERROR_T;

typedef struct {
  ERROR_T base;
  hb_string_T name;
} STRICT_LOCALS_POSITIONAL_ARGUMENT_ERROR_T;

typedef struct {
  ERROR_T base;
  hb_string_T name;
} STRICT_LOCALS_BLOCK_ARGUMENT_ERROR_T;

typedef struct {
  ERROR_T base;
  hb_string_T name;
} STRICT_LOCALS_SPLAT_ARGUMENT_ERROR_T;

typedef struct {
  ERROR_T base;
  hb_string_T rest;
} STRICT_LOCALS_MISSING_PARENTHESIS_ERROR_T;

typedef struct {
  ERROR_T base;
  /* no additional fields */
} STRICT_LOCALS_DUPLICATE_DECLARATION_ERROR_T;

typedef struct {
  ERROR_T base;
  token_T* tag_name;
  hb_string_T helper_name;
  hb_string_T content_type;
} VOID_ELEMENT_CONTENT_ERROR_T;

typedef struct {
  ERROR_T base;
  token_T* segment;
} DOT_NOTATION_CASING_ERROR_T;

UNEXPECTED_ERROR_T* unexpected_error_init(hb_string_T description, hb_string_T expected, hb_string_T found, position_T start, position_T end, hb_allocator_T* allocator);
void append_unexpected_error(hb_string_T description, hb_string_T expected, hb_string_T found, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error_init(token_type_T expected_type, token_T* found, position_T start, position_T end, hb_allocator_T* allocator);
void append_unexpected_token_error(token_type_T expected_type, token_T* found, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error_init(token_T* closing_tag, position_T start, position_T end, hb_allocator_T* allocator);
void append_missing_opening_tag_error(token_T* closing_tag, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error_init(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator);
void append_missing_closing_tag_error(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error_init(token_T* opening_tag, token_T* closing_tag, position_T start, position_T end, hb_allocator_T* allocator);
void append_tag_names_mismatch_error(token_T* opening_tag, token_T* closing_tag, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error_init(token_T* tag_name, hb_string_T expected, hb_string_T found, position_T start, position_T end, hb_allocator_T* allocator);
void append_void_element_closing_tag_error(token_T* tag_name, hb_string_T expected, hb_string_T found, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error_init(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator);
void append_unclosed_element_error(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
RUBY_PARSE_ERROR_T* ruby_parse_error_init(hb_string_T error_message, hb_string_T diagnostic_id, hb_string_T level, position_T start, position_T end, hb_allocator_T* allocator);
void append_ruby_parse_error(hb_string_T error_message, hb_string_T diagnostic_id, hb_string_T level, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
ERB_CONTROL_FLOW_SCOPE_ERROR_T* erb_control_flow_scope_error_init(hb_string_T keyword, position_T start, position_T end, hb_allocator_T* allocator);
void append_erb_control_flow_scope_error(hb_string_T keyword, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
MISSING_ERB_END_TAG_ERROR_T* missing_erb_end_tag_error_init(hb_string_T keyword, position_T start, position_T end, hb_allocator_T* allocator);
void append_missing_erb_end_tag_error(hb_string_T keyword, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* erb_multiple_blocks_in_tag_error_init(position_T start, position_T end, hb_allocator_T* allocator);
void append_erb_multiple_blocks_in_tag_error(position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
ERB_CASE_WITH_CONDITIONS_ERROR_T* erb_case_with_conditions_error_init(position_T start, position_T end, hb_allocator_T* allocator);
void append_erb_case_with_conditions_error(position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR_T* conditional_element_multiple_tags_error_init(size_t line, size_t column, position_T start, position_T end, hb_allocator_T* allocator);
void append_conditional_element_multiple_tags_error(size_t line, size_t column, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR_T* conditional_element_condition_mismatch_error_init(hb_string_T tag_name, hb_string_T open_condition, size_t open_line, size_t open_column, hb_string_T close_condition, size_t close_line, size_t close_column, position_T start, position_T end, hb_allocator_T* allocator);
void append_conditional_element_condition_mismatch_error(hb_string_T tag_name, hb_string_T open_condition, size_t open_line, size_t open_column, hb_string_T close_condition, size_t close_line, size_t close_column, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
INVALID_COMMENT_CLOSING_TAG_ERROR_T* invalid_comment_closing_tag_error_init(token_T* closing_tag, position_T start, position_T end, hb_allocator_T* allocator);
void append_invalid_comment_closing_tag_error(token_T* closing_tag, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
OMITTED_CLOSING_TAG_ERROR_T* omitted_closing_tag_error_init(token_T* opening_tag, position_T insertion_point, position_T start, position_T end, hb_allocator_T* allocator);
void append_omitted_closing_tag_error(token_T* opening_tag, position_T insertion_point, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
UNCLOSED_OPEN_TAG_ERROR_T* unclosed_open_tag_error_init(token_T* tag_name, position_T start, position_T end, hb_allocator_T* allocator);
void append_unclosed_open_tag_error(token_T* tag_name, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
UNCLOSED_CLOSE_TAG_ERROR_T* unclosed_close_tag_error_init(token_T* tag_name, position_T start, position_T end, hb_allocator_T* allocator);
void append_unclosed_close_tag_error(token_T* tag_name, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
UNCLOSED_QUOTE_ERROR_T* unclosed_quote_error_init(token_T* opening_quote, position_T start, position_T end, hb_allocator_T* allocator);
void append_unclosed_quote_error(token_T* opening_quote, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
MISSING_ATTRIBUTE_VALUE_ERROR_T* missing_attribute_value_error_init(hb_string_T attribute_name, position_T start, position_T end, hb_allocator_T* allocator);
void append_missing_attribute_value_error(hb_string_T attribute_name, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
UNCLOSED_ERB_TAG_ERROR_T* unclosed_erb_tag_error_init(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator);
void append_unclosed_erb_tag_error(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
STRAY_ERB_CLOSING_TAG_ERROR_T* stray_erb_closing_tag_error_init(position_T start, position_T end, hb_allocator_T* allocator);
void append_stray_erb_closing_tag_error(position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
NESTED_ERB_TAG_ERROR_T* nested_erb_tag_error_init(token_T* opening_tag, size_t nested_tag_line, size_t nested_tag_column, position_T start, position_T end, hb_allocator_T* allocator);
void append_nested_erb_tag_error(token_T* opening_tag, size_t nested_tag_line, size_t nested_tag_column, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
RENDER_AMBIGUOUS_LOCALS_ERROR_T* render_ambiguous_locals_error_init(hb_string_T partial, position_T start, position_T end, hb_allocator_T* allocator);
void append_render_ambiguous_locals_error(hb_string_T partial, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
RENDER_MISSING_LOCALS_ERROR_T* render_missing_locals_error_init(hb_string_T partial, hb_string_T keywords, position_T start, position_T end, hb_allocator_T* allocator);
void append_render_missing_locals_error(hb_string_T partial, hb_string_T keywords, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
RENDER_NO_ARGUMENTS_ERROR_T* render_no_arguments_error_init(position_T start, position_T end, hb_allocator_T* allocator);
void append_render_no_arguments_error(position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
RENDER_CONFLICTING_PARTIAL_ERROR_T* render_conflicting_partial_error_init(hb_string_T positional_partial, hb_string_T keyword_partial, position_T start, position_T end, hb_allocator_T* allocator);
void append_render_conflicting_partial_error(hb_string_T positional_partial, hb_string_T keyword_partial, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
RENDER_INVALID_AS_OPTION_ERROR_T* render_invalid_as_option_error_init(hb_string_T as_value, position_T start, position_T end, hb_allocator_T* allocator);
void append_render_invalid_as_option_error(hb_string_T as_value, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
RENDER_OBJECT_AND_COLLECTION_ERROR_T* render_object_and_collection_error_init(position_T start, position_T end, hb_allocator_T* allocator);
void append_render_object_and_collection_error(position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
RENDER_LAYOUT_WITHOUT_BLOCK_ERROR_T* render_layout_without_block_error_init(hb_string_T layout, position_T start, position_T end, hb_allocator_T* allocator);
void append_render_layout_without_block_error(hb_string_T layout, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
STRICT_LOCALS_POSITIONAL_ARGUMENT_ERROR_T* strict_locals_positional_argument_error_init(hb_string_T name, position_T start, position_T end, hb_allocator_T* allocator);
void append_strict_locals_positional_argument_error(hb_string_T name, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
STRICT_LOCALS_BLOCK_ARGUMENT_ERROR_T* strict_locals_block_argument_error_init(hb_string_T name, position_T start, position_T end, hb_allocator_T* allocator);
void append_strict_locals_block_argument_error(hb_string_T name, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
STRICT_LOCALS_SPLAT_ARGUMENT_ERROR_T* strict_locals_splat_argument_error_init(hb_string_T name, position_T start, position_T end, hb_allocator_T* allocator);
void append_strict_locals_splat_argument_error(hb_string_T name, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
STRICT_LOCALS_MISSING_PARENTHESIS_ERROR_T* strict_locals_missing_parenthesis_error_init(hb_string_T rest, position_T start, position_T end, hb_allocator_T* allocator);
void append_strict_locals_missing_parenthesis_error(hb_string_T rest, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
STRICT_LOCALS_DUPLICATE_DECLARATION_ERROR_T* strict_locals_duplicate_declaration_error_init(position_T start, position_T end, hb_allocator_T* allocator);
void append_strict_locals_duplicate_declaration_error(position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
VOID_ELEMENT_CONTENT_ERROR_T* void_element_content_error_init(token_T* tag_name, hb_string_T helper_name, hb_string_T content_type, position_T start, position_T end, hb_allocator_T* allocator);
void append_void_element_content_error(token_T* tag_name, hb_string_T helper_name, hb_string_T content_type, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
DOT_NOTATION_CASING_ERROR_T* dot_notation_casing_error_init(token_T* segment, position_T start, position_T end, hb_allocator_T* allocator);
void append_dot_notation_casing_error(token_T* segment, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);

void error_init(ERROR_T* error, error_type_T type, position_T start, position_T end);

size_t error_sizeof(void);
error_type_T error_type(ERROR_T* error);

hb_string_T error_message(ERROR_T* error);

hb_string_T error_type_to_string(ERROR_T* error);
hb_string_T error_human_type(ERROR_T* error);

void error_free(ERROR_T* error, hb_allocator_T* allocator);

#ifndef HERB_EXCLUDE_PRETTYPRINT
  void error_pretty_print(ERROR_T* error, size_t indent, size_t relative_indent, hb_buffer_T* buffer);

  void error_pretty_print_array(
    const char* name, hb_array_T* array, size_t indent, size_t relative_indent, bool last_property,
    hb_buffer_T* buffer
  );
#endif

#endif
