@herb-tools/node 0.8.10 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/binding.gyp +27 -8
  2. package/dist/herb-node.cjs +41 -12
  3. package/dist/herb-node.cjs.map +1 -1
  4. package/dist/herb-node.esm.js +8 -1
  5. package/dist/herb-node.esm.js.map +1 -1
  6. package/dist/types/node-backend.d.ts +3 -1
  7. package/extension/error_helpers.cpp +598 -73
  8. package/extension/error_helpers.h +20 -3
  9. package/extension/extension_helpers.cpp +40 -35
  10. package/extension/extension_helpers.h +2 -2
  11. package/extension/herb.cpp +194 -64
  12. package/extension/libherb/analyze/action_view/attribute_extraction_helpers.c +303 -0
  13. package/extension/libherb/analyze/action_view/attribute_extraction_helpers.h +36 -0
  14. package/extension/libherb/analyze/action_view/content_tag.c +78 -0
  15. package/extension/libherb/analyze/action_view/link_to.c +167 -0
  16. package/extension/libherb/analyze/action_view/registry.c +83 -0
  17. package/extension/libherb/analyze/action_view/tag.c +70 -0
  18. package/extension/libherb/analyze/action_view/tag_helper_handler.h +43 -0
  19. package/extension/libherb/analyze/action_view/tag_helper_node_builders.c +305 -0
  20. package/extension/libherb/analyze/action_view/tag_helper_node_builders.h +70 -0
  21. package/extension/libherb/analyze/action_view/tag_helpers.c +815 -0
  22. package/extension/libherb/analyze/action_view/tag_helpers.h +38 -0
  23. package/extension/libherb/analyze/action_view/turbo_frame_tag.c +88 -0
  24. package/extension/libherb/analyze/analyze.c +885 -0
  25. package/extension/libherb/{include → analyze}/analyze.h +14 -4
  26. package/extension/libherb/{analyzed_ruby.c → analyze/analyzed_ruby.c} +13 -11
  27. package/extension/libherb/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
  28. package/extension/libherb/analyze/builders.c +343 -0
  29. package/extension/libherb/analyze/builders.h +27 -0
  30. package/extension/libherb/analyze/conditional_elements.c +594 -0
  31. package/extension/libherb/analyze/conditional_elements.h +9 -0
  32. package/extension/libherb/analyze/conditional_open_tags.c +640 -0
  33. package/extension/libherb/analyze/conditional_open_tags.h +9 -0
  34. package/extension/libherb/analyze/control_type.c +250 -0
  35. package/extension/libherb/analyze/control_type.h +14 -0
  36. package/extension/libherb/{analyze_helpers.c → analyze/helpers.c} +48 -23
  37. package/extension/libherb/{analyze_helpers.h → analyze/helpers.h} +4 -2
  38. package/extension/libherb/analyze/invalid_structures.c +193 -0
  39. package/extension/libherb/analyze/invalid_structures.h +11 -0
  40. package/extension/libherb/{analyze_missing_end.c → analyze/missing_end.c} +33 -22
  41. package/extension/libherb/analyze/parse_errors.c +84 -0
  42. package/extension/libherb/analyze/prism_annotate.c +399 -0
  43. package/extension/libherb/analyze/prism_annotate.h +16 -0
  44. package/extension/libherb/analyze/render_nodes.c +761 -0
  45. package/extension/libherb/analyze/render_nodes.h +11 -0
  46. package/extension/libherb/{analyze_transform.c → analyze/transform.c} +24 -3
  47. package/extension/libherb/ast_node.c +17 -7
  48. package/extension/libherb/ast_node.h +11 -5
  49. package/extension/libherb/ast_nodes.c +760 -388
  50. package/extension/libherb/ast_nodes.h +155 -39
  51. package/extension/libherb/ast_pretty_print.c +265 -7
  52. package/extension/libherb/ast_pretty_print.h +6 -1
  53. package/extension/libherb/element_source.h +3 -8
  54. package/extension/libherb/errors.c +1455 -520
  55. package/extension/libherb/errors.h +207 -56
  56. package/extension/libherb/extract.c +145 -49
  57. package/extension/libherb/extract.h +21 -5
  58. package/extension/libherb/herb.c +52 -34
  59. package/extension/libherb/herb.h +18 -6
  60. package/extension/libherb/herb_prism_node.h +13 -0
  61. package/extension/libherb/html_util.c +241 -12
  62. package/extension/libherb/html_util.h +7 -2
  63. package/extension/libherb/include/analyze/action_view/attribute_extraction_helpers.h +36 -0
  64. package/extension/libherb/include/analyze/action_view/tag_helper_handler.h +43 -0
  65. package/extension/libherb/include/analyze/action_view/tag_helper_node_builders.h +70 -0
  66. package/extension/libherb/include/analyze/action_view/tag_helpers.h +38 -0
  67. package/extension/libherb/{analyze.h → include/analyze/analyze.h} +14 -4
  68. package/extension/libherb/include/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
  69. package/extension/libherb/include/analyze/builders.h +27 -0
  70. package/extension/libherb/include/analyze/conditional_elements.h +9 -0
  71. package/extension/libherb/include/analyze/conditional_open_tags.h +9 -0
  72. package/extension/libherb/include/analyze/control_type.h +14 -0
  73. package/extension/libherb/include/{analyze_helpers.h → analyze/helpers.h} +4 -2
  74. package/extension/libherb/include/analyze/invalid_structures.h +11 -0
  75. package/extension/libherb/include/analyze/prism_annotate.h +16 -0
  76. package/extension/libherb/include/analyze/render_nodes.h +11 -0
  77. package/extension/libherb/include/ast_node.h +11 -5
  78. package/extension/libherb/include/ast_nodes.h +155 -39
  79. package/extension/libherb/include/ast_pretty_print.h +6 -1
  80. package/extension/libherb/include/element_source.h +3 -8
  81. package/extension/libherb/include/errors.h +207 -56
  82. package/extension/libherb/include/extract.h +21 -5
  83. package/extension/libherb/include/herb.h +18 -6
  84. package/extension/libherb/include/herb_prism_node.h +13 -0
  85. package/extension/libherb/include/html_util.h +7 -2
  86. package/extension/libherb/include/io.h +3 -1
  87. package/extension/libherb/include/lex_helpers.h +29 -0
  88. package/extension/libherb/include/lexer.h +1 -1
  89. package/extension/libherb/include/lexer_peek_helpers.h +87 -13
  90. package/extension/libherb/include/lexer_struct.h +2 -0
  91. package/extension/libherb/include/location.h +2 -1
  92. package/extension/libherb/include/parser.h +28 -2
  93. package/extension/libherb/include/parser_helpers.h +19 -3
  94. package/extension/libherb/include/pretty_print.h +10 -5
  95. package/extension/libherb/include/prism_context.h +45 -0
  96. package/extension/libherb/include/prism_helpers.h +10 -7
  97. package/extension/libherb/include/prism_serialized.h +12 -0
  98. package/extension/libherb/include/token.h +16 -4
  99. package/extension/libherb/include/token_struct.h +10 -3
  100. package/extension/libherb/include/utf8.h +2 -1
  101. package/extension/libherb/include/util/hb_allocator.h +78 -0
  102. package/extension/libherb/include/util/hb_arena.h +6 -1
  103. package/extension/libherb/include/util/hb_arena_debug.h +12 -1
  104. package/extension/libherb/include/util/hb_array.h +7 -3
  105. package/extension/libherb/include/util/hb_buffer.h +6 -4
  106. package/extension/libherb/include/util/hb_foreach.h +79 -0
  107. package/extension/libherb/include/util/hb_narray.h +8 -4
  108. package/extension/libherb/include/util/hb_string.h +56 -9
  109. package/extension/libherb/include/util.h +6 -3
  110. package/extension/libherb/include/version.h +1 -1
  111. package/extension/libherb/io.c +3 -2
  112. package/extension/libherb/io.h +3 -1
  113. package/extension/libherb/lex_helpers.h +29 -0
  114. package/extension/libherb/lexer.c +42 -30
  115. package/extension/libherb/lexer.h +1 -1
  116. package/extension/libherb/lexer_peek_helpers.c +12 -74
  117. package/extension/libherb/lexer_peek_helpers.h +87 -13
  118. package/extension/libherb/lexer_struct.h +2 -0
  119. package/extension/libherb/location.c +2 -2
  120. package/extension/libherb/location.h +2 -1
  121. package/extension/libherb/main.c +53 -28
  122. package/extension/libherb/parser.c +784 -247
  123. package/extension/libherb/parser.h +28 -2
  124. package/extension/libherb/parser_helpers.c +110 -23
  125. package/extension/libherb/parser_helpers.h +19 -3
  126. package/extension/libherb/parser_match_tags.c +130 -49
  127. package/extension/libherb/pretty_print.c +29 -24
  128. package/extension/libherb/pretty_print.h +10 -5
  129. package/extension/libherb/prism_context.h +45 -0
  130. package/extension/libherb/prism_helpers.c +30 -27
  131. package/extension/libherb/prism_helpers.h +10 -7
  132. package/extension/libherb/prism_serialized.h +12 -0
  133. package/extension/libherb/ruby_parser.c +2 -0
  134. package/extension/libherb/token.c +151 -66
  135. package/extension/libherb/token.h +16 -4
  136. package/extension/libherb/token_matchers.c +0 -1
  137. package/extension/libherb/token_struct.h +10 -3
  138. package/extension/libherb/utf8.c +7 -6
  139. package/extension/libherb/utf8.h +2 -1
  140. package/extension/libherb/util/hb_allocator.c +341 -0
  141. package/extension/libherb/util/hb_allocator.h +78 -0
  142. package/extension/libherb/util/hb_arena.c +81 -56
  143. package/extension/libherb/util/hb_arena.h +6 -1
  144. package/extension/libherb/util/hb_arena_debug.c +32 -17
  145. package/extension/libherb/util/hb_arena_debug.h +12 -1
  146. package/extension/libherb/util/hb_array.c +30 -15
  147. package/extension/libherb/util/hb_array.h +7 -3
  148. package/extension/libherb/util/hb_buffer.c +17 -21
  149. package/extension/libherb/util/hb_buffer.h +6 -4
  150. package/extension/libherb/util/hb_foreach.h +79 -0
  151. package/extension/libherb/util/hb_narray.c +22 -7
  152. package/extension/libherb/util/hb_narray.h +8 -4
  153. package/extension/libherb/util/hb_string.c +49 -35
  154. package/extension/libherb/util/hb_string.h +56 -9
  155. package/extension/libherb/util.c +21 -11
  156. package/extension/libherb/util.h +6 -3
  157. package/extension/libherb/version.h +1 -1
  158. package/extension/libherb/visitor.c +68 -1
  159. package/extension/nodes.cpp +593 -6
  160. package/extension/nodes.h +10 -1
  161. package/package.json +12 -8
  162. package/src/node-backend.ts +11 -1
  163. package/dist/types/index-cjs.d.cts +0 -1
  164. package/extension/libherb/analyze.c +0 -1608
  165. package/extension/libherb/element_source.c +0 -12
  166. package/extension/libherb/include/util/hb_system.h +0 -9
  167. package/extension/libherb/util/hb_system.c +0 -30
  168. package/extension/libherb/util/hb_system.h +0 -9
  169. package/src/index-cjs.cts +0 -22
  170. /package/dist/types/{index-esm.d.mts → index.d.ts} +0 -0
  171. /package/src/{index-esm.mts → index.ts} +0 -0
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.8.10/templates/src/errors.c.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.9.1/templates/src/errors.c.erb
3
3
 
4
4
  #include "include/errors.h"
5
5
  #include "include/location.h"
@@ -7,7 +7,9 @@
7
7
  #include "include/pretty_print.h"
8
8
  #include "include/token.h"
9
9
  #include "include/util.h"
10
+ #include "include/util/hb_allocator.h"
10
11
  #include "include/util/hb_array.h"
12
+ #include "include/util/hb_string.h"
11
13
 
12
14
  #include <stdio.h>
13
15
  #include <stdbool.h>
@@ -28,658 +30,1326 @@ void error_init(ERROR_T* error, const error_type_T type, position_T start, posit
28
30
  error->location.end = end;
29
31
  }
30
32
 
