herb 0.8.10-arm-linux-gnu → 0.9.1-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 (212) 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 +473 -34
  6. data/ext/herb/error_helpers.c +535 -140
  7. data/ext/herb/error_helpers.h +1 -0
  8. data/ext/herb/extconf.rb +67 -28
  9. data/ext/herb/extension.c +321 -51
  10. data/ext/herb/extension.h +1 -0
  11. data/ext/herb/extension_helpers.c +24 -14
  12. data/ext/herb/extension_helpers.h +2 -2
  13. data/ext/herb/nodes.c +647 -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 +1530 -179
  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 +119 -43
  36. data/lib/herb/errors.rb +808 -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 +62 -0
  41. data/lib/herb/position.rb +1 -0
  42. data/lib/herb/prism_inspect.rb +120 -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 +47 -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 +773 -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 +21 -3
  59. data/sig/herb/errors.rbs +372 -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 +46 -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 +31 -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/rubyvm.rbs +5 -0
  72. data/sig/serialized_ast_errors.rbs +82 -6
  73. data/sig/serialized_ast_nodes.rbs +91 -6
  74. data/src/analyze/action_view/attribute_extraction_helpers.c +303 -0
  75. data/src/analyze/action_view/content_tag.c +78 -0
  76. data/src/analyze/action_view/link_to.c +167 -0
  77. data/src/analyze/action_view/registry.c +83 -0
  78. data/src/analyze/action_view/tag.c +70 -0
  79. data/src/analyze/action_view/tag_helper_node_builders.c +305 -0
  80. data/src/analyze/action_view/tag_helpers.c +815 -0
  81. data/src/analyze/action_view/turbo_frame_tag.c +88 -0
  82. data/src/analyze/analyze.c +885 -0
  83. data/src/{analyzed_ruby.c → analyze/analyzed_ruby.c} +13 -11
  84. data/src/analyze/builders.c +343 -0
  85. data/src/analyze/conditional_elements.c +594 -0
  86. data/src/analyze/conditional_open_tags.c +640 -0
  87. data/src/analyze/control_type.c +250 -0
  88. data/src/{analyze_helpers.c → analyze/helpers.c} +48 -23
  89. data/src/analyze/invalid_structures.c +193 -0
  90. data/src/{analyze_missing_end.c → analyze/missing_end.c} +33 -22
  91. data/src/analyze/parse_errors.c +84 -0
  92. data/src/analyze/prism_annotate.c +399 -0
  93. data/src/analyze/render_nodes.c +761 -0
  94. data/src/{analyze_transform.c → analyze/transform.c} +24 -3
  95. data/src/ast_node.c +17 -7
  96. data/src/ast_nodes.c +759 -387
  97. data/src/ast_pretty_print.c +264 -6
  98. data/src/errors.c +1454 -519
  99. data/src/extract.c +145 -49
  100. data/src/herb.c +52 -34
  101. data/src/html_util.c +241 -12
  102. data/src/include/analyze/action_view/attribute_extraction_helpers.h +36 -0
  103. data/src/include/analyze/action_view/tag_helper_handler.h +43 -0
  104. data/src/include/analyze/action_view/tag_helper_node_builders.h +70 -0
  105. data/src/include/analyze/action_view/tag_helpers.h +38 -0
  106. data/src/include/{analyze.h → analyze/analyze.h} +14 -4
  107. data/src/include/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
  108. data/src/include/analyze/builders.h +27 -0
  109. data/src/include/analyze/conditional_elements.h +9 -0
  110. data/src/include/analyze/conditional_open_tags.h +9 -0
  111. data/src/include/analyze/control_type.h +14 -0
  112. data/src/include/{analyze_helpers.h → analyze/helpers.h} +4 -2
  113. data/src/include/analyze/invalid_structures.h +11 -0
  114. data/src/include/analyze/prism_annotate.h +16 -0
  115. data/src/include/analyze/render_nodes.h +11 -0
  116. data/src/include/ast_node.h +11 -5
  117. data/src/include/ast_nodes.h +154 -38
  118. data/src/include/ast_pretty_print.h +5 -0
  119. data/src/include/element_source.h +3 -8
  120. data/src/include/errors.h +206 -55
  121. data/src/include/extract.h +21 -5
  122. data/src/include/herb.h +18 -6
  123. data/src/include/herb_prism_node.h +13 -0
  124. data/src/include/html_util.h +7 -2
  125. data/src/include/io.h +3 -1
  126. data/src/include/lex_helpers.h +29 -0
  127. data/src/include/lexer.h +1 -1
  128. data/src/include/lexer_peek_helpers.h +87 -13
  129. data/src/include/lexer_struct.h +2 -0
  130. data/src/include/location.h +2 -1
  131. data/src/include/parser.h +28 -2
  132. data/src/include/parser_helpers.h +19 -3
  133. data/src/include/pretty_print.h +10 -5
  134. data/src/include/prism_context.h +45 -0
  135. data/src/include/prism_helpers.h +10 -7
  136. data/src/include/prism_serialized.h +12 -0
  137. data/src/include/token.h +16 -4
  138. data/src/include/token_struct.h +10 -3
  139. data/src/include/utf8.h +2 -1
  140. data/src/include/util/hb_allocator.h +78 -0
  141. data/src/include/util/hb_arena.h +6 -1
  142. data/src/include/util/hb_arena_debug.h +12 -1
  143. data/src/include/util/hb_array.h +7 -3
  144. data/src/include/util/hb_buffer.h +6 -4
  145. data/src/include/util/hb_foreach.h +79 -0
  146. data/src/include/util/hb_narray.h +8 -4
  147. data/src/include/util/hb_string.h +56 -9
  148. data/src/include/util.h +6 -3
  149. data/src/include/version.h +1 -1
  150. data/src/io.c +3 -2
  151. data/src/lexer.c +42 -30
  152. data/src/lexer_peek_helpers.c +12 -74
  153. data/src/location.c +2 -2
  154. data/src/main.c +53 -28
  155. data/src/parser.c +784 -247
  156. data/src/parser_helpers.c +110 -23
  157. data/src/parser_match_tags.c +129 -48
  158. data/src/pretty_print.c +29 -24
  159. data/src/prism_helpers.c +30 -27
  160. data/src/ruby_parser.c +2 -0
  161. data/src/token.c +151 -66
  162. data/src/token_matchers.c +0 -1
  163. data/src/utf8.c +7 -6
  164. data/src/util/hb_allocator.c +341 -0
  165. data/src/util/hb_arena.c +81 -56
  166. data/src/util/hb_arena_debug.c +32 -17
  167. data/src/util/hb_array.c +30 -15
  168. data/src/util/hb_buffer.c +17 -21
  169. data/src/util/hb_narray.c +22 -7
  170. data/src/util/hb_string.c +49 -35
  171. data/src/util.c +21 -11
  172. data/src/visitor.c +67 -0
  173. data/templates/ext/herb/error_helpers.c.erb +24 -11
  174. data/templates/ext/herb/error_helpers.h.erb +1 -0
  175. data/templates/ext/herb/nodes.c.erb +50 -16
  176. data/templates/ext/herb/nodes.h.erb +1 -0
  177. data/templates/java/error_helpers.c.erb +1 -1
  178. data/templates/java/nodes.c.erb +30 -8
  179. data/templates/java/org/herb/ast/Errors.java.erb +24 -1
  180. data/templates/java/org/herb/ast/Nodes.java.erb +80 -21
  181. data/templates/javascript/packages/core/src/errors.ts.erb +16 -3
  182. data/templates/javascript/packages/core/src/node-type-guards.ts.erb +3 -1
  183. data/templates/javascript/packages/core/src/nodes.ts.erb +109 -32
  184. data/templates/javascript/packages/node/extension/error_helpers.cpp.erb +13 -4
  185. data/templates/javascript/packages/node/extension/nodes.cpp.erb +43 -4
  186. data/templates/lib/herb/ast/nodes.rb.erb +95 -32
  187. data/templates/lib/herb/errors.rb.erb +15 -3
  188. data/templates/lib/herb/visitor.rb.erb +2 -2
  189. data/templates/rust/src/ast/nodes.rs.erb +97 -44
  190. data/templates/rust/src/errors.rs.erb +2 -1
  191. data/templates/rust/src/nodes.rs.erb +168 -16
  192. data/templates/rust/src/union_types.rs.erb +60 -0
  193. data/templates/rust/src/visitor.rs.erb +81 -0
  194. data/templates/src/{analyze_missing_end.c.erb → analyze/missing_end.c.erb} +9 -6
  195. data/templates/src/{analyze_transform.c.erb → analyze/transform.c.erb} +2 -2
  196. data/templates/src/ast_nodes.c.erb +34 -26
  197. data/templates/src/ast_pretty_print.c.erb +24 -5
  198. data/templates/src/errors.c.erb +60 -54
  199. data/templates/src/include/ast_nodes.h.erb +6 -2
  200. data/templates/src/include/ast_pretty_print.h.erb +5 -0
  201. data/templates/src/include/errors.h.erb +15 -11
  202. data/templates/src/include/util/hb_foreach.h.erb +20 -0
  203. data/templates/src/parser_match_tags.c.erb +10 -4
  204. data/templates/src/visitor.c.erb +2 -2
  205. data/templates/template.rb +204 -29
  206. data/templates/wasm/error_helpers.cpp.erb +9 -5
  207. data/templates/wasm/nodes.cpp.erb +41 -4
  208. metadata +60 -16
  209. data/src/analyze.c +0 -1608
  210. data/src/element_source.c +0 -12
  211. data/src/include/util/hb_system.h +0 -9
  212. data/src/util/hb_system.c +0 -30
