herb 0.7.1-aarch64-linux-gnu → 0.7.2-aarch64-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.
- checksums.yaml +4 -4
- data/ext/herb/error_helpers.c +27 -27
- data/ext/herb/extension.c +6 -6
- data/ext/herb/extension_helpers.c +3 -3
- data/ext/herb/nodes.c +35 -35
- data/lib/herb/3.0/herb.so +0 -0
- data/lib/herb/3.1/herb.so +0 -0
- data/lib/herb/3.2/herb.so +0 -0
- data/lib/herb/3.3/herb.so +0 -0
- data/lib/herb/3.4/herb.so +0 -0
- data/lib/herb/engine/debug_visitor.rb +41 -21
- data/lib/herb/engine.rb +20 -6
- data/lib/herb/version.rb +1 -1
- data/sig/herb/engine/debug_visitor.rbs +3 -3
- data/sig/herb/engine.rbs +5 -0
- data/src/include/version.h +1 -1
- data/src/parser.c +5 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 895440e8ea64843094ab9a47f7544387bc8d85e34a0f1e44dc8ea3a38cf117c6
|
4
|
+
data.tar.gz: 1c2bbd54b30968e7bdc28a9bc193fb752ebe6bc5e598d50e9ce55ce08c0ff923
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8152debff2f130c4aff9824207bb3d01e839eb017b440f42cec99faef2a4a230a03bc34a45766f2beb429e5e02668712cc202702b0f29d496f9d325d19014532
|
7
|
+
data.tar.gz: e3d564461868ab2a78d82daf7896ba53f489cdc38b0fc4fb349bbe23da46796f4a02f9ce24bfaedc32a69767a76ec57c46f9297e8ad03f4da49d3d6e40196f0d
|
data/ext/herb/error_helpers.c
CHANGED
@@ -23,13 +23,13 @@ static VALUE rb_unexpected_error_from_c_struct(UNEXPECTED_ERROR_T* unexpected_er
|
|
23
23
|
VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
|
24
24
|
VALUE UnexpectedError = rb_define_class_under(Errors, "UnexpectedError", Error);
|
25
25
|
|
26
|
-
VALUE type =
|
26
|
+
VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
|
27
27
|
VALUE location = rb_location_from_c_struct(error->location);
|
28
|
-
VALUE message =
|
28
|
+
VALUE message = rb_utf8_str_new_cstr(error->message);
|
29
29
|
|
30
|
-
VALUE unexpected_error_description =
|
31
|
-
VALUE unexpected_error_expected =
|
32
|
-
VALUE unexpected_error_found =
|
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);
|
33
33
|
|
34
34
|
VALUE args[6] = {
|
35
35
|
type,
|
@@ -53,11 +53,11 @@ static VALUE rb_unexpected_token_error_from_c_struct(UNEXPECTED_TOKEN_ERROR_T* u
|
|
53
53
|
VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
|
54
54
|
VALUE UnexpectedTokenError = rb_define_class_under(Errors, "UnexpectedTokenError", Error);
|
55
55
|
|
56
|
-
VALUE type =
|
56
|
+
VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
|
57
57
|
VALUE location = rb_location_from_c_struct(error->location);
|
58
|
-
VALUE message =
|
58
|
+
VALUE message = rb_utf8_str_new_cstr(error->message);
|
59
59
|
|
60
|
-
VALUE unexpected_token_error_expected_type =
|
60
|
+
VALUE unexpected_token_error_expected_type = rb_utf8_str_new_cstr(token_type_to_string(unexpected_token_error->expected_type));
|
61
61
|
VALUE unexpected_token_error_found = rb_token_from_c_struct(unexpected_token_error->found);
|
62
62
|
|
63
63
|
VALUE args[5] = {
|
@@ -81,9 +81,9 @@ static VALUE rb_missing_opening_tag_error_from_c_struct(MISSING_OPENING_TAG_ERRO
|
|
81
81
|
VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
|
82
82
|
VALUE MissingOpeningTagError = rb_define_class_under(Errors, "MissingOpeningTagError", Error);
|
83
83
|
|
84
|
-
VALUE type =
|
84
|
+
VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
|
85
85
|
VALUE location = rb_location_from_c_struct(error->location);
|
86
|
-
VALUE message =
|
86
|
+
VALUE message = rb_utf8_str_new_cstr(error->message);
|
87
87
|
|
88
88
|
VALUE missing_opening_tag_error_closing_tag = rb_token_from_c_struct(missing_opening_tag_error->closing_tag);
|
89
89
|
|
@@ -107,9 +107,9 @@ static VALUE rb_missing_closing_tag_error_from_c_struct(MISSING_CLOSING_TAG_ERRO
|
|
107
107
|
VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
|
108
108
|
VALUE MissingClosingTagError = rb_define_class_under(Errors, "MissingClosingTagError", Error);
|
109
109
|
|
110
|
-
VALUE type =
|
110
|
+
VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
|
111
111
|
VALUE location = rb_location_from_c_struct(error->location);
|
112
|
-
VALUE message =
|
112
|
+
VALUE message = rb_utf8_str_new_cstr(error->message);
|
113
113
|
|
114
114
|
VALUE missing_closing_tag_error_opening_tag = rb_token_from_c_struct(missing_closing_tag_error->opening_tag);
|
115
115
|
|
@@ -133,9 +133,9 @@ static VALUE rb_tag_names_mismatch_error_from_c_struct(TAG_NAMES_MISMATCH_ERROR_
|
|
133
133
|
VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
|
134
134
|
VALUE TagNamesMismatchError = rb_define_class_under(Errors, "TagNamesMismatchError", Error);
|
135
135
|
|
136
|
-
VALUE type =
|
136
|
+
VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
|
137
137
|
VALUE location = rb_location_from_c_struct(error->location);
|
138
|
-
VALUE message =
|
138
|
+
VALUE message = rb_utf8_str_new_cstr(error->message);
|
139
139
|
|
140
140
|
VALUE tag_names_mismatch_error_opening_tag = rb_token_from_c_struct(tag_names_mismatch_error->opening_tag);
|
141
141
|
VALUE tag_names_mismatch_error_closing_tag = rb_token_from_c_struct(tag_names_mismatch_error->closing_tag);
|
@@ -161,9 +161,9 @@ static VALUE rb_quotes_mismatch_error_from_c_struct(QUOTES_MISMATCH_ERROR_T* quo
|
|
161
161
|
VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
|
162
162
|
VALUE QuotesMismatchError = rb_define_class_under(Errors, "QuotesMismatchError", Error);
|
163
163
|
|
164
|
-
VALUE type =
|
164
|
+
VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
|
165
165
|
VALUE location = rb_location_from_c_struct(error->location);
|
166
|
-
VALUE message =
|
166
|
+
VALUE message = rb_utf8_str_new_cstr(error->message);
|
167
167
|
|
168
168
|
VALUE quotes_mismatch_error_opening_quote = rb_token_from_c_struct(quotes_mismatch_error->opening_quote);
|
169
169
|
VALUE quotes_mismatch_error_closing_quote = rb_token_from_c_struct(quotes_mismatch_error->closing_quote);
|
@@ -189,13 +189,13 @@ static VALUE rb_void_element_closing_tag_error_from_c_struct(VOID_ELEMENT_CLOSIN
|
|
189
189
|
VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
|
190
190
|
VALUE VoidElementClosingTagError = rb_define_class_under(Errors, "VoidElementClosingTagError", Error);
|
191
191
|
|
192
|
-
VALUE type =
|
192
|
+
VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
|
193
193
|
VALUE location = rb_location_from_c_struct(error->location);
|
194
|
-
VALUE message =
|
194
|
+
VALUE message = rb_utf8_str_new_cstr(error->message);
|
195
195
|
|
196
196
|
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 =
|
198
|
-
VALUE void_element_closing_tag_error_found =
|
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);
|
199
199
|
|
200
200
|
VALUE args[6] = {
|
201
201
|
type,
|
@@ -219,9 +219,9 @@ static VALUE rb_unclosed_element_error_from_c_struct(UNCLOSED_ELEMENT_ERROR_T* u
|
|
219
219
|
VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
|
220
220
|
VALUE UnclosedElementError = rb_define_class_under(Errors, "UnclosedElementError", Error);
|
221
221
|
|
222
|
-
VALUE type =
|
222
|
+
VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
|
223
223
|
VALUE location = rb_location_from_c_struct(error->location);
|
224
|
-
VALUE message =
|
224
|
+
VALUE message = rb_utf8_str_new_cstr(error->message);
|
225
225
|
|
226
226
|
VALUE unclosed_element_error_opening_tag = rb_token_from_c_struct(unclosed_element_error->opening_tag);
|
227
227
|
|
@@ -245,13 +245,13 @@ static VALUE rb_ruby_parse_error_from_c_struct(RUBY_PARSE_ERROR_T* ruby_parse_er
|
|
245
245
|
VALUE Error = rb_define_class_under(Errors, "Error", rb_cObject);
|
246
246
|
VALUE RubyParseError = rb_define_class_under(Errors, "RubyParseError", Error);
|
247
247
|
|
248
|
-
VALUE type =
|
248
|
+
VALUE type = rb_utf8_str_new_cstr(error_type_to_string(error));
|
249
249
|
VALUE location = rb_location_from_c_struct(error->location);
|
250
|
-
VALUE message =
|
250
|
+
VALUE message = rb_utf8_str_new_cstr(error->message);
|
251
251
|
|
252
|
-
VALUE ruby_parse_error_error_message =
|
253
|
-
VALUE ruby_parse_error_diagnostic_id =
|
254
|
-
VALUE ruby_parse_error_level =
|
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);
|
255
255
|
|
256
256
|
VALUE args[6] = {
|
257
257
|
type,
|
data/ext/herb/extension.c
CHANGED
@@ -50,7 +50,7 @@ static VALUE Herb_parse(int argc, VALUE* argv, VALUE self) {
|
|
50
50
|
parser_options_T opts = { 0 };
|
51
51
|
|
52
52
|
if (!NIL_P(options)) {
|
53
|
-
VALUE track_whitespace = rb_hash_lookup(options,
|
53
|
+
VALUE track_whitespace = rb_hash_lookup(options, rb_utf8_str_new_cstr("track_whitespace"));
|
54
54
|
if (NIL_P(track_whitespace)) { track_whitespace = rb_hash_lookup(options, ID2SYM(rb_intern("track_whitespace"))); }
|
55
55
|
|
56
56
|
if (!NIL_P(track_whitespace) && RTEST(track_whitespace)) {
|
@@ -108,7 +108,7 @@ static VALUE Herb_extract_ruby(VALUE self, VALUE source) {
|
|
108
108
|
|
109
109
|
herb_extract_ruby_to_buffer(string, &output);
|
110
110
|
|
111
|
-
VALUE result =
|
111
|
+
VALUE result = rb_utf8_str_new_cstr(output.value);
|
112
112
|
buffer_free(&output);
|
113
113
|
|
114
114
|
return result;
|
@@ -122,7 +122,7 @@ static VALUE Herb_extract_html(VALUE self, VALUE source) {
|
|
122
122
|
|
123
123
|
herb_extract_html_to_buffer(string, &output);
|
124
124
|
|
125
|
-
VALUE result =
|
125
|
+
VALUE result = rb_utf8_str_new_cstr(output.value);
|
126
126
|
buffer_free(&output);
|
127
127
|
|
128
128
|
return result;
|
@@ -130,9 +130,9 @@ static VALUE Herb_extract_html(VALUE self, VALUE source) {
|
|
130
130
|
|
131
131
|
static VALUE Herb_version(VALUE self) {
|
132
132
|
VALUE gem_version = rb_const_get(self, rb_intern("VERSION"));
|
133
|
-
VALUE libherb_version =
|
134
|
-
VALUE libprism_version =
|
135
|
-
VALUE format_string =
|
133
|
+
VALUE libherb_version = rb_utf8_str_new_cstr(herb_version());
|
134
|
+
VALUE libprism_version = rb_utf8_str_new_cstr(herb_prism_version());
|
135
|
+
VALUE format_string = rb_utf8_str_new_cstr("herb gem v%s, libprism v%s, libherb v%s (Ruby C native extension)");
|
136
136
|
|
137
137
|
return rb_funcall(rb_mKernel, rb_intern("sprintf"), 4, format_string, gem_version, libprism_version, libherb_version);
|
138
138
|
}
|
@@ -53,11 +53,11 @@ VALUE rb_range_from_c_struct(range_T* range) {
|
|
53
53
|
VALUE rb_token_from_c_struct(token_T* token) {
|
54
54
|
if (!token) { return Qnil; }
|
55
55
|
|
56
|
-
VALUE value = token->value ?
|
56
|
+
VALUE value = token->value ? rb_utf8_str_new_cstr(token->value) : Qnil;
|
57
57
|
|
58
58
|
VALUE range = rb_range_from_c_struct(token->range);
|
59
59
|
VALUE location = rb_location_from_c_struct(token->location);
|
60
|
-
VALUE type =
|
60
|
+
VALUE type = rb_utf8_str_new_cstr(token_type_to_string(token->type));
|
61
61
|
|
62
62
|
VALUE args[4] = { value, range, location, type };
|
63
63
|
|
@@ -91,7 +91,7 @@ VALUE create_parse_result(AST_DOCUMENT_NODE_T* root, VALUE source) {
|
|
91
91
|
|
92
92
|
VALUE read_file_to_ruby_string(const char* file_path) {
|
93
93
|
char* source = herb_read_file(file_path);
|
94
|
-
VALUE source_value =
|
94
|
+
VALUE source_value = rb_utf8_str_new_cstr(source);
|
95
95
|
|
96
96
|
free(source);
|
97
97
|
|
data/ext/herb/nodes.c
CHANGED
@@ -24,7 +24,7 @@ static VALUE rb_document_node_from_c_struct(AST_DOCUMENT_NODE_T* document_node)
|
|
24
24
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
25
25
|
VALUE DocumentNode = rb_define_class_under(AST, "DocumentNode", Node);
|
26
26
|
|
27
|
-
VALUE type =
|
27
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
28
28
|
VALUE location = rb_location_from_c_struct(node->location);
|
29
29
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
30
30
|
|
@@ -50,11 +50,11 @@ static VALUE rb_literal_node_from_c_struct(AST_LITERAL_NODE_T* literal_node) {
|
|
50
50
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
51
51
|
VALUE LiteralNode = rb_define_class_under(AST, "LiteralNode", Node);
|
52
52
|
|
53
|
-
VALUE type =
|
53
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
54
54
|
VALUE location = rb_location_from_c_struct(node->location);
|
55
55
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
56
56
|
|
57
|
-
VALUE literal_node_content =
|
57
|
+
VALUE literal_node_content = rb_utf8_str_new_cstr(literal_node->content);
|
58
58
|
|
59
59
|
VALUE args[4] = {
|
60
60
|
type,
|
@@ -76,7 +76,7 @@ static VALUE rb_html_open_tag_node_from_c_struct(AST_HTML_OPEN_TAG_NODE_T* html_
|
|
76
76
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
77
77
|
VALUE HTMLOpenTagNode = rb_define_class_under(AST, "HTMLOpenTagNode", Node);
|
78
78
|
|
79
|
-
VALUE type =
|
79
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
80
80
|
VALUE location = rb_location_from_c_struct(node->location);
|
81
81
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
82
82
|
|
@@ -110,7 +110,7 @@ static VALUE rb_html_close_tag_node_from_c_struct(AST_HTML_CLOSE_TAG_NODE_T* htm
|
|
110
110
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
111
111
|
VALUE HTMLCloseTagNode = rb_define_class_under(AST, "HTMLCloseTagNode", Node);
|
112
112
|
|
113
|
-
VALUE type =
|
113
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
114
114
|
VALUE location = rb_location_from_c_struct(node->location);
|
115
115
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
116
116
|
|
@@ -142,7 +142,7 @@ static VALUE rb_html_element_node_from_c_struct(AST_HTML_ELEMENT_NODE_T* html_el
|
|
142
142
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
143
143
|
VALUE HTMLElementNode = rb_define_class_under(AST, "HTMLElementNode", Node);
|
144
144
|
|
145
|
-
VALUE type =
|
145
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
146
146
|
VALUE location = rb_location_from_c_struct(node->location);
|
147
147
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
148
148
|
|
@@ -151,7 +151,7 @@ static VALUE rb_html_element_node_from_c_struct(AST_HTML_ELEMENT_NODE_T* html_el
|
|
151
151
|
VALUE html_element_node_body = rb_nodes_array_from_c_array(html_element_node->body);
|
152
152
|
VALUE html_element_node_close_tag = rb_node_from_c_struct((AST_NODE_T*) html_element_node->close_tag);
|
153
153
|
VALUE html_element_node_is_void = (html_element_node->is_void) ? Qtrue : Qfalse;
|
154
|
-
VALUE html_element_node_source =
|
154
|
+
VALUE html_element_node_source = rb_utf8_str_new_cstr(element_source_to_string(html_element_node->source));
|
155
155
|
|
156
156
|
VALUE args[9] = {
|
157
157
|
type,
|
@@ -178,7 +178,7 @@ static VALUE rb_html_attribute_value_node_from_c_struct(AST_HTML_ATTRIBUTE_VALUE
|
|
178
178
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
179
179
|
VALUE HTMLAttributeValueNode = rb_define_class_under(AST, "HTMLAttributeValueNode", Node);
|
180
180
|
|
181
|
-
VALUE type =
|
181
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
182
182
|
VALUE location = rb_location_from_c_struct(node->location);
|
183
183
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
184
184
|
|
@@ -210,7 +210,7 @@ static VALUE rb_html_attribute_name_node_from_c_struct(AST_HTML_ATTRIBUTE_NAME_N
|
|
210
210
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
211
211
|
VALUE HTMLAttributeNameNode = rb_define_class_under(AST, "HTMLAttributeNameNode", Node);
|
212
212
|
|
213
|
-
VALUE type =
|
213
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
214
214
|
VALUE location = rb_location_from_c_struct(node->location);
|
215
215
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
216
216
|
|
@@ -236,7 +236,7 @@ static VALUE rb_html_attribute_node_from_c_struct(AST_HTML_ATTRIBUTE_NODE_T* htm
|
|
236
236
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
237
237
|
VALUE HTMLAttributeNode = rb_define_class_under(AST, "HTMLAttributeNode", Node);
|
238
238
|
|
239
|
-
VALUE type =
|
239
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
240
240
|
VALUE location = rb_location_from_c_struct(node->location);
|
241
241
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
242
242
|
|
@@ -266,11 +266,11 @@ static VALUE rb_html_text_node_from_c_struct(AST_HTML_TEXT_NODE_T* html_text_nod
|
|
266
266
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
267
267
|
VALUE HTMLTextNode = rb_define_class_under(AST, "HTMLTextNode", Node);
|
268
268
|
|
269
|
-
VALUE type =
|
269
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
270
270
|
VALUE location = rb_location_from_c_struct(node->location);
|
271
271
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
272
272
|
|
273
|
-
VALUE html_text_node_content =
|
273
|
+
VALUE html_text_node_content = rb_utf8_str_new_cstr(html_text_node->content);
|
274
274
|
|
275
275
|
VALUE args[4] = {
|
276
276
|
type,
|
@@ -292,7 +292,7 @@ static VALUE rb_html_comment_node_from_c_struct(AST_HTML_COMMENT_NODE_T* html_co
|
|
292
292
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
293
293
|
VALUE HTMLCommentNode = rb_define_class_under(AST, "HTMLCommentNode", Node);
|
294
294
|
|
295
|
-
VALUE type =
|
295
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
296
296
|
VALUE location = rb_location_from_c_struct(node->location);
|
297
297
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
298
298
|
|
@@ -322,7 +322,7 @@ static VALUE rb_html_doctype_node_from_c_struct(AST_HTML_DOCTYPE_NODE_T* html_do
|
|
322
322
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
323
323
|
VALUE HTMLDoctypeNode = rb_define_class_under(AST, "HTMLDoctypeNode", Node);
|
324
324
|
|
325
|
-
VALUE type =
|
325
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
326
326
|
VALUE location = rb_location_from_c_struct(node->location);
|
327
327
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
328
328
|
|
@@ -352,7 +352,7 @@ static VALUE rb_xml_declaration_node_from_c_struct(AST_XML_DECLARATION_NODE_T* x
|
|
352
352
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
353
353
|
VALUE XMLDeclarationNode = rb_define_class_under(AST, "XMLDeclarationNode", Node);
|
354
354
|
|
355
|
-
VALUE type =
|
355
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
356
356
|
VALUE location = rb_location_from_c_struct(node->location);
|
357
357
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
358
358
|
|
@@ -382,7 +382,7 @@ static VALUE rb_cdata_node_from_c_struct(AST_CDATA_NODE_T* cdata_node) {
|
|
382
382
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
383
383
|
VALUE CDATANode = rb_define_class_under(AST, "CDATANode", Node);
|
384
384
|
|
385
|
-
VALUE type =
|
385
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
386
386
|
VALUE location = rb_location_from_c_struct(node->location);
|
387
387
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
388
388
|
|
@@ -412,7 +412,7 @@ static VALUE rb_whitespace_node_from_c_struct(AST_WHITESPACE_NODE_T* whitespace_
|
|
412
412
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
413
413
|
VALUE WhitespaceNode = rb_define_class_under(AST, "WhitespaceNode", Node);
|
414
414
|
|
415
|
-
VALUE type =
|
415
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
416
416
|
VALUE location = rb_location_from_c_struct(node->location);
|
417
417
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
418
418
|
|
@@ -438,14 +438,14 @@ static VALUE rb_erb_content_node_from_c_struct(AST_ERB_CONTENT_NODE_T* erb_conte
|
|
438
438
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
439
439
|
VALUE ERBContentNode = rb_define_class_under(AST, "ERBContentNode", Node);
|
440
440
|
|
441
|
-
VALUE type =
|
441
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
442
442
|
VALUE location = rb_location_from_c_struct(node->location);
|
443
443
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
444
444
|
|
445
445
|
VALUE erb_content_node_tag_opening = rb_token_from_c_struct(erb_content_node->tag_opening);
|
446
446
|
VALUE erb_content_node_content = rb_token_from_c_struct(erb_content_node->content);
|
447
447
|
VALUE erb_content_node_tag_closing = rb_token_from_c_struct(erb_content_node->tag_closing);
|
448
|
-
/* #<Herb::Template::AnalyzedRubyField:
|
448
|
+
/* #<Herb::Template::AnalyzedRubyField:0x00007f83d1dfc878 @name="analyzed_ruby", @options={kind: nil}> */
|
449
449
|
VALUE erb_content_node_analyzed_ruby = Qnil;
|
450
450
|
VALUE erb_content_node_parsed = (erb_content_node->parsed) ? Qtrue : Qfalse;
|
451
451
|
VALUE erb_content_node_valid = (erb_content_node->valid) ? Qtrue : Qfalse;
|
@@ -475,7 +475,7 @@ static VALUE rb_erb_end_node_from_c_struct(AST_ERB_END_NODE_T* erb_end_node) {
|
|
475
475
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
476
476
|
VALUE ERBEndNode = rb_define_class_under(AST, "ERBEndNode", Node);
|
477
477
|
|
478
|
-
VALUE type =
|
478
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
479
479
|
VALUE location = rb_location_from_c_struct(node->location);
|
480
480
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
481
481
|
|
@@ -505,7 +505,7 @@ static VALUE rb_erb_else_node_from_c_struct(AST_ERB_ELSE_NODE_T* erb_else_node)
|
|
505
505
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
506
506
|
VALUE ERBElseNode = rb_define_class_under(AST, "ERBElseNode", Node);
|
507
507
|
|
508
|
-
VALUE type =
|
508
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
509
509
|
VALUE location = rb_location_from_c_struct(node->location);
|
510
510
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
511
511
|
|
@@ -537,7 +537,7 @@ static VALUE rb_erb_if_node_from_c_struct(AST_ERB_IF_NODE_T* erb_if_node) {
|
|
537
537
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
538
538
|
VALUE ERBIfNode = rb_define_class_under(AST, "ERBIfNode", Node);
|
539
539
|
|
540
|
-
VALUE type =
|
540
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
541
541
|
VALUE location = rb_location_from_c_struct(node->location);
|
542
542
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
543
543
|
|
@@ -573,7 +573,7 @@ static VALUE rb_erb_block_node_from_c_struct(AST_ERB_BLOCK_NODE_T* erb_block_nod
|
|
573
573
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
574
574
|
VALUE ERBBlockNode = rb_define_class_under(AST, "ERBBlockNode", Node);
|
575
575
|
|
576
|
-
VALUE type =
|
576
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
577
577
|
VALUE location = rb_location_from_c_struct(node->location);
|
578
578
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
579
579
|
|
@@ -607,7 +607,7 @@ static VALUE rb_erb_when_node_from_c_struct(AST_ERB_WHEN_NODE_T* erb_when_node)
|
|
607
607
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
608
608
|
VALUE ERBWhenNode = rb_define_class_under(AST, "ERBWhenNode", Node);
|
609
609
|
|
610
|
-
VALUE type =
|
610
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
611
611
|
VALUE location = rb_location_from_c_struct(node->location);
|
612
612
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
613
613
|
|
@@ -639,7 +639,7 @@ static VALUE rb_erb_case_node_from_c_struct(AST_ERB_CASE_NODE_T* erb_case_node)
|
|
639
639
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
640
640
|
VALUE ERBCaseNode = rb_define_class_under(AST, "ERBCaseNode", Node);
|
641
641
|
|
642
|
-
VALUE type =
|
642
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
643
643
|
VALUE location = rb_location_from_c_struct(node->location);
|
644
644
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
645
645
|
|
@@ -677,7 +677,7 @@ static VALUE rb_erb_case_match_node_from_c_struct(AST_ERB_CASE_MATCH_NODE_T* erb
|
|
677
677
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
678
678
|
VALUE ERBCaseMatchNode = rb_define_class_under(AST, "ERBCaseMatchNode", Node);
|
679
679
|
|
680
|
-
VALUE type =
|
680
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
681
681
|
VALUE location = rb_location_from_c_struct(node->location);
|
682
682
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
683
683
|
|
@@ -715,7 +715,7 @@ static VALUE rb_erb_while_node_from_c_struct(AST_ERB_WHILE_NODE_T* erb_while_nod
|
|
715
715
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
716
716
|
VALUE ERBWhileNode = rb_define_class_under(AST, "ERBWhileNode", Node);
|
717
717
|
|
718
|
-
VALUE type =
|
718
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
719
719
|
VALUE location = rb_location_from_c_struct(node->location);
|
720
720
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
721
721
|
|
@@ -749,7 +749,7 @@ static VALUE rb_erb_until_node_from_c_struct(AST_ERB_UNTIL_NODE_T* erb_until_nod
|
|
749
749
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
750
750
|
VALUE ERBUntilNode = rb_define_class_under(AST, "ERBUntilNode", Node);
|
751
751
|
|
752
|
-
VALUE type =
|
752
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
753
753
|
VALUE location = rb_location_from_c_struct(node->location);
|
754
754
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
755
755
|
|
@@ -783,7 +783,7 @@ static VALUE rb_erb_for_node_from_c_struct(AST_ERB_FOR_NODE_T* erb_for_node) {
|
|
783
783
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
784
784
|
VALUE ERBForNode = rb_define_class_under(AST, "ERBForNode", Node);
|
785
785
|
|
786
|
-
VALUE type =
|
786
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
787
787
|
VALUE location = rb_location_from_c_struct(node->location);
|
788
788
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
789
789
|
|
@@ -817,7 +817,7 @@ static VALUE rb_erb_rescue_node_from_c_struct(AST_ERB_RESCUE_NODE_T* erb_rescue_
|
|
817
817
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
818
818
|
VALUE ERBRescueNode = rb_define_class_under(AST, "ERBRescueNode", Node);
|
819
819
|
|
820
|
-
VALUE type =
|
820
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
821
821
|
VALUE location = rb_location_from_c_struct(node->location);
|
822
822
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
823
823
|
|
@@ -851,7 +851,7 @@ static VALUE rb_erb_ensure_node_from_c_struct(AST_ERB_ENSURE_NODE_T* erb_ensure_
|
|
851
851
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
852
852
|
VALUE ERBEnsureNode = rb_define_class_under(AST, "ERBEnsureNode", Node);
|
853
853
|
|
854
|
-
VALUE type =
|
854
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
855
855
|
VALUE location = rb_location_from_c_struct(node->location);
|
856
856
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
857
857
|
|
@@ -883,7 +883,7 @@ static VALUE rb_erb_begin_node_from_c_struct(AST_ERB_BEGIN_NODE_T* erb_begin_nod
|
|
883
883
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
884
884
|
VALUE ERBBeginNode = rb_define_class_under(AST, "ERBBeginNode", Node);
|
885
885
|
|
886
|
-
VALUE type =
|
886
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
887
887
|
VALUE location = rb_location_from_c_struct(node->location);
|
888
888
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
889
889
|
|
@@ -923,7 +923,7 @@ static VALUE rb_erb_unless_node_from_c_struct(AST_ERB_UNLESS_NODE_T* erb_unless_
|
|
923
923
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
924
924
|
VALUE ERBUnlessNode = rb_define_class_under(AST, "ERBUnlessNode", Node);
|
925
925
|
|
926
|
-
VALUE type =
|
926
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
927
927
|
VALUE location = rb_location_from_c_struct(node->location);
|
928
928
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
929
929
|
|
@@ -959,7 +959,7 @@ static VALUE rb_erb_yield_node_from_c_struct(AST_ERB_YIELD_NODE_T* erb_yield_nod
|
|
959
959
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
960
960
|
VALUE ERBYieldNode = rb_define_class_under(AST, "ERBYieldNode", Node);
|
961
961
|
|
962
|
-
VALUE type =
|
962
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
963
963
|
VALUE location = rb_location_from_c_struct(node->location);
|
964
964
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
965
965
|
|
@@ -989,7 +989,7 @@ static VALUE rb_erb_in_node_from_c_struct(AST_ERB_IN_NODE_T* erb_in_node) {
|
|
989
989
|
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
990
990
|
VALUE ERBInNode = rb_define_class_under(AST, "ERBInNode", Node);
|
991
991
|
|
992
|
-
VALUE type =
|
992
|
+
VALUE type = rb_utf8_str_new_cstr(ast_node_type_to_string(node));
|
993
993
|
VALUE location = rb_location_from_c_struct(node->location);
|
994
994
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
995
995
|
|
data/lib/herb/3.0/herb.so
CHANGED
Binary file
|
data/lib/herb/3.1/herb.so
CHANGED
Binary file
|
data/lib/herb/3.2/herb.so
CHANGED
Binary file
|
data/lib/herb/3.3/herb.so
CHANGED
Binary file
|
data/lib/herb/3.4/herb.so
CHANGED
Binary file
|
@@ -3,10 +3,26 @@
|
|
3
3
|
module Herb
|
4
4
|
class Engine
|
5
5
|
class DebugVisitor < Herb::Visitor
|
6
|
-
def initialize(
|
6
|
+
def initialize(file_path: nil, project_path: nil)
|
7
7
|
super()
|
8
8
|
|
9
|
-
@
|
9
|
+
@filename = case file_path
|
10
|
+
when ::Pathname
|
11
|
+
file_path
|
12
|
+
when String
|
13
|
+
file_path.empty? ? nil : ::Pathname.new(file_path)
|
14
|
+
end
|
15
|
+
|
16
|
+
@project_path = case project_path
|
17
|
+
when ::Pathname
|
18
|
+
project_path
|
19
|
+
when String
|
20
|
+
::Pathname.new(project_path)
|
21
|
+
else
|
22
|
+
::Pathname.new(Dir.pwd)
|
23
|
+
end
|
24
|
+
|
25
|
+
@relative_file_path = calculate_relative_path
|
10
26
|
@top_level_elements = [] #: Array[Herb::AST::HTMLElementNode]
|
11
27
|
@element_stack = [] #: Array[String]
|
12
28
|
@debug_attributes_applied = false
|
@@ -16,13 +32,7 @@ module Herb
|
|
16
32
|
@erb_nodes_to_wrap = [] #: Array[Herb::AST::ERBContentNode]
|
17
33
|
end
|
18
34
|
|
19
|
-
def debug_enabled?
|
20
|
-
@engine.debug
|
21
|
-
end
|
22
|
-
|
23
35
|
def visit_document_node(node)
|
24
|
-
return unless debug_enabled?
|
25
|
-
|
26
36
|
find_top_level_elements(node)
|
27
37
|
|
28
38
|
super
|
@@ -31,8 +41,6 @@ module Herb
|
|
31
41
|
end
|
32
42
|
|
33
43
|
def visit_html_element_node(node)
|
34
|
-
return super unless debug_enabled?
|
35
|
-
|
36
44
|
tag_name = node.tag_name&.value&.downcase
|
37
45
|
@element_stack.push(tag_name) if tag_name
|
38
46
|
|
@@ -62,7 +70,7 @@ module Herb
|
|
62
70
|
end
|
63
71
|
|
64
72
|
def visit_erb_content_node(node)
|
65
|
-
if
|
73
|
+
if !@in_attribute && !@in_html_comment && !@in_html_doctype && !in_excluded_context? && erb_output?(node.tag_opening.value)
|
66
74
|
code = node.content.value.strip
|
67
75
|
|
68
76
|
@erb_nodes_to_wrap << node unless complex_rails_helper?(code)
|
@@ -77,6 +85,18 @@ module Herb
|
|
77
85
|
|
78
86
|
private
|
79
87
|
|
88
|
+
def calculate_relative_path
|
89
|
+
return "unknown" unless @filename
|
90
|
+
|
91
|
+
if @filename.absolute?
|
92
|
+
@filename.relative_path_from(@project_path).to_s
|
93
|
+
else
|
94
|
+
@filename.to_s
|
95
|
+
end
|
96
|
+
rescue ArgumentError
|
97
|
+
@filename.to_s
|
98
|
+
end
|
99
|
+
|
80
100
|
def wrap_all_erb_nodes(node)
|
81
101
|
replace_erb_nodes_recursive(node)
|
82
102
|
end
|
@@ -151,9 +171,9 @@ module Herb
|
|
151
171
|
|
152
172
|
debug_attributes = [
|
153
173
|
create_debug_attribute("data-herb-debug-outline-type", view_type),
|
154
|
-
create_debug_attribute("data-herb-debug-file-name", @
|
155
|
-
create_debug_attribute("data-herb-debug-file-relative-path", @
|
156
|
-
create_debug_attribute("data-herb-debug-file-full-path", @
|
174
|
+
create_debug_attribute("data-herb-debug-file-name", @filename&.basename&.to_s || "unknown"),
|
175
|
+
create_debug_attribute("data-herb-debug-file-relative-path", @relative_file_path || "unknown"),
|
176
|
+
create_debug_attribute("data-herb-debug-file-full-path", @filename&.to_s || "unknown")
|
157
177
|
]
|
158
178
|
|
159
179
|
if @top_level_elements.length > 1
|
@@ -206,9 +226,9 @@ module Herb
|
|
206
226
|
debug_attributes = [
|
207
227
|
create_debug_attribute("data-herb-debug-outline-type", outline_type),
|
208
228
|
create_debug_attribute("data-herb-debug-erb", escaped_erb),
|
209
|
-
create_debug_attribute("data-herb-debug-file-name", @
|
210
|
-
create_debug_attribute("data-herb-debug-file-relative-path", @
|
211
|
-
create_debug_attribute("data-herb-debug-file-full-path", @
|
229
|
+
create_debug_attribute("data-herb-debug-file-name", @filename&.basename&.to_s || "unknown"),
|
230
|
+
create_debug_attribute("data-herb-debug-file-relative-path", @relative_file_path || "unknown"),
|
231
|
+
create_debug_attribute("data-herb-debug-file-full-path", @filename&.to_s || "unknown"),
|
212
232
|
create_debug_attribute("data-herb-debug-inserted", "true")
|
213
233
|
]
|
214
234
|
|
@@ -256,16 +276,16 @@ module Herb
|
|
256
276
|
end
|
257
277
|
|
258
278
|
def partial?
|
259
|
-
return false unless @
|
279
|
+
return false unless @filename
|
260
280
|
|
261
|
-
basename = @
|
281
|
+
basename = @filename.basename.to_s
|
262
282
|
basename.start_with?("_")
|
263
283
|
end
|
264
284
|
|
265
285
|
def component?
|
266
|
-
return false unless @
|
286
|
+
return false unless @filename
|
267
287
|
|
268
|
-
path = @
|
288
|
+
path = @filename.to_s
|
269
289
|
path.include?("/components/")
|
270
290
|
end
|
271
291
|
|
data/lib/herb/engine.rb
CHANGED
@@ -17,7 +17,7 @@ require_relative "engine/validators/accessibility_validator"
|
|
17
17
|
module Herb
|
18
18
|
class Engine
|
19
19
|
attr_reader :src, :filename, :project_path, :relative_file_path, :bufvar, :debug, :content_for_head,
|
20
|
-
:validation_error_template
|
20
|
+
:validation_error_template, :visitors
|
21
21
|
|
22
22
|
ESCAPE_TABLE = {
|
23
23
|
"&" => "&",
|
@@ -51,6 +51,16 @@ module Herb
|
|
51
51
|
@content_for_head = properties[:content_for_head]
|
52
52
|
@validation_error_template = nil
|
53
53
|
@validation_mode = properties.fetch(:validation_mode, :raise)
|
54
|
+
@visitors = properties.fetch(:visitors, default_visitors)
|
55
|
+
|
56
|
+
if @debug && @visitors.empty?
|
57
|
+
debug_visitor = DebugVisitor.new(
|
58
|
+
file_path: @filename,
|
59
|
+
project_path: @project_path
|
60
|
+
)
|
61
|
+
|
62
|
+
@visitors << debug_visitor
|
63
|
+
end
|
54
64
|
|
55
65
|
unless [:raise, :overlay, :none].include?(@validation_mode)
|
56
66
|
raise ArgumentError,
|
@@ -109,12 +119,12 @@ module Herb
|
|
109
119
|
|
110
120
|
add_validation_overlay(validation_errors, input) if @validation_mode == :overlay && validation_errors&.any?
|
111
121
|
|
112
|
-
|
113
|
-
|
114
|
-
ast.accept(debug_visitor)
|
122
|
+
@visitors.each do |visitor|
|
123
|
+
ast.accept(visitor)
|
115
124
|
end
|
116
125
|
|
117
126
|
compiler = Compiler.new(self, properties)
|
127
|
+
|
118
128
|
ast.accept(compiler)
|
119
129
|
|
120
130
|
compiler.generate_output
|
@@ -359,8 +369,12 @@ module Herb
|
|
359
369
|
)
|
360
370
|
|
361
371
|
error_html = overlay_generator.generate_html
|
362
|
-
|
363
|
-
|
372
|
+
@validation_error_template = "<template data-herb-parser-error>#{error_html}</template>"
|
373
|
+
end
|
374
|
+
|
375
|
+
#: () -> Array[Herb::Visitor]
|
376
|
+
def default_visitors
|
377
|
+
[]
|
364
378
|
end
|
365
379
|
end
|
366
380
|
end
|
data/lib/herb/version.rb
CHANGED
@@ -3,9 +3,7 @@
|
|
3
3
|
module Herb
|
4
4
|
class Engine
|
5
5
|
class DebugVisitor < Herb::Visitor
|
6
|
-
def initialize: (untyped
|
7
|
-
|
8
|
-
def debug_enabled?: () -> untyped
|
6
|
+
def initialize: (?file_path: untyped, ?project_path: untyped) -> untyped
|
9
7
|
|
10
8
|
def visit_document_node: (untyped node) -> untyped
|
11
9
|
|
@@ -23,6 +21,8 @@ module Herb
|
|
23
21
|
|
24
22
|
private
|
25
23
|
|
24
|
+
def calculate_relative_path: () -> untyped
|
25
|
+
|
26
26
|
def wrap_all_erb_nodes: (untyped node) -> untyped
|
27
27
|
|
28
28
|
# Creates a dummy location for AST nodes that don't need real location info
|
data/sig/herb/engine.rbs
CHANGED
@@ -18,6 +18,8 @@ module Herb
|
|
18
18
|
|
19
19
|
attr_reader validation_error_template: untyped
|
20
20
|
|
21
|
+
attr_reader visitors: untyped
|
22
|
+
|
21
23
|
ESCAPE_TABLE: untyped
|
22
24
|
|
23
25
|
class CompilationError < StandardError
|
@@ -68,5 +70,8 @@ module Herb
|
|
68
70
|
def escape_attr: (untyped text) -> untyped
|
69
71
|
|
70
72
|
def add_parser_error_overlay: (untyped parser_errors, untyped input) -> untyped
|
73
|
+
|
74
|
+
# : () -> Array[Herb::Visitor]
|
75
|
+
def default_visitors: () -> Array[Herb::Visitor]
|
71
76
|
end
|
72
77
|
end
|
data/src/include/version.h
CHANGED
data/src/parser.c
CHANGED
@@ -555,14 +555,12 @@ static AST_HTML_ATTRIBUTE_VALUE_NODE_T* parser_parse_html_attribute_value(parser
|
|
555
555
|
return value;
|
556
556
|
}
|
557
557
|
|
558
|
-
token_T* token = parser_advance(parser);
|
559
|
-
|
560
558
|
append_unexpected_error(
|
561
559
|
"Unexpected Token",
|
562
560
|
"TOKEN_IDENTIFIER, TOKEN_QUOTE, TOKEN_ERB_START",
|
563
|
-
token_type_to_string(
|
564
|
-
|
565
|
-
|
561
|
+
token_type_to_string(parser->current_token->type),
|
562
|
+
parser->current_token->location->start,
|
563
|
+
parser->current_token->location->end,
|
566
564
|
errors
|
567
565
|
);
|
568
566
|
|
@@ -571,13 +569,11 @@ static AST_HTML_ATTRIBUTE_VALUE_NODE_T* parser_parse_html_attribute_value(parser
|
|
571
569
|
children,
|
572
570
|
NULL,
|
573
571
|
false,
|
574
|
-
|
575
|
-
|
572
|
+
parser->current_token->location->start,
|
573
|
+
parser->current_token->location->end,
|
576
574
|
errors
|
577
575
|
);
|
578
576
|
|
579
|
-
token_free(token);
|
580
|
-
|
581
577
|
return value;
|
582
578
|
}
|
583
579
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: herb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: aarch64-linux-gnu
|
6
6
|
authors:
|
7
7
|
- Marco Roth
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-09-
|
10
|
+
date: 2025-09-17 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: Powerful and seamless HTML-aware ERB parsing and tooling.
|
13
13
|
email:
|