31
- UNEXPECTED_ERROR_T* unexpected_error_init(const char* description, const char* expected, const char* found, position_T start, position_T end) {
32
- UNEXPECTED_ERROR_T* unexpected_error = malloc(sizeof(UNEXPECTED_ERROR_T));
33
+ 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) {
34
+ UNEXPECTED_ERROR_T* unexpected_error = hb_allocator_alloc(allocator, sizeof(UNEXPECTED_ERROR_T));
35
+
36
+ if (!unexpected_error) { return NULL; }
33
37
 
34
38
  error_init(&unexpected_error->base, UNEXPECTED_ERROR, start, end);
35
39
 
36
- const char* message_template = "%s. Expected: `%s`, found: `%s`.";
37
-
38
- size_t message_size = 417;
39
- char* message = (char*) malloc(message_size);
40
-
41
- if (message) {
42
- char truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
43
- strncpy(truncated_argument_0, description, ERROR_MESSAGES_TRUNCATED_LENGTH);
44
- truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
45
-
46
- char truncated_argument_1[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
47
- strncpy(truncated_argument_1, expected, ERROR_MESSAGES_TRUNCATED_LENGTH);
48
- truncated_argument_1[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
49
-
50
- char truncated_argument_2[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
51
- strncpy(truncated_argument_2, found, ERROR_MESSAGES_TRUNCATED_LENGTH);
52
- truncated_argument_2[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
53
-
54
- snprintf(
55
- message,
56
- message_size,
57
- message_template,
58
- truncated_argument_0,
59
- truncated_argument_1,
60
- truncated_argument_2
61
- );
62
-
63
- unexpected_error->base.message = herb_strdup(message);
64
- free(message);
65
- } else {
66
- unexpected_error->base.message = herb_strdup("%s. Expected: `%s`, found: `%s`.");
67
- }
40
+ const char* message_template = "%s. Expected: %s, found: %s.";
41
+
42
+ hb_string_T truncated_argument_0 = hb_string_truncate(description, ERROR_MESSAGES_TRUNCATED_LENGTH);
43
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
44
+
45
+ hb_string_T truncated_argument_1 = hb_string_truncate(expected, ERROR_MESSAGES_TRUNCATED_LENGTH);
46
+ char* truncated_c_string_1 = hb_string_to_c_string_using_malloc(truncated_argument_1);
68
47
 
69
- unexpected_error->description = herb_strdup(description);
70
- unexpected_error->expected = herb_strdup(expected);
71
- unexpected_error->found = herb_strdup(found);
48
+ hb_string_T truncated_argument_2 = hb_string_truncate(found, ERROR_MESSAGES_TRUNCATED_LENGTH);
49
+ char* truncated_c_string_2 = hb_string_to_c_string_using_malloc(truncated_argument_2);
50
+
51
+ char message[413];
52
+ snprintf(
53
+ message,
54
+ sizeof(message),
55
+ message_template,
56
+ truncated_c_string_0 ? truncated_c_string_0 : "",
57
+ truncated_c_string_1 ? truncated_c_string_1 : "",
58
+ truncated_c_string_2 ? truncated_c_string_2 : ""
59
+ );
60
+
61
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
62
+ if (truncated_c_string_1) { free(truncated_c_string_1); }
63
+ if (truncated_c_string_2) { free(truncated_c_string_2); }
64
+ unexpected_error->base.message = hb_string_copy(hb_string(message), allocator);
65
+
66
+ unexpected_error->description = hb_string_copy(description, allocator);
67
+ unexpected_error->expected = hb_string_copy(expected, allocator);
68
+ unexpected_error->found = hb_string_copy(found, allocator);
72
69
  return unexpected_error;
73
70
  }
74
71
 
75
- void append_unexpected_error(const char* description, const char* expected, const char* found, position_T start, position_T end, hb_array_T* errors) {
76
- hb_array_append(errors, unexpected_error_init(description, expected, found, start, end));
72
+ 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) {
73
+ hb_array_append(errors, unexpected_error_init(description, expected, found, start, end, allocator));
77
74
  }
78
75
 
79
- UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error_init(token_type_T expected_type, token_T* found, position_T start, position_T end) {
80
- UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error = malloc(sizeof(UNEXPECTED_TOKEN_ERROR_T));
76
+ 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) {
77
+ UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error = hb_allocator_alloc(allocator, sizeof(UNEXPECTED_TOKEN_ERROR_T));
78
+
79
+ if (!unexpected_token_error) { return NULL; }
81
80
 
82
81
  error_init(&unexpected_token_error->base, UNEXPECTED_TOKEN_ERROR, start, end);
83
82
 
84
- const char* message_template = "Found `%s` when expecting `%s` at (%u:%u).";
85
-
86
- size_t message_size = 319;
87
- char* message = (char*) malloc(message_size);
88
-
89
- if (message) {
90
- char truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
91
- strncpy(truncated_argument_0, token_type_to_string(found->type), ERROR_MESSAGES_TRUNCATED_LENGTH);
92
- truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
93
-
94
- char truncated_argument_1[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
95
- strncpy(truncated_argument_1, token_type_to_string(expected_type), ERROR_MESSAGES_TRUNCATED_LENGTH);
96
- truncated_argument_1[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
97
-
98
- snprintf(
99
- message,
100
- message_size,
101
- message_template,
102
- truncated_argument_0,
103
- truncated_argument_1,
104
- found->location.start.line,
105
- found->location.start.column
106
- );
107
-
108
- unexpected_token_error->base.message = herb_strdup(message);
109
- free(message);
110
- } else {
111
- unexpected_token_error->base.message = herb_strdup("Found `%s` when expecting `%s` at (%u:%u).");
112
- }
83
+ const char* message_template = "Found %s when expecting %s at (%u:%u).";
84
+
85
+ hb_string_T truncated_argument_0 = hb_string_truncate(token_type_to_friendly_string(found->type), ERROR_MESSAGES_TRUNCATED_LENGTH);
86
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
87
+
88
+ hb_string_T truncated_argument_1 = hb_string_truncate(token_type_to_friendly_string(expected_type), ERROR_MESSAGES_TRUNCATED_LENGTH);
89
+ char* truncated_c_string_1 = hb_string_to_c_string_using_malloc(truncated_argument_1);
90
+
91
+ char message[315];
92
+ snprintf(
93
+ message,
94
+ sizeof(message),
95
+ message_template,
96
+ truncated_c_string_0 ? truncated_c_string_0 : "",
97
+ truncated_c_string_1 ? truncated_c_string_1 : "",
98
+ found->location.start.line,
99
+ found->location.start.column
100
+ );
101
+
102
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
103
+ if (truncated_c_string_1) { free(truncated_c_string_1); }
104
+ unexpected_token_error->base.message = hb_string_copy(hb_string(message), allocator);
113
105
 
114
106
  unexpected_token_error->expected_type = expected_type;
115
- unexpected_token_error->found = token_copy(found);
107
+ unexpected_token_error->found = token_copy(found, allocator);
116
108
  return unexpected_token_error;
117
109
  }
118
110
 
119
- void append_unexpected_token_error(token_type_T expected_type, token_T* found, position_T start, position_T end, hb_array_T* errors) {
120
- hb_array_append(errors, unexpected_token_error_init(expected_type, found, start, end));
111
+ 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) {
112
+ hb_array_append(errors, unexpected_token_error_init(expected_type, found, start, end, allocator));
121
113
  }
122
114
 
123
- MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error_init(token_T* closing_tag, position_T start, position_T end) {
124
- MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error = malloc(sizeof(MISSING_OPENING_TAG_ERROR_T));
115
+ MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error_init(token_T* closing_tag, position_T start, position_T end, hb_allocator_T* allocator) {
116
+ MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error = hb_allocator_alloc(allocator, sizeof(MISSING_OPENING_TAG_ERROR_T));
117
+
118
+ if (!missing_opening_tag_error) { return NULL; }
125
119
 
126
120
  error_init(&missing_opening_tag_error->base, MISSING_OPENING_TAG_ERROR, start, end);
127
121
 
128
122
  const char* message_template = "Found closing tag `</%s>` at (%u:%u) without a matching opening tag in the same scope.";
129
123
 
130
- size_t message_size = 235;
131
- char* message = (char*) malloc(message_size);
132
-
133
- if (message) {
134
- char truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
135
- strncpy(truncated_argument_0, closing_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
136
- truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
137
-
138
- snprintf(
139
- message,
140
- message_size,
141
- message_template,
142
- truncated_argument_0,
143
- closing_tag->location.start.line,
144
- closing_tag->location.start.column
145
- );
146
-
147
- missing_opening_tag_error->base.message = herb_strdup(message);
148
- free(message);
149
- } else {
150
- missing_opening_tag_error->base.message = herb_strdup("Found closing tag `</%s>` at (%u:%u) without a matching opening tag in the same scope.");
151
- }
124
+ hb_string_T truncated_argument_0 = hb_string_truncate(closing_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
125
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
126
+
127
+ char message[235];
128
+ snprintf(
129
+ message,
130
+ sizeof(message),
131
+ message_template,
132
+ truncated_c_string_0 ? truncated_c_string_0 : "",
133
+ closing_tag->location.start.line,
134
+ closing_tag->location.start.column
135
+ );
152
136
 
153
- missing_opening_tag_error->closing_tag = token_copy(closing_tag);
137
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
138
+ missing_opening_tag_error->base.message = hb_string_copy(hb_string(message), allocator);
139
+
140
+ missing_opening_tag_error->closing_tag = token_copy(closing_tag, allocator);
154
141
  return missing_opening_tag_error;
155
142
  }
156
143
 
157
- void append_missing_opening_tag_error(token_T* closing_tag, position_T start, position_T end, hb_array_T* errors) {
158
- hb_array_append(errors, missing_opening_tag_error_init(closing_tag, start, end));
144
+ void append_missing_opening_tag_error(token_T* closing_tag, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors) {
145
+ hb_array_append(errors, missing_opening_tag_error_init(closing_tag, start, end, allocator));
159
146
  }
160
147
 
161
- MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error_init(token_T* opening_tag, position_T start, position_T end) {
162
- MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error = malloc(sizeof(MISSING_CLOSING_TAG_ERROR_T));
148
+ MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error_init(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator) {
149
+ MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error = hb_allocator_alloc(allocator, sizeof(MISSING_CLOSING_TAG_ERROR_T));
150
+
151
+ if (!missing_closing_tag_error) { return NULL; }
163
152
 
164
153
  error_init(&missing_closing_tag_error->base, MISSING_CLOSING_TAG_ERROR, start, end);
165
154
 
166
155
  const char* message_template = "Opening tag `<%s>` at (%u:%u) doesn't have a matching closing tag `</%s>` in the same scope.";
167
156
 
168
- size_t message_size = 369;
169
- char* message = (char*) malloc(message_size);
170
-
171
- if (message) {
172
- char truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
173
- strncpy(truncated_argument_0, opening_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
174
- truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
175
-
176
- char truncated_argument_3[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
177
- strncpy(truncated_argument_3, opening_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
178
- truncated_argument_3[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
179
-
180
- snprintf(
181
- message,
182
- message_size,
183
- message_template,
184
- truncated_argument_0,
185
- opening_tag->location.start.line,
186
- opening_tag->location.start.column,
187
- truncated_argument_3
188
- );
189
-
190
- missing_closing_tag_error->base.message = herb_strdup(message);
191
- free(message);
192
- } else {
193
- missing_closing_tag_error->base.message = herb_strdup("Opening tag `<%s>` at (%u:%u) doesn't have a matching closing tag `</%s>` in the same scope.");
194
- }
157
+ hb_string_T truncated_argument_0 = hb_string_truncate(opening_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
158
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
159
+
160
+ hb_string_T truncated_argument_3 = hb_string_truncate(opening_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
161
+ char* truncated_c_string_3 = hb_string_to_c_string_using_malloc(truncated_argument_3);
195
162
 
196
- missing_closing_tag_error->opening_tag = token_copy(opening_tag);
163
+ char message[369];
164
+ snprintf(
165
+ message,
166
+ sizeof(message),
167
+ message_template,
168
+ truncated_c_string_0 ? truncated_c_string_0 : "",
169
+ opening_tag->location.start.line,
170
+ opening_tag->location.start.column,
171
+ truncated_c_string_3 ? truncated_c_string_3 : ""
172
+ );
173
+
174
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
175
+ if (truncated_c_string_3) { free(truncated_c_string_3); }
176
+ missing_closing_tag_error->base.message = hb_string_copy(hb_string(message), allocator);
177
+
178
+ missing_closing_tag_error->opening_tag = token_copy(opening_tag, allocator);
197
179
  return missing_closing_tag_error;
198
180
  }
199
181
 
200
- void append_missing_closing_tag_error(token_T* opening_tag, position_T start, position_T end, hb_array_T* errors) {
201
- hb_array_append(errors, missing_closing_tag_error_init(opening_tag, start, end));
182
+ void append_missing_closing_tag_error(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors) {
183
+ hb_array_append(errors, missing_closing_tag_error_init(opening_tag, start, end, allocator));
202
184
  }
203
185
 
204
- TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error_init(token_T* opening_tag, token_T* closing_tag, position_T start, position_T end) {
205
- TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error = malloc(sizeof(TAG_NAMES_MISMATCH_ERROR_T));
186
+ 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) {
187
+ TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error = hb_allocator_alloc(allocator, sizeof(TAG_NAMES_MISMATCH_ERROR_T));
188
+
189
+ if (!tag_names_mismatch_error) { return NULL; }
206
190
 
207
191
  error_init(&tag_names_mismatch_error->base, TAG_NAMES_MISMATCH_ERROR, start, end);
208
192
 
209
193
  const char* message_template = "Opening tag `<%s>` at (%u:%u) closed with `</%s>` at (%u:%u).";
210
194
 
211
- size_t message_size = 358;
212
- char* message = (char*) malloc(message_size);
213
-
214
- if (message) {
215
- char truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
216
- strncpy(truncated_argument_0, opening_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
217
- truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
218
-
219
- char truncated_argument_3[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
220
- strncpy(truncated_argument_3, closing_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
221
- truncated_argument_3[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
222
-
223
- snprintf(
224
- message,
225
- message_size,
226
- message_template,
227
- truncated_argument_0,
228
- opening_tag->location.start.line,
229
- opening_tag->location.start.column,
230
- truncated_argument_3,
231
- closing_tag->location.start.line,
232
- closing_tag->location.start.column
233
- );
234
-
235
- tag_names_mismatch_error->base.message = herb_strdup(message);
236
- free(message);
237
- } else {
238
- tag_names_mismatch_error->base.message = herb_strdup("Opening tag `<%s>` at (%u:%u) closed with `</%s>` at (%u:%u).");
239
- }
240
-
241
- tag_names_mismatch_error->opening_tag = token_copy(opening_tag);
242
- tag_names_mismatch_error->closing_tag = token_copy(closing_tag);
195
+ hb_string_T truncated_argument_0 = hb_string_truncate(opening_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
196
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
197
+
198
+ hb_string_T truncated_argument_3 = hb_string_truncate(closing_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
199
+ char* truncated_c_string_3 = hb_string_to_c_string_using_malloc(truncated_argument_3);
200
+
201
+ char message[358];
202
+ snprintf(
203
+ message,
204
+ sizeof(message),
205
+ message_template,
206
+ truncated_c_string_0 ? truncated_c_string_0 : "",
207
+ opening_tag->location.start.line,
208
+ opening_tag->location.start.column,
209
+ truncated_c_string_3 ? truncated_c_string_3 : "",
210
+ closing_tag->location.start.line,
211
+ closing_tag->location.start.column
212
+ );
213
+
214
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
215
+ if (truncated_c_string_3) { free(truncated_c_string_3); }
216
+ tag_names_mismatch_error->base.message = hb_string_copy(hb_string(message), allocator);
217
+
218
+ tag_names_mismatch_error->opening_tag = token_copy(opening_tag, allocator);
219
+ tag_names_mismatch_error->closing_tag = token_copy(closing_tag, allocator);
243
220
  return tag_names_mismatch_error;
244
221
  }
245
222
 
246
- void append_tag_names_mismatch_error(token_T* opening_tag, token_T* closing_tag, position_T start, position_T end, hb_array_T* errors) {
247
- hb_array_append(errors, tag_names_mismatch_error_init(opening_tag, closing_tag, start, end));
248
- }
249
-
250
- QUOTES_MISMATCH_ERROR_T* quotes_mismatch_error_init(token_T* opening_quote, token_T* closing_quote, position_T start, position_T end) {
251
- QUOTES_MISMATCH_ERROR_T* quotes_mismatch_error = malloc(sizeof(QUOTES_MISMATCH_ERROR_T));
252
-
253
- error_init(&quotes_mismatch_error->base, QUOTES_MISMATCH_ERROR, start, end);
254
-
255
- const char* message_template = "String opened with %s but closed with %s at (%u:%u).";
256
-
257
- size_t message_size = 329;
258
- char* message = (char*) malloc(message_size);
259
-
260
- if (message) {
261
- char truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
262
- strncpy(truncated_argument_0, opening_quote->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
263
- truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
264
-
265
- char truncated_argument_1[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
266
- strncpy(truncated_argument_1, closing_quote->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
267
- truncated_argument_1[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
268
-
269
- snprintf(
270
- message,
271
- message_size,
272
- message_template,
273
- truncated_argument_0,
274
- truncated_argument_1,
275
- closing_quote->location.start.line,
276
- closing_quote->location.start.column
277
- );
278
-
279
- quotes_mismatch_error->base.message = herb_strdup(message);
280
- free(message);
281
- } else {
282
- quotes_mismatch_error->base.message = herb_strdup("String opened with %s but closed with %s at (%u:%u).");
283
- }
284
-
285
- quotes_mismatch_error->opening_quote = token_copy(opening_quote);
286
- quotes_mismatch_error->closing_quote = token_copy(closing_quote);
287
- return quotes_mismatch_error;
223
+ 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) {
224
+ hb_array_append(errors, tag_names_mismatch_error_init(opening_tag, closing_tag, start, end, allocator));
288
225
  }
289
226
 
290
- void append_quotes_mismatch_error(token_T* opening_quote, token_T* closing_quote, position_T start, position_T end, hb_array_T* errors) {
291
- hb_array_append(errors, quotes_mismatch_error_init(opening_quote, closing_quote, start, end));
292
- }
227
+ 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) {
228
+ VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error = hb_allocator_alloc(allocator, sizeof(VOID_ELEMENT_CLOSING_TAG_ERROR_T));
293
229
 
294
- VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error_init(token_T* tag_name, const char* expected, const char* found, position_T start, position_T end) {
295
- VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error = malloc(sizeof(VOID_ELEMENT_CLOSING_TAG_ERROR_T));
230
+ if (!void_element_closing_tag_error) { return NULL; }
296
231
 
297
232
  error_init(&void_element_closing_tag_error->base, VOID_ELEMENT_CLOSING_TAG_ERROR, start, end);
298
233
 
299
234
  const char* message_template = "`%s` is a void element and should not be used as a closing tag. Use `<%s>` or `<%s />` instead of `</%s>`.";
300
235
 
301
- size_t message_size = 619;
302
- char* message = (char*) malloc(message_size);
303
-
304
- if (message) {
305
- char truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
306
- strncpy(truncated_argument_0, tag_name->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
307
- truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
308
-
309
- char truncated_argument_1[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
310
- strncpy(truncated_argument_1, tag_name->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
311
- truncated_argument_1[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
312
-
313
- char truncated_argument_2[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
314
- strncpy(truncated_argument_2, tag_name->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
315
- truncated_argument_2[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
316
-
317
- char truncated_argument_3[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
318
- strncpy(truncated_argument_3, tag_name->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
319
- truncated_argument_3[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
320
-
321
- snprintf(
322
- message,
323
- message_size,
324
- message_template,
325
- truncated_argument_0,
326
- truncated_argument_1,
327
- truncated_argument_2,
328
- truncated_argument_3
329
- );
330
-
331
- void_element_closing_tag_error->base.message = herb_strdup(message);
332
- free(message);
333
- } else {
334
- void_element_closing_tag_error->base.message = herb_strdup("`%s` is a void element and should not be used as a closing tag. Use `<%s>` or `<%s />` instead of `</%s>`.");
335
- }
336
-
337
- void_element_closing_tag_error->tag_name = token_copy(tag_name);
338
- void_element_closing_tag_error->expected = herb_strdup(expected);
339
- void_element_closing_tag_error->found = herb_strdup(found);
236
+ hb_string_T truncated_argument_0 = hb_string_truncate(tag_name->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
237
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
238
+
239
+ hb_string_T truncated_argument_1 = hb_string_truncate(tag_name->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
240
+ char* truncated_c_string_1 = hb_string_to_c_string_using_malloc(truncated_argument_1);
241
+
242
+ hb_string_T truncated_argument_2 = hb_string_truncate(tag_name->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
243
+ char* truncated_c_string_2 = hb_string_to_c_string_using_malloc(truncated_argument_2);
244
+
245
+ hb_string_T truncated_argument_3 = hb_string_truncate(tag_name->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
246
+ char* truncated_c_string_3 = hb_string_to_c_string_using_malloc(truncated_argument_3);
247
+
248
+ char message[619];
249
+ snprintf(
250
+ message,
251
+ sizeof(message),
252
+ message_template,
253
+ truncated_c_string_0 ? truncated_c_string_0 : "",
254
+ truncated_c_string_1 ? truncated_c_string_1 : "",
255
+ truncated_c_string_2 ? truncated_c_string_2 : "",
256
+ truncated_c_string_3 ? truncated_c_string_3 : ""
257
+ );
258
+
259
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
260
+ if (truncated_c_string_1) { free(truncated_c_string_1); }
261
+ if (truncated_c_string_2) { free(truncated_c_string_2); }
262
+ if (truncated_c_string_3) { free(truncated_c_string_3); }
263
+ void_element_closing_tag_error->base.message = hb_string_copy(hb_string(message), allocator);
264
+
265
+ void_element_closing_tag_error->tag_name = token_copy(tag_name, allocator);
266
+ void_element_closing_tag_error->expected = hb_string_copy(expected, allocator);
267
+ void_element_closing_tag_error->found = hb_string_copy(found, allocator);
340
268
  return void_element_closing_tag_error;
341
269
  }
342
270
 
343
- void append_void_element_closing_tag_error(token_T* tag_name, const char* expected, const char* found, position_T start, position_T end, hb_array_T* errors) {
344
- hb_array_append(errors, void_element_closing_tag_error_init(tag_name, expected, found, start, end));
271
+ 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) {
272
+ hb_array_append(errors, void_element_closing_tag_error_init(tag_name, expected, found, start, end, allocator));
345
273
  }
346
274
 
347
- UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error_init(token_T* opening_tag, position_T start, position_T end) {
348
- UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error = malloc(sizeof(UNCLOSED_ELEMENT_ERROR_T));
275
+ UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error_init(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator) {
276
+ UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error = hb_allocator_alloc(allocator, sizeof(UNCLOSED_ELEMENT_ERROR_T));
277
+
278
+ if (!unclosed_element_error) { return NULL; }
349
279
 
350
280
  error_init(&unclosed_element_error->base, UNCLOSED_ELEMENT_ERROR, start, end);
351
281
 
352
282
  const char* message_template = "Tag `<%s>` opened at (%u:%u) was never closed before the end of document.";
353
283
 
354
- size_t message_size = 222;
355
- char* message = (char*) malloc(message_size);
356
-
357
- if (message) {
358
- char truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
359
- strncpy(truncated_argument_0, opening_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
360
- truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
361
-
362
- snprintf(
363
- message,
364
- message_size,
365
- message_template,
366
- truncated_argument_0,
367
- opening_tag->location.start.line,
368
- opening_tag->location.start.column
369
- );
370
-
371
- unclosed_element_error->base.message = herb_strdup(message);
372
- free(message);
373
- } else {
374
- unclosed_element_error->base.message = herb_strdup("Tag `<%s>` opened at (%u:%u) was never closed before the end of document.");
375
- }
284
+ hb_string_T truncated_argument_0 = hb_string_truncate(opening_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
285
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
286
+
287
+ char message[222];
288
+ snprintf(
289
+ message,
290
+ sizeof(message),
291
+ message_template,
292
+ truncated_c_string_0 ? truncated_c_string_0 : "",
293
+ opening_tag->location.start.line,
294
+ opening_tag->location.start.column
295
+ );
296
+
297
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
298
+ unclosed_element_error->base.message = hb_string_copy(hb_string(message), allocator);
376
299
 
377
- unclosed_element_error->opening_tag = token_copy(opening_tag);
300
+ unclosed_element_error->opening_tag = token_copy(opening_tag, allocator);
378
301
  return unclosed_element_error;
379
302
  }
380
303
 
381
- void append_unclosed_element_error(token_T* opening_tag, position_T start, position_T end, hb_array_T* errors) {
382
- hb_array_append(errors, unclosed_element_error_init(opening_tag, start, end));
304
+ void append_unclosed_element_error(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors) {
305
+ hb_array_append(errors, unclosed_element_error_init(opening_tag, start, end, allocator));
383
306
  }
384
307
 
385
- RUBY_PARSE_ERROR_T* ruby_parse_error_init(const char* error_message, const char* diagnostic_id, const char* level, position_T start, position_T end) {
386
- RUBY_PARSE_ERROR_T* ruby_parse_error = malloc(sizeof(RUBY_PARSE_ERROR_T));
308
+ 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) {
309
+ RUBY_PARSE_ERROR_T* ruby_parse_error = hb_allocator_alloc(allocator, sizeof(RUBY_PARSE_ERROR_T));
310
+
311
+ if (!ruby_parse_error) { return NULL; }
387
312
 
388
313
  error_init(&ruby_parse_error->base, RUBY_PARSE_ERROR, start, end);
389
314
 
390
315
  const char* message_template = "%s: %s";
391
316
 
392
- size_t message_size = 263;
393
- char* message = (char*) malloc(message_size);
394
-
395
- if (message) {
396
- char truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
397
- strncpy(truncated_argument_0, diagnostic_id, ERROR_MESSAGES_TRUNCATED_LENGTH);
398
- truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
399
-
400
- char truncated_argument_1[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
401
- strncpy(truncated_argument_1, error_message, ERROR_MESSAGES_TRUNCATED_LENGTH);
402
- truncated_argument_1[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
403
-
404
- snprintf(
405
- message,
406
- message_size,
407
- message_template,
408
- truncated_argument_0,
409
- truncated_argument_1
410
- );
411
-
412
- ruby_parse_error->base.message = herb_strdup(message);
413
- free(message);
414
- } else {
415
- ruby_parse_error->base.message = herb_strdup("%s: %s");
416
- }
317
+ hb_string_T truncated_argument_0 = hb_string_truncate(diagnostic_id, ERROR_MESSAGES_TRUNCATED_LENGTH);
318
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
319
+
320
+ hb_string_T truncated_argument_1 = hb_string_truncate(error_message, ERROR_MESSAGES_TRUNCATED_LENGTH);
321
+ char* truncated_c_string_1 = hb_string_to_c_string_using_malloc(truncated_argument_1);
322
+
323
+ char message[263];
324
+ snprintf(
325
+ message,
326
+ sizeof(message),
327
+ message_template,
328
+ truncated_c_string_0 ? truncated_c_string_0 : "",
329
+ truncated_c_string_1 ? truncated_c_string_1 : ""
330
+ );
417
331
 
418
- ruby_parse_error->error_message = herb_strdup(error_message);
419
- ruby_parse_error->diagnostic_id = herb_strdup(diagnostic_id);
420
- ruby_parse_error->level = herb_strdup(level);
332
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
333
+ if (truncated_c_string_1) { free(truncated_c_string_1); }
334
+ ruby_parse_error->base.message = hb_string_copy(hb_string(message), allocator);
335
+
336
+ ruby_parse_error->error_message = hb_string_copy(error_message, allocator);
337
+ ruby_parse_error->diagnostic_id = hb_string_copy(diagnostic_id, allocator);
338
+ ruby_parse_error->level = hb_string_copy(level, allocator);
421
339
  return ruby_parse_error;
422
340
  }
423
341
 
424
- void append_ruby_parse_error(const char* error_message, const char* diagnostic_id, const char* level, position_T start, position_T end, hb_array_T* errors) {
425
- hb_array_append(errors, ruby_parse_error_init(error_message, diagnostic_id, level, start, end));
342
+ 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) {
343
+ hb_array_append(errors, ruby_parse_error_init(error_message, diagnostic_id, level, start, end, allocator));
426
344
  }
427
345
 
428
- ERB_CONTROL_FLOW_SCOPE_ERROR_T* erb_control_flow_scope_error_init(const char* keyword, position_T start, position_T end) {
429
- ERB_CONTROL_FLOW_SCOPE_ERROR_T* erb_control_flow_scope_error = malloc(sizeof(ERB_CONTROL_FLOW_SCOPE_ERROR_T));
346
+ 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) {
347
+ ERB_CONTROL_FLOW_SCOPE_ERROR_T* erb_control_flow_scope_error = hb_allocator_alloc(allocator, sizeof(ERB_CONTROL_FLOW_SCOPE_ERROR_T));
348
+
349
+ if (!erb_control_flow_scope_error) { return NULL; }
430
350
 
431
351
  error_init(&erb_control_flow_scope_error->base, ERB_CONTROL_FLOW_SCOPE_ERROR, start, end);
432
352
 
433
353
  const char* message_template = "%s appears outside its control flow block. Keep ERB control flow statements together within the same HTML scope (tag, attribute, or content).";
434
354
 
435
- size_t message_size = 270;
436
- char* message = (char*) malloc(message_size);
437
-
438
- if (message) {
439
- char truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
440
- strncpy(truncated_argument_0, keyword, ERROR_MESSAGES_TRUNCATED_LENGTH);
441
- truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
442
-
443
- snprintf(
444
- message,
445
- message_size,
446
- message_template,
447
- truncated_argument_0
448
- );
449
-
450
- erb_control_flow_scope_error->base.message = herb_strdup(message);
451
- free(message);
452
- } else {
453
- erb_control_flow_scope_error->base.message = herb_strdup("%s appears outside its control flow block. Keep ERB control flow statements together within the same HTML scope (tag, attribute, or content).");
454
- }
355
+ hb_string_T truncated_argument_0 = hb_string_truncate(keyword, ERROR_MESSAGES_TRUNCATED_LENGTH);
356
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
357
+
358
+ char message[270];
359
+ snprintf(
360
+ message,
361
+ sizeof(message),
362
+ message_template,
363
+ truncated_c_string_0 ? truncated_c_string_0 : ""
364
+ );
455
365
 
456
- erb_control_flow_scope_error->keyword = herb_strdup(keyword);
366
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
367
+ erb_control_flow_scope_error->base.message = hb_string_copy(hb_string(message), allocator);
368
+
369
+ erb_control_flow_scope_error->keyword = hb_string_copy(keyword, allocator);
457
370
  return erb_control_flow_scope_error;
458
371
  }
459
372
 
460
- void append_erb_control_flow_scope_error(const char* keyword, position_T start, position_T end, hb_array_T* errors) {
461
- hb_array_append(errors, erb_control_flow_scope_error_init(keyword, start, end));
373
+ 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) {
374
+ hb_array_append(errors, erb_control_flow_scope_error_init(keyword, start, end, allocator));
462
375
  }
463
376
 
464
- MISSINGERB_END_TAG_ERROR_T* missingerb_end_tag_error_init(const char* keyword, position_T start, position_T end) {
465
- MISSINGERB_END_TAG_ERROR_T* missingerb_end_tag_error = malloc(sizeof(MISSINGERB_END_TAG_ERROR_T));
377
+ 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) {
378
+ MISSING_ERB_END_TAG_ERROR_T* missing_erb_end_tag_error = hb_allocator_alloc(allocator, sizeof(MISSING_ERB_END_TAG_ERROR_T));
379
+
380
+ if (!missing_erb_end_tag_error) { return NULL; }
466
381
 
467
- error_init(&missingerb_end_tag_error->base, MISSINGERB_END_TAG_ERROR, start, end);
382
+ error_init(&missing_erb_end_tag_error->base, MISSING_ERB_END_TAG_ERROR, start, end);
468
383
 
469
384
  const char* message_template = "%s started here but never closed with an end tag. The end tag may be in a different scope.";
470
385
 
471
- size_t message_size = 219;
472
- char* message = (char*) malloc(message_size);
473
-
474
- if (message) {
475
- char truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH + 1];
476
- strncpy(truncated_argument_0, keyword, ERROR_MESSAGES_TRUNCATED_LENGTH);
477
- truncated_argument_0[ERROR_MESSAGES_TRUNCATED_LENGTH] = '\0';
478
-
479
- snprintf(
480
- message,
481
- message_size,
482
- message_template,
483
- truncated_argument_0
484
- );
485
-
486
- missingerb_end_tag_error->base.message = herb_strdup(message);
487
- free(message);
488
- } else {
489
- missingerb_end_tag_error->base.message = herb_strdup("%s started here but never closed with an end tag. The end tag may be in a different scope.");
490
- }
386
+ hb_string_T truncated_argument_0 = hb_string_truncate(keyword, ERROR_MESSAGES_TRUNCATED_LENGTH);
387
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
388
+
389
+ char message[219];
390
+ snprintf(
391
+ message,
392
+ sizeof(message),
393
+ message_template,
394
+ truncated_c_string_0 ? truncated_c_string_0 : ""
395
+ );
491
396
 
492
- missingerb_end_tag_error->keyword = herb_strdup(keyword);
493
- return missingerb_end_tag_error;
397
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
398
+ missing_erb_end_tag_error->base.message = hb_string_copy(hb_string(message), allocator);
399
+
400
+ missing_erb_end_tag_error->keyword = hb_string_copy(keyword, allocator);
401
+ return missing_erb_end_tag_error;
494
402
  }
495
403
 
496
- void append_missingerb_end_tag_error(const char* keyword, position_T start, position_T end, hb_array_T* errors) {
497
- hb_array_append(errors, missingerb_end_tag_error_init(keyword, start, end));
404
+ 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) {
405
+ hb_array_append(errors, missing_erb_end_tag_error_init(keyword, start, end, allocator));
498
406
  }
499
407
 
500
- ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* erb_multiple_blocks_in_tag_error_init(position_T start, position_T end) {
501
- ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* erb_multiple_blocks_in_tag_error = malloc(sizeof(ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T));
408
+ ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* erb_multiple_blocks_in_tag_error_init(position_T start, position_T end, hb_allocator_T* allocator) {
409
+ ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* erb_multiple_blocks_in_tag_error = hb_allocator_alloc(allocator, sizeof(ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T));
410
+
411
+ if (!erb_multiple_blocks_in_tag_error) { return NULL; }
502
412
 
503
413
  error_init(&erb_multiple_blocks_in_tag_error->base, ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR, start, end);
504
414
 
505
- erb_multiple_blocks_in_tag_error->base.message = herb_strdup("Multiple unclosed control flow blocks in a single ERB tag. Split each block into its own ERB tag, or close all blocks within the same tag.");
415
+ erb_multiple_blocks_in_tag_error->base.message = hb_string_copy(hb_string("Multiple unclosed control flow blocks in a single ERB tag. Split each block into its own ERB tag, or close all blocks within the same tag."), allocator);
506
416
 
507
417
  return erb_multiple_blocks_in_tag_error;
508
418
  }
509
419
 
510
- void append_erb_multiple_blocks_in_tag_error(position_T start, position_T end, hb_array_T* errors) {
511
- hb_array_append(errors, erb_multiple_blocks_in_tag_error_init(start, end));
420
+ void append_erb_multiple_blocks_in_tag_error(position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors) {
421
+ hb_array_append(errors, erb_multiple_blocks_in_tag_error_init(start, end, allocator));
512
422
  }
513
423
 
514
- ERB_CASE_WITH_CONDITIONS_ERROR_T* erb_case_with_conditions_error_init(position_T start, position_T end) {
515
- ERB_CASE_WITH_CONDITIONS_ERROR_T* erb_case_with_conditions_error = malloc(sizeof(ERB_CASE_WITH_CONDITIONS_ERROR_T));
424
+ ERB_CASE_WITH_CONDITIONS_ERROR_T* erb_case_with_conditions_error_init(position_T start, position_T end, hb_allocator_T* allocator) {
425
+ ERB_CASE_WITH_CONDITIONS_ERROR_T* erb_case_with_conditions_error = hb_allocator_alloc(allocator, sizeof(ERB_CASE_WITH_CONDITIONS_ERROR_T));
426
+
427
+ if (!erb_case_with_conditions_error) { return NULL; }
516
428
 
517
429
  error_init(&erb_case_with_conditions_error->base, ERB_CASE_WITH_CONDITIONS_ERROR, start, end);
518
430
 
519
- erb_case_with_conditions_error->base.message = herb_strdup("A `case` statement with `when`/`in` in a single ERB tag cannot be formatted. Use separate tags for `case` and its conditions.");
431
+ erb_case_with_conditions_error->base.message = hb_string_copy(hb_string("A `case` statement with `when`/`in` conditions in a single ERB tag cannot be reliably parsed, compiled, and formatted. Use separate ERB tags for `case` and its conditions (e.g., `<% case x %>` followed by `<% when y %>`)."), allocator);
520
432
 
521
433
  return erb_case_with_conditions_error;
522
434
  }
523
435
 
524
- void append_erb_case_with_conditions_error(position_T start, position_T end, hb_array_T* errors) {
525
- hb_array_append(errors, erb_case_with_conditions_error_init(start, end));
436
+ void append_erb_case_with_conditions_error(position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors) {
437
+ hb_array_append(errors, erb_case_with_conditions_error_init(start, end, allocator));
438
+ }
439
+
440
+ 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) {
441
+ CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR_T* conditional_element_multiple_tags_error = hb_allocator_alloc(allocator, sizeof(CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR_T));
442
+
443
+ if (!conditional_element_multiple_tags_error) { return NULL; }
444
+
445
+ error_init(&conditional_element_multiple_tags_error->base, CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR, start, end);
446
+
447
+ const char* message_template = "Conditional element pattern detected at (%zu:%zu) but the conditional block contains multiple HTML tags. Each conditional element must wrap exactly one opening and one closing tag. Consider nesting the conditionals individually.";
448
+
449
+ char message[269];
450
+ snprintf(
451
+ message,
452
+ sizeof(message),
453
+ message_template,
454
+ line,
455
+ column
456
+ );
457
+
458
+ conditional_element_multiple_tags_error->base.message = hb_string_copy(hb_string(message), allocator);
459
+
460
+ conditional_element_multiple_tags_error->line = line;
461
+ conditional_element_multiple_tags_error->column = column;
462
+ return conditional_element_multiple_tags_error;
463
+ }
464
+
465
+ 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) {
466
+ hb_array_append(errors, conditional_element_multiple_tags_error_init(line, column, start, end, allocator));
467
+ }
468
+
469
+ 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) {
470
+ CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR_T* conditional_element_condition_mismatch_error = hb_allocator_alloc(allocator, sizeof(CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR_T));
471
+
472
+ if (!conditional_element_condition_mismatch_error) { return NULL; }
473
+
474
+ error_init(&conditional_element_condition_mismatch_error->base, CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR, start, end);
475
+
476
+ const char* message_template = "Conditional element `<%s>` has mismatched conditions: opening uses `%s` at (%zu:%zu) but closing uses `%s` at (%zu:%zu). Both conditions must be identical.";
477
+
478
+ hb_string_T truncated_argument_0 = hb_string_truncate(tag_name, ERROR_MESSAGES_TRUNCATED_LENGTH);
479
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
480
+
481
+ hb_string_T truncated_argument_1 = hb_string_truncate(open_condition, ERROR_MESSAGES_TRUNCATED_LENGTH);
482
+ char* truncated_c_string_1 = hb_string_to_c_string_using_malloc(truncated_argument_1);
483
+
484
+ hb_string_T truncated_argument_4 = hb_string_truncate(close_condition, ERROR_MESSAGES_TRUNCATED_LENGTH);
485
+ char* truncated_c_string_4 = hb_string_to_c_string_using_malloc(truncated_argument_4);
486
+
487
+ char message[620];
488
+ snprintf(
489
+ message,
490
+ sizeof(message),
491
+ message_template,
492
+ truncated_c_string_0 ? truncated_c_string_0 : "",
493
+ truncated_c_string_1 ? truncated_c_string_1 : "",
494
+ open_line,
495
+ open_column,
496
+ truncated_c_string_4 ? truncated_c_string_4 : "",
497
+ close_line,
498
+ close_column
499
+ );
500
+
501
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
502
+ if (truncated_c_string_1) { free(truncated_c_string_1); }
503
+ if (truncated_c_string_4) { free(truncated_c_string_4); }
504
+ conditional_element_condition_mismatch_error->base.message = hb_string_copy(hb_string(message), allocator);
505
+
506
+ conditional_element_condition_mismatch_error->tag_name = hb_string_copy(tag_name, allocator);
507
+ conditional_element_condition_mismatch_error->open_condition = hb_string_copy(open_condition, allocator);
508
+ conditional_element_condition_mismatch_error->open_line = open_line;
509
+ conditional_element_condition_mismatch_error->open_column = open_column;
510
+ conditional_element_condition_mismatch_error->close_condition = hb_string_copy(close_condition, allocator);
511
+ conditional_element_condition_mismatch_error->close_line = close_line;
512
+ conditional_element_condition_mismatch_error->close_column = close_column;
513
+ return conditional_element_condition_mismatch_error;
514
+ }
515
+
516
+ 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) {
517
+ hb_array_append(errors, conditional_element_condition_mismatch_error_init(tag_name, open_condition, open_line, open_column, close_condition, close_line, close_column, start, end, allocator));
518
+ }
519
+
520
+ 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) {
521
+ INVALID_COMMENT_CLOSING_TAG_ERROR_T* invalid_comment_closing_tag_error = hb_allocator_alloc(allocator, sizeof(INVALID_COMMENT_CLOSING_TAG_ERROR_T));
522
+
523
+ if (!invalid_comment_closing_tag_error) { return NULL; }
524
+
525
+ error_init(&invalid_comment_closing_tag_error->base, INVALID_COMMENT_CLOSING_TAG_ERROR, start, end);
526
+
527
+ const char* message_template = "Invalid comment closing tag `%s` at (%u:%u). Use `-->` instead of `--!>`.";
528
+
529
+ hb_string_T truncated_argument_0 = hb_string_truncate(closing_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
530
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
531
+
532
+ char message[222];
533
+ snprintf(
534
+ message,
535
+ sizeof(message),
536
+ message_template,
537
+ truncated_c_string_0 ? truncated_c_string_0 : "",
538
+ closing_tag->location.start.line,
539
+ closing_tag->location.start.column
540
+ );
541
+
542
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
543
+ invalid_comment_closing_tag_error->base.message = hb_string_copy(hb_string(message), allocator);
544
+
545
+ invalid_comment_closing_tag_error->closing_tag = token_copy(closing_tag, allocator);
546
+ return invalid_comment_closing_tag_error;
547
+ }
548
+
549
+ 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) {
550
+ hb_array_append(errors, invalid_comment_closing_tag_error_init(closing_tag, start, end, allocator));
551
+ }
552
+
553
+ 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) {
554
+ OMITTED_CLOSING_TAG_ERROR_T* omitted_closing_tag_error = hb_allocator_alloc(allocator, sizeof(OMITTED_CLOSING_TAG_ERROR_T));
555
+
556
+ if (!omitted_closing_tag_error) { return NULL; }
557
+
558
+ error_init(&omitted_closing_tag_error->base, OMITTED_CLOSING_TAG_ERROR, start, end);
559
+
560
+ const char* message_template = "Element `<%s>` at (%u:%u) has its closing tag omitted. While valid HTML, consider adding an explicit `</%s>` closing tag at (%u:%u) for clarity, or set `strict: false` to allow this.";
561
+
562
+ hb_string_T truncated_argument_0 = hb_string_truncate(opening_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
563
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
564
+
565
+ hb_string_T truncated_argument_3 = hb_string_truncate(opening_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
566
+ char* truncated_c_string_3 = hb_string_to_c_string_using_malloc(truncated_argument_3);
567
+
568
+ char message[479];
569
+ snprintf(
570
+ message,
571
+ sizeof(message),
572
+ message_template,
573
+ truncated_c_string_0 ? truncated_c_string_0 : "",
574
+ opening_tag->location.start.line,
575
+ opening_tag->location.start.column,
576
+ truncated_c_string_3 ? truncated_c_string_3 : "",
577
+ insertion_point.line,
578
+ insertion_point.column
579
+ );
580
+
581
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
582
+ if (truncated_c_string_3) { free(truncated_c_string_3); }
583
+ omitted_closing_tag_error->base.message = hb_string_copy(hb_string(message), allocator);
584
+
585
+ omitted_closing_tag_error->opening_tag = token_copy(opening_tag, allocator);
586
+ omitted_closing_tag_error->insertion_point = insertion_point;
587
+ return omitted_closing_tag_error;
588
+ }
589
+
590
+ 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) {
591
+ hb_array_append(errors, omitted_closing_tag_error_init(opening_tag, insertion_point, start, end, allocator));
592
+ }
593
+
594
+ UNCLOSED_OPEN_TAG_ERROR_T* unclosed_open_tag_error_init(token_T* tag_name, position_T start, position_T end, hb_allocator_T* allocator) {
595
+ UNCLOSED_OPEN_TAG_ERROR_T* unclosed_open_tag_error = hb_allocator_alloc(allocator, sizeof(UNCLOSED_OPEN_TAG_ERROR_T));
596
+
597
+ if (!unclosed_open_tag_error) { return NULL; }
598
+
599
+ error_init(&unclosed_open_tag_error->base, UNCLOSED_OPEN_TAG_ERROR, start, end);
600
+
601
+ const char* message_template = "Opening tag `<%s>` at (%u:%u) is missing closing `>`.";
602
+
603
+ hb_string_T truncated_argument_0 = hb_string_truncate(tag_name->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
604
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
605
+
606
+ char message[202];
607
+ snprintf(
608
+ message,
609
+ sizeof(message),
610
+ message_template,
611
+ truncated_c_string_0 ? truncated_c_string_0 : "",
612
+ tag_name->location.start.line,
613
+ tag_name->location.start.column
614
+ );
615
+
616
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
617
+ unclosed_open_tag_error->base.message = hb_string_copy(hb_string(message), allocator);
618
+
619
+ unclosed_open_tag_error->tag_name = token_copy(tag_name, allocator);
620
+ return unclosed_open_tag_error;
621
+ }
622
+
623
+ void append_unclosed_open_tag_error(token_T* tag_name, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors) {
624
+ hb_array_append(errors, unclosed_open_tag_error_init(tag_name, start, end, allocator));
625
+ }
626
+
627
+ UNCLOSED_CLOSE_TAG_ERROR_T* unclosed_close_tag_error_init(token_T* tag_name, position_T start, position_T end, hb_allocator_T* allocator) {
628
+ UNCLOSED_CLOSE_TAG_ERROR_T* unclosed_close_tag_error = hb_allocator_alloc(allocator, sizeof(UNCLOSED_CLOSE_TAG_ERROR_T));
629
+
630
+ if (!unclosed_close_tag_error) { return NULL; }
631
+
632
+ error_init(&unclosed_close_tag_error->base, UNCLOSED_CLOSE_TAG_ERROR, start, end);
633
+
634
+ const char* message_template = "Closing tag `</%s>` at (%u:%u) is missing closing `>`.";
635
+
636
+ hb_string_T truncated_argument_0 = hb_string_truncate(tag_name->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
637
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
638
+
639
+ char message[203];
640
+ snprintf(
641
+ message,
642
+ sizeof(message),
643
+ message_template,
644
+ truncated_c_string_0 ? truncated_c_string_0 : "",
645
+ tag_name->location.start.line,
646
+ tag_name->location.start.column
647
+ );
648
+
649
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
650
+ unclosed_close_tag_error->base.message = hb_string_copy(hb_string(message), allocator);
651
+
652
+ unclosed_close_tag_error->tag_name = token_copy(tag_name, allocator);
653
+ return unclosed_close_tag_error;
654
+ }
655
+
656
+ void append_unclosed_close_tag_error(token_T* tag_name, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors) {
657
+ hb_array_append(errors, unclosed_close_tag_error_init(tag_name, start, end, allocator));
658
+ }
659
+
660
+ UNCLOSED_QUOTE_ERROR_T* unclosed_quote_error_init(token_T* opening_quote, position_T start, position_T end, hb_allocator_T* allocator) {
661
+ UNCLOSED_QUOTE_ERROR_T* unclosed_quote_error = hb_allocator_alloc(allocator, sizeof(UNCLOSED_QUOTE_ERROR_T));
662
+
663
+ if (!unclosed_quote_error) { return NULL; }
664
+
665
+ error_init(&unclosed_quote_error->base, UNCLOSED_QUOTE_ERROR, start, end);
666
+
667
+ const char* message_template = "Attribute value opened with %s at (%u:%u) was never closed.";
668
+
669
+ hb_string_T truncated_argument_0 = hb_string_truncate(opening_quote->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
670
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
671
+
672
+ char message[208];
673
+ snprintf(
674
+ message,
675
+ sizeof(message),
676
+ message_template,
677
+ truncated_c_string_0 ? truncated_c_string_0 : "",
678
+ opening_quote->location.start.line,
679
+ opening_quote->location.start.column
680
+ );
681
+
682
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
683
+ unclosed_quote_error->base.message = hb_string_copy(hb_string(message), allocator);
684
+
685
+ unclosed_quote_error->opening_quote = token_copy(opening_quote, allocator);
686
+ return unclosed_quote_error;
687
+ }
688
+
689
+ void append_unclosed_quote_error(token_T* opening_quote, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors) {
690
+ hb_array_append(errors, unclosed_quote_error_init(opening_quote, start, end, allocator));
691
+ }
692
+
693
+ 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) {
694
+ MISSING_ATTRIBUTE_VALUE_ERROR_T* missing_attribute_value_error = hb_allocator_alloc(allocator, sizeof(MISSING_ATTRIBUTE_VALUE_ERROR_T));
695
+
696
+ if (!missing_attribute_value_error) { return NULL; }
697
+
698
+ error_init(&missing_attribute_value_error->base, MISSING_ATTRIBUTE_VALUE_ERROR, start, end);
699
+
700
+ const char* message_template = "Attribute `%s` at (%u:%u) is missing a value after the equals sign.";
701
+
702
+ hb_string_T truncated_argument_0 = hb_string_truncate(attribute_name, ERROR_MESSAGES_TRUNCATED_LENGTH);
703
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
704
+
705
+ char message[216];
706
+ snprintf(
707
+ message,
708
+ sizeof(message),
709
+ message_template,
710
+ truncated_c_string_0 ? truncated_c_string_0 : "",
711
+ start.line,
712
+ start.column
713
+ );
714
+
715
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
716
+ missing_attribute_value_error->base.message = hb_string_copy(hb_string(message), allocator);
717
+
718
+ missing_attribute_value_error->attribute_name = hb_string_copy(attribute_name, allocator);
719
+ return missing_attribute_value_error;
720
+ }
721
+
722
+ 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) {
723
+ hb_array_append(errors, missing_attribute_value_error_init(attribute_name, start, end, allocator));
724
+ }
725
+
726
+ UNCLOSED_ERB_TAG_ERROR_T* unclosed_erb_tag_error_init(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator) {
727
+ UNCLOSED_ERB_TAG_ERROR_T* unclosed_erb_tag_error = hb_allocator_alloc(allocator, sizeof(UNCLOSED_ERB_TAG_ERROR_T));
728
+
729
+ if (!unclosed_erb_tag_error) { return NULL; }
730
+
731
+ error_init(&unclosed_erb_tag_error->base, UNCLOSED_ERB_TAG_ERROR, start, end);
732
+
733
+ const char* message_template = "ERB tag `%s` at (%u:%u) is missing closing `%%>`.";
734
+
735
+ hb_string_T truncated_argument_0 = hb_string_truncate(opening_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
736
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
737
+
738
+ char message[198];
739
+ snprintf(
740
+ message,
741
+ sizeof(message),
742
+ message_template,
743
+ truncated_c_string_0 ? truncated_c_string_0 : "",
744
+ opening_tag->location.start.line,
745
+ opening_tag->location.start.column
746
+ );
747
+
748
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
749
+ unclosed_erb_tag_error->base.message = hb_string_copy(hb_string(message), allocator);
750
+
751
+ unclosed_erb_tag_error->opening_tag = token_copy(opening_tag, allocator);
752
+ return unclosed_erb_tag_error;
753
+ }
754
+
755
+ void append_unclosed_erb_tag_error(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors) {
756
+ hb_array_append(errors, unclosed_erb_tag_error_init(opening_tag, start, end, allocator));
757
+ }
758
+
759
+ STRAY_ERB_CLOSING_TAG_ERROR_T* stray_erb_closing_tag_error_init(position_T start, position_T end, hb_allocator_T* allocator) {
760
+ STRAY_ERB_CLOSING_TAG_ERROR_T* stray_erb_closing_tag_error = hb_allocator_alloc(allocator, sizeof(STRAY_ERB_CLOSING_TAG_ERROR_T));
761
+
762
+ if (!stray_erb_closing_tag_error) { return NULL; }
763
+
764
+ error_init(&stray_erb_closing_tag_error->base, STRAY_ERB_CLOSING_TAG_ERROR, start, end);
765
+
766
+ const char* message_template = "Stray `%%>` found at (%u:%u). This closing delimiter is not part of an ERB tag and will be treated as plain text. If you want a literal `%%>`, use the HTML entities `&percnt;&gt;` instead.";
767
+
768
+ char message[209];
769
+ snprintf(
770
+ message,
771
+ sizeof(message),
772
+ message_template,
773
+ start.line,
774
+ start.column
775
+ );
776
+
777
+ stray_erb_closing_tag_error->base.message = hb_string_copy(hb_string(message), allocator);
778
+
779
+ return stray_erb_closing_tag_error;
780
+ }
781
+
782
+ void append_stray_erb_closing_tag_error(position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors) {
783
+ hb_array_append(errors, stray_erb_closing_tag_error_init(start, end, allocator));
784
+ }
785
+
786
+ 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) {
787
+ NESTED_ERB_TAG_ERROR_T* nested_erb_tag_error = hb_allocator_alloc(allocator, sizeof(NESTED_ERB_TAG_ERROR_T));
788
+
789
+ if (!nested_erb_tag_error) { return NULL; }
790
+
791
+ error_init(&nested_erb_tag_error->base, NESTED_ERB_TAG_ERROR, start, end);
792
+
793
+ const char* message_template = "ERB tag `%s` at (%u:%u) was terminated by nested `<%%` tag at (%zu:%zu). Nesting `<%%` tags is not supported.";
794
+
795
+ hb_string_T truncated_argument_0 = hb_string_truncate(opening_tag->value, ERROR_MESSAGES_TRUNCATED_LENGTH);
796
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
797
+
798
+ char message[298];
799
+ snprintf(
800
+ message,
801
+ sizeof(message),
802
+ message_template,
803
+ truncated_c_string_0 ? truncated_c_string_0 : "",
804
+ opening_tag->location.start.line,
805
+ opening_tag->location.start.column,
806
+ nested_tag_line,
807
+ nested_tag_column
808
+ );
809
+
810
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
811
+ nested_erb_tag_error->base.message = hb_string_copy(hb_string(message), allocator);
812
+
813
+ nested_erb_tag_error->opening_tag = token_copy(opening_tag, allocator);
814
+ nested_erb_tag_error->nested_tag_line = nested_tag_line;
815
+ nested_erb_tag_error->nested_tag_column = nested_tag_column;
816
+ return nested_erb_tag_error;
817
+ }
818
+
819
+ 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) {
820
+ hb_array_append(errors, nested_erb_tag_error_init(opening_tag, nested_tag_line, nested_tag_column, start, end, allocator));
821
+ }
822
+
823
+ RENDER_AMBIGUOUS_LOCALS_ERROR_T* render_ambiguous_locals_error_init(hb_string_T partial, position_T start, position_T end, hb_allocator_T* allocator) {
824
+ RENDER_AMBIGUOUS_LOCALS_ERROR_T* render_ambiguous_locals_error = hb_allocator_alloc(allocator, sizeof(RENDER_AMBIGUOUS_LOCALS_ERROR_T));
825
+
826
+ if (!render_ambiguous_locals_error) { return NULL; }
827
+
828
+ error_init(&render_ambiguous_locals_error->base, RENDER_AMBIGUOUS_LOCALS_ERROR, start, end);
829
+
830
+ const char* message_template = "Did you mean `render partial: '%s', locals: { ... }`? Using `render '%s', locals: { ... }` passes a local variable named `locals` to the partial instead of setting the `locals:` option.";
831
+
832
+ hb_string_T truncated_argument_0 = hb_string_truncate(partial, ERROR_MESSAGES_TRUNCATED_LENGTH);
833
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
834
+
835
+ hb_string_T truncated_argument_1 = hb_string_truncate(partial, ERROR_MESSAGES_TRUNCATED_LENGTH);
836
+ char* truncated_c_string_1 = hb_string_to_c_string_using_malloc(truncated_argument_1);
837
+
838
+ char message[442];
839
+ snprintf(
840
+ message,
841
+ sizeof(message),
842
+ message_template,
843
+ truncated_c_string_0 ? truncated_c_string_0 : "",
844
+ truncated_c_string_1 ? truncated_c_string_1 : ""
845
+ );
846
+
847
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
848
+ if (truncated_c_string_1) { free(truncated_c_string_1); }
849
+ render_ambiguous_locals_error->base.message = hb_string_copy(hb_string(message), allocator);
850
+
851
+ render_ambiguous_locals_error->partial = hb_string_copy(partial, allocator);
852
+ return render_ambiguous_locals_error;
853
+ }
854
+
855
+ void append_render_ambiguous_locals_error(hb_string_T partial, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors) {
856
+ hb_array_append(errors, render_ambiguous_locals_error_init(partial, start, end, allocator));
857
+ }
858
+
859
+ 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) {
860
+ RENDER_MISSING_LOCALS_ERROR_T* render_missing_locals_error = hb_allocator_alloc(allocator, sizeof(RENDER_MISSING_LOCALS_ERROR_T));
861
+
862
+ if (!render_missing_locals_error) { return NULL; }
863
+
864
+ error_init(&render_missing_locals_error->base, RENDER_MISSING_LOCALS_ERROR, start, end);
865
+
866
+ const char* message_template = "Wrap `%s` in `locals: { ... }` when using `partial:`. Use `render partial: '%s', locals: { %s }` instead. Without `locals:`, these keyword arguments are ignored.";
867
+
868
+ hb_string_T truncated_argument_0 = hb_string_truncate(keywords, ERROR_MESSAGES_TRUNCATED_LENGTH);
869
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
870
+
871
+ hb_string_T truncated_argument_1 = hb_string_truncate(partial, ERROR_MESSAGES_TRUNCATED_LENGTH);
872
+ char* truncated_c_string_1 = hb_string_to_c_string_using_malloc(truncated_argument_1);
873
+
874
+ hb_string_T truncated_argument_2 = hb_string_truncate(keywords, ERROR_MESSAGES_TRUNCATED_LENGTH);
875
+ char* truncated_c_string_2 = hb_string_to_c_string_using_malloc(truncated_argument_2);
876
+
877
+ char message[546];
878
+ snprintf(
879
+ message,
880
+ sizeof(message),
881
+ message_template,
882
+ truncated_c_string_0 ? truncated_c_string_0 : "",
883
+ truncated_c_string_1 ? truncated_c_string_1 : "",
884
+ truncated_c_string_2 ? truncated_c_string_2 : ""
885
+ );
886
+
887
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
888
+ if (truncated_c_string_1) { free(truncated_c_string_1); }
889
+ if (truncated_c_string_2) { free(truncated_c_string_2); }
890
+ render_missing_locals_error->base.message = hb_string_copy(hb_string(message), allocator);
891
+
892
+ render_missing_locals_error->partial = hb_string_copy(partial, allocator);
893
+ render_missing_locals_error->keywords = hb_string_copy(keywords, allocator);
894
+ return render_missing_locals_error;
895
+ }
896
+
897
+ 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) {
898
+ hb_array_append(errors, render_missing_locals_error_init(partial, keywords, start, end, allocator));
899
+ }
900
+
901
+ RENDER_NO_ARGUMENTS_ERROR_T* render_no_arguments_error_init(position_T start, position_T end, hb_allocator_T* allocator) {
902
+ RENDER_NO_ARGUMENTS_ERROR_T* render_no_arguments_error = hb_allocator_alloc(allocator, sizeof(RENDER_NO_ARGUMENTS_ERROR_T));
903
+
904
+ if (!render_no_arguments_error) { return NULL; }
905
+
906
+ error_init(&render_no_arguments_error->base, RENDER_NO_ARGUMENTS_ERROR, start, end);
907
+
908
+ render_no_arguments_error->base.message = hb_string_copy(hb_string("No arguments passed to `render`. It needs a partial name, a keyword argument like `partial:`, `template:`, or `layout:`, or a renderable object."), allocator);
909
+
910
+ return render_no_arguments_error;
911
+ }
912
+
913
+ void append_render_no_arguments_error(position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors) {
914
+ hb_array_append(errors, render_no_arguments_error_init(start, end, allocator));
915
+ }
916
+
917
+ 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) {
918
+ RENDER_CONFLICTING_PARTIAL_ERROR_T* render_conflicting_partial_error = hb_allocator_alloc(allocator, sizeof(RENDER_CONFLICTING_PARTIAL_ERROR_T));
919
+
920
+ if (!render_conflicting_partial_error) { return NULL; }
921
+
922
+ error_init(&render_conflicting_partial_error->base, RENDER_CONFLICTING_PARTIAL_ERROR, start, end);
923
+
924
+ const char* message_template = "Both a positional partial `'%s'` and a keyword `partial: '%s'` were passed to `render`. Use one form or the other, not both.";
925
+
926
+ hb_string_T truncated_argument_0 = hb_string_truncate(positional_partial, ERROR_MESSAGES_TRUNCATED_LENGTH);
927
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
928
+
929
+ hb_string_T truncated_argument_1 = hb_string_truncate(keyword_partial, ERROR_MESSAGES_TRUNCATED_LENGTH);
930
+ char* truncated_c_string_1 = hb_string_to_c_string_using_malloc(truncated_argument_1);
931
+
932
+ char message[381];
933
+ snprintf(
934
+ message,
935
+ sizeof(message),
936
+ message_template,
937
+ truncated_c_string_0 ? truncated_c_string_0 : "",
938
+ truncated_c_string_1 ? truncated_c_string_1 : ""
939
+ );
940
+
941
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
942
+ if (truncated_c_string_1) { free(truncated_c_string_1); }
943
+ render_conflicting_partial_error->base.message = hb_string_copy(hb_string(message), allocator);
944
+
945
+ render_conflicting_partial_error->positional_partial = hb_string_copy(positional_partial, allocator);
946
+ render_conflicting_partial_error->keyword_partial = hb_string_copy(keyword_partial, allocator);
947
+ return render_conflicting_partial_error;
948
+ }
949
+
950
+ 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) {
951
+ hb_array_append(errors, render_conflicting_partial_error_init(positional_partial, keyword_partial, start, end, allocator));
952
+ }
953
+
954
+ 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) {
955
+ RENDER_INVALID_AS_OPTION_ERROR_T* render_invalid_as_option_error = hb_allocator_alloc(allocator, sizeof(RENDER_INVALID_AS_OPTION_ERROR_T));
956
+
957
+ if (!render_invalid_as_option_error) { return NULL; }
958
+
959
+ error_init(&render_invalid_as_option_error->base, RENDER_INVALID_AS_OPTION_ERROR, start, end);
960
+
961
+ const char* message_template = "The `as:` value `'%s'` is not a valid Ruby identifier. Use a name that starts with a lowercase letter or underscore, like `as: :item`.";
962
+
963
+ hb_string_T truncated_argument_0 = hb_string_truncate(as_value, ERROR_MESSAGES_TRUNCATED_LENGTH);
964
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
965
+
966
+ char message[263];
967
+ snprintf(
968
+ message,
969
+ sizeof(message),
970
+ message_template,
971
+ truncated_c_string_0 ? truncated_c_string_0 : ""
972
+ );
973
+
974
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
975
+ render_invalid_as_option_error->base.message = hb_string_copy(hb_string(message), allocator);
976
+
977
+ render_invalid_as_option_error->as_value = hb_string_copy(as_value, allocator);
978
+ return render_invalid_as_option_error;
979
+ }
980
+
981
+ 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) {
982
+ hb_array_append(errors, render_invalid_as_option_error_init(as_value, start, end, allocator));
983
+ }
984
+
985
+ RENDER_OBJECT_AND_COLLECTION_ERROR_T* render_object_and_collection_error_init(position_T start, position_T end, hb_allocator_T* allocator) {
986
+ RENDER_OBJECT_AND_COLLECTION_ERROR_T* render_object_and_collection_error = hb_allocator_alloc(allocator, sizeof(RENDER_OBJECT_AND_COLLECTION_ERROR_T));
987
+
988
+ if (!render_object_and_collection_error) { return NULL; }
989
+
990
+ error_init(&render_object_and_collection_error->base, RENDER_OBJECT_AND_COLLECTION_ERROR, start, end);
991
+
992
+ render_object_and_collection_error->base.message = hb_string_copy(hb_string("The `object:` and `collection:` options are mutually exclusive. Use one or the other in your `render` call."), allocator);
993
+
994
+ return render_object_and_collection_error;
995
+ }
996
+
997
+ void append_render_object_and_collection_error(position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors) {
998
+ hb_array_append(errors, render_object_and_collection_error_init(start, end, allocator));
999
+ }
1000
+
1001
+ 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) {
1002
+ RENDER_LAYOUT_WITHOUT_BLOCK_ERROR_T* render_layout_without_block_error = hb_allocator_alloc(allocator, sizeof(RENDER_LAYOUT_WITHOUT_BLOCK_ERROR_T));
1003
+
1004
+ if (!render_layout_without_block_error) { return NULL; }
1005
+
1006
+ error_init(&render_layout_without_block_error->base, RENDER_LAYOUT_WITHOUT_BLOCK_ERROR, start, end);
1007
+
1008
+ const char* message_template = "Layout rendering needs a block. Use `render layout: '%s' do ... end` so the layout has content to wrap.";
1009
+
1010
+ hb_string_T truncated_argument_0 = hb_string_truncate(layout, ERROR_MESSAGES_TRUNCATED_LENGTH);
1011
+ char* truncated_c_string_0 = hb_string_to_c_string_using_malloc(truncated_argument_0);
1012
+
1013
+ char message[232];
1014
+ snprintf(
1015
+ message,
1016
+ sizeof(message),
1017
+ message_template,
1018
+ truncated_c_string_0 ? truncated_c_string_0 : ""
1019
+ );
1020
+
1021
+ if (truncated_c_string_0) { free(truncated_c_string_0); }
1022
+ render_layout_without_block_error->base.message = hb_string_copy(hb_string(message), allocator);
1023
+
1024
+ render_layout_without_block_error->layout = hb_string_copy(layout, allocator);
1025
+ return render_layout_without_block_error;
1026
+ }
1027
+
1028
+ 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) {
1029
+ hb_array_append(errors, render_layout_without_block_error_init(layout, start, end, allocator));
526
1030
  }
527
1031
 
528
- const char* error_type_to_string(ERROR_T* error) {
1032
+ hb_string_T error_type_to_string(ERROR_T* error) {
529
1033
  switch (error->type) {
530
- case UNEXPECTED_ERROR: return "UNEXPECTED_ERROR";
531
- case UNEXPECTED_TOKEN_ERROR: return "UNEXPECTED_TOKEN_ERROR";
532
- case MISSING_OPENING_TAG_ERROR: return "MISSING_OPENING_TAG_ERROR";
533
- case MISSING_CLOSING_TAG_ERROR: return "MISSING_CLOSING_TAG_ERROR";
534
- case TAG_NAMES_MISMATCH_ERROR: return "TAG_NAMES_MISMATCH_ERROR";
535
- case QUOTES_MISMATCH_ERROR: return "QUOTES_MISMATCH_ERROR";
536
- case VOID_ELEMENT_CLOSING_TAG_ERROR: return "VOID_ELEMENT_CLOSING_TAG_ERROR";
537
- case UNCLOSED_ELEMENT_ERROR: return "UNCLOSED_ELEMENT_ERROR";
538
- case RUBY_PARSE_ERROR: return "RUBY_PARSE_ERROR";
539
- case ERB_CONTROL_FLOW_SCOPE_ERROR: return "ERB_CONTROL_FLOW_SCOPE_ERROR";
540
- case MISSINGERB_END_TAG_ERROR: return "MISSINGERB_END_TAG_ERROR";
541
- case ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR: return "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR";
542
- case ERB_CASE_WITH_CONDITIONS_ERROR: return "ERB_CASE_WITH_CONDITIONS_ERROR";
1034
+ case UNEXPECTED_ERROR: return hb_string("UNEXPECTED_ERROR");
1035
+ case UNEXPECTED_TOKEN_ERROR: return hb_string("UNEXPECTED_TOKEN_ERROR");
1036
+ case MISSING_OPENING_TAG_ERROR: return hb_string("MISSING_OPENING_TAG_ERROR");
1037
+ case MISSING_CLOSING_TAG_ERROR: return hb_string("MISSING_CLOSING_TAG_ERROR");
1038
+ case TAG_NAMES_MISMATCH_ERROR: return hb_string("TAG_NAMES_MISMATCH_ERROR");
1039
+ case VOID_ELEMENT_CLOSING_TAG_ERROR: return hb_string("VOID_ELEMENT_CLOSING_TAG_ERROR");
1040
+ case UNCLOSED_ELEMENT_ERROR: return hb_string("UNCLOSED_ELEMENT_ERROR");
1041
+ case RUBY_PARSE_ERROR: return hb_string("RUBY_PARSE_ERROR");
1042
+ case ERB_CONTROL_FLOW_SCOPE_ERROR: return hb_string("ERB_CONTROL_FLOW_SCOPE_ERROR");
1043
+ case MISSING_ERB_END_TAG_ERROR: return hb_string("MISSING_ERB_END_TAG_ERROR");
1044
+ case ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR: return hb_string("ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR");
1045
+ case ERB_CASE_WITH_CONDITIONS_ERROR: return hb_string("ERB_CASE_WITH_CONDITIONS_ERROR");
1046
+ case CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR: return hb_string("CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR");
1047
+ case CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR: return hb_string("CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR");
1048
+ case INVALID_COMMENT_CLOSING_TAG_ERROR: return hb_string("INVALID_COMMENT_CLOSING_TAG_ERROR");
1049
+ case OMITTED_CLOSING_TAG_ERROR: return hb_string("OMITTED_CLOSING_TAG_ERROR");
1050
+ case UNCLOSED_OPEN_TAG_ERROR: return hb_string("UNCLOSED_OPEN_TAG_ERROR");
1051
+ case UNCLOSED_CLOSE_TAG_ERROR: return hb_string("UNCLOSED_CLOSE_TAG_ERROR");
1052
+ case UNCLOSED_QUOTE_ERROR: return hb_string("UNCLOSED_QUOTE_ERROR");
1053
+ case MISSING_ATTRIBUTE_VALUE_ERROR: return hb_string("MISSING_ATTRIBUTE_VALUE_ERROR");
1054
+ case UNCLOSED_ERB_TAG_ERROR: return hb_string("UNCLOSED_ERB_TAG_ERROR");
1055
+ case STRAY_ERB_CLOSING_TAG_ERROR: return hb_string("STRAY_ERB_CLOSING_TAG_ERROR");
1056
+ case NESTED_ERB_TAG_ERROR: return hb_string("NESTED_ERB_TAG_ERROR");
1057
+ case RENDER_AMBIGUOUS_LOCALS_ERROR: return hb_string("RENDER_AMBIGUOUS_LOCALS_ERROR");
1058
+ case RENDER_MISSING_LOCALS_ERROR: return hb_string("RENDER_MISSING_LOCALS_ERROR");
1059
+ case RENDER_NO_ARGUMENTS_ERROR: return hb_string("RENDER_NO_ARGUMENTS_ERROR");
1060
+ case RENDER_CONFLICTING_PARTIAL_ERROR: return hb_string("RENDER_CONFLICTING_PARTIAL_ERROR");
1061
+ case RENDER_INVALID_AS_OPTION_ERROR: return hb_string("RENDER_INVALID_AS_OPTION_ERROR");
1062
+ case RENDER_OBJECT_AND_COLLECTION_ERROR: return hb_string("RENDER_OBJECT_AND_COLLECTION_ERROR");
1063
+ case RENDER_LAYOUT_WITHOUT_BLOCK_ERROR: return hb_string("RENDER_LAYOUT_WITHOUT_BLOCK_ERROR");
543
1064
  }
544
1065
 
545
- return "Unknown error_type_T";
1066
+ return hb_string("Unknown error_type_T");
546
1067
  }
547
1068
 
548
- const char* error_human_type(ERROR_T* error) {
1069
+ hb_string_T error_human_type(ERROR_T* error) {
549
1070
  switch (error->type) {
550
- case UNEXPECTED_ERROR: return "UnexpectedError";
551
- case UNEXPECTED_TOKEN_ERROR: return "UnexpectedTokenError";
552
- case MISSING_OPENING_TAG_ERROR: return "MissingOpeningTagError";
553
- case MISSING_CLOSING_TAG_ERROR: return "MissingClosingTagError";
554
- case TAG_NAMES_MISMATCH_ERROR: return "TagNamesMismatchError";
555
- case QUOTES_MISMATCH_ERROR: return "QuotesMismatchError";
556
- case VOID_ELEMENT_CLOSING_TAG_ERROR: return "VoidElementClosingTagError";
557
- case UNCLOSED_ELEMENT_ERROR: return "UnclosedElementError";
558
- case RUBY_PARSE_ERROR: return "RubyParseError";
559
- case ERB_CONTROL_FLOW_SCOPE_ERROR: return "ERBControlFlowScopeError";
560
- case MISSINGERB_END_TAG_ERROR: return "MissingERBEndTagError";
561
- case ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR: return "ERBMultipleBlocksInTagError";
562
- case ERB_CASE_WITH_CONDITIONS_ERROR: return "ERBCaseWithConditionsError";
1071
+ case UNEXPECTED_ERROR: return hb_string("UnexpectedError");
1072
+ case UNEXPECTED_TOKEN_ERROR: return hb_string("UnexpectedTokenError");
1073
+ case MISSING_OPENING_TAG_ERROR: return hb_string("MissingOpeningTagError");
1074
+ case MISSING_CLOSING_TAG_ERROR: return hb_string("MissingClosingTagError");
1075
+ case TAG_NAMES_MISMATCH_ERROR: return hb_string("TagNamesMismatchError");
1076
+ case VOID_ELEMENT_CLOSING_TAG_ERROR: return hb_string("VoidElementClosingTagError");
1077
+ case UNCLOSED_ELEMENT_ERROR: return hb_string("UnclosedElementError");
1078
+ case RUBY_PARSE_ERROR: return hb_string("RubyParseError");
1079
+ case ERB_CONTROL_FLOW_SCOPE_ERROR: return hb_string("ERBControlFlowScopeError");
1080
+ case MISSING_ERB_END_TAG_ERROR: return hb_string("MissingERBEndTagError");
1081
+ case ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR: return hb_string("ERBMultipleBlocksInTagError");
1082
+ case ERB_CASE_WITH_CONDITIONS_ERROR: return hb_string("ERBCaseWithConditionsError");
1083
+ case CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR: return hb_string("ConditionalElementMultipleTagsError");
1084
+ case CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR: return hb_string("ConditionalElementConditionMismatchError");
1085
+ case INVALID_COMMENT_CLOSING_TAG_ERROR: return hb_string("InvalidCommentClosingTagError");
1086
+ case OMITTED_CLOSING_TAG_ERROR: return hb_string("OmittedClosingTagError");
1087
+ case UNCLOSED_OPEN_TAG_ERROR: return hb_string("UnclosedOpenTagError");
1088
+ case UNCLOSED_CLOSE_TAG_ERROR: return hb_string("UnclosedCloseTagError");
1089
+ case UNCLOSED_QUOTE_ERROR: return hb_string("UnclosedQuoteError");
1090
+ case MISSING_ATTRIBUTE_VALUE_ERROR: return hb_string("MissingAttributeValueError");
1091
+ case UNCLOSED_ERB_TAG_ERROR: return hb_string("UnclosedERBTagError");
1092
+ case STRAY_ERB_CLOSING_TAG_ERROR: return hb_string("StrayERBClosingTagError");
1093
+ case NESTED_ERB_TAG_ERROR: return hb_string("NestedERBTagError");
1094
+ case RENDER_AMBIGUOUS_LOCALS_ERROR: return hb_string("RenderAmbiguousLocalsError");
1095
+ case RENDER_MISSING_LOCALS_ERROR: return hb_string("RenderMissingLocalsError");
1096
+ case RENDER_NO_ARGUMENTS_ERROR: return hb_string("RenderNoArgumentsError");
1097
+ case RENDER_CONFLICTING_PARTIAL_ERROR: return hb_string("RenderConflictingPartialError");
1098
+ case RENDER_INVALID_AS_OPTION_ERROR: return hb_string("RenderInvalidAsOptionError");
1099
+ case RENDER_OBJECT_AND_COLLECTION_ERROR: return hb_string("RenderObjectAndCollectionError");
1100
+ case RENDER_LAYOUT_WITHOUT_BLOCK_ERROR: return hb_string("RenderLayoutWithoutBlockError");
563
1101
  }
564
1102
 
565
- return "Unknown error_type_T";
1103
+ return hb_string("Unknown error_type_T");
566
1104
  }
567
1105
 
568
- void error_free_base_error(ERROR_T* error) {
1106
+ void error_free_base_error(ERROR_T* error, hb_allocator_T* allocator) {
569
1107
  if (error == NULL) { return; }
570
1108
 
571
- if (error->message != NULL) { free(error->message); }
1109
+ if (!hb_string_is_null(error->message)) { hb_allocator_dealloc(allocator, error->message.data); }
572
1110
 
573
- free(error);
1111
+ hb_allocator_dealloc(allocator, error);
574
1112
  }
575
1113
 
576
- static void error_free_unexpected_error(UNEXPECTED_ERROR_T* unexpected_error) {
577
- if (unexpected_error->description != NULL) { free((char*) unexpected_error->description); }
578
- if (unexpected_error->expected != NULL) { free((char*) unexpected_error->expected); }
579
- if (unexpected_error->found != NULL) { free((char*) unexpected_error->found); }
1114
+ static void error_free_unexpected_error(UNEXPECTED_ERROR_T* unexpected_error, hb_allocator_T* allocator) {
1115
+ if (unexpected_error->description.data != NULL) { hb_allocator_dealloc(allocator, unexpected_error->description.data); }
1116
+ if (unexpected_error->expected.data != NULL) { hb_allocator_dealloc(allocator, unexpected_error->expected.data); }
1117
+ if (unexpected_error->found.data != NULL) { hb_allocator_dealloc(allocator, unexpected_error->found.data); }
580
1118
 
581
- error_free_base_error(&unexpected_error->base);
1119
+ error_free_base_error(&unexpected_error->base, allocator);
582
1120
  }
583
1121
 
584
- static void error_free_unexpected_token_error(UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error) {
1122
+ static void error_free_unexpected_token_error(UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error, hb_allocator_T* allocator) {
585
1123
  // token_type_T is part of struct
586
- if (unexpected_token_error->found != NULL) { token_free(unexpected_token_error->found); }
1124
+ if (unexpected_token_error->found != NULL) { token_free(unexpected_token_error->found, allocator); }
587
1125
 
588
- error_free_base_error(&unexpected_token_error->base);
1126
+ error_free_base_error(&unexpected_token_error->base, allocator);
589
1127
  }
590
1128
 
591
- static void error_free_missing_opening_tag_error(MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error) {
592
- if (missing_opening_tag_error->closing_tag != NULL) { token_free(missing_opening_tag_error->closing_tag); }
1129
+ static void error_free_missing_opening_tag_error(MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error, hb_allocator_T* allocator) {
1130
+ if (missing_opening_tag_error->closing_tag != NULL) { token_free(missing_opening_tag_error->closing_tag, allocator); }
593
1131
 
594
- error_free_base_error(&missing_opening_tag_error->base);
1132
+ error_free_base_error(&missing_opening_tag_error->base, allocator);
595
1133
  }
596
1134
 
597
- static void error_free_missing_closing_tag_error(MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error) {
598
- if (missing_closing_tag_error->opening_tag != NULL) { token_free(missing_closing_tag_error->opening_tag); }
1135
+ static void error_free_missing_closing_tag_error(MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error, hb_allocator_T* allocator) {
1136
+ if (missing_closing_tag_error->opening_tag != NULL) { token_free(missing_closing_tag_error->opening_tag, allocator); }
599
1137
 
600
- error_free_base_error(&missing_closing_tag_error->base);
1138
+ error_free_base_error(&missing_closing_tag_error->base, allocator);
601
1139
  }
602
1140
 
603
- static void error_free_tag_names_mismatch_error(TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error) {
604
- if (tag_names_mismatch_error->opening_tag != NULL) { token_free(tag_names_mismatch_error->opening_tag); }
605
- if (tag_names_mismatch_error->closing_tag != NULL) { token_free(tag_names_mismatch_error->closing_tag); }
1141
+ static void error_free_tag_names_mismatch_error(TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error, hb_allocator_T* allocator) {
1142
+ if (tag_names_mismatch_error->opening_tag != NULL) { token_free(tag_names_mismatch_error->opening_tag, allocator); }
1143
+ if (tag_names_mismatch_error->closing_tag != NULL) { token_free(tag_names_mismatch_error->closing_tag, allocator); }
606
1144
 
607
- error_free_base_error(&tag_names_mismatch_error->base);
1145
+ error_free_base_error(&tag_names_mismatch_error->base, allocator);
608
1146
  }
609
1147
 
610
- static void error_free_quotes_mismatch_error(QUOTES_MISMATCH_ERROR_T* quotes_mismatch_error) {
611
- if (quotes_mismatch_error->opening_quote != NULL) { token_free(quotes_mismatch_error->opening_quote); }
612
- if (quotes_mismatch_error->closing_quote != NULL) { token_free(quotes_mismatch_error->closing_quote); }
1148
+ static void error_free_void_element_closing_tag_error(VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error, hb_allocator_T* allocator) {
1149
+ if (void_element_closing_tag_error->tag_name != NULL) { token_free(void_element_closing_tag_error->tag_name, allocator); }
1150
+ if (void_element_closing_tag_error->expected.data != NULL) { hb_allocator_dealloc(allocator, void_element_closing_tag_error->expected.data); }
1151
+ if (void_element_closing_tag_error->found.data != NULL) { hb_allocator_dealloc(allocator, void_element_closing_tag_error->found.data); }
613
1152
 
614
- error_free_base_error(&quotes_mismatch_error->base);
1153
+ error_free_base_error(&void_element_closing_tag_error->base, allocator);
615
1154
  }
616
1155
 
617
- static void error_free_void_element_closing_tag_error(VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error) {
618
- if (void_element_closing_tag_error->tag_name != NULL) { token_free(void_element_closing_tag_error->tag_name); }
619
- if (void_element_closing_tag_error->expected != NULL) { free((char*) void_element_closing_tag_error->expected); }
620
- if (void_element_closing_tag_error->found != NULL) { free((char*) void_element_closing_tag_error->found); }
1156
+ static void error_free_unclosed_element_error(UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error, hb_allocator_T* allocator) {
1157
+ if (unclosed_element_error->opening_tag != NULL) { token_free(unclosed_element_error->opening_tag, allocator); }
621
1158
 
622
- error_free_base_error(&void_element_closing_tag_error->base);
1159
+ error_free_base_error(&unclosed_element_error->base, allocator);
623
1160
  }
624
1161
 
625
- static void error_free_unclosed_element_error(UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error) {
626
- if (unclosed_element_error->opening_tag != NULL) { token_free(unclosed_element_error->opening_tag); }
1162
+ static void error_free_ruby_parse_error(RUBY_PARSE_ERROR_T* ruby_parse_error, hb_allocator_T* allocator) {
1163
+ if (ruby_parse_error->error_message.data != NULL) { hb_allocator_dealloc(allocator, ruby_parse_error->error_message.data); }
1164
+ if (ruby_parse_error->diagnostic_id.data != NULL) { hb_allocator_dealloc(allocator, ruby_parse_error->diagnostic_id.data); }
1165
+ if (ruby_parse_error->level.data != NULL) { hb_allocator_dealloc(allocator, ruby_parse_error->level.data); }
627
1166
 
628
- error_free_base_error(&unclosed_element_error->base);
1167
+ error_free_base_error(&ruby_parse_error->base, allocator);
629
1168
  }
630
1169
 
631
- static void error_free_ruby_parse_error(RUBY_PARSE_ERROR_T* ruby_parse_error) {
632
- if (ruby_parse_error->error_message != NULL) { free((char*) ruby_parse_error->error_message); }
633
- if (ruby_parse_error->diagnostic_id != NULL) { free((char*) ruby_parse_error->diagnostic_id); }
634
- if (ruby_parse_error->level != NULL) { free((char*) ruby_parse_error->level); }
1170
+ static void error_free_erb_control_flow_scope_error(ERB_CONTROL_FLOW_SCOPE_ERROR_T* erb_control_flow_scope_error, hb_allocator_T* allocator) {
1171
+ if (erb_control_flow_scope_error->keyword.data != NULL) { hb_allocator_dealloc(allocator, erb_control_flow_scope_error->keyword.data); }
635
1172
 
636
- error_free_base_error(&ruby_parse_error->base);
1173
+ error_free_base_error(&erb_control_flow_scope_error->base, allocator);
637
1174
  }
638
1175
 
639
- static void error_free_erb_control_flow_scope_error(ERB_CONTROL_FLOW_SCOPE_ERROR_T* erb_control_flow_scope_error) {
640
- if (erb_control_flow_scope_error->keyword != NULL) { free((char*) erb_control_flow_scope_error->keyword); }
1176
+ static void error_free_missing_erb_end_tag_error(MISSING_ERB_END_TAG_ERROR_T* missing_erb_end_tag_error, hb_allocator_T* allocator) {
1177
+ if (missing_erb_end_tag_error->keyword.data != NULL) { hb_allocator_dealloc(allocator, missing_erb_end_tag_error->keyword.data); }
641
1178
 
642
- error_free_base_error(&erb_control_flow_scope_error->base);
1179
+ error_free_base_error(&missing_erb_end_tag_error->base, allocator);
643
1180
  }
644
1181
 
645
- static void error_free_missingerb_end_tag_error(MISSINGERB_END_TAG_ERROR_T* missingerb_end_tag_error) {
646
- if (missingerb_end_tag_error->keyword != NULL) { free((char*) missingerb_end_tag_error->keyword); }
1182
+ static void error_free_erb_multiple_blocks_in_tag_error(ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* erb_multiple_blocks_in_tag_error, hb_allocator_T* allocator) {
1183
+ /* no ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T specific fields to free up */
647
1184
 
648
- error_free_base_error(&missingerb_end_tag_error->base);
1185
+ error_free_base_error(&erb_multiple_blocks_in_tag_error->base, allocator);
649
1186
  }
650
1187
 
651
- static void error_free_erb_multiple_blocks_in_tag_error(ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* erb_multiple_blocks_in_tag_error) {
652
- /* no ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T specific fields to free up */
1188
+ static void error_free_erb_case_with_conditions_error(ERB_CASE_WITH_CONDITIONS_ERROR_T* erb_case_with_conditions_error, hb_allocator_T* allocator) {
1189
+ /* no ERB_CASE_WITH_CONDITIONS_ERROR_T specific fields to free up */
653
1190
 
654
- error_free_base_error(&erb_multiple_blocks_in_tag_error->base);
1191
+ error_free_base_error(&erb_case_with_conditions_error->base, allocator);
655
1192
  }
656
1193
 
657
- static void error_free_erb_case_with_conditions_error(ERB_CASE_WITH_CONDITIONS_ERROR_T* erb_case_with_conditions_error) {
658
- /* no ERB_CASE_WITH_CONDITIONS_ERROR_T specific fields to free up */
1194
+ static void error_free_conditional_element_multiple_tags_error(CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR_T* conditional_element_multiple_tags_error, hb_allocator_T* allocator) {
1195
+ // size_t is part of struct
1196
+ // size_t is part of struct
1197
+
1198
+ error_free_base_error(&conditional_element_multiple_tags_error->base, allocator);
1199
+ }
1200
+
1201
+ static void error_free_conditional_element_condition_mismatch_error(CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR_T* conditional_element_condition_mismatch_error, hb_allocator_T* allocator) {
1202
+ if (conditional_element_condition_mismatch_error->tag_name.data != NULL) { hb_allocator_dealloc(allocator, conditional_element_condition_mismatch_error->tag_name.data); }
1203
+ if (conditional_element_condition_mismatch_error->open_condition.data != NULL) { hb_allocator_dealloc(allocator, conditional_element_condition_mismatch_error->open_condition.data); }
1204
+ // size_t is part of struct
1205
+ // size_t is part of struct
1206
+ if (conditional_element_condition_mismatch_error->close_condition.data != NULL) { hb_allocator_dealloc(allocator, conditional_element_condition_mismatch_error->close_condition.data); }
1207
+ // size_t is part of struct
1208
+ // size_t is part of struct
1209
+
1210
+ error_free_base_error(&conditional_element_condition_mismatch_error->base, allocator);
1211
+ }
1212
+
1213
+ static void error_free_invalid_comment_closing_tag_error(INVALID_COMMENT_CLOSING_TAG_ERROR_T* invalid_comment_closing_tag_error, hb_allocator_T* allocator) {
1214
+ if (invalid_comment_closing_tag_error->closing_tag != NULL) { token_free(invalid_comment_closing_tag_error->closing_tag, allocator); }
1215
+
1216
+ error_free_base_error(&invalid_comment_closing_tag_error->base, allocator);
1217
+ }
1218
+
1219
+ static void error_free_omitted_closing_tag_error(OMITTED_CLOSING_TAG_ERROR_T* omitted_closing_tag_error, hb_allocator_T* allocator) {
1220
+ if (omitted_closing_tag_error->opening_tag != NULL) { token_free(omitted_closing_tag_error->opening_tag, allocator); }
1221
+ // position_T is part of struct
1222
+
1223
+ error_free_base_error(&omitted_closing_tag_error->base, allocator);
1224
+ }
1225
+
1226
+ static void error_free_unclosed_open_tag_error(UNCLOSED_OPEN_TAG_ERROR_T* unclosed_open_tag_error, hb_allocator_T* allocator) {
1227
+ if (unclosed_open_tag_error->tag_name != NULL) { token_free(unclosed_open_tag_error->tag_name, allocator); }
1228
+
1229
+ error_free_base_error(&unclosed_open_tag_error->base, allocator);
1230
+ }
1231
+
1232
+ static void error_free_unclosed_close_tag_error(UNCLOSED_CLOSE_TAG_ERROR_T* unclosed_close_tag_error, hb_allocator_T* allocator) {
1233
+ if (unclosed_close_tag_error->tag_name != NULL) { token_free(unclosed_close_tag_error->tag_name, allocator); }
1234
+
1235
+ error_free_base_error(&unclosed_close_tag_error->base, allocator);
1236
+ }
1237
+
1238
+ static void error_free_unclosed_quote_error(UNCLOSED_QUOTE_ERROR_T* unclosed_quote_error, hb_allocator_T* allocator) {
1239
+ if (unclosed_quote_error->opening_quote != NULL) { token_free(unclosed_quote_error->opening_quote, allocator); }
1240
+
1241
+ error_free_base_error(&unclosed_quote_error->base, allocator);
1242
+ }
1243
+
1244
+ static void error_free_missing_attribute_value_error(MISSING_ATTRIBUTE_VALUE_ERROR_T* missing_attribute_value_error, hb_allocator_T* allocator) {
1245
+ if (missing_attribute_value_error->attribute_name.data != NULL) { hb_allocator_dealloc(allocator, missing_attribute_value_error->attribute_name.data); }
1246
+
1247
+ error_free_base_error(&missing_attribute_value_error->base, allocator);
1248
+ }
1249
+
1250
+ static void error_free_unclosed_erb_tag_error(UNCLOSED_ERB_TAG_ERROR_T* unclosed_erb_tag_error, hb_allocator_T* allocator) {
1251
+ if (unclosed_erb_tag_error->opening_tag != NULL) { token_free(unclosed_erb_tag_error->opening_tag, allocator); }
1252
+
1253
+ error_free_base_error(&unclosed_erb_tag_error->base, allocator);
1254
+ }
1255
+
1256
+ static void error_free_stray_erb_closing_tag_error(STRAY_ERB_CLOSING_TAG_ERROR_T* stray_erb_closing_tag_error, hb_allocator_T* allocator) {
1257
+ /* no STRAY_ERB_CLOSING_TAG_ERROR_T specific fields to free up */
659
1258
 
660
- error_free_base_error(&erb_case_with_conditions_error->base);
1259
+ error_free_base_error(&stray_erb_closing_tag_error->base, allocator);
661
1260
  }
662
1261
 
663
- void error_free(ERROR_T* error) {
1262
+ static void error_free_nested_erb_tag_error(NESTED_ERB_TAG_ERROR_T* nested_erb_tag_error, hb_allocator_T* allocator) {
1263
+ if (nested_erb_tag_error->opening_tag != NULL) { token_free(nested_erb_tag_error->opening_tag, allocator); }
1264
+ // size_t is part of struct
1265
+ // size_t is part of struct
1266
+
1267
+ error_free_base_error(&nested_erb_tag_error->base, allocator);
1268
+ }
1269
+
1270
+ static void error_free_render_ambiguous_locals_error(RENDER_AMBIGUOUS_LOCALS_ERROR_T* render_ambiguous_locals_error, hb_allocator_T* allocator) {
1271
+ if (render_ambiguous_locals_error->partial.data != NULL) { hb_allocator_dealloc(allocator, render_ambiguous_locals_error->partial.data); }
1272
+
1273
+ error_free_base_error(&render_ambiguous_locals_error->base, allocator);
1274
+ }
1275
+
1276
+ static void error_free_render_missing_locals_error(RENDER_MISSING_LOCALS_ERROR_T* render_missing_locals_error, hb_allocator_T* allocator) {
1277
+ if (render_missing_locals_error->partial.data != NULL) { hb_allocator_dealloc(allocator, render_missing_locals_error->partial.data); }
1278
+ if (render_missing_locals_error->keywords.data != NULL) { hb_allocator_dealloc(allocator, render_missing_locals_error->keywords.data); }
1279
+
1280
+ error_free_base_error(&render_missing_locals_error->base, allocator);
1281
+ }
1282
+
1283
+ static void error_free_render_no_arguments_error(RENDER_NO_ARGUMENTS_ERROR_T* render_no_arguments_error, hb_allocator_T* allocator) {
1284
+ /* no RENDER_NO_ARGUMENTS_ERROR_T specific fields to free up */
1285
+
1286
+ error_free_base_error(&render_no_arguments_error->base, allocator);
1287
+ }
1288
+
1289
+ static void error_free_render_conflicting_partial_error(RENDER_CONFLICTING_PARTIAL_ERROR_T* render_conflicting_partial_error, hb_allocator_T* allocator) {
1290
+ if (render_conflicting_partial_error->positional_partial.data != NULL) { hb_allocator_dealloc(allocator, render_conflicting_partial_error->positional_partial.data); }
1291
+ if (render_conflicting_partial_error->keyword_partial.data != NULL) { hb_allocator_dealloc(allocator, render_conflicting_partial_error->keyword_partial.data); }
1292
+
1293
+ error_free_base_error(&render_conflicting_partial_error->base, allocator);
1294
+ }
1295
+
1296
+ static void error_free_render_invalid_as_option_error(RENDER_INVALID_AS_OPTION_ERROR_T* render_invalid_as_option_error, hb_allocator_T* allocator) {
1297
+ if (render_invalid_as_option_error->as_value.data != NULL) { hb_allocator_dealloc(allocator, render_invalid_as_option_error->as_value.data); }
1298
+
1299
+ error_free_base_error(&render_invalid_as_option_error->base, allocator);
1300
+ }
1301
+
1302
+ static void error_free_render_object_and_collection_error(RENDER_OBJECT_AND_COLLECTION_ERROR_T* render_object_and_collection_error, hb_allocator_T* allocator) {
1303
+ /* no RENDER_OBJECT_AND_COLLECTION_ERROR_T specific fields to free up */
1304
+
1305
+ error_free_base_error(&render_object_and_collection_error->base, allocator);
1306
+ }
1307
+
1308
+ static void error_free_render_layout_without_block_error(RENDER_LAYOUT_WITHOUT_BLOCK_ERROR_T* render_layout_without_block_error, hb_allocator_T* allocator) {
1309
+ if (render_layout_without_block_error->layout.data != NULL) { hb_allocator_dealloc(allocator, render_layout_without_block_error->layout.data); }
1310
+
1311
+ error_free_base_error(&render_layout_without_block_error->base, allocator);
1312
+ }
1313
+
1314
+ void error_free(ERROR_T* error, hb_allocator_T* allocator) {
664
1315
  if (!error) { return; }
665
1316
 
666
1317
  switch (error->type) {
667
- case UNEXPECTED_ERROR: error_free_unexpected_error((UNEXPECTED_ERROR_T*) error); break;
668
- case UNEXPECTED_TOKEN_ERROR: error_free_unexpected_token_error((UNEXPECTED_TOKEN_ERROR_T*) error); break;
669
- case MISSING_OPENING_TAG_ERROR: error_free_missing_opening_tag_error((MISSING_OPENING_TAG_ERROR_T*) error); break;
670
- case MISSING_CLOSING_TAG_ERROR: error_free_missing_closing_tag_error((MISSING_CLOSING_TAG_ERROR_T*) error); break;
671
- case TAG_NAMES_MISMATCH_ERROR: error_free_tag_names_mismatch_error((TAG_NAMES_MISMATCH_ERROR_T*) error); break;
672
- case QUOTES_MISMATCH_ERROR: error_free_quotes_mismatch_error((QUOTES_MISMATCH_ERROR_T*) error); break;
673
- case VOID_ELEMENT_CLOSING_TAG_ERROR: error_free_void_element_closing_tag_error((VOID_ELEMENT_CLOSING_TAG_ERROR_T*) error); break;
674
- case UNCLOSED_ELEMENT_ERROR: error_free_unclosed_element_error((UNCLOSED_ELEMENT_ERROR_T*) error); break;
675
- case RUBY_PARSE_ERROR: error_free_ruby_parse_error((RUBY_PARSE_ERROR_T*) error); break;
676
- case ERB_CONTROL_FLOW_SCOPE_ERROR: error_free_erb_control_flow_scope_error((ERB_CONTROL_FLOW_SCOPE_ERROR_T*) error); break;
677
- case MISSINGERB_END_TAG_ERROR: error_free_missingerb_end_tag_error((MISSINGERB_END_TAG_ERROR_T*) error); break;
678
- case ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR: error_free_erb_multiple_blocks_in_tag_error((ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T*) error); break;
679
- case ERB_CASE_WITH_CONDITIONS_ERROR: error_free_erb_case_with_conditions_error((ERB_CASE_WITH_CONDITIONS_ERROR_T*) error); break;
1318
+ case UNEXPECTED_ERROR: error_free_unexpected_error((UNEXPECTED_ERROR_T*) error, allocator); break;
1319
+ case UNEXPECTED_TOKEN_ERROR: error_free_unexpected_token_error((UNEXPECTED_TOKEN_ERROR_T*) error, allocator); break;
1320
+ case MISSING_OPENING_TAG_ERROR: error_free_missing_opening_tag_error((MISSING_OPENING_TAG_ERROR_T*) error, allocator); break;
1321
+ case MISSING_CLOSING_TAG_ERROR: error_free_missing_closing_tag_error((MISSING_CLOSING_TAG_ERROR_T*) error, allocator); break;
1322
+ case TAG_NAMES_MISMATCH_ERROR: error_free_tag_names_mismatch_error((TAG_NAMES_MISMATCH_ERROR_T*) error, allocator); break;
1323
+ case VOID_ELEMENT_CLOSING_TAG_ERROR: error_free_void_element_closing_tag_error((VOID_ELEMENT_CLOSING_TAG_ERROR_T*) error, allocator); break;
1324
+ case UNCLOSED_ELEMENT_ERROR: error_free_unclosed_element_error((UNCLOSED_ELEMENT_ERROR_T*) error, allocator); break;
1325
+ case RUBY_PARSE_ERROR: error_free_ruby_parse_error((RUBY_PARSE_ERROR_T*) error, allocator); break;
1326
+ case ERB_CONTROL_FLOW_SCOPE_ERROR: error_free_erb_control_flow_scope_error((ERB_CONTROL_FLOW_SCOPE_ERROR_T*) error, allocator); break;
1327
+ case MISSING_ERB_END_TAG_ERROR: error_free_missing_erb_end_tag_error((MISSING_ERB_END_TAG_ERROR_T*) error, allocator); break;
1328
+ case ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR: error_free_erb_multiple_blocks_in_tag_error((ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T*) error, allocator); break;
1329
+ case ERB_CASE_WITH_CONDITIONS_ERROR: error_free_erb_case_with_conditions_error((ERB_CASE_WITH_CONDITIONS_ERROR_T*) error, allocator); break;
1330
+ case CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR: error_free_conditional_element_multiple_tags_error((CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR_T*) error, allocator); break;
1331
+ case CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR: error_free_conditional_element_condition_mismatch_error((CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR_T*) error, allocator); break;
1332
+ case INVALID_COMMENT_CLOSING_TAG_ERROR: error_free_invalid_comment_closing_tag_error((INVALID_COMMENT_CLOSING_TAG_ERROR_T*) error, allocator); break;
1333
+ case OMITTED_CLOSING_TAG_ERROR: error_free_omitted_closing_tag_error((OMITTED_CLOSING_TAG_ERROR_T*) error, allocator); break;
1334
+ case UNCLOSED_OPEN_TAG_ERROR: error_free_unclosed_open_tag_error((UNCLOSED_OPEN_TAG_ERROR_T*) error, allocator); break;
1335
+ case UNCLOSED_CLOSE_TAG_ERROR: error_free_unclosed_close_tag_error((UNCLOSED_CLOSE_TAG_ERROR_T*) error, allocator); break;
1336
+ case UNCLOSED_QUOTE_ERROR: error_free_unclosed_quote_error((UNCLOSED_QUOTE_ERROR_T*) error, allocator); break;
1337
+ case MISSING_ATTRIBUTE_VALUE_ERROR: error_free_missing_attribute_value_error((MISSING_ATTRIBUTE_VALUE_ERROR_T*) error, allocator); break;
1338
+ case UNCLOSED_ERB_TAG_ERROR: error_free_unclosed_erb_tag_error((UNCLOSED_ERB_TAG_ERROR_T*) error, allocator); break;
1339
+ case STRAY_ERB_CLOSING_TAG_ERROR: error_free_stray_erb_closing_tag_error((STRAY_ERB_CLOSING_TAG_ERROR_T*) error, allocator); break;
1340
+ case NESTED_ERB_TAG_ERROR: error_free_nested_erb_tag_error((NESTED_ERB_TAG_ERROR_T*) error, allocator); break;
1341
+ case RENDER_AMBIGUOUS_LOCALS_ERROR: error_free_render_ambiguous_locals_error((RENDER_AMBIGUOUS_LOCALS_ERROR_T*) error, allocator); break;
1342
+ case RENDER_MISSING_LOCALS_ERROR: error_free_render_missing_locals_error((RENDER_MISSING_LOCALS_ERROR_T*) error, allocator); break;
1343
+ case RENDER_NO_ARGUMENTS_ERROR: error_free_render_no_arguments_error((RENDER_NO_ARGUMENTS_ERROR_T*) error, allocator); break;
1344
+ case RENDER_CONFLICTING_PARTIAL_ERROR: error_free_render_conflicting_partial_error((RENDER_CONFLICTING_PARTIAL_ERROR_T*) error, allocator); break;
1345
+ case RENDER_INVALID_AS_OPTION_ERROR: error_free_render_invalid_as_option_error((RENDER_INVALID_AS_OPTION_ERROR_T*) error, allocator); break;
1346
+ case RENDER_OBJECT_AND_COLLECTION_ERROR: error_free_render_object_and_collection_error((RENDER_OBJECT_AND_COLLECTION_ERROR_T*) error, allocator); break;
1347
+ case RENDER_LAYOUT_WITHOUT_BLOCK_ERROR: error_free_render_layout_without_block_error((RENDER_LAYOUT_WITHOUT_BLOCK_ERROR_T*) error, allocator); break;
680
1348
  }
681
1349
  }
682
1350
 
1351
+ #ifndef HERB_EXCLUDE_PRETTYPRINT
1352
+
683
1353
  void error_pretty_print_array(
684
1354
  const char* name, hb_array_T* array, const size_t indent, const size_t relative_indent, const bool last_property,
685
1355
  hb_buffer_T* buffer
@@ -728,30 +1398,30 @@ static void error_pretty_print_unexpected_error(UNEXPECTED_ERROR_T* error, const
728
1398
  if (!error) { return; }
729
1399
 
730
1400
  hb_buffer_append(buffer, "@ ");
731
- hb_buffer_append(buffer, error_human_type((ERROR_T*) error));
1401
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
732
1402
  hb_buffer_append(buffer, " ");
733
1403
 
734
1404
  pretty_print_location(error->base.location, buffer);
735
1405
  hb_buffer_append(buffer, "\n");
736
1406
 
737
- pretty_print_quoted_property(hb_string("message"), hb_string(error->base.message), indent, relative_indent, false, buffer);
738
- pretty_print_quoted_property(hb_string("description"), hb_string(error->description), indent, relative_indent, false, buffer);
739
- pretty_print_quoted_property(hb_string("expected"), hb_string(error->expected), indent, relative_indent, false, buffer);
740
- pretty_print_quoted_property(hb_string("found"), hb_string(error->found), indent, relative_indent, true, buffer);
1407
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1408
+ pretty_print_quoted_property(hb_string("description"), error->description, indent, relative_indent, false, buffer);
1409
+ pretty_print_quoted_property(hb_string("expected"), error->expected, indent, relative_indent, false, buffer);
1410
+ pretty_print_quoted_property(hb_string("found"), error->found, indent, relative_indent, true, buffer);
741
1411
  }
742
1412
 
743
1413
  static void error_pretty_print_unexpected_token_error(UNEXPECTED_TOKEN_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
744
1414
  if (!error) { return; }
745
1415
 
746
1416
  hb_buffer_append(buffer, "@ ");
747
- hb_buffer_append(buffer, error_human_type((ERROR_T*) error));
1417
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
748
1418
  hb_buffer_append(buffer, " ");
749
1419
 
750
1420
  pretty_print_location(error->base.location, buffer);
751
1421
  hb_buffer_append(buffer, "\n");
752
1422
 
753
- pretty_print_quoted_property(hb_string("message"), hb_string(error->base.message), indent, relative_indent, false, buffer);
754
- pretty_print_property(hb_string(token_type_to_string(error->expected_type)), hb_string("expected_type"), indent, relative_indent, false, buffer);
1423
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1424
+ pretty_print_property(token_type_to_string(error->expected_type), hb_string("expected_type"), indent, relative_indent, false, buffer);
755
1425
  pretty_print_token_property(error->found, hb_string("found"), indent, relative_indent, true, buffer);
756
1426
  }
757
1427
 
@@ -759,13 +1429,13 @@ static void error_pretty_print_missing_opening_tag_error(MISSING_OPENING_TAG_ERR
759
1429
  if (!error) { return; }
760
1430
 
761
1431
  hb_buffer_append(buffer, "@ ");
762
- hb_buffer_append(buffer, error_human_type((ERROR_T*) error));
1432
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
763
1433
  hb_buffer_append(buffer, " ");
764
1434
 
765
1435
  pretty_print_location(error->base.location, buffer);
766
1436
  hb_buffer_append(buffer, "\n");
767
1437
 
768
- pretty_print_quoted_property(hb_string("message"), hb_string(error->base.message), indent, relative_indent, false, buffer);
1438
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
769
1439
  pretty_print_token_property(error->closing_tag, hb_string("closing_tag"), indent, relative_indent, true, buffer);
770
1440
  }
771
1441
 
@@ -773,13 +1443,13 @@ static void error_pretty_print_missing_closing_tag_error(MISSING_CLOSING_TAG_ERR
773
1443
  if (!error) { return; }
774
1444
 
775
1445
  hb_buffer_append(buffer, "@ ");
776
- hb_buffer_append(buffer, error_human_type((ERROR_T*) error));
1446
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
777
1447
  hb_buffer_append(buffer, " ");
778
1448
 
779
1449
  pretty_print_location(error->base.location, buffer);
780
1450
  hb_buffer_append(buffer, "\n");
781
1451
 
782
- pretty_print_quoted_property(hb_string("message"), hb_string(error->base.message), indent, relative_indent, false, buffer);
1452
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
783
1453
  pretty_print_token_property(error->opening_tag, hb_string("opening_tag"), indent, relative_indent, true, buffer);
784
1454
  }
785
1455
 
@@ -787,130 +1457,376 @@ static void error_pretty_print_tag_names_mismatch_error(TAG_NAMES_MISMATCH_ERROR
787
1457
  if (!error) { return; }
788
1458
 
789
1459
  hb_buffer_append(buffer, "@ ");
790
- hb_buffer_append(buffer, error_human_type((ERROR_T*) error));
1460
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
791
1461
  hb_buffer_append(buffer, " ");
792
1462
 
793
1463
  pretty_print_location(error->base.location, buffer);
794
1464
  hb_buffer_append(buffer, "\n");
795
1465
 
796
- pretty_print_quoted_property(hb_string("message"), hb_string(error->base.message), indent, relative_indent, false, buffer);
1466
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
797
1467
  pretty_print_token_property(error->opening_tag, hb_string("opening_tag"), indent, relative_indent, false, buffer);
798
1468
  pretty_print_token_property(error->closing_tag, hb_string("closing_tag"), indent, relative_indent, true, buffer);
799
1469
  }
800
1470
 
801
- static void error_pretty_print_quotes_mismatch_error(QUOTES_MISMATCH_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1471
+ static void error_pretty_print_void_element_closing_tag_error(VOID_ELEMENT_CLOSING_TAG_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
802
1472
  if (!error) { return; }
803
1473
 
804
1474
  hb_buffer_append(buffer, "@ ");
805
- hb_buffer_append(buffer, error_human_type((ERROR_T*) error));
1475
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
806
1476
  hb_buffer_append(buffer, " ");
807
1477
 
808
1478
  pretty_print_location(error->base.location, buffer);
809
1479
  hb_buffer_append(buffer, "\n");
810
1480
 
811
- pretty_print_quoted_property(hb_string("message"), hb_string(error->base.message), indent, relative_indent, false, buffer);
812
- pretty_print_token_property(error->opening_quote, hb_string("opening_quote"), indent, relative_indent, false, buffer);
813
- pretty_print_token_property(error->closing_quote, hb_string("closing_quote"), indent, relative_indent, true, buffer);
1481
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1482
+ pretty_print_token_property(error->tag_name, hb_string("tag_name"), indent, relative_indent, false, buffer);
1483
+ pretty_print_quoted_property(hb_string("expected"), error->expected, indent, relative_indent, false, buffer);
1484
+ pretty_print_quoted_property(hb_string("found"), error->found, indent, relative_indent, true, buffer);
814
1485
  }
815
1486
 
816
- static void error_pretty_print_void_element_closing_tag_error(VOID_ELEMENT_CLOSING_TAG_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1487
+ static void error_pretty_print_unclosed_element_error(UNCLOSED_ELEMENT_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
817
1488
  if (!error) { return; }
818
1489
 
819
1490
  hb_buffer_append(buffer, "@ ");
820
- hb_buffer_append(buffer, error_human_type((ERROR_T*) error));
1491
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
821
1492
  hb_buffer_append(buffer, " ");
822
1493
 
823
1494
  pretty_print_location(error->base.location, buffer);
824
1495
  hb_buffer_append(buffer, "\n");
825
1496
 
826
- pretty_print_quoted_property(hb_string("message"), hb_string(error->base.message), indent, relative_indent, false, buffer);
827
- pretty_print_token_property(error->tag_name, hb_string("tag_name"), indent, relative_indent, false, buffer);
828
- pretty_print_quoted_property(hb_string("expected"), hb_string(error->expected), indent, relative_indent, false, buffer);
829
- pretty_print_quoted_property(hb_string("found"), hb_string(error->found), indent, relative_indent, true, buffer);
1497
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1498
+ pretty_print_token_property(error->opening_tag, hb_string("opening_tag"), indent, relative_indent, true, buffer);
830
1499
  }
831
1500
 
832
- static void error_pretty_print_unclosed_element_error(UNCLOSED_ELEMENT_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1501
+ static void error_pretty_print_ruby_parse_error(RUBY_PARSE_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1502
+ if (!error) { return; }
1503
+
1504
+ hb_buffer_append(buffer, "@ ");
1505
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1506
+ hb_buffer_append(buffer, " ");
1507
+
1508
+ pretty_print_location(error->base.location, buffer);
1509
+ hb_buffer_append(buffer, "\n");
1510
+
1511
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1512
+ pretty_print_quoted_property(hb_string("error_message"), error->error_message, indent, relative_indent, false, buffer);
1513
+ pretty_print_quoted_property(hb_string("diagnostic_id"), error->diagnostic_id, indent, relative_indent, false, buffer);
1514
+ pretty_print_quoted_property(hb_string("level"), error->level, indent, relative_indent, true, buffer);
1515
+ }
1516
+
1517
+ static void error_pretty_print_erb_control_flow_scope_error(ERB_CONTROL_FLOW_SCOPE_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
833
1518
  if (!error) { return; }
834
1519
 
835
1520
  hb_buffer_append(buffer, "@ ");
836
- hb_buffer_append(buffer, error_human_type((ERROR_T*) error));
1521
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
837
1522
  hb_buffer_append(buffer, " ");
838
1523
 
839
1524
  pretty_print_location(error->base.location, buffer);
840
1525
  hb_buffer_append(buffer, "\n");
841
1526
 
842
- pretty_print_quoted_property(hb_string("message"), hb_string(error->base.message), indent, relative_indent, false, buffer);
1527
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1528
+ pretty_print_quoted_property(hb_string("keyword"), error->keyword, indent, relative_indent, true, buffer);
1529
+ }
1530
+
1531
+ static void error_pretty_print_missing_erb_end_tag_error(MISSING_ERB_END_TAG_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1532
+ if (!error) { return; }
1533
+
1534
+ hb_buffer_append(buffer, "@ ");
1535
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1536
+ hb_buffer_append(buffer, " ");
1537
+
1538
+ pretty_print_location(error->base.location, buffer);
1539
+ hb_buffer_append(buffer, "\n");
1540
+
1541
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1542
+ pretty_print_quoted_property(hb_string("keyword"), error->keyword, indent, relative_indent, true, buffer);
1543
+ }
1544
+
1545
+ static void error_pretty_print_erb_multiple_blocks_in_tag_error(ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1546
+ if (!error) { return; }
1547
+
1548
+ hb_buffer_append(buffer, "@ ");
1549
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1550
+ hb_buffer_append(buffer, " ");
1551
+
1552
+ pretty_print_location(error->base.location, buffer);
1553
+ hb_buffer_append(buffer, "\n");
1554
+
1555
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, true, buffer);
1556
+ }
1557
+
1558
+ static void error_pretty_print_erb_case_with_conditions_error(ERB_CASE_WITH_CONDITIONS_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1559
+ if (!error) { return; }
1560
+
1561
+ hb_buffer_append(buffer, "@ ");
1562
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1563
+ hb_buffer_append(buffer, " ");
1564
+
1565
+ pretty_print_location(error->base.location, buffer);
1566
+ hb_buffer_append(buffer, "\n");
1567
+
1568
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, true, buffer);
1569
+ }
1570
+
1571
+ static void error_pretty_print_conditional_element_multiple_tags_error(CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1572
+ if (!error) { return; }
1573
+
1574
+ hb_buffer_append(buffer, "@ ");
1575
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1576
+ hb_buffer_append(buffer, " ");
1577
+
1578
+ pretty_print_location(error->base.location, buffer);
1579
+ hb_buffer_append(buffer, "\n");
1580
+
1581
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1582
+ pretty_print_size_t_property(error->line, hb_string("line"), indent, relative_indent, false, buffer);
1583
+ pretty_print_size_t_property(error->column, hb_string("column"), indent, relative_indent, true, buffer);
1584
+ }
1585
+
1586
+ static void error_pretty_print_conditional_element_condition_mismatch_error(CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1587
+ if (!error) { return; }
1588
+
1589
+ hb_buffer_append(buffer, "@ ");
1590
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1591
+ hb_buffer_append(buffer, " ");
1592
+
1593
+ pretty_print_location(error->base.location, buffer);
1594
+ hb_buffer_append(buffer, "\n");
1595
+
1596
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1597
+ pretty_print_quoted_property(hb_string("tag_name"), error->tag_name, indent, relative_indent, false, buffer);
1598
+ pretty_print_quoted_property(hb_string("open_condition"), error->open_condition, indent, relative_indent, false, buffer);
1599
+ pretty_print_size_t_property(error->open_line, hb_string("open_line"), indent, relative_indent, false, buffer);
1600
+ pretty_print_size_t_property(error->open_column, hb_string("open_column"), indent, relative_indent, false, buffer);
1601
+ pretty_print_quoted_property(hb_string("close_condition"), error->close_condition, indent, relative_indent, false, buffer);
1602
+ pretty_print_size_t_property(error->close_line, hb_string("close_line"), indent, relative_indent, false, buffer);
1603
+ pretty_print_size_t_property(error->close_column, hb_string("close_column"), indent, relative_indent, true, buffer);
1604
+ }
1605
+
1606
+ static void error_pretty_print_invalid_comment_closing_tag_error(INVALID_COMMENT_CLOSING_TAG_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1607
+ if (!error) { return; }
1608
+
1609
+ hb_buffer_append(buffer, "@ ");
1610
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1611
+ hb_buffer_append(buffer, " ");
1612
+
1613
+ pretty_print_location(error->base.location, buffer);
1614
+ hb_buffer_append(buffer, "\n");
1615
+
1616
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1617
+ pretty_print_token_property(error->closing_tag, hb_string("closing_tag"), indent, relative_indent, true, buffer);
1618
+ }
1619
+
1620
+ static void error_pretty_print_omitted_closing_tag_error(OMITTED_CLOSING_TAG_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1621
+ if (!error) { return; }
1622
+
1623
+ hb_buffer_append(buffer, "@ ");
1624
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1625
+ hb_buffer_append(buffer, " ");
1626
+
1627
+ pretty_print_location(error->base.location, buffer);
1628
+ hb_buffer_append(buffer, "\n");
1629
+
1630
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1631
+ pretty_print_token_property(error->opening_tag, hb_string("opening_tag"), indent, relative_indent, false, buffer);
1632
+ pretty_print_position_property(&error->insertion_point, hb_string("insertion_point"), indent, relative_indent, true, buffer);
1633
+ }
1634
+
1635
+ static void error_pretty_print_unclosed_open_tag_error(UNCLOSED_OPEN_TAG_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1636
+ if (!error) { return; }
1637
+
1638
+ hb_buffer_append(buffer, "@ ");
1639
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1640
+ hb_buffer_append(buffer, " ");
1641
+
1642
+ pretty_print_location(error->base.location, buffer);
1643
+ hb_buffer_append(buffer, "\n");
1644
+
1645
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1646
+ pretty_print_token_property(error->tag_name, hb_string("tag_name"), indent, relative_indent, true, buffer);
1647
+ }
1648
+
1649
+ static void error_pretty_print_unclosed_close_tag_error(UNCLOSED_CLOSE_TAG_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1650
+ if (!error) { return; }
1651
+
1652
+ hb_buffer_append(buffer, "@ ");
1653
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1654
+ hb_buffer_append(buffer, " ");
1655
+
1656
+ pretty_print_location(error->base.location, buffer);
1657
+ hb_buffer_append(buffer, "\n");
1658
+
1659
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1660
+ pretty_print_token_property(error->tag_name, hb_string("tag_name"), indent, relative_indent, true, buffer);
1661
+ }
1662
+
1663
+ static void error_pretty_print_unclosed_quote_error(UNCLOSED_QUOTE_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1664
+ if (!error) { return; }
1665
+
1666
+ hb_buffer_append(buffer, "@ ");
1667
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1668
+ hb_buffer_append(buffer, " ");
1669
+
1670
+ pretty_print_location(error->base.location, buffer);
1671
+ hb_buffer_append(buffer, "\n");
1672
+
1673
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1674
+ pretty_print_token_property(error->opening_quote, hb_string("opening_quote"), indent, relative_indent, true, buffer);
1675
+ }
1676
+
1677
+ static void error_pretty_print_missing_attribute_value_error(MISSING_ATTRIBUTE_VALUE_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1678
+ if (!error) { return; }
1679
+
1680
+ hb_buffer_append(buffer, "@ ");
1681
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1682
+ hb_buffer_append(buffer, " ");
1683
+
1684
+ pretty_print_location(error->base.location, buffer);
1685
+ hb_buffer_append(buffer, "\n");
1686
+
1687
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1688
+ pretty_print_quoted_property(hb_string("attribute_name"), error->attribute_name, indent, relative_indent, true, buffer);
1689
+ }
1690
+
1691
+ static void error_pretty_print_unclosed_erb_tag_error(UNCLOSED_ERB_TAG_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1692
+ if (!error) { return; }
1693
+
1694
+ hb_buffer_append(buffer, "@ ");
1695
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1696
+ hb_buffer_append(buffer, " ");
1697
+
1698
+ pretty_print_location(error->base.location, buffer);
1699
+ hb_buffer_append(buffer, "\n");
1700
+
1701
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
843
1702
  pretty_print_token_property(error->opening_tag, hb_string("opening_tag"), indent, relative_indent, true, buffer);
844
1703
  }
845
1704
 
846
- static void error_pretty_print_ruby_parse_error(RUBY_PARSE_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1705
+ static void error_pretty_print_stray_erb_closing_tag_error(STRAY_ERB_CLOSING_TAG_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
847
1706
  if (!error) { return; }
848
1707
 
849
1708
  hb_buffer_append(buffer, "@ ");
850
- hb_buffer_append(buffer, error_human_type((ERROR_T*) error));
1709
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
851
1710
  hb_buffer_append(buffer, " ");
852
1711
 
853
1712
  pretty_print_location(error->base.location, buffer);
854
1713
  hb_buffer_append(buffer, "\n");
855
1714
 
856
- pretty_print_quoted_property(hb_string("message"), hb_string(error->base.message), indent, relative_indent, false, buffer);
857
- pretty_print_quoted_property(hb_string("error_message"), hb_string(error->error_message), indent, relative_indent, false, buffer);
858
- pretty_print_quoted_property(hb_string("diagnostic_id"), hb_string(error->diagnostic_id), indent, relative_indent, false, buffer);
859
- pretty_print_quoted_property(hb_string("level"), hb_string(error->level), indent, relative_indent, true, buffer);
1715
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, true, buffer);
860
1716
  }
861
1717
 
862
- static void error_pretty_print_erb_control_flow_scope_error(ERB_CONTROL_FLOW_SCOPE_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1718
+ static void error_pretty_print_nested_erb_tag_error(NESTED_ERB_TAG_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
863
1719
  if (!error) { return; }
864
1720
 
865
1721
  hb_buffer_append(buffer, "@ ");
866
- hb_buffer_append(buffer, error_human_type((ERROR_T*) error));
1722
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
867
1723
  hb_buffer_append(buffer, " ");
868
1724
 
869
1725
  pretty_print_location(error->base.location, buffer);
870
1726
  hb_buffer_append(buffer, "\n");
871
1727
 
872
- pretty_print_quoted_property(hb_string("message"), hb_string(error->base.message), indent, relative_indent, false, buffer);
873
- pretty_print_quoted_property(hb_string("keyword"), hb_string(error->keyword), indent, relative_indent, true, buffer);
1728
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1729
+ pretty_print_token_property(error->opening_tag, hb_string("opening_tag"), indent, relative_indent, false, buffer);
1730
+ pretty_print_size_t_property(error->nested_tag_line, hb_string("nested_tag_line"), indent, relative_indent, false, buffer);
1731
+ pretty_print_size_t_property(error->nested_tag_column, hb_string("nested_tag_column"), indent, relative_indent, true, buffer);
874
1732
  }
875
1733
 
876
- static void error_pretty_print_missingerb_end_tag_error(MISSINGERB_END_TAG_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1734
+ static void error_pretty_print_render_ambiguous_locals_error(RENDER_AMBIGUOUS_LOCALS_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
877
1735
  if (!error) { return; }
878
1736
 
879
1737
  hb_buffer_append(buffer, "@ ");
880
- hb_buffer_append(buffer, error_human_type((ERROR_T*) error));
1738
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
881
1739
  hb_buffer_append(buffer, " ");
882
1740
 
883
1741
  pretty_print_location(error->base.location, buffer);
884
1742
  hb_buffer_append(buffer, "\n");
885
1743
 
886
- pretty_print_quoted_property(hb_string("message"), hb_string(error->base.message), indent, relative_indent, false, buffer);
887
- pretty_print_quoted_property(hb_string("keyword"), hb_string(error->keyword), indent, relative_indent, true, buffer);
1744
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1745
+ pretty_print_quoted_property(hb_string("partial"), error->partial, indent, relative_indent, true, buffer);
888
1746
  }
889
1747
 
890
- static void error_pretty_print_erb_multiple_blocks_in_tag_error(ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1748
+ static void error_pretty_print_render_missing_locals_error(RENDER_MISSING_LOCALS_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
891
1749
  if (!error) { return; }
892
1750
 
893
1751
  hb_buffer_append(buffer, "@ ");
894
- hb_buffer_append(buffer, error_human_type((ERROR_T*) error));
1752
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
895
1753
  hb_buffer_append(buffer, " ");
896
1754
 
897
1755
  pretty_print_location(error->base.location, buffer);
898
1756
  hb_buffer_append(buffer, "\n");
899
1757
 
900
- pretty_print_quoted_property(hb_string("message"), hb_string(error->base.message), indent, relative_indent, true, buffer);
1758
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1759
+ pretty_print_quoted_property(hb_string("partial"), error->partial, indent, relative_indent, false, buffer);
1760
+ pretty_print_quoted_property(hb_string("keywords"), error->keywords, indent, relative_indent, true, buffer);
901
1761
  }
902
1762
 
903
- static void error_pretty_print_erb_case_with_conditions_error(ERB_CASE_WITH_CONDITIONS_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1763
+ static void error_pretty_print_render_no_arguments_error(RENDER_NO_ARGUMENTS_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
904
1764
  if (!error) { return; }
905
1765
 
906
1766
  hb_buffer_append(buffer, "@ ");
907
- hb_buffer_append(buffer, error_human_type((ERROR_T*) error));
1767
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
908
1768
  hb_buffer_append(buffer, " ");
909
1769
 
910
1770
  pretty_print_location(error->base.location, buffer);
911
1771
  hb_buffer_append(buffer, "\n");
912
1772
 
913
- pretty_print_quoted_property(hb_string("message"), hb_string(error->base.message), indent, relative_indent, true, buffer);
1773
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, true, buffer);
1774
+ }
1775
+
1776
+ static void error_pretty_print_render_conflicting_partial_error(RENDER_CONFLICTING_PARTIAL_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1777
+ if (!error) { return; }
1778
+
1779
+ hb_buffer_append(buffer, "@ ");
1780
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1781
+ hb_buffer_append(buffer, " ");
1782
+
1783
+ pretty_print_location(error->base.location, buffer);
1784
+ hb_buffer_append(buffer, "\n");
1785
+
1786
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1787
+ pretty_print_quoted_property(hb_string("positional_partial"), error->positional_partial, indent, relative_indent, false, buffer);
1788
+ pretty_print_quoted_property(hb_string("keyword_partial"), error->keyword_partial, indent, relative_indent, true, buffer);
1789
+ }
1790
+
1791
+ static void error_pretty_print_render_invalid_as_option_error(RENDER_INVALID_AS_OPTION_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1792
+ if (!error) { return; }
1793
+
1794
+ hb_buffer_append(buffer, "@ ");
1795
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1796
+ hb_buffer_append(buffer, " ");
1797
+
1798
+ pretty_print_location(error->base.location, buffer);
1799
+ hb_buffer_append(buffer, "\n");
1800
+
1801
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1802
+ pretty_print_quoted_property(hb_string("as_value"), error->as_value, indent, relative_indent, true, buffer);
1803
+ }
1804
+
1805
+ static void error_pretty_print_render_object_and_collection_error(RENDER_OBJECT_AND_COLLECTION_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1806
+ if (!error) { return; }
1807
+
1808
+ hb_buffer_append(buffer, "@ ");
1809
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1810
+ hb_buffer_append(buffer, " ");
1811
+
1812
+ pretty_print_location(error->base.location, buffer);
1813
+ hb_buffer_append(buffer, "\n");
1814
+
1815
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, true, buffer);
1816
+ }
1817
+
1818
+ static void error_pretty_print_render_layout_without_block_error(RENDER_LAYOUT_WITHOUT_BLOCK_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
1819
+ if (!error) { return; }
1820
+
1821
+ hb_buffer_append(buffer, "@ ");
1822
+ hb_buffer_append_string(buffer, error_human_type((ERROR_T*) error));
1823
+ hb_buffer_append(buffer, " ");
1824
+
1825
+ pretty_print_location(error->base.location, buffer);
1826
+ hb_buffer_append(buffer, "\n");
1827
+
1828
+ pretty_print_quoted_property(hb_string("message"), error->base.message, indent, relative_indent, false, buffer);
1829
+ pretty_print_quoted_property(hb_string("layout"), error->layout, indent, relative_indent, true, buffer);
914
1830
  }
915
1831
 
916
1832
  void error_pretty_print(ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
@@ -922,13 +1838,32 @@ void error_pretty_print(ERROR_T* error, const size_t indent, const size_t relati
922
1838
  case MISSING_OPENING_TAG_ERROR: error_pretty_print_missing_opening_tag_error((MISSING_OPENING_TAG_ERROR_T*) error, indent, relative_indent, buffer); break;
923
1839
  case MISSING_CLOSING_TAG_ERROR: error_pretty_print_missing_closing_tag_error((MISSING_CLOSING_TAG_ERROR_T*) error, indent, relative_indent, buffer); break;
924
1840
  case TAG_NAMES_MISMATCH_ERROR: error_pretty_print_tag_names_mismatch_error((TAG_NAMES_MISMATCH_ERROR_T*) error, indent, relative_indent, buffer); break;
925
- case QUOTES_MISMATCH_ERROR: error_pretty_print_quotes_mismatch_error((QUOTES_MISMATCH_ERROR_T*) error, indent, relative_indent, buffer); break;
926
1841
  case VOID_ELEMENT_CLOSING_TAG_ERROR: error_pretty_print_void_element_closing_tag_error((VOID_ELEMENT_CLOSING_TAG_ERROR_T*) error, indent, relative_indent, buffer); break;
927
1842
  case UNCLOSED_ELEMENT_ERROR: error_pretty_print_unclosed_element_error((UNCLOSED_ELEMENT_ERROR_T*) error, indent, relative_indent, buffer); break;
928
1843
  case RUBY_PARSE_ERROR: error_pretty_print_ruby_parse_error((RUBY_PARSE_ERROR_T*) error, indent, relative_indent, buffer); break;
929
1844
  case ERB_CONTROL_FLOW_SCOPE_ERROR: error_pretty_print_erb_control_flow_scope_error((ERB_CONTROL_FLOW_SCOPE_ERROR_T*) error, indent, relative_indent, buffer); break;
930
- case MISSINGERB_END_TAG_ERROR: error_pretty_print_missingerb_end_tag_error((MISSINGERB_END_TAG_ERROR_T*) error, indent, relative_indent, buffer); break;
1845
+ case MISSING_ERB_END_TAG_ERROR: error_pretty_print_missing_erb_end_tag_error((MISSING_ERB_END_TAG_ERROR_T*) error, indent, relative_indent, buffer); break;
931
1846
  case ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR: error_pretty_print_erb_multiple_blocks_in_tag_error((ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T*) error, indent, relative_indent, buffer); break;
932
1847
  case ERB_CASE_WITH_CONDITIONS_ERROR: error_pretty_print_erb_case_with_conditions_error((ERB_CASE_WITH_CONDITIONS_ERROR_T*) error, indent, relative_indent, buffer); break;
1848
+ case CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR: error_pretty_print_conditional_element_multiple_tags_error((CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR_T*) error, indent, relative_indent, buffer); break;
1849
+ case CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR: error_pretty_print_conditional_element_condition_mismatch_error((CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR_T*) error, indent, relative_indent, buffer); break;
1850
+ case INVALID_COMMENT_CLOSING_TAG_ERROR: error_pretty_print_invalid_comment_closing_tag_error((INVALID_COMMENT_CLOSING_TAG_ERROR_T*) error, indent, relative_indent, buffer); break;
1851
+ case OMITTED_CLOSING_TAG_ERROR: error_pretty_print_omitted_closing_tag_error((OMITTED_CLOSING_TAG_ERROR_T*) error, indent, relative_indent, buffer); break;
1852
+ case UNCLOSED_OPEN_TAG_ERROR: error_pretty_print_unclosed_open_tag_error((UNCLOSED_OPEN_TAG_ERROR_T*) error, indent, relative_indent, buffer); break;
1853
+ case UNCLOSED_CLOSE_TAG_ERROR: error_pretty_print_unclosed_close_tag_error((UNCLOSED_CLOSE_TAG_ERROR_T*) error, indent, relative_indent, buffer); break;
1854
+ case UNCLOSED_QUOTE_ERROR: error_pretty_print_unclosed_quote_error((UNCLOSED_QUOTE_ERROR_T*) error, indent, relative_indent, buffer); break;
1855
+ case MISSING_ATTRIBUTE_VALUE_ERROR: error_pretty_print_missing_attribute_value_error((MISSING_ATTRIBUTE_VALUE_ERROR_T*) error, indent, relative_indent, buffer); break;
1856
+ case UNCLOSED_ERB_TAG_ERROR: error_pretty_print_unclosed_erb_tag_error((UNCLOSED_ERB_TAG_ERROR_T*) error, indent, relative_indent, buffer); break;
1857
+ case STRAY_ERB_CLOSING_TAG_ERROR: error_pretty_print_stray_erb_closing_tag_error((STRAY_ERB_CLOSING_TAG_ERROR_T*) error, indent, relative_indent, buffer); break;
1858
+ case NESTED_ERB_TAG_ERROR: error_pretty_print_nested_erb_tag_error((NESTED_ERB_TAG_ERROR_T*) error, indent, relative_indent, buffer); break;
1859
+ case RENDER_AMBIGUOUS_LOCALS_ERROR: error_pretty_print_render_ambiguous_locals_error((RENDER_AMBIGUOUS_LOCALS_ERROR_T*) error, indent, relative_indent, buffer); break;
1860
+ case RENDER_MISSING_LOCALS_ERROR: error_pretty_print_render_missing_locals_error((RENDER_MISSING_LOCALS_ERROR_T*) error, indent, relative_indent, buffer); break;
1861
+ case RENDER_NO_ARGUMENTS_ERROR: error_pretty_print_render_no_arguments_error((RENDER_NO_ARGUMENTS_ERROR_T*) error, indent, relative_indent, buffer); break;
1862
+ case RENDER_CONFLICTING_PARTIAL_ERROR: error_pretty_print_render_conflicting_partial_error((RENDER_CONFLICTING_PARTIAL_ERROR_T*) error, indent, relative_indent, buffer); break;
1863
+ case RENDER_INVALID_AS_OPTION_ERROR: error_pretty_print_render_invalid_as_option_error((RENDER_INVALID_AS_OPTION_ERROR_T*) error, indent, relative_indent, buffer); break;
1864
+ case RENDER_OBJECT_AND_COLLECTION_ERROR: error_pretty_print_render_object_and_collection_error((RENDER_OBJECT_AND_COLLECTION_ERROR_T*) error, indent, relative_indent, buffer); break;
1865
+ case RENDER_LAYOUT_WITHOUT_BLOCK_ERROR: error_pretty_print_render_layout_without_block_error((RENDER_LAYOUT_WITHOUT_BLOCK_ERROR_T*) error, indent, relative_indent, buffer); break;
933
1866
  }
934
1867
  }
1868
+
1869
+ #endif