@@ -10,26 +10,90 @@
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
+ static VALUE cRenderAmbiguousLocalsError;
43
+ static VALUE cRenderMissingLocalsError;
44
+ static VALUE cRenderNoArgumentsError;
45
+ static VALUE cRenderConflictingPartialError;
46
+ static VALUE cRenderInvalidAsOptionError;
47
+ static VALUE cRenderObjectAndCollectionError;
48
+ static VALUE cRenderLayoutWithoutBlockError;
49
+
50
+ void rb_init_error_classes(void) {
51
+ mErrors = rb_define_module_under(mHerb, "Errors");
52
+ cError = rb_define_class_under(mErrors, "Error", rb_cObject);
53
+ cUnexpectedError = rb_define_class_under(mErrors, "UnexpectedError", cError);
54
+ cUnexpectedTokenError = rb_define_class_under(mErrors, "UnexpectedTokenError", cError);
55
+ cMissingOpeningTagError = rb_define_class_under(mErrors, "MissingOpeningTagError", cError);
56
+ cMissingClosingTagError = rb_define_class_under(mErrors, "MissingClosingTagError", cError);
57
+ cTagNamesMismatchError = rb_define_class_under(mErrors, "TagNamesMismatchError", cError);
58
+ cVoidElementClosingTagError = rb_define_class_under(mErrors, "VoidElementClosingTagError", cError);
59
+ cUnclosedElementError = rb_define_class_under(mErrors, "UnclosedElementError", cError);
60
+ cRubyParseError = rb_define_class_under(mErrors, "RubyParseError", cError);
61
+ cERBControlFlowScopeError = rb_define_class_under(mErrors, "ERBControlFlowScopeError", cError);
62
+ cMissingERBEndTagError = rb_define_class_under(mErrors, "MissingERBEndTagError", cError);
63
+ cERBMultipleBlocksInTagError = rb_define_class_under(mErrors, "ERBMultipleBlocksInTagError", cError);
64
+ cERBCaseWithConditionsError = rb_define_class_under(mErrors, "ERBCaseWithConditionsError", cError);
65
+ cConditionalElementMultipleTagsError = rb_define_class_under(mErrors, "ConditionalElementMultipleTagsError", cError);
66
+ cConditionalElementConditionMismatchError = rb_define_class_under(mErrors, "ConditionalElementConditionMismatchError", cError);
67
+ cInvalidCommentClosingTagError = rb_define_class_under(mErrors, "InvalidCommentClosingTagError", cError);
68
+ cOmittedClosingTagError = rb_define_class_under(mErrors, "OmittedClosingTagError", cError);
69
+ cUnclosedOpenTagError = rb_define_class_under(mErrors, "UnclosedOpenTagError", cError);
70
+ cUnclosedCloseTagError = rb_define_class_under(mErrors, "UnclosedCloseTagError", cError);
71
+ cUnclosedQuoteError = rb_define_class_under(mErrors, "UnclosedQuoteError", cError);
72
+ cMissingAttributeValueError = rb_define_class_under(mErrors, "MissingAttributeValueError", cError);
73
+ cUnclosedERBTagError = rb_define_class_under(mErrors, "UnclosedERBTagError", cError);
74
+ cStrayERBClosingTagError = rb_define_class_under(mErrors, "StrayERBClosingTagError", cError);
75
+ cNestedERBTagError = rb_define_class_under(mErrors, "NestedERBTagError", cError);
76
+ cRenderAmbiguousLocalsError = rb_define_class_under(mErrors, "RenderAmbiguousLocalsError", cError);
77
+ cRenderMissingLocalsError = rb_define_class_under(mErrors, "RenderMissingLocalsError", cError);
78
+ cRenderNoArgumentsError = rb_define_class_under(mErrors, "RenderNoArgumentsError", cError);
79
+ cRenderConflictingPartialError = rb_define_class_under(mErrors, "RenderConflictingPartialError", cError);
80
+ cRenderInvalidAsOptionError = rb_define_class_under(mErrors, "RenderInvalidAsOptionError", cError);
81
+ cRenderObjectAndCollectionError = rb_define_class_under(mErrors, "RenderObjectAndCollectionError", cError);
82
+ cRenderLayoutWithoutBlockError = rb_define_class_under(mErrors, "RenderLayoutWithoutBlockError", cError);
83
+ }
84
+
16
85
  static VALUE rb_unexpected_error_from_c_struct(UNEXPECTED_ERROR_T* unexpected_error) {
17
86
  if (unexpected_error == NULL) { return Qnil; }
18
87
 
19
88
  ERROR_T* error = &unexpected_error->base;
20
89
 
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));
90
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
27
91
  VALUE location = rb_location_from_c_struct(error->location);
