herb 0.8.10-arm-linux-gnu → 0.9.0-arm-linux-gnu

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 (209) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +11 -3
  3. data/README.md +64 -34
  4. data/Rakefile +48 -40
  5. data/config.yml +317 -34
  6. data/ext/herb/error_helpers.c +367 -140
  7. data/ext/herb/error_helpers.h +1 -0
  8. data/ext/herb/extconf.rb +67 -28
  9. data/ext/herb/extension.c +317 -51
  10. data/ext/herb/extension.h +1 -0
  11. data/ext/herb/extension_helpers.c +23 -14
  12. data/ext/herb/extension_helpers.h +2 -2
  13. data/ext/herb/nodes.c +537 -270
  14. data/ext/herb/nodes.h +1 -0
  15. data/herb.gemspec +3 -2
  16. data/lib/herb/3.0/herb.so +0 -0
  17. data/lib/herb/3.1/herb.so +0 -0
  18. data/lib/herb/3.2/herb.so +0 -0
  19. data/lib/herb/3.3/herb.so +0 -0
  20. data/lib/herb/3.4/herb.so +0 -0
  21. data/lib/herb/4.0/herb.so +0 -0
  22. data/lib/herb/ast/helpers.rb +3 -3
  23. data/lib/herb/ast/node.rb +15 -2
  24. data/lib/herb/ast/nodes.rb +1132 -157
  25. data/lib/herb/bootstrap.rb +87 -0
  26. data/lib/herb/cli.rb +341 -31
  27. data/lib/herb/configuration.rb +248 -0
  28. data/lib/herb/defaults.yml +32 -0
  29. data/lib/herb/engine/compiler.rb +78 -11
  30. data/lib/herb/engine/debug_visitor.rb +13 -3
  31. data/lib/herb/engine/error_formatter.rb +13 -9
  32. data/lib/herb/engine/parser_error_overlay.rb +10 -6
  33. data/lib/herb/engine/validator.rb +8 -3
  34. data/lib/herb/engine/validators/nesting_validator.rb +2 -2
  35. data/lib/herb/engine.rb +82 -35
  36. data/lib/herb/errors.rb +563 -88
  37. data/lib/herb/lex_result.rb +1 -0
  38. data/lib/herb/location.rb +7 -3
  39. data/lib/herb/parse_result.rb +12 -2
  40. data/lib/herb/parser_options.rb +57 -0
  41. data/lib/herb/position.rb +1 -0
  42. data/lib/herb/prism_inspect.rb +116 -0
  43. data/lib/herb/project.rb +923 -331
  44. data/lib/herb/range.rb +1 -0
  45. data/lib/herb/token.rb +7 -1
  46. data/lib/herb/version.rb +1 -1
  47. data/lib/herb/visitor.rb +37 -2
  48. data/lib/herb/warnings.rb +6 -1
  49. data/lib/herb.rb +35 -3
  50. data/sig/herb/ast/helpers.rbs +2 -2
  51. data/sig/herb/ast/node.rbs +12 -2
  52. data/sig/herb/ast/nodes.rbs +641 -128
  53. data/sig/herb/bootstrap.rbs +31 -0
  54. data/sig/herb/configuration.rbs +89 -0
  55. data/sig/herb/engine/compiler.rbs +9 -1
  56. data/sig/herb/engine/debug_visitor.rbs +2 -0
  57. data/sig/herb/engine/validator.rbs +5 -1
  58. data/sig/herb/engine.rbs +17 -3
  59. data/sig/herb/errors.rbs +258 -63
  60. data/sig/herb/location.rbs +4 -0
  61. data/sig/herb/parse_result.rbs +4 -2
  62. data/sig/herb/parser_options.rbs +42 -0
  63. data/sig/herb/position.rbs +1 -0
  64. data/sig/herb/prism_inspect.rbs +28 -0
  65. data/sig/herb/range.rbs +1 -0
  66. data/sig/herb/token.rbs +6 -0
  67. data/sig/herb/visitor.rbs +25 -4
  68. data/sig/herb/warnings.rbs +6 -1
  69. data/sig/herb.rbs +14 -0
  70. data/sig/herb_c_extension.rbs +5 -2
  71. data/sig/serialized_ast_errors.rbs +54 -6
  72. data/sig/serialized_ast_nodes.rbs +60 -6
  73. data/src/analyze/action_view/attribute_extraction_helpers.c +290 -0
  74. data/src/analyze/action_view/content_tag.c +70 -0
  75. data/src/analyze/action_view/link_to.c +143 -0
  76. data/src/analyze/action_view/registry.c +60 -0
  77. data/src/analyze/action_view/tag.c +64 -0
  78. data/src/analyze/action_view/tag_helper_node_builders.c +305 -0
  79. data/src/analyze/action_view/tag_helpers.c +748 -0
  80. data/src/analyze/action_view/turbo_frame_tag.c +88 -0
  81. data/src/analyze/analyze.c +882 -0
  82. data/src/{analyzed_ruby.c → analyze/analyzed_ruby.c} +13 -11
  83. data/src/analyze/builders.c +343 -0
  84. data/src/analyze/conditional_elements.c +594 -0
  85. data/src/analyze/conditional_open_tags.c +640 -0
  86. data/src/analyze/control_type.c +250 -0
  87. data/src/{analyze_helpers.c → analyze/helpers.c} +48 -23
  88. data/src/analyze/invalid_structures.c +193 -0
  89. data/src/{analyze_missing_end.c → analyze/missing_end.c} +33 -22
  90. data/src/analyze/parse_errors.c +84 -0
  91. data/src/analyze/prism_annotate.c +397 -0
  92. data/src/{analyze_transform.c → analyze/transform.c} +17 -3
  93. data/src/ast_node.c +17 -7
  94. data/src/ast_nodes.c +662 -387
  95. data/src/ast_pretty_print.c +190 -6
  96. data/src/errors.c +1076 -520
  97. data/src/extract.c +145 -49
  98. data/src/herb.c +52 -34
  99. data/src/html_util.c +241 -12
  100. data/src/include/analyze/action_view/attribute_extraction_helpers.h +36 -0
  101. data/src/include/analyze/action_view/tag_helper_handler.h +41 -0
  102. data/src/include/analyze/action_view/tag_helper_node_builders.h +70 -0
  103. data/src/include/analyze/action_view/tag_helpers.h +38 -0
  104. data/src/include/{analyze.h → analyze/analyze.h} +14 -4
  105. data/src/include/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
  106. data/src/include/analyze/builders.h +27 -0
  107. data/src/include/analyze/conditional_elements.h +9 -0
  108. data/src/include/analyze/conditional_open_tags.h +9 -0
  109. data/src/include/analyze/control_type.h +14 -0
  110. data/src/include/{analyze_helpers.h → analyze/helpers.h} +4 -2
  111. data/src/include/analyze/invalid_structures.h +11 -0
  112. data/src/include/analyze/prism_annotate.h +16 -0
  113. data/src/include/ast_node.h +11 -5
  114. data/src/include/ast_nodes.h +117 -38
  115. data/src/include/ast_pretty_print.h +5 -0
  116. data/src/include/element_source.h +3 -8
  117. data/src/include/errors.h +148 -55
  118. data/src/include/extract.h +21 -5
  119. data/src/include/herb.h +18 -6
  120. data/src/include/herb_prism_node.h +13 -0
  121. data/src/include/html_util.h +7 -2
  122. data/src/include/io.h +3 -1
  123. data/src/include/lex_helpers.h +29 -0
  124. data/src/include/lexer.h +1 -1
  125. data/src/include/lexer_peek_helpers.h +87 -13
  126. data/src/include/lexer_struct.h +2 -0
  127. data/src/include/location.h +2 -1
  128. data/src/include/parser.h +27 -2
  129. data/src/include/parser_helpers.h +19 -3
  130. data/src/include/pretty_print.h +10 -5
  131. data/src/include/prism_context.h +45 -0
  132. data/src/include/prism_helpers.h +10 -7
  133. data/src/include/prism_serialized.h +12 -0
  134. data/src/include/token.h +16 -4
  135. data/src/include/token_struct.h +10 -3
  136. data/src/include/utf8.h +2 -1
  137. data/src/include/util/hb_allocator.h +78 -0
  138. data/src/include/util/hb_arena.h +6 -1
  139. data/src/include/util/hb_arena_debug.h +12 -1
  140. data/src/include/util/hb_array.h +7 -3
  141. data/src/include/util/hb_buffer.h +6 -4
  142. data/src/include/util/hb_foreach.h +79 -0
  143. data/src/include/util/hb_narray.h +8 -4
  144. data/src/include/util/hb_string.h +56 -9
  145. data/src/include/util.h +6 -3
  146. data/src/include/version.h +1 -1
  147. data/src/io.c +3 -2
  148. data/src/lexer.c +42 -30
  149. data/src/lexer_peek_helpers.c +12 -74
  150. data/src/location.c +2 -2
  151. data/src/main.c +53 -28
  152. data/src/parser.c +783 -247
  153. data/src/parser_helpers.c +110 -23
  154. data/src/parser_match_tags.c +109 -48
  155. data/src/pretty_print.c +29 -24
  156. data/src/prism_helpers.c +30 -27
  157. data/src/ruby_parser.c +2 -0
  158. data/src/token.c +151 -66
  159. data/src/token_matchers.c +0 -1
  160. data/src/utf8.c +7 -6
  161. data/src/util/hb_allocator.c +341 -0
  162. data/src/util/hb_arena.c +81 -56
  163. data/src/util/hb_arena_debug.c +32 -17
  164. data/src/util/hb_array.c +30 -15
  165. data/src/util/hb_buffer.c +17 -21
  166. data/src/util/hb_narray.c +22 -7
  167. data/src/util/hb_string.c +49 -35
  168. data/src/util.c +21 -11
  169. data/src/visitor.c +47 -0
  170. data/templates/ext/herb/error_helpers.c.erb +24 -11
  171. data/templates/ext/herb/error_helpers.h.erb +1 -0
  172. data/templates/ext/herb/nodes.c.erb +50 -16
  173. data/templates/ext/herb/nodes.h.erb +1 -0
  174. data/templates/java/error_helpers.c.erb +1 -1
  175. data/templates/java/nodes.c.erb +30 -8
  176. data/templates/java/org/herb/ast/Errors.java.erb +24 -1
  177. data/templates/java/org/herb/ast/Nodes.java.erb +80 -21
  178. data/templates/javascript/packages/core/src/errors.ts.erb +16 -3
  179. data/templates/javascript/packages/core/src/node-type-guards.ts.erb +3 -1
  180. data/templates/javascript/packages/core/src/nodes.ts.erb +109 -32
  181. data/templates/javascript/packages/node/extension/error_helpers.cpp.erb +13 -4
  182. data/templates/javascript/packages/node/extension/nodes.cpp.erb +43 -4
  183. data/templates/lib/herb/ast/nodes.rb.erb +88 -31
  184. data/templates/lib/herb/errors.rb.erb +15 -3
  185. data/templates/lib/herb/visitor.rb.erb +2 -2
  186. data/templates/rust/src/ast/nodes.rs.erb +97 -44
  187. data/templates/rust/src/errors.rs.erb +2 -1
  188. data/templates/rust/src/nodes.rs.erb +167 -15
  189. data/templates/rust/src/union_types.rs.erb +60 -0
  190. data/templates/rust/src/visitor.rs.erb +81 -0
  191. data/templates/src/{analyze_missing_end.c.erb → analyze/missing_end.c.erb} +9 -6
  192. data/templates/src/{analyze_transform.c.erb → analyze/transform.c.erb} +2 -2
  193. data/templates/src/ast_nodes.c.erb +34 -26
  194. data/templates/src/ast_pretty_print.c.erb +24 -5
  195. data/templates/src/errors.c.erb +60 -54
  196. data/templates/src/include/ast_nodes.h.erb +6 -2
  197. data/templates/src/include/ast_pretty_print.h.erb +5 -0
  198. data/templates/src/include/errors.h.erb +15 -11
  199. data/templates/src/include/util/hb_foreach.h.erb +20 -0
  200. data/templates/src/parser_match_tags.c.erb +10 -4
  201. data/templates/src/visitor.c.erb +2 -2
  202. data/templates/template.rb +204 -29
  203. data/templates/wasm/error_helpers.cpp.erb +9 -5
  204. data/templates/wasm/nodes.cpp.erb +41 -4
  205. metadata +57 -16
  206. data/src/analyze.c +0 -1608
  207. data/src/element_source.c +0 -12
  208. data/src/include/util/hb_system.h +0 -9
  209. data/src/util/hb_system.c +0 -30