28
- VALUE message = rb_utf8_str_new_cstr(error->message);
92
+ VALUE message = rb_string_from_hb_string(error->message);
29
93
 
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);
94
+ VALUE unexpected_error_description = rb_utf8_str_new(unexpected_error->description.data, unexpected_error->description.length);
95
+ VALUE unexpected_error_expected = rb_utf8_str_new(unexpected_error->expected.data, unexpected_error->expected.length);
96
+ VALUE unexpected_error_found = rb_utf8_str_new(unexpected_error->found.data, unexpected_error->found.length);
33
97
 
34
98
  VALUE args[6] = {
35
99
  type,
@@ -40,7 +104,7 @@ static VALUE rb_unexpected_error_from_c_struct(UNEXPECTED_ERROR_T* unexpected_er
40
104
  unexpected_error_found
41
105
  };
42
106
 
43
- return rb_class_new_instance(6, args, UnexpectedError);
107
+ return rb_class_new_instance(6, args, cUnexpectedError);
44
108
  };
45
109
 
46
110
  static VALUE rb_unexpected_token_error_from_c_struct(UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error) {
@@ -48,16 +112,12 @@ static VALUE rb_unexpected_token_error_from_c_struct(UNEXPECTED_TOKEN_ERROR_T* u
48
112
 
49
113
  ERROR_T* error = &unexpected_token_error->base;
50
114
 
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));
115
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
57
116
  VALUE location = rb_location_from_c_struct(error->location);
58
- VALUE message = rb_utf8_str_new_cstr(error->message);
117
+ VALUE message = rb_string_from_hb_string(error->message);
59
118
 
60
- VALUE unexpected_token_error_expected_type = rb_utf8_str_new_cstr(token_type_to_string(unexpected_token_error->expected_type));
119
+ hb_string_T _expected_type_string = token_type_to_string(unexpected_token_error->expected_type);
120
+ VALUE unexpected_token_error_expected_type = rb_utf8_str_new(_expected_type_string.data, _expected_type_string.length);
61
121
  VALUE unexpected_token_error_found = rb_token_from_c_struct(unexpected_token_error->found);
62
122
 
63
123
  VALUE args[5] = {
@@ -68,7 +128,7 @@ static VALUE rb_unexpected_token_error_from_c_struct(UNEXPECTED_TOKEN_ERROR_T* u
68
128
  unexpected_token_error_found
69
129
  };
70
130
 
71
- return rb_class_new_instance(5, args, UnexpectedTokenError);
131
+ return rb_class_new_instance(5, args, cUnexpectedTokenError);
72
132
  };
73
133
 
74
134
  static VALUE rb_missing_opening_tag_error_from_c_struct(MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error) {
@@ -76,14 +136,9 @@ static VALUE rb_missing_opening_tag_error_from_c_struct(MISSING_OPENING_TAG_ERRO
76
136
 
77
137
  ERROR_T* error = &missing_opening_tag_error->base;
78
138
 
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));
139
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
85
140
  VALUE location = rb_location_from_c_struct(error->location);
86
- VALUE message = rb_utf8_str_new_cstr(error->message);
141
+ VALUE message = rb_string_from_hb_string(error->message);
87
142
 
88
143
  VALUE missing_opening_tag_error_closing_tag = rb_token_from_c_struct(missing_opening_tag_error->closing_tag);
89
144
 
@@ -94,7 +149,7 @@ static VALUE rb_missing_opening_tag_error_from_c_struct(MISSING_OPENING_TAG_ERRO
94
149
  missing_opening_tag_error_closing_tag
95
150
  };
96
151
 
97
- return rb_class_new_instance(4, args, MissingOpeningTagError);
152
+ return rb_class_new_instance(4, args, cMissingOpeningTagError);
98
153
  };
99
154
 
100
155
  static VALUE rb_missing_closing_tag_error_from_c_struct(MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error) {
@@ -102,14 +157,9 @@ static VALUE rb_missing_closing_tag_error_from_c_struct(MISSING_CLOSING_TAG_ERRO
102
157
 
103
158
  ERROR_T* error = &missing_closing_tag_error->base;
104
159
 
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));
160
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
111
161
  VALUE location = rb_location_from_c_struct(error->location);
112
- VALUE message = rb_utf8_str_new_cstr(error->message);
162
+ VALUE message = rb_string_from_hb_string(error->message);
113
163
 
114
164
  VALUE missing_closing_tag_error_opening_tag = rb_token_from_c_struct(missing_closing_tag_error->opening_tag);
115
165
 
@@ -120,7 +170,7 @@ static VALUE rb_missing_closing_tag_error_from_c_struct(MISSING_CLOSING_TAG_ERRO
120
170
  missing_closing_tag_error_opening_tag
121
171
  };
122
172
 
123
- return rb_class_new_instance(4, args, MissingClosingTagError);
173
+ return rb_class_new_instance(4, args, cMissingClosingTagError);
124
174
  };
125
175
 
126
176
  static VALUE rb_tag_names_mismatch_error_from_c_struct(TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error) {
@@ -128,14 +178,9 @@ static VALUE rb_tag_names_mismatch_error_from_c_struct(TAG_NAMES_MISMATCH_ERROR_
128
178
 
129
179
  ERROR_T* error = &tag_names_mismatch_error->base;
130
180
 
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));
181
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
137
182
  VALUE location = rb_location_from_c_struct(error->location);
138
- VALUE message = rb_utf8_str_new_cstr(error->message);
183
+ VALUE message = rb_string_from_hb_string(error->message);
139
184
 
140
185
  VALUE tag_names_mismatch_error_opening_tag = rb_token_from_c_struct(tag_names_mismatch_error->opening_tag);
141
186
  VALUE tag_names_mismatch_error_closing_tag = rb_token_from_c_struct(tag_names_mismatch_error->closing_tag);
@@ -148,35 +193,7 @@ static VALUE rb_tag_names_mismatch_error_from_c_struct(TAG_NAMES_MISMATCH_ERROR_
148
193
  tag_names_mismatch_error_closing_tag
149
194
  };
150
195
 
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);
196
+ return rb_class_new_instance(5, args, cTagNamesMismatchError);
180
197
  };
181
198
 
182
199
  static VALUE rb_void_element_closing_tag_error_from_c_struct(VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error) {
@@ -184,18 +201,13 @@ static VALUE rb_void_element_closing_tag_error_from_c_struct(VOID_ELEMENT_CLOSIN
184
201
 
185
202
  ERROR_T* error = &void_element_closing_tag_error->base;
186
203
 
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));
204
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
193
205
  VALUE location = rb_location_from_c_struct(error->location);
194
- VALUE message = rb_utf8_str_new_cstr(error->message);
206
+ VALUE message = rb_string_from_hb_string(error->message);
195
207
 
196
208
  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);
209
+ 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);
210
+ 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
211
 
200
212
  VALUE args[6] = {
201
213
  type,
@@ -206,7 +218,7 @@ static VALUE rb_void_element_closing_tag_error_from_c_struct(VOID_ELEMENT_CLOSIN
206
218
  void_element_closing_tag_error_found
207
219
  };
208
220
 
209
- return rb_class_new_instance(6, args, VoidElementClosingTagError);
221
+ return rb_class_new_instance(6, args, cVoidElementClosingTagError);
210
222
  };
211
223
 
212
224
  static VALUE rb_unclosed_element_error_from_c_struct(UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error) {
@@ -214,14 +226,9 @@ static VALUE rb_unclosed_element_error_from_c_struct(UNCLOSED_ELEMENT_ERROR_T* u
214
226
 
215
227
  ERROR_T* error = &unclosed_element_error->base;
216
228
 
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));
229
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
223
230
  VALUE location = rb_location_from_c_struct(error->location);
224
- VALUE message = rb_utf8_str_new_cstr(error->message);
231
+ VALUE message = rb_string_from_hb_string(error->message);
225
232
 
226
233
  VALUE unclosed_element_error_opening_tag = rb_token_from_c_struct(unclosed_element_error->opening_tag);
227
234
 
@@ -232,7 +239,7 @@ static VALUE rb_unclosed_element_error_from_c_struct(UNCLOSED_ELEMENT_ERROR_T* u
232
239
  unclosed_element_error_opening_tag
233
240
  };
234
241
 
235
- return rb_class_new_instance(4, args, UnclosedElementError);
242
+ return rb_class_new_instance(4, args, cUnclosedElementError);
236
243
  };
237
244
 
238
245
  static VALUE rb_ruby_parse_error_from_c_struct(RUBY_PARSE_ERROR_T* ruby_parse_error) {
@@ -240,18 +247,13 @@ static VALUE rb_ruby_parse_error_from_c_struct(RUBY_PARSE_ERROR_T* ruby_parse_er
240
247
 
241
248
  ERROR_T* error = &ruby_parse_error->base;
242
249
 
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));
250
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
249
251
  VALUE location = rb_location_from_c_struct(error->location);
250
- VALUE message = rb_utf8_str_new_cstr(error->message);
252
+ VALUE message = rb_string_from_hb_string(error->message);
251
253
 
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);
254
+ VALUE ruby_parse_error_error_message = rb_utf8_str_new(ruby_parse_error->error_message.data, ruby_parse_error->error_message.length);
255
+ VALUE ruby_parse_error_diagnostic_id = rb_utf8_str_new(ruby_parse_error->diagnostic_id.data, ruby_parse_error->diagnostic_id.length);
256
+ VALUE ruby_parse_error_level = rb_utf8_str_new(ruby_parse_error->level.data, ruby_parse_error->level.length);
255
257
 
256
258
  VALUE args[6] = {
257
259
  type,
@@ -262,7 +264,7 @@ static VALUE rb_ruby_parse_error_from_c_struct(RUBY_PARSE_ERROR_T* ruby_parse_er
262
264
  ruby_parse_error_level
263
265
  };
264
266
 
265
- return rb_class_new_instance(6, args, RubyParseError);
267
+ return rb_class_new_instance(6, args, cRubyParseError);
266
268
  };
267
269
 
268
270
  static VALUE rb_erb_control_flow_scope_error_from_c_struct(ERB_CONTROL_FLOW_SCOPE_ERROR_T* erb_control_flow_scope_error) {
@@ -270,16 +272,11 @@ static VALUE rb_erb_control_flow_scope_error_from_c_struct(ERB_CONTROL_FLOW_SCOP
270
272
 
271
273
  ERROR_T* error = &erb_control_flow_scope_error->base;
272
274
 
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));
275
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
279
276
  VALUE location = rb_location_from_c_struct(error->location);
280
- VALUE message = rb_utf8_str_new_cstr(error->message);
277
+ VALUE message = rb_string_from_hb_string(error->message);
281
278
 
282
- VALUE erb_control_flow_scope_error_keyword = rb_utf8_str_new_cstr(erb_control_flow_scope_error->keyword);
279
+ 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
280
 
284
281
  VALUE args[4] = {
285
282
  type,
@@ -288,33 +285,28 @@ static VALUE rb_erb_control_flow_scope_error_from_c_struct(ERB_CONTROL_FLOW_SCOP
288
285
  erb_control_flow_scope_error_keyword
289
286
  };
290
287
 
291
- return rb_class_new_instance(4, args, ERBControlFlowScopeError);
288
+ return rb_class_new_instance(4, args, cERBControlFlowScopeError);
292
289
  };
293
290
 
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; }
291
+ static VALUE rb_missing_erb_end_tag_error_from_c_struct(MISSING_ERB_END_TAG_ERROR_T* missing_erb_end_tag_error) {
292
+ if (missing_erb_end_tag_error == NULL) { return Qnil; }
296
293
 
297
- ERROR_T* error = &missingerb_end_tag_error->base;
294
+ ERROR_T* error = &missing_erb_end_tag_error->base;
298
295
 
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);
303
-
304
- VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
296
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
305
297
  VALUE location = rb_location_from_c_struct(error->location);