@@ -10,26 +10,76 @@
10
10
  #include "../../src/include/errors.h"
11
11
  #include "../../src/include/herb.h"
12
12
  #include "../../src/include/token.h"
13
+ #include "../../src/include/util/hb_string.h"
13
14
 
14
15
  VALUE rb_error_from_c_struct(ERROR_T* error);
15
16
 
17
+ static VALUE mErrors;
18
+ static VALUE cError;
19
+ static VALUE cUnexpectedError;
20
+ static VALUE cUnexpectedTokenError;
21
+ static VALUE cMissingOpeningTagError;
22
+ static VALUE cMissingClosingTagError;
23
+ static VALUE cTagNamesMismatchError;
24
+ static VALUE cVoidElementClosingTagError;
25
+ static VALUE cUnclosedElementError;
26
+ static VALUE cRubyParseError;
27
+ static VALUE cERBControlFlowScopeError;
28
+ static VALUE cMissingERBEndTagError;
29
+ static VALUE cERBMultipleBlocksInTagError;
30
+ static VALUE cERBCaseWithConditionsError;
31
+ static VALUE cConditionalElementMultipleTagsError;
32
+ static VALUE cConditionalElementConditionMismatchError;
33
+ static VALUE cInvalidCommentClosingTagError;
34
+ static VALUE cOmittedClosingTagError;
35
+ static VALUE cUnclosedOpenTagError;
36
+ static VALUE cUnclosedCloseTagError;
37
+ static VALUE cUnclosedQuoteError;
38
+ static VALUE cMissingAttributeValueError;
39
+ static VALUE cUnclosedERBTagError;
40
+ static VALUE cStrayERBClosingTagError;
41
+ static VALUE cNestedERBTagError;
42
+
43
+ void rb_init_error_classes(void) {
44
+ mErrors = rb_define_module_under(mHerb, "Errors");
45
+ cError = rb_define_class_under(mErrors, "Error", rb_cObject);
46
+ cUnexpectedError = rb_define_class_under(mErrors, "UnexpectedError", cError);
47
+ cUnexpectedTokenError = rb_define_class_under(mErrors, "UnexpectedTokenError", cError);
48
+ cMissingOpeningTagError = rb_define_class_under(mErrors, "MissingOpeningTagError", cError);
49
+ cMissingClosingTagError = rb_define_class_under(mErrors, "MissingClosingTagError", cError);
50
+ cTagNamesMismatchError = rb_define_class_under(mErrors, "TagNamesMismatchError", cError);
51
+ cVoidElementClosingTagError = rb_define_class_under(mErrors, "VoidElementClosingTagError", cError);
52
+ cUnclosedElementError = rb_define_class_under(mErrors, "UnclosedElementError", cError);
53
+ cRubyParseError = rb_define_class_under(mErrors, "RubyParseError", cError);
54
+ cERBControlFlowScopeError = rb_define_class_under(mErrors, "ERBControlFlowScopeError", cError);
55
+ cMissingERBEndTagError = rb_define_class_under(mErrors, "MissingERBEndTagError", cError);
56
+ cERBMultipleBlocksInTagError = rb_define_class_under(mErrors, "ERBMultipleBlocksInTagError", cError);
57
+ cERBCaseWithConditionsError = rb_define_class_under(mErrors, "ERBCaseWithConditionsError", cError);
58
+ cConditionalElementMultipleTagsError = rb_define_class_under(mErrors, "ConditionalElementMultipleTagsError", cError);
59
+ cConditionalElementConditionMismatchError = rb_define_class_under(mErrors, "ConditionalElementConditionMismatchError", cError);
60
+ cInvalidCommentClosingTagError = rb_define_class_under(mErrors, "InvalidCommentClosingTagError", cError);
61
+ cOmittedClosingTagError = rb_define_class_under(mErrors, "OmittedClosingTagError", cError);
62
+ cUnclosedOpenTagError = rb_define_class_under(mErrors, "UnclosedOpenTagError", cError);
63
+ cUnclosedCloseTagError = rb_define_class_under(mErrors, "UnclosedCloseTagError", cError);
64
+ cUnclosedQuoteError = rb_define_class_under(mErrors, "UnclosedQuoteError", cError);
65
+ cMissingAttributeValueError = rb_define_class_under(mErrors, "MissingAttributeValueError", cError);
66
+ cUnclosedERBTagError = rb_define_class_under(mErrors, "UnclosedERBTagError", cError);
67
+ cStrayERBClosingTagError = rb_define_class_under(mErrors, "StrayERBClosingTagError", cError);
68
+ cNestedERBTagError = rb_define_class_under(mErrors, "NestedERBTagError", cError);
69
+ }
70
+
16
71
  static VALUE rb_unexpected_error_from_c_struct(UNEXPECTED_ERROR_T* unexpected_error) {
17
72
  if (unexpected_error == NULL) { return Qnil; }
18
73
 
19
74
  ERROR_T* error = &unexpected_error->base;
20
75
 
21
- VALUE Herb = rb_define_module("Herb");
22
- VALUE Errors = rb_define_module_under(Herb, "Errors");
23
- VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
24
- VALUE UnexpectedError = rb_define_class_under(Errors, "UnexpectedError", Error);
25
-
26
- VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
76
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
27
77
  VALUE location = rb_location_from_c_struct(error->location);
28
- VALUE message = rb_utf8_str_new_cstr(error->message);
78
+ VALUE message = rb_string_from_hb_string(error->message);
29
79
 
30
- VALUE unexpected_error_description = rb_utf8_str_new_cstr(unexpected_error->description);
31
- VALUE unexpected_error_expected = rb_utf8_str_new_cstr(unexpected_error->expected);
32
- VALUE unexpected_error_found = rb_utf8_str_new_cstr(unexpected_error->found);
80
+ VALUE unexpected_error_description = rb_utf8_str_new(unexpected_error->description.data, unexpected_error->description.length);
81
+ VALUE unexpected_error_expected = rb_utf8_str_new(unexpected_error->expected.data, unexpected_error->expected.length);
82
+ VALUE unexpected_error_found = rb_utf8_str_new(unexpected_error->found.data, unexpected_error->found.length);
33
83
 
34
84
  VALUE args[6] = {
35
85
  type,
@@ -40,7 +90,7 @@ static VALUE rb_unexpected_error_from_c_struct(UNEXPECTED_ERROR_T* unexpected_er
40
90
  unexpected_error_found
41
91
  };
42
92
 
43
- return rb_class_new_instance(6, args, UnexpectedError);
93
+ return rb_class_new_instance(6, args, cUnexpectedError);
44
94
  };
45
95
 
46
96
  static VALUE rb_unexpected_token_error_from_c_struct(UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error) {
@@ -48,16 +98,12 @@ static VALUE rb_unexpected_token_error_from_c_struct(UNEXPECTED_TOKEN_ERROR_T* u
48
98
 
49
99
  ERROR_T* error = &unexpected_token_error->base;
50
100
 
51
- VALUE Herb = rb_define_module("Herb");
52
- VALUE Errors = rb_define_module_under(Herb, "Errors");
53
- VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
54
- VALUE UnexpectedTokenError = rb_define_class_under(Errors, "UnexpectedTokenError", Error);
55
-
56
- VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
101
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
57
102
  VALUE location = rb_location_from_c_struct(error->location);
58
- VALUE message = rb_utf8_str_new_cstr(error->message);
103
+ VALUE message = rb_string_from_hb_string(error->message);
59
104
 
60
- VALUE unexpected_token_error_expected_type = rb_utf8_str_new_cstr(token_type_to_string(unexpected_token_error->expected_type));
105
+ hb_string_T _expected_type_string = token_type_to_string(unexpected_token_error->expected_type);
106
+ VALUE unexpected_token_error_expected_type = rb_utf8_str_new(_expected_type_string.data, _expected_type_string.length);
61
107
  VALUE unexpected_token_error_found = rb_token_from_c_struct(unexpected_token_error->found);
62
108
 
63
109
  VALUE args[5] = {
@@ -68,7 +114,7 @@ static VALUE rb_unexpected_token_error_from_c_struct(UNEXPECTED_TOKEN_ERROR_T* u
68
114
  unexpected_token_error_found
69
115
  };
70
116
 
71
- return rb_class_new_instance(5, args, UnexpectedTokenError);
117
+ return rb_class_new_instance(5, args, cUnexpectedTokenError);
72
118
  };
73
119
 
74
120
  static VALUE rb_missing_opening_tag_error_from_c_struct(MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error) {
@@ -76,14 +122,9 @@ static VALUE rb_missing_opening_tag_error_from_c_struct(MISSING_OPENING_TAG_ERRO
76
122
 
77
123
  ERROR_T* error = &missing_opening_tag_error->base;
78
124
 
79
- VALUE Herb = rb_define_module("Herb");
80
- VALUE Errors = rb_define_module_under(Herb, "Errors");
81
- VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
82
- VALUE MissingOpeningTagError = rb_define_class_under(Errors, "MissingOpeningTagError", Error);
83
-
84
- VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
125
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
85
126
  VALUE location = rb_location_from_c_struct(error->location);
86
- VALUE message = rb_utf8_str_new_cstr(error->message);
127
+ VALUE message = rb_string_from_hb_string(error->message);
87
128
 
88
129
  VALUE missing_opening_tag_error_closing_tag = rb_token_from_c_struct(missing_opening_tag_error->closing_tag);
89
130
 
@@ -94,7 +135,7 @@ static VALUE rb_missing_opening_tag_error_from_c_struct(MISSING_OPENING_TAG_ERRO
94
135
  missing_opening_tag_error_closing_tag
95
136
  };
96
137
 
97
- return rb_class_new_instance(4, args, MissingOpeningTagError);
138
+ return rb_class_new_instance(4, args, cMissingOpeningTagError);
98
139
  };
99
140
 
100
141
  static VALUE rb_missing_closing_tag_error_from_c_struct(MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error) {
@@ -102,14 +143,9 @@ static VALUE rb_missing_closing_tag_error_from_c_struct(MISSING_CLOSING_TAG_ERRO
102
143
 
103
144
  ERROR_T* error = &missing_closing_tag_error->base;
104
145
 
105
- VALUE Herb = rb_define_module("Herb");
106
- VALUE Errors = rb_define_module_under(Herb, "Errors");
107
- VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
108
- VALUE MissingClosingTagError = rb_define_class_under(Errors, "MissingClosingTagError", Error);
109
-
110
- VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
146
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
111
147
  VALUE location = rb_location_from_c_struct(error->location);
112
- VALUE message = rb_utf8_str_new_cstr(error->message);
148
+ VALUE message = rb_string_from_hb_string(error->message);
113
149
 
114
150
  VALUE missing_closing_tag_error_opening_tag = rb_token_from_c_struct(missing_closing_tag_error->opening_tag);
115
151
 
@@ -120,7 +156,7 @@ static VALUE rb_missing_closing_tag_error_from_c_struct(MISSING_CLOSING_TAG_ERRO
120
156
  missing_closing_tag_error_opening_tag
121
157
  };
122
158
 
123
- return rb_class_new_instance(4, args, MissingClosingTagError);
159
+ return rb_class_new_instance(4, args, cMissingClosingTagError);
124
160
  };
125
161
 
126
162
  static VALUE rb_tag_names_mismatch_error_from_c_struct(TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error) {
@@ -128,14 +164,9 @@ static VALUE rb_tag_names_mismatch_error_from_c_struct(TAG_NAMES_MISMATCH_ERROR_
128
164
 
129
165
  ERROR_T* error = &tag_names_mismatch_error->base;
130
166
 
131
- VALUE Herb = rb_define_module("Herb");
132
- VALUE Errors = rb_define_module_under(Herb, "Errors");
133
- VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
134
- VALUE TagNamesMismatchError = rb_define_class_under(Errors, "TagNamesMismatchError", Error);
135
-
136
- VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
167
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
137
168
  VALUE location = rb_location_from_c_struct(error->location);
138
- VALUE message = rb_utf8_str_new_cstr(error->message);
169
+ VALUE message = rb_string_from_hb_string(error->message);
139
170
 
140
171
  VALUE tag_names_mismatch_error_opening_tag = rb_token_from_c_struct(tag_names_mismatch_error->opening_tag);
141
172
  VALUE tag_names_mismatch_error_closing_tag = rb_token_from_c_struct(tag_names_mismatch_error->closing_tag);
@@ -148,35 +179,7 @@ static VALUE rb_tag_names_mismatch_error_from_c_struct(TAG_NAMES_MISMATCH_ERROR_
148
179
  tag_names_mismatch_error_closing_tag
149
180
  };
150
181
 
151
- return rb_class_new_instance(5, args, TagNamesMismatchError);
152
- };
153
-
154
- static VALUE rb_quotes_mismatch_error_from_c_struct(QUOTES_MISMATCH_ERROR_T* quotes_mismatch_error) {
155
- if (quotes_mismatch_error == NULL) { return Qnil; }
156
-
157
- ERROR_T* error = &quotes_mismatch_error->base;
158
-
159
- VALUE Herb = rb_define_module("Herb");
160
- VALUE Errors = rb_define_module_under(Herb, "Errors");
161
- VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
162
- VALUE QuotesMismatchError = rb_define_class_under(Errors, "QuotesMismatchError", Error);
163
-
164
- VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
165
- VALUE location = rb_location_from_c_struct(error->location);
166
- VALUE message = rb_utf8_str_new_cstr(error->message);
167
-
168
- VALUE quotes_mismatch_error_opening_quote = rb_token_from_c_struct(quotes_mismatch_error->opening_quote);
169
- VALUE quotes_mismatch_error_closing_quote = rb_token_from_c_struct(quotes_mismatch_error->closing_quote);
170
-
171
- VALUE args[5] = {
172
- type,
173
- location,
174
- message,
175
- quotes_mismatch_error_opening_quote,
176
- quotes_mismatch_error_closing_quote
177
- };
178
-
179
- return rb_class_new_instance(5, args, QuotesMismatchError);
182
+ return rb_class_new_instance(5, args, cTagNamesMismatchError);
180
183
  };
181
184
 
182
185
  static VALUE rb_void_element_closing_tag_error_from_c_struct(VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error) {
@@ -184,18 +187,13 @@ static VALUE rb_void_element_closing_tag_error_from_c_struct(VOID_ELEMENT_CLOSIN
184
187
 
185
188
  ERROR_T* error = &void_element_closing_tag_error->base;
186
189
 
187
- VALUE Herb = rb_define_module("Herb");
188
- VALUE Errors = rb_define_module_under(Herb, "Errors");
189
- VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
190
- VALUE VoidElementClosingTagError = rb_define_class_under(Errors, "VoidElementClosingTagError", Error);
191
-
192
- VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
190
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
193
191
  VALUE location = rb_location_from_c_struct(error->location);
194
- VALUE message = rb_utf8_str_new_cstr(error->message);
192
+ VALUE message = rb_string_from_hb_string(error->message);
195
193
 
196
194
  VALUE void_element_closing_tag_error_tag_name = rb_token_from_c_struct(void_element_closing_tag_error->tag_name);
197
- VALUE void_element_closing_tag_error_expected = rb_utf8_str_new_cstr(void_element_closing_tag_error->expected);
198
- VALUE void_element_closing_tag_error_found = rb_utf8_str_new_cstr(void_element_closing_tag_error->found);
195
+ VALUE void_element_closing_tag_error_expected = rb_utf8_str_new(void_element_closing_tag_error->expected.data, void_element_closing_tag_error->expected.length);
196
+ VALUE void_element_closing_tag_error_found = rb_utf8_str_new(void_element_closing_tag_error->found.data, void_element_closing_tag_error->found.length);
199
197
 
200
198
  VALUE args[6] = {
201
199
  type,
@@ -206,7 +204,7 @@ static VALUE rb_void_element_closing_tag_error_from_c_struct(VOID_ELEMENT_CLOSIN
206
204
  void_element_closing_tag_error_found
207
205
  };
208
206
 
209
- return rb_class_new_instance(6, args, VoidElementClosingTagError);
207
+ return rb_class_new_instance(6, args, cVoidElementClosingTagError);
210
208
  };
211
209
 
212
210
  static VALUE rb_unclosed_element_error_from_c_struct(UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error) {
@@ -214,14 +212,9 @@ static VALUE rb_unclosed_element_error_from_c_struct(UNCLOSED_ELEMENT_ERROR_T* u
214
212
 
215
213
  ERROR_T* error = &unclosed_element_error->base;
216
214
 
217
- VALUE Herb = rb_define_module("Herb");
218
- VALUE Errors = rb_define_module_under(Herb, "Errors");
219
- VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
220
- VALUE UnclosedElementError = rb_define_class_under(Errors, "UnclosedElementError", Error);
221
-
222
- VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
215
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
223
216
  VALUE location = rb_location_from_c_struct(error->location);
224
- VALUE message = rb_utf8_str_new_cstr(error->message);
217
+ VALUE message = rb_string_from_hb_string(error->message);
225
218
 
226
219
  VALUE unclosed_element_error_opening_tag = rb_token_from_c_struct(unclosed_element_error->opening_tag);
227
220
 
@@ -232,7 +225,7 @@ static VALUE rb_unclosed_element_error_from_c_struct(UNCLOSED_ELEMENT_ERROR_T* u
232
225
  unclosed_element_error_opening_tag
233
226
  };
234
227
 
235
- return rb_class_new_instance(4, args, UnclosedElementError);
228
+ return rb_class_new_instance(4, args, cUnclosedElementError);
236
229
  };
237
230
 
238
231
  static VALUE rb_ruby_parse_error_from_c_struct(RUBY_PARSE_ERROR_T* ruby_parse_error) {
@@ -240,18 +233,13 @@ static VALUE rb_ruby_parse_error_from_c_struct(RUBY_PARSE_ERROR_T* ruby_parse_er
240
233
 
241
234
  ERROR_T* error = &ruby_parse_error->base;
242
235
 
243
- VALUE Herb = rb_define_module("Herb");
244
- VALUE Errors = rb_define_module_under(Herb, "Errors");
245
- VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
246
- VALUE RubyParseError = rb_define_class_under(Errors, "RubyParseError", Error);
247
-
248
- VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
236
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
249
237
  VALUE location = rb_location_from_c_struct(error->location);
250
- VALUE message = rb_utf8_str_new_cstr(error->message);
238
+ VALUE message = rb_string_from_hb_string(error->message);
251
239
 
252
- VALUE ruby_parse_error_error_message = rb_utf8_str_new_cstr(ruby_parse_error->error_message);
253
- VALUE ruby_parse_error_diagnostic_id = rb_utf8_str_new_cstr(ruby_parse_error->diagnostic_id);
254
- VALUE ruby_parse_error_level = rb_utf8_str_new_cstr(ruby_parse_error->level);
240
+ VALUE ruby_parse_error_error_message = rb_utf8_str_new(ruby_parse_error->error_message.data, ruby_parse_error->error_message.length);
241
+ VALUE ruby_parse_error_diagnostic_id = rb_utf8_str_new(ruby_parse_error->diagnostic_id.data, ruby_parse_error->diagnostic_id.length);
242
+ VALUE ruby_parse_error_level = rb_utf8_str_new(ruby_parse_error->level.data, ruby_parse_error->level.length);
255
243
 
256
244
  VALUE args[6] = {
257
245
  type,
@@ -262,7 +250,7 @@ static VALUE rb_ruby_parse_error_from_c_struct(RUBY_PARSE_ERROR_T* ruby_parse_er
262
250
  ruby_parse_error_level
263
251
  };
264
252
 
265
- return rb_class_new_instance(6, args, RubyParseError);
253
+ return rb_class_new_instance(6, args, cRubyParseError);
266
254
  };
267
255
 
268
256
  static VALUE rb_erb_control_flow_scope_error_from_c_struct(ERB_CONTROL_FLOW_SCOPE_ERROR_T* erb_control_flow_scope_error) {
@@ -270,16 +258,11 @@ static VALUE rb_erb_control_flow_scope_error_from_c_struct(ERB_CONTROL_FLOW_SCOP
270
258
 
271
259
  ERROR_T* error = &erb_control_flow_scope_error->base;
272
260
 
273
- VALUE Herb = rb_define_module("Herb");
274
- VALUE Errors = rb_define_module_under(Herb, "Errors");
275
- VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
276
- VALUE ERBControlFlowScopeError = rb_define_class_under(Errors, "ERBControlFlowScopeError", Error);
277
-
278
- VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
261
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
279
262
  VALUE location = rb_location_from_c_struct(error->location);
280
- VALUE message = rb_utf8_str_new_cstr(error->message);
263
+ VALUE message = rb_string_from_hb_string(error->message);
281
264
 
282
- VALUE erb_control_flow_scope_error_keyword = rb_utf8_str_new_cstr(erb_control_flow_scope_error->keyword);
265
+ VALUE erb_control_flow_scope_error_keyword = rb_utf8_str_new(erb_control_flow_scope_error->keyword.data, erb_control_flow_scope_error->keyword.length);
283
266
 
284
267
  VALUE args[4] = {
285
268
  type,
@@ -288,33 +271,28 @@ static VALUE rb_erb_control_flow_scope_error_from_c_struct(ERB_CONTROL_FLOW_SCOP
288
271
  erb_control_flow_scope_error_keyword
289
272
  };
290
273
 
291
- return rb_class_new_instance(4, args, ERBControlFlowScopeError);
274
+ return rb_class_new_instance(4, args, cERBControlFlowScopeError);
292
275
  };
293
276
 
294
- static VALUE rb_missingerb_end_tag_error_from_c_struct(MISSINGERB_END_TAG_ERROR_T* missingerb_end_tag_error) {
295
- if (missingerb_end_tag_error == NULL) { return Qnil; }
296
-
297
- ERROR_T* error = &missingerb_end_tag_error->base;
277
+ static VALUE rb_missing_erb_end_tag_error_from_c_struct(MISSING_ERB_END_TAG_ERROR_T* missing_erb_end_tag_error) {
278
+ if (missing_erb_end_tag_error == NULL) { return Qnil; }
298
279
 
299
- VALUE Herb = rb_define_module("Herb");
300
- VALUE Errors = rb_define_module_under(Herb, "Errors");
301
- VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
302
- VALUE MissingERBEndTagError = rb_define_class_under(Errors, "MissingERBEndTagError", Error);
280
+ ERROR_T* error = &missing_erb_end_tag_error->base;
303
281
 
304
- VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
282
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
305
283
  VALUE location = rb_location_from_c_struct(error->location);
306
- VALUE message = rb_utf8_str_new_cstr(error->message);
284
+ VALUE message = rb_string_from_hb_string(error->message);
307
285
 
308
- VALUE missingerb_end_tag_error_keyword = rb_utf8_str_new_cstr(missingerb_end_tag_error->keyword);
286
+ VALUE missing_erb_end_tag_error_keyword = rb_utf8_str_new(missing_erb_end_tag_error->keyword.data, missing_erb_end_tag_error->keyword.length);
309
287
 
310
288
  VALUE args[4] = {
311
289
  type,
312
290
  location,
313
291
  message,
314
- missingerb_end_tag_error_keyword
292
+ missing_erb_end_tag_error_keyword
315
293
  };
316
294
 
317
- return rb_class_new_instance(4, args, MissingERBEndTagError);
295
+ return rb_class_new_instance(4, args, cMissingERBEndTagError);
318
296
  };
319
297
 
320
298
  static VALUE rb_erb_multiple_blocks_in_tag_error_from_c_struct(ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* erb_multiple_blocks_in_tag_error) {
@@ -322,14 +300,9 @@ static VALUE rb_erb_multiple_blocks_in_tag_error_from_c_struct(ERB_MULTIPLE_BLOC
322
300
 
323
301
  ERROR_T* error = &erb_multiple_blocks_in_tag_error->base;
324
302
 
325
- VALUE Herb = rb_define_module("Herb");
326
- VALUE Errors = rb_define_module_under(Herb, "Errors");
327
- VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
328
- VALUE ERBMultipleBlocksInTagError = rb_define_class_under(Errors, "ERBMultipleBlocksInTagError", Error);
329
-
330
- VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
303
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
331
304
  VALUE location = rb_location_from_c_struct(error->location);
332
- VALUE message = rb_utf8_str_new_cstr(error->message);
305
+ VALUE message = rb_string_from_hb_string(error->message);
333
306
 
334
307
 
335
308
  VALUE args[3] = {
@@ -338,7 +311,7 @@ static VALUE rb_erb_multiple_blocks_in_tag_error_from_c_struct(ERB_MULTIPLE_BLOC
338
311
  message
339
312
  };
340
313
 
341
- return rb_class_new_instance(3, args, ERBMultipleBlocksInTagError);
314
+ return rb_class_new_instance(3, args, cERBMultipleBlocksInTagError);
342
315
  };
343
316
 
344
317
  static VALUE rb_erb_case_with_conditions_error_from_c_struct(ERB_CASE_WITH_CONDITIONS_ERROR_T* erb_case_with_conditions_error) {
@@ -346,14 +319,233 @@ static VALUE rb_erb_case_with_conditions_error_from_c_struct(ERB_CASE_WITH_CONDI
346
319
 
347
320
  ERROR_T* error = &erb_case_with_conditions_error->base;
348
321
 
349
- VALUE Herb = rb_define_module("Herb");
350
- VALUE Errors = rb_define_module_under(Herb, "Errors");
351
- VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
352
- VALUE ERBCaseWithConditionsError = rb_define_class_under(Errors, "ERBCaseWithConditionsError", Error);
322
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
323
+ VALUE location = rb_location_from_c_struct(error->location);
324
+ VALUE message = rb_string_from_hb_string(error->message);
325
+
326
+
327
+ VALUE args[3] = {
328
+ type,
329
+ location,
330
+ message
331
+ };
332
+
333
+ return rb_class_new_instance(3, args, cERBCaseWithConditionsError);
334
+ };
335
+
336
+ static VALUE rb_conditional_element_multiple_tags_error_from_c_struct(CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR_T* conditional_element_multiple_tags_error) {
337
+ if (conditional_element_multiple_tags_error == NULL) { return Qnil; }
338
+
339
+ ERROR_T* error = &conditional_element_multiple_tags_error->base;
340
+
341
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
342
+ VALUE location = rb_location_from_c_struct(error->location);
343
+ VALUE message = rb_string_from_hb_string(error->message);
344
+
345
+ VALUE conditional_element_multiple_tags_error_line = ULONG2NUM(conditional_element_multiple_tags_error->line);
346
+ VALUE conditional_element_multiple_tags_error_column = ULONG2NUM(conditional_element_multiple_tags_error->column);
347
+
348
+ VALUE args[5] = {
349
+ type,
350
+ location,
351
+ message,
352
+ conditional_element_multiple_tags_error_line,
353
+ conditional_element_multiple_tags_error_column
354
+ };
355
+
356
+ return rb_class_new_instance(5, args, cConditionalElementMultipleTagsError);
357
+ };
358
+
359
+ static VALUE rb_conditional_element_condition_mismatch_error_from_c_struct(CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR_T* conditional_element_condition_mismatch_error) {
360
+ if (conditional_element_condition_mismatch_error == NULL) { return Qnil; }
361
+
362
+ ERROR_T* error = &conditional_element_condition_mismatch_error->base;
363
+
364
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
365
+ VALUE location = rb_location_from_c_struct(error->location);
366
+ VALUE message = rb_string_from_hb_string(error->message);
367
+
368
+ VALUE conditional_element_condition_mismatch_error_tag_name = rb_utf8_str_new(conditional_element_condition_mismatch_error->tag_name.data, conditional_element_condition_mismatch_error->tag_name.length);
369
+ VALUE conditional_element_condition_mismatch_error_open_condition = rb_utf8_str_new(conditional_element_condition_mismatch_error->open_condition.data, conditional_element_condition_mismatch_error->open_condition.length);
370
+ VALUE conditional_element_condition_mismatch_error_open_line = ULONG2NUM(conditional_element_condition_mismatch_error->open_line);
371
+ VALUE conditional_element_condition_mismatch_error_open_column = ULONG2NUM(conditional_element_condition_mismatch_error->open_column);
372
+ VALUE conditional_element_condition_mismatch_error_close_condition = rb_utf8_str_new(conditional_element_condition_mismatch_error->close_condition.data, conditional_element_condition_mismatch_error->close_condition.length);
373
+ VALUE conditional_element_condition_mismatch_error_close_line = ULONG2NUM(conditional_element_condition_mismatch_error->close_line);
374
+ VALUE conditional_element_condition_mismatch_error_close_column = ULONG2NUM(conditional_element_condition_mismatch_error->close_column);
375
+
376
+ VALUE args[10] = {
377
+ type,
378
+ location,
379
+ message,
380
+ conditional_element_condition_mismatch_error_tag_name,
381
+ conditional_element_condition_mismatch_error_open_condition,
382
+ conditional_element_condition_mismatch_error_open_line,
383
+ conditional_element_condition_mismatch_error_open_column,
384
+ conditional_element_condition_mismatch_error_close_condition,
385
+ conditional_element_condition_mismatch_error_close_line,
386
+ conditional_element_condition_mismatch_error_close_column
387
+ };
388
+
389
+ return rb_class_new_instance(10, args, cConditionalElementConditionMismatchError);
390
+ };
391
+
392
+ static VALUE rb_invalid_comment_closing_tag_error_from_c_struct(INVALID_COMMENT_CLOSING_TAG_ERROR_T* invalid_comment_closing_tag_error) {
393
+ if (invalid_comment_closing_tag_error == NULL) { return Qnil; }
394
+
395
+ ERROR_T* error = &invalid_comment_closing_tag_error->base;
396
+
397
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
398
+ VALUE location = rb_location_from_c_struct(error->location);
399
+ VALUE message = rb_string_from_hb_string(error->message);
400
+
401
+ VALUE invalid_comment_closing_tag_error_closing_tag = rb_token_from_c_struct(invalid_comment_closing_tag_error->closing_tag);
402
+
403
+ VALUE args[4] = {
404
+ type,
405
+ location,
406
+ message,
407
+ invalid_comment_closing_tag_error_closing_tag
408
+ };
409
+
410
+ return rb_class_new_instance(4, args, cInvalidCommentClosingTagError);
411
+ };
412
+
413
+ static VALUE rb_omitted_closing_tag_error_from_c_struct(OMITTED_CLOSING_TAG_ERROR_T* omitted_closing_tag_error) {
414
+ if (omitted_closing_tag_error == NULL) { return Qnil; }
415
+
416
+ ERROR_T* error = &omitted_closing_tag_error->base;
417
+
418
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
419
+ VALUE location = rb_location_from_c_struct(error->location);
420
+ VALUE message = rb_string_from_hb_string(error->message);
421
+
422
+ VALUE omitted_closing_tag_error_opening_tag = rb_token_from_c_struct(omitted_closing_tag_error->opening_tag);
423
+ VALUE omitted_closing_tag_error_insertion_point = rb_position_from_c_struct(omitted_closing_tag_error->insertion_point);
424
+
425
+ VALUE args[5] = {
426
+ type,
427
+ location,
428
+ message,
429
+ omitted_closing_tag_error_opening_tag,
430
+ omitted_closing_tag_error_insertion_point
431
+ };
432
+
433
+ return rb_class_new_instance(5, args, cOmittedClosingTagError);
434
+ };
435
+
436
+ static VALUE rb_unclosed_open_tag_error_from_c_struct(UNCLOSED_OPEN_TAG_ERROR_T* unclosed_open_tag_error) {
437
+ if (unclosed_open_tag_error == NULL) { return Qnil; }
438
+
439
+ ERROR_T* error = &unclosed_open_tag_error->base;
440
+
441
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
442
+ VALUE location = rb_location_from_c_struct(error->location);
443
+ VALUE message = rb_string_from_hb_string(error->message);
444
+
445
+ VALUE unclosed_open_tag_error_tag_name = rb_token_from_c_struct(unclosed_open_tag_error->tag_name);
446
+
447
+ VALUE args[4] = {
448
+ type,
449
+ location,
450
+ message,
451
+ unclosed_open_tag_error_tag_name
452
+ };
453
+
454
+ return rb_class_new_instance(4, args, cUnclosedOpenTagError);
455
+ };
456
+
457
+ static VALUE rb_unclosed_close_tag_error_from_c_struct(UNCLOSED_CLOSE_TAG_ERROR_T* unclosed_close_tag_error) {
458
+ if (unclosed_close_tag_error == NULL) { return Qnil; }
459
+
460
+ ERROR_T* error = &unclosed_close_tag_error->base;
461
+
462
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
463
+ VALUE location = rb_location_from_c_struct(error->location);
464
+ VALUE message = rb_string_from_hb_string(error->message);
465
+
466
+ VALUE unclosed_close_tag_error_tag_name = rb_token_from_c_struct(unclosed_close_tag_error->tag_name);
467
+
468
+ VALUE args[4] = {
469
+ type,
470
+ location,
471
+ message,
472
+ unclosed_close_tag_error_tag_name
473
+ };
474
+
475
+ return rb_class_new_instance(4, args, cUnclosedCloseTagError);
476
+ };
477
+
478
+ static VALUE rb_unclosed_quote_error_from_c_struct(UNCLOSED_QUOTE_ERROR_T* unclosed_quote_error) {
479
+ if (unclosed_quote_error == NULL) { return Qnil; }
480
+
481
+ ERROR_T* error = &unclosed_quote_error->base;
482
+
483
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
484
+ VALUE location = rb_location_from_c_struct(error->location);
485
+ VALUE message = rb_string_from_hb_string(error->message);
486
+
487
+ VALUE unclosed_quote_error_opening_quote = rb_token_from_c_struct(unclosed_quote_error->opening_quote);
488
+
489
+ VALUE args[4] = {
490
+ type,
491
+ location,
492
+ message,
493
+ unclosed_quote_error_opening_quote
494
+ };
495
+
496
+ return rb_class_new_instance(4, args, cUnclosedQuoteError);
497
+ };
498
+
499
+ static VALUE rb_missing_attribute_value_error_from_c_struct(MISSING_ATTRIBUTE_VALUE_ERROR_T* missing_attribute_value_error) {
500
+ if (missing_attribute_value_error == NULL) { return Qnil; }
501
+
502
+ ERROR_T* error = &missing_attribute_value_error->base;
503
+
504
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
505
+ VALUE location = rb_location_from_c_struct(error->location);
506
+ VALUE message = rb_string_from_hb_string(error->message);
507
+
508
+ VALUE missing_attribute_value_error_attribute_name = rb_utf8_str_new(missing_attribute_value_error->attribute_name.data, missing_attribute_value_error->attribute_name.length);
509
+
510
+ VALUE args[4] = {
511
+ type,
512
+ location,
513
+ message,
514
+ missing_attribute_value_error_attribute_name
515
+ };
516
+
517
+ return rb_class_new_instance(4, args, cMissingAttributeValueError);
518
+ };
519
+
520
+ static VALUE rb_unclosed_erb_tag_error_from_c_struct(UNCLOSED_ERB_TAG_ERROR_T* unclosed_erb_tag_error) {
521
+ if (unclosed_erb_tag_error == NULL) { return Qnil; }
522
+
523
+ ERROR_T* error = &unclosed_erb_tag_error->base;
524
+
525
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
526
+ VALUE location = rb_location_from_c_struct(error->location);
527
+ VALUE message = rb_string_from_hb_string(error->message);
528
+
529
+ VALUE unclosed_erb_tag_error_opening_tag = rb_token_from_c_struct(unclosed_erb_tag_error->opening_tag);
530
+
531
+ VALUE args[4] = {
532
+ type,
533
+ location,
534
+ message,
535
+ unclosed_erb_tag_error_opening_tag
536
+ };
537
+
538
+ return rb_class_new_instance(4, args, cUnclosedERBTagError);
539
+ };
353
540
 
354
- VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
541
+ static VALUE rb_stray_erb_closing_tag_error_from_c_struct(STRAY_ERB_CLOSING_TAG_ERROR_T* stray_erb_closing_tag_error) {
542
+ if (stray_erb_closing_tag_error == NULL) { return Qnil; }
543
+
544
+ ERROR_T* error = &stray_erb_closing_tag_error->base;
545
+
546
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
355
547
  VALUE location = rb_location_from_c_struct(error->location);
356
- VALUE message = rb_utf8_str_new_cstr(error->message);
548
+ VALUE message = rb_string_from_hb_string(error->message);
357
549
 
358
550
 
359
551
  VALUE args[3] = {
@@ -362,7 +554,32 @@ static VALUE rb_erb_case_with_conditions_error_from_c_struct(ERB_CASE_WITH_CONDI
362
554
  message
363
555
  };
364
556
 
365
- return rb_class_new_instance(3, args, ERBCaseWithConditionsError);
557
+ return rb_class_new_instance(3, args, cStrayERBClosingTagError);
558
+ };
559
+
560
+ static VALUE rb_nested_erb_tag_error_from_c_struct(NESTED_ERB_TAG_ERROR_T* nested_erb_tag_error) {
561
+ if (nested_erb_tag_error == NULL) { return Qnil; }
562
+
563
+ ERROR_T* error = &nested_erb_tag_error->base;
564
+
565
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
566
+ VALUE location = rb_location_from_c_struct(error->location);
567
+ VALUE message = rb_string_from_hb_string(error->message);
568
+
569
+ VALUE nested_erb_tag_error_opening_tag = rb_token_from_c_struct(nested_erb_tag_error->opening_tag);
570
+ VALUE nested_erb_tag_error_nested_tag_line = ULONG2NUM(nested_erb_tag_error->nested_tag_line);
571
+ VALUE nested_erb_tag_error_nested_tag_column = ULONG2NUM(nested_erb_tag_error->nested_tag_column);
572
+
573
+ VALUE args[6] = {
574
+ type,
575
+ location,
576
+ message,
577
+ nested_erb_tag_error_opening_tag,
578
+ nested_erb_tag_error_nested_tag_line,
579
+ nested_erb_tag_error_nested_tag_column
580
+ };
581
+
582
+ return rb_class_new_instance(6, args, cNestedERBTagError);
366
583
  };
367
584
 
368
585
 
@@ -375,14 +592,24 @@ VALUE rb_error_from_c_struct(ERROR_T* error) {
375
592
  case MISSING_OPENING_TAG_ERROR: return rb_missing_opening_tag_error_from_c_struct((MISSING_OPENING_TAG_ERROR_T*) error); break;
376
593
  case MISSING_CLOSING_TAG_ERROR: return rb_missing_closing_tag_error_from_c_struct((MISSING_CLOSING_TAG_ERROR_T*) error); break;
377
594
  case TAG_NAMES_MISMATCH_ERROR: return rb_tag_names_mismatch_error_from_c_struct((TAG_NAMES_MISMATCH_ERROR_T*) error); break;
378
- case QUOTES_MISMATCH_ERROR: return rb_quotes_mismatch_error_from_c_struct((QUOTES_MISMATCH_ERROR_T*) error); break;
379
595
  case VOID_ELEMENT_CLOSING_TAG_ERROR: return rb_void_element_closing_tag_error_from_c_struct((VOID_ELEMENT_CLOSING_TAG_ERROR_T*) error); break;
380
596
  case UNCLOSED_ELEMENT_ERROR: return rb_unclosed_element_error_from_c_struct((UNCLOSED_ELEMENT_ERROR_T*) error); break;
381
597
  case RUBY_PARSE_ERROR: return rb_ruby_parse_error_from_c_struct((RUBY_PARSE_ERROR_T*) error); break;
382
598
  case ERB_CONTROL_FLOW_SCOPE_ERROR: return rb_erb_control_flow_scope_error_from_c_struct((ERB_CONTROL_FLOW_SCOPE_ERROR_T*) error); break;
383
- case MISSINGERB_END_TAG_ERROR: return rb_missingerb_end_tag_error_from_c_struct((MISSINGERB_END_TAG_ERROR_T*) error); break;
599
+ case MISSING_ERB_END_TAG_ERROR: return rb_missing_erb_end_tag_error_from_c_struct((MISSING_ERB_END_TAG_ERROR_T*) error); break;
384
600
  case ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR: return rb_erb_multiple_blocks_in_tag_error_from_c_struct((ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T*) error); break;
385
601
  case ERB_CASE_WITH_CONDITIONS_ERROR: return rb_erb_case_with_conditions_error_from_c_struct((ERB_CASE_WITH_CONDITIONS_ERROR_T*) error); break;
602
+ case CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR: return rb_conditional_element_multiple_tags_error_from_c_struct((CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR_T*) error); break;
603
+ case CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR: return rb_conditional_element_condition_mismatch_error_from_c_struct((CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR_T*) error); break;
604
+ case INVALID_COMMENT_CLOSING_TAG_ERROR: return rb_invalid_comment_closing_tag_error_from_c_struct((INVALID_COMMENT_CLOSING_TAG_ERROR_T*) error); break;
605
+ case OMITTED_CLOSING_TAG_ERROR: return rb_omitted_closing_tag_error_from_c_struct((OMITTED_CLOSING_TAG_ERROR_T*) error); break;
606
+ case UNCLOSED_OPEN_TAG_ERROR: return rb_unclosed_open_tag_error_from_c_struct((UNCLOSED_OPEN_TAG_ERROR_T*) error); break;
607
+ case UNCLOSED_CLOSE_TAG_ERROR: return rb_unclosed_close_tag_error_from_c_struct((UNCLOSED_CLOSE_TAG_ERROR_T*) error); break;
608
+ case UNCLOSED_QUOTE_ERROR: return rb_unclosed_quote_error_from_c_struct((UNCLOSED_QUOTE_ERROR_T*) error); break;
609
+ case MISSING_ATTRIBUTE_VALUE_ERROR: return rb_missing_attribute_value_error_from_c_struct((MISSING_ATTRIBUTE_VALUE_ERROR_T*) error); break;
610
+ case UNCLOSED_ERB_TAG_ERROR: return rb_unclosed_erb_tag_error_from_c_struct((UNCLOSED_ERB_TAG_ERROR_T*) error); break;
611
+ case STRAY_ERB_CLOSING_TAG_ERROR: return rb_stray_erb_closing_tag_error_from_c_struct((STRAY_ERB_CLOSING_TAG_ERROR_T*) error); break;
612
+ case NESTED_ERB_TAG_ERROR: return rb_nested_erb_tag_error_from_c_struct((NESTED_ERB_TAG_ERROR_T*) error); break;
386
613
  }
387
614
 
388
615
  return Qnil;