306
- VALUE message = rb_utf8_str_new_cstr(error->message);
298
+ VALUE message = rb_string_from_hb_string(error->message);
307
299
 
308
- VALUE missingerb_end_tag_error_keyword = rb_utf8_str_new_cstr(missingerb_end_tag_error->keyword);
300
+ 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
301
 
310
302
  VALUE args[4] = {
311
303
  type,
312
304
  location,
313
305
  message,
314
- missingerb_end_tag_error_keyword
306
+ missing_erb_end_tag_error_keyword
315
307
  };
316
308
 
317
- return rb_class_new_instance(4, args, MissingERBEndTagError);
309
+ return rb_class_new_instance(4, args, cMissingERBEndTagError);
318
310
  };
319
311
 
320
312
  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 +314,9 @@ static VALUE rb_erb_multiple_blocks_in_tag_error_from_c_struct(ERB_MULTIPLE_BLOC
322
314
 
323
315
  ERROR_T* error = &erb_multiple_blocks_in_tag_error->base;
324
316
 
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));
317
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
331
318
  VALUE location = rb_location_from_c_struct(error->location);
332
- VALUE message = rb_utf8_str_new_cstr(error->message);
319
+ VALUE message = rb_string_from_hb_string(error->message);
333
320
 
334
321
 
335
322
  VALUE args[3] = {
@@ -338,7 +325,7 @@ static VALUE rb_erb_multiple_blocks_in_tag_error_from_c_struct(ERB_MULTIPLE_BLOC
338
325
  message
339
326
  };
340
327
 
341
- return rb_class_new_instance(3, args, ERBMultipleBlocksInTagError);
328
+ return rb_class_new_instance(3, args, cERBMultipleBlocksInTagError);
342
329
  };
343
330
 
344
331
  static VALUE rb_erb_case_with_conditions_error_from_c_struct(ERB_CASE_WITH_CONDITIONS_ERROR_T* erb_case_with_conditions_error) {
@@ -346,14 +333,233 @@ static VALUE rb_erb_case_with_conditions_error_from_c_struct(ERB_CASE_WITH_CONDI
346
333
 
347
334
  ERROR_T* error = &erb_case_with_conditions_error->base;
348
335
 
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);
336
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
337
+ VALUE location = rb_location_from_c_struct(error->location);
338
+ VALUE message = rb_string_from_hb_string(error->message);
339
+
340
+
341
+ VALUE args[3] = {
342
+ type,
343
+ location,
344
+ message
345
+ };
346
+
347
+ return rb_class_new_instance(3, args, cERBCaseWithConditionsError);
348
+ };
349
+
350
+ static VALUE rb_conditional_element_multiple_tags_error_from_c_struct(CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR_T* conditional_element_multiple_tags_error) {
351
+ if (conditional_element_multiple_tags_error == NULL) { return Qnil; }
352
+
353
+ ERROR_T* error = &conditional_element_multiple_tags_error->base;
354
+
355
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
356
+ VALUE location = rb_location_from_c_struct(error->location);
357
+ VALUE message = rb_string_from_hb_string(error->message);
358
+
359
+ VALUE conditional_element_multiple_tags_error_line = ULONG2NUM(conditional_element_multiple_tags_error->line);
360
+ VALUE conditional_element_multiple_tags_error_column = ULONG2NUM(conditional_element_multiple_tags_error->column);
361
+
362
+ VALUE args[5] = {
363
+ type,
364
+ location,
365
+ message,
366
+ conditional_element_multiple_tags_error_line,
367
+ conditional_element_multiple_tags_error_column
368
+ };
369
+
370
+ return rb_class_new_instance(5, args, cConditionalElementMultipleTagsError);
371
+ };
372
+
373
+ static VALUE rb_conditional_element_condition_mismatch_error_from_c_struct(CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR_T* conditional_element_condition_mismatch_error) {
374
+ if (conditional_element_condition_mismatch_error == NULL) { return Qnil; }
375
+
376
+ ERROR_T* error = &conditional_element_condition_mismatch_error->base;
377
+
378
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
379
+ VALUE location = rb_location_from_c_struct(error->location);
380
+ VALUE message = rb_string_from_hb_string(error->message);
381
+
382
+ 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);
383
+ 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);
384
+ VALUE conditional_element_condition_mismatch_error_open_line = ULONG2NUM(conditional_element_condition_mismatch_error->open_line);
385
+ VALUE conditional_element_condition_mismatch_error_open_column = ULONG2NUM(conditional_element_condition_mismatch_error->open_column);
386
+ 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);
387
+ VALUE conditional_element_condition_mismatch_error_close_line = ULONG2NUM(conditional_element_condition_mismatch_error->close_line);
388
+ VALUE conditional_element_condition_mismatch_error_close_column = ULONG2NUM(conditional_element_condition_mismatch_error->close_column);
389
+
390
+ VALUE args[10] = {
391
+ type,
392
+ location,
393
+ message,
394
+ conditional_element_condition_mismatch_error_tag_name,
395
+ conditional_element_condition_mismatch_error_open_condition,
396
+ conditional_element_condition_mismatch_error_open_line,
397
+ conditional_element_condition_mismatch_error_open_column,
398
+ conditional_element_condition_mismatch_error_close_condition,
399
+ conditional_element_condition_mismatch_error_close_line,
400
+ conditional_element_condition_mismatch_error_close_column
401
+ };
402
+
403
+ return rb_class_new_instance(10, args, cConditionalElementConditionMismatchError);
404
+ };
405
+
406
+ static VALUE rb_invalid_comment_closing_tag_error_from_c_struct(INVALID_COMMENT_CLOSING_TAG_ERROR_T* invalid_comment_closing_tag_error) {
407
+ if (invalid_comment_closing_tag_error == NULL) { return Qnil; }
408
+
409
+ ERROR_T* error = &invalid_comment_closing_tag_error->base;
410
+
411
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
412
+ VALUE location = rb_location_from_c_struct(error->location);
413
+ VALUE message = rb_string_from_hb_string(error->message);
414
+
415
+ VALUE invalid_comment_closing_tag_error_closing_tag = rb_token_from_c_struct(invalid_comment_closing_tag_error->closing_tag);
353
416
 
354
- VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
417
+ VALUE args[4] = {
418
+ type,
419
+ location,
420
+ message,
421
+ invalid_comment_closing_tag_error_closing_tag
422
+ };
423
+
424
+ return rb_class_new_instance(4, args, cInvalidCommentClosingTagError);
425
+ };
426
+
427
+ static VALUE rb_omitted_closing_tag_error_from_c_struct(OMITTED_CLOSING_TAG_ERROR_T* omitted_closing_tag_error) {
428
+ if (omitted_closing_tag_error == NULL) { return Qnil; }
429
+
430
+ ERROR_T* error = &omitted_closing_tag_error->base;
431
+
432
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
355
433
  VALUE location = rb_location_from_c_struct(error->location);
356
- VALUE message = rb_utf8_str_new_cstr(error->message);
434
+ VALUE message = rb_string_from_hb_string(error->message);
435
+
436
+ VALUE omitted_closing_tag_error_opening_tag = rb_token_from_c_struct(omitted_closing_tag_error->opening_tag);
437
+ VALUE omitted_closing_tag_error_insertion_point = rb_position_from_c_struct(omitted_closing_tag_error->insertion_point);
438
+
439
+ VALUE args[5] = {
440
+ type,
441
+ location,
442
+ message,
443
+ omitted_closing_tag_error_opening_tag,
444
+ omitted_closing_tag_error_insertion_point
445
+ };
446
+
447
+ return rb_class_new_instance(5, args, cOmittedClosingTagError);
448
+ };
449
+
450
+ static VALUE rb_unclosed_open_tag_error_from_c_struct(UNCLOSED_OPEN_TAG_ERROR_T* unclosed_open_tag_error) {
451
+ if (unclosed_open_tag_error == NULL) { return Qnil; }
452
+
453
+ ERROR_T* error = &unclosed_open_tag_error->base;
454
+
455
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
456
+ VALUE location = rb_location_from_c_struct(error->location);
457
+ VALUE message = rb_string_from_hb_string(error->message);
458
+
459
+ VALUE unclosed_open_tag_error_tag_name = rb_token_from_c_struct(unclosed_open_tag_error->tag_name);
460
+
461
+ VALUE args[4] = {
462
+ type,
463
+ location,
464
+ message,
465
+ unclosed_open_tag_error_tag_name
466
+ };
467
+
468
+ return rb_class_new_instance(4, args, cUnclosedOpenTagError);
469
+ };
470
+
471
+ static VALUE rb_unclosed_close_tag_error_from_c_struct(UNCLOSED_CLOSE_TAG_ERROR_T* unclosed_close_tag_error) {
472
+ if (unclosed_close_tag_error == NULL) { return Qnil; }
473
+
474
+ ERROR_T* error = &unclosed_close_tag_error->base;
475
+
476
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
477
+ VALUE location = rb_location_from_c_struct(error->location);
478
+ VALUE message = rb_string_from_hb_string(error->message);
479
+
480
+ VALUE unclosed_close_tag_error_tag_name = rb_token_from_c_struct(unclosed_close_tag_error->tag_name);
481
+
482
+ VALUE args[4] = {
483
+ type,
484
+ location,
485
+ message,
486
+ unclosed_close_tag_error_tag_name
487
+ };
488
+
489
+ return rb_class_new_instance(4, args, cUnclosedCloseTagError);
490
+ };
491
+
492
+ static VALUE rb_unclosed_quote_error_from_c_struct(UNCLOSED_QUOTE_ERROR_T* unclosed_quote_error) {
493
+ if (unclosed_quote_error == NULL) { return Qnil; }
494
+
495
+ ERROR_T* error = &unclosed_quote_error->base;
496
+
497
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
498
+ VALUE location = rb_location_from_c_struct(error->location);
499
+ VALUE message = rb_string_from_hb_string(error->message);
500
+
501
+ VALUE unclosed_quote_error_opening_quote = rb_token_from_c_struct(unclosed_quote_error->opening_quote);
502
+
503
+ VALUE args[4] = {
504
+ type,
505
+ location,
506
+ message,
507
+ unclosed_quote_error_opening_quote
508
+ };
509
+
510
+ return rb_class_new_instance(4, args, cUnclosedQuoteError);
511
+ };
512
+
513
+ static VALUE rb_missing_attribute_value_error_from_c_struct(MISSING_ATTRIBUTE_VALUE_ERROR_T* missing_attribute_value_error) {
514
+ if (missing_attribute_value_error == NULL) { return Qnil; }
515
+
516
+ ERROR_T* error = &missing_attribute_value_error->base;
517
+
518
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
519
+ VALUE location = rb_location_from_c_struct(error->location);
520
+ VALUE message = rb_string_from_hb_string(error->message);
521
+
522
+ 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);
523
+
524
+ VALUE args[4] = {
525
+ type,
526
+ location,
527
+ message,
528
+ missing_attribute_value_error_attribute_name
529
+ };
530
+
531
+ return rb_class_new_instance(4, args, cMissingAttributeValueError);
532
+ };
533
+
534
+ static VALUE rb_unclosed_erb_tag_error_from_c_struct(UNCLOSED_ERB_TAG_ERROR_T* unclosed_erb_tag_error) {
535
+ if (unclosed_erb_tag_error == NULL) { return Qnil; }
536
+
537
+ ERROR_T* error = &unclosed_erb_tag_error->base;
538
+
539
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
540
+ VALUE location = rb_location_from_c_struct(error->location);
541
+ VALUE message = rb_string_from_hb_string(error->message);
542
+
543
+ VALUE unclosed_erb_tag_error_opening_tag = rb_token_from_c_struct(unclosed_erb_tag_error->opening_tag);
544
+
545
+ VALUE args[4] = {
546
+ type,
547
+ location,
548
+ message,
549
+ unclosed_erb_tag_error_opening_tag
550
+ };
551
+
552
+ return rb_class_new_instance(4, args, cUnclosedERBTagError);
553
+ };
554
+
555
+ static VALUE rb_stray_erb_closing_tag_error_from_c_struct(STRAY_ERB_CLOSING_TAG_ERROR_T* stray_erb_closing_tag_error) {
556
+ if (stray_erb_closing_tag_error == NULL) { return Qnil; }
557
+
558
+ ERROR_T* error = &stray_erb_closing_tag_error->base;
559
+
560
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
561
+ VALUE location = rb_location_from_c_struct(error->location);
562
+ VALUE message = rb_string_from_hb_string(error->message);
357
563
 
358
564
 
359
565
  VALUE args[3] = {
@@ -362,7 +568,179 @@ static VALUE rb_erb_case_with_conditions_error_from_c_struct(ERB_CASE_WITH_CONDI
362
568
  message
363
569
  };
364
570
 
365
- return rb_class_new_instance(3, args, ERBCaseWithConditionsError);
571
+ return rb_class_new_instance(3, args, cStrayERBClosingTagError);
572
+ };
573
+
574
+ static VALUE rb_nested_erb_tag_error_from_c_struct(NESTED_ERB_TAG_ERROR_T* nested_erb_tag_error) {
575
+ if (nested_erb_tag_error == NULL) { return Qnil; }
576
+
577
+ ERROR_T* error = &nested_erb_tag_error->base;
578
+
579
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
580
+ VALUE location = rb_location_from_c_struct(error->location);
581
+ VALUE message = rb_string_from_hb_string(error->message);
582
+
583
+ VALUE nested_erb_tag_error_opening_tag = rb_token_from_c_struct(nested_erb_tag_error->opening_tag);
584
+ VALUE nested_erb_tag_error_nested_tag_line = ULONG2NUM(nested_erb_tag_error->nested_tag_line);
585
+ VALUE nested_erb_tag_error_nested_tag_column = ULONG2NUM(nested_erb_tag_error->nested_tag_column);
586
+
587
+ VALUE args[6] = {
588
+ type,
589
+ location,
590
+ message,
591
+ nested_erb_tag_error_opening_tag,
592
+ nested_erb_tag_error_nested_tag_line,
593
+ nested_erb_tag_error_nested_tag_column
594
+ };
595
+
596
+ return rb_class_new_instance(6, args, cNestedERBTagError);
597
+ };
598
+
599
+ static VALUE rb_render_ambiguous_locals_error_from_c_struct(RENDER_AMBIGUOUS_LOCALS_ERROR_T* render_ambiguous_locals_error) {
600
+ if (render_ambiguous_locals_error == NULL) { return Qnil; }
601
+
602
+ ERROR_T* error = &render_ambiguous_locals_error->base;
603
+
604
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
605
+ VALUE location = rb_location_from_c_struct(error->location);
606
+ VALUE message = rb_string_from_hb_string(error->message);
607
+
608
+ VALUE render_ambiguous_locals_error_partial = rb_utf8_str_new(render_ambiguous_locals_error->partial.data, render_ambiguous_locals_error->partial.length);
609
+
610
+ VALUE args[4] = {
611
+ type,
612
+ location,
613
+ message,
614
+ render_ambiguous_locals_error_partial
615
+ };
616
+
617
+ return rb_class_new_instance(4, args, cRenderAmbiguousLocalsError);
618
+ };
619
+
620
+ static VALUE rb_render_missing_locals_error_from_c_struct(RENDER_MISSING_LOCALS_ERROR_T* render_missing_locals_error) {
621
+ if (render_missing_locals_error == NULL) { return Qnil; }
622
+
623
+ ERROR_T* error = &render_missing_locals_error->base;
624
+
625
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
626
+ VALUE location = rb_location_from_c_struct(error->location);
627
+ VALUE message = rb_string_from_hb_string(error->message);
628
+
629
+ VALUE render_missing_locals_error_partial = rb_utf8_str_new(render_missing_locals_error->partial.data, render_missing_locals_error->partial.length);
630
+ VALUE render_missing_locals_error_keywords = rb_utf8_str_new(render_missing_locals_error->keywords.data, render_missing_locals_error->keywords.length);
631
+
632
+ VALUE args[5] = {
633
+ type,
634
+ location,
635
+ message,
636
+ render_missing_locals_error_partial,
637
+ render_missing_locals_error_keywords
638
+ };
639
+
640
+ return rb_class_new_instance(5, args, cRenderMissingLocalsError);
641
+ };
642
+
643
+ static VALUE rb_render_no_arguments_error_from_c_struct(RENDER_NO_ARGUMENTS_ERROR_T* render_no_arguments_error) {
644
+ if (render_no_arguments_error == NULL) { return Qnil; }
645
+
646
+ ERROR_T* error = &render_no_arguments_error->base;
647
+
648
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
649
+ VALUE location = rb_location_from_c_struct(error->location);
650
+ VALUE message = rb_string_from_hb_string(error->message);
651
+
652
+
653
+ VALUE args[3] = {
654
+ type,
655
+ location,
656
+ message
657
+ };
658
+
659
+ return rb_class_new_instance(3, args, cRenderNoArgumentsError);
660
+ };
661
+
662
+ static VALUE rb_render_conflicting_partial_error_from_c_struct(RENDER_CONFLICTING_PARTIAL_ERROR_T* render_conflicting_partial_error) {
663
+ if (render_conflicting_partial_error == NULL) { return Qnil; }
664
+
665
+ ERROR_T* error = &render_conflicting_partial_error->base;
666
+
667
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
668
+ VALUE location = rb_location_from_c_struct(error->location);
669
+ VALUE message = rb_string_from_hb_string(error->message);
670
+
671
+ VALUE render_conflicting_partial_error_positional_partial = rb_utf8_str_new(render_conflicting_partial_error->positional_partial.data, render_conflicting_partial_error->positional_partial.length);
672
+ VALUE render_conflicting_partial_error_keyword_partial = rb_utf8_str_new(render_conflicting_partial_error->keyword_partial.data, render_conflicting_partial_error->keyword_partial.length);
673
+
674
+ VALUE args[5] = {
675
+ type,
676
+ location,
677
+ message,
678
+ render_conflicting_partial_error_positional_partial,
679
+ render_conflicting_partial_error_keyword_partial
680
+ };
681
+
682
+ return rb_class_new_instance(5, args, cRenderConflictingPartialError);
683
+ };
684
+
685
+ static VALUE rb_render_invalid_as_option_error_from_c_struct(RENDER_INVALID_AS_OPTION_ERROR_T* render_invalid_as_option_error) {
686
+ if (render_invalid_as_option_error == NULL) { return Qnil; }
687
+
688
+ ERROR_T* error = &render_invalid_as_option_error->base;
689
+
690
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
691
+ VALUE location = rb_location_from_c_struct(error->location);
692
+ VALUE message = rb_string_from_hb_string(error->message);
693
+
694
+ VALUE render_invalid_as_option_error_as_value = rb_utf8_str_new(render_invalid_as_option_error->as_value.data, render_invalid_as_option_error->as_value.length);
695
+
696
+ VALUE args[4] = {
697
+ type,
698
+ location,
699
+ message,
700
+ render_invalid_as_option_error_as_value
701
+ };
702
+
703
+ return rb_class_new_instance(4, args, cRenderInvalidAsOptionError);
704
+ };
705
+
706
+ static VALUE rb_render_object_and_collection_error_from_c_struct(RENDER_OBJECT_AND_COLLECTION_ERROR_T* render_object_and_collection_error) {
707
+ if (render_object_and_collection_error == NULL) { return Qnil; }
708
+
709
+ ERROR_T* error = &render_object_and_collection_error->base;
710
+
711
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
712
+ VALUE location = rb_location_from_c_struct(error->location);
713
+ VALUE message = rb_string_from_hb_string(error->message);
714
+
715
+
716
+ VALUE args[3] = {
717
+ type,
718
+ location,
719
+ message
720
+ };
721
+
722
+ return rb_class_new_instance(3, args, cRenderObjectAndCollectionError);
723
+ };
724
+
725
+ static VALUE rb_render_layout_without_block_error_from_c_struct(RENDER_LAYOUT_WITHOUT_BLOCK_ERROR_T* render_layout_without_block_error) {
726
+ if (render_layout_without_block_error == NULL) { return Qnil; }
727
+
728
+ ERROR_T* error = &render_layout_without_block_error->base;
729
+
730
+ VALUE type = rb_string_from_hb_string(error_type_to_string(error));
731
+ VALUE location = rb_location_from_c_struct(error->location);
732
+ VALUE message = rb_string_from_hb_string(error->message);
733
+
734
+ VALUE render_layout_without_block_error_layout = rb_utf8_str_new(render_layout_without_block_error->layout.data, render_layout_without_block_error->layout.length);
735
+
736
+ VALUE args[4] = {
737
+ type,
738
+ location,
739
+ message,
740
+ render_layout_without_block_error_layout
741
+ };
742
+
743
+ return rb_class_new_instance(4, args, cRenderLayoutWithoutBlockError);
366
744
  };
367
745
 
368
746
 
@@ -375,14 +753,31 @@ VALUE rb_error_from_c_struct(ERROR_T* error) {
375
753
  case MISSING_OPENING_TAG_ERROR: return rb_missing_opening_tag_error_from_c_struct((MISSING_OPENING_TAG_ERROR_T*) error); break;
376
754
  case MISSING_CLOSING_TAG_ERROR: return rb_missing_closing_tag_error_from_c_struct((MISSING_CLOSING_TAG_ERROR_T*) error); break;
377
755
  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
756
  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
757
  case UNCLOSED_ELEMENT_ERROR: return rb_unclosed_element_error_from_c_struct((UNCLOSED_ELEMENT_ERROR_T*) error); break;
381
758
  case RUBY_PARSE_ERROR: return rb_ruby_parse_error_from_c_struct((RUBY_PARSE_ERROR_T*) error); break;
382
759
  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;
760
+ 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
761
  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
762
  case ERB_CASE_WITH_CONDITIONS_ERROR: return rb_erb_case_with_conditions_error_from_c_struct((ERB_CASE_WITH_CONDITIONS_ERROR_T*) error); break;
763
+ case CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR: return rb_conditional_element_multiple_tags_error_from_c_struct((CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR_T*) error); break;
764
+ case CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR: return rb_conditional_element_condition_mismatch_error_from_c_struct((CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR_T*) error); break;
765
+ case INVALID_COMMENT_CLOSING_TAG_ERROR: return rb_invalid_comment_closing_tag_error_from_c_struct((INVALID_COMMENT_CLOSING_TAG_ERROR_T*) error); break;
766
+ case OMITTED_CLOSING_TAG_ERROR: return rb_omitted_closing_tag_error_from_c_struct((OMITTED_CLOSING_TAG_ERROR_T*) error); break;
767
+ case UNCLOSED_OPEN_TAG_ERROR: return rb_unclosed_open_tag_error_from_c_struct((UNCLOSED_OPEN_TAG_ERROR_T*) error); break;
768
+ case UNCLOSED_CLOSE_TAG_ERROR: return rb_unclosed_close_tag_error_from_c_struct((UNCLOSED_CLOSE_TAG_ERROR_T*) error); break;
769
+ case UNCLOSED_QUOTE_ERROR: return rb_unclosed_quote_error_from_c_struct((UNCLOSED_QUOTE_ERROR_T*) error); break;
770
+ case MISSING_ATTRIBUTE_VALUE_ERROR: return rb_missing_attribute_value_error_from_c_struct((MISSING_ATTRIBUTE_VALUE_ERROR_T*) error); break;
771
+ case UNCLOSED_ERB_TAG_ERROR: return rb_unclosed_erb_tag_error_from_c_struct((UNCLOSED_ERB_TAG_ERROR_T*) error); break;
772
+ case STRAY_ERB_CLOSING_TAG_ERROR: return rb_stray_erb_closing_tag_error_from_c_struct((STRAY_ERB_CLOSING_TAG_ERROR_T*) error); break;
773
+ case NESTED_ERB_TAG_ERROR: return rb_nested_erb_tag_error_from_c_struct((NESTED_ERB_TAG_ERROR_T*) error); break;
774
+ case RENDER_AMBIGUOUS_LOCALS_ERROR: return rb_render_ambiguous_locals_error_from_c_struct((RENDER_AMBIGUOUS_LOCALS_ERROR_T*) error); break;
775
+ case RENDER_MISSING_LOCALS_ERROR: return rb_render_missing_locals_error_from_c_struct((RENDER_MISSING_LOCALS_ERROR_T*) error); break;
776
+ case RENDER_NO_ARGUMENTS_ERROR: return rb_render_no_arguments_error_from_c_struct((RENDER_NO_ARGUMENTS_ERROR_T*) error); break;
777
+ case RENDER_CONFLICTING_PARTIAL_ERROR: return rb_render_conflicting_partial_error_from_c_struct((RENDER_CONFLICTING_PARTIAL_ERROR_T*) error); break;
778
+ case RENDER_INVALID_AS_OPTION_ERROR: return rb_render_invalid_as_option_error_from_c_struct((RENDER_INVALID_AS_OPTION_ERROR_T*) error); break;
779
+ case RENDER_OBJECT_AND_COLLECTION_ERROR: return rb_render_object_and_collection_error_from_c_struct((RENDER_OBJECT_AND_COLLECTION_ERROR_T*) error); break;
780
+ case RENDER_LAYOUT_WITHOUT_BLOCK_ERROR: return rb_render_layout_without_block_error_from_c_struct((RENDER_LAYOUT_WITHOUT_BLOCK_ERROR_T*) error); break;
386
781
  }
387
782
 
388
783
  return Qnil;