herb 0.8.10-arm-linux-gnu → 0.9.0-arm-linux-gnu
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +11 -3
- data/README.md +64 -34
- data/Rakefile +48 -40
- data/config.yml +317 -34
- data/ext/herb/error_helpers.c +367 -140
- data/ext/herb/error_helpers.h +1 -0
- data/ext/herb/extconf.rb +67 -28
- data/ext/herb/extension.c +317 -51
- data/ext/herb/extension.h +1 -0
- data/ext/herb/extension_helpers.c +23 -14
- data/ext/herb/extension_helpers.h +2 -2
- data/ext/herb/nodes.c +537 -270
- data/ext/herb/nodes.h +1 -0
- data/herb.gemspec +3 -2
- 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/4.0/herb.so +0 -0
- data/lib/herb/ast/helpers.rb +3 -3
- data/lib/herb/ast/node.rb +15 -2
- data/lib/herb/ast/nodes.rb +1132 -157
- data/lib/herb/bootstrap.rb +87 -0
- data/lib/herb/cli.rb +341 -31
- data/lib/herb/configuration.rb +248 -0
- data/lib/herb/defaults.yml +32 -0
- data/lib/herb/engine/compiler.rb +78 -11
- data/lib/herb/engine/debug_visitor.rb +13 -3
- data/lib/herb/engine/error_formatter.rb +13 -9
- data/lib/herb/engine/parser_error_overlay.rb +10 -6
- data/lib/herb/engine/validator.rb +8 -3
- data/lib/herb/engine/validators/nesting_validator.rb +2 -2
- data/lib/herb/engine.rb +82 -35
- data/lib/herb/errors.rb +563 -88
- data/lib/herb/lex_result.rb +1 -0
- data/lib/herb/location.rb +7 -3
- data/lib/herb/parse_result.rb +12 -2
- data/lib/herb/parser_options.rb +57 -0
- data/lib/herb/position.rb +1 -0
- data/lib/herb/prism_inspect.rb +116 -0
- data/lib/herb/project.rb +923 -331
- data/lib/herb/range.rb +1 -0
- data/lib/herb/token.rb +7 -1
- data/lib/herb/version.rb +1 -1
- data/lib/herb/visitor.rb +37 -2
- data/lib/herb/warnings.rb +6 -1
- data/lib/herb.rb +35 -3
- data/sig/herb/ast/helpers.rbs +2 -2
- data/sig/herb/ast/node.rbs +12 -2
- data/sig/herb/ast/nodes.rbs +641 -128
- data/sig/herb/bootstrap.rbs +31 -0
- data/sig/herb/configuration.rbs +89 -0
- data/sig/herb/engine/compiler.rbs +9 -1
- data/sig/herb/engine/debug_visitor.rbs +2 -0
- data/sig/herb/engine/validator.rbs +5 -1
- data/sig/herb/engine.rbs +17 -3
- data/sig/herb/errors.rbs +258 -63
- data/sig/herb/location.rbs +4 -0
- data/sig/herb/parse_result.rbs +4 -2
- data/sig/herb/parser_options.rbs +42 -0
- data/sig/herb/position.rbs +1 -0
- data/sig/herb/prism_inspect.rbs +28 -0
- data/sig/herb/range.rbs +1 -0
- data/sig/herb/token.rbs +6 -0
- data/sig/herb/visitor.rbs +25 -4
- data/sig/herb/warnings.rbs +6 -1
- data/sig/herb.rbs +14 -0
- data/sig/herb_c_extension.rbs +5 -2
- data/sig/serialized_ast_errors.rbs +54 -6
- data/sig/serialized_ast_nodes.rbs +60 -6
- data/src/analyze/action_view/attribute_extraction_helpers.c +290 -0
- data/src/analyze/action_view/content_tag.c +70 -0
- data/src/analyze/action_view/link_to.c +143 -0
- data/src/analyze/action_view/registry.c +60 -0
- data/src/analyze/action_view/tag.c +64 -0
- data/src/analyze/action_view/tag_helper_node_builders.c +305 -0
- data/src/analyze/action_view/tag_helpers.c +748 -0
- data/src/analyze/action_view/turbo_frame_tag.c +88 -0
- data/src/analyze/analyze.c +882 -0
- data/src/{analyzed_ruby.c → analyze/analyzed_ruby.c} +13 -11
- data/src/analyze/builders.c +343 -0
- data/src/analyze/conditional_elements.c +594 -0
- data/src/analyze/conditional_open_tags.c +640 -0
- data/src/analyze/control_type.c +250 -0
- data/src/{analyze_helpers.c → analyze/helpers.c} +48 -23
- data/src/analyze/invalid_structures.c +193 -0
- data/src/{analyze_missing_end.c → analyze/missing_end.c} +33 -22
- data/src/analyze/parse_errors.c +84 -0
- data/src/analyze/prism_annotate.c +397 -0
- data/src/{analyze_transform.c → analyze/transform.c} +17 -3
- data/src/ast_node.c +17 -7
- data/src/ast_nodes.c +662 -387
- data/src/ast_pretty_print.c +190 -6
- data/src/errors.c +1076 -520
- data/src/extract.c +145 -49
- data/src/herb.c +52 -34
- data/src/html_util.c +241 -12
- data/src/include/analyze/action_view/attribute_extraction_helpers.h +36 -0
- data/src/include/analyze/action_view/tag_helper_handler.h +41 -0
- data/src/include/analyze/action_view/tag_helper_node_builders.h +70 -0
- data/src/include/analyze/action_view/tag_helpers.h +38 -0
- data/src/include/{analyze.h → analyze/analyze.h} +14 -4
- data/src/include/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
- data/src/include/analyze/builders.h +27 -0
- data/src/include/analyze/conditional_elements.h +9 -0
- data/src/include/analyze/conditional_open_tags.h +9 -0
- data/src/include/analyze/control_type.h +14 -0
- data/src/include/{analyze_helpers.h → analyze/helpers.h} +4 -2
- data/src/include/analyze/invalid_structures.h +11 -0
- data/src/include/analyze/prism_annotate.h +16 -0
- data/src/include/ast_node.h +11 -5
- data/src/include/ast_nodes.h +117 -38
- data/src/include/ast_pretty_print.h +5 -0
- data/src/include/element_source.h +3 -8
- data/src/include/errors.h +148 -55
- data/src/include/extract.h +21 -5
- data/src/include/herb.h +18 -6
- data/src/include/herb_prism_node.h +13 -0
- data/src/include/html_util.h +7 -2
- data/src/include/io.h +3 -1
- data/src/include/lex_helpers.h +29 -0
- data/src/include/lexer.h +1 -1
- data/src/include/lexer_peek_helpers.h +87 -13
- data/src/include/lexer_struct.h +2 -0
- data/src/include/location.h +2 -1
- data/src/include/parser.h +27 -2
- data/src/include/parser_helpers.h +19 -3
- data/src/include/pretty_print.h +10 -5
- data/src/include/prism_context.h +45 -0
- data/src/include/prism_helpers.h +10 -7
- data/src/include/prism_serialized.h +12 -0
- data/src/include/token.h +16 -4
- data/src/include/token_struct.h +10 -3
- data/src/include/utf8.h +2 -1
- data/src/include/util/hb_allocator.h +78 -0
- data/src/include/util/hb_arena.h +6 -1
- data/src/include/util/hb_arena_debug.h +12 -1
- data/src/include/util/hb_array.h +7 -3
- data/src/include/util/hb_buffer.h +6 -4
- data/src/include/util/hb_foreach.h +79 -0
- data/src/include/util/hb_narray.h +8 -4
- data/src/include/util/hb_string.h +56 -9
- data/src/include/util.h +6 -3
- data/src/include/version.h +1 -1
- data/src/io.c +3 -2
- data/src/lexer.c +42 -30
- data/src/lexer_peek_helpers.c +12 -74
- data/src/location.c +2 -2
- data/src/main.c +53 -28
- data/src/parser.c +783 -247
- data/src/parser_helpers.c +110 -23
- data/src/parser_match_tags.c +109 -48
- data/src/pretty_print.c +29 -24
- data/src/prism_helpers.c +30 -27
- data/src/ruby_parser.c +2 -0
- data/src/token.c +151 -66
- data/src/token_matchers.c +0 -1
- data/src/utf8.c +7 -6
- data/src/util/hb_allocator.c +341 -0
- data/src/util/hb_arena.c +81 -56
- data/src/util/hb_arena_debug.c +32 -17
- data/src/util/hb_array.c +30 -15
- data/src/util/hb_buffer.c +17 -21
- data/src/util/hb_narray.c +22 -7
- data/src/util/hb_string.c +49 -35
- data/src/util.c +21 -11
- data/src/visitor.c +47 -0
- data/templates/ext/herb/error_helpers.c.erb +24 -11
- data/templates/ext/herb/error_helpers.h.erb +1 -0
- data/templates/ext/herb/nodes.c.erb +50 -16
- data/templates/ext/herb/nodes.h.erb +1 -0
- data/templates/java/error_helpers.c.erb +1 -1
- data/templates/java/nodes.c.erb +30 -8
- data/templates/java/org/herb/ast/Errors.java.erb +24 -1
- data/templates/java/org/herb/ast/Nodes.java.erb +80 -21
- data/templates/javascript/packages/core/src/errors.ts.erb +16 -3
- data/templates/javascript/packages/core/src/node-type-guards.ts.erb +3 -1
- data/templates/javascript/packages/core/src/nodes.ts.erb +109 -32
- data/templates/javascript/packages/node/extension/error_helpers.cpp.erb +13 -4
- data/templates/javascript/packages/node/extension/nodes.cpp.erb +43 -4
- data/templates/lib/herb/ast/nodes.rb.erb +88 -31
- data/templates/lib/herb/errors.rb.erb +15 -3
- data/templates/lib/herb/visitor.rb.erb +2 -2
- data/templates/rust/src/ast/nodes.rs.erb +97 -44
- data/templates/rust/src/errors.rs.erb +2 -1
- data/templates/rust/src/nodes.rs.erb +167 -15
- data/templates/rust/src/union_types.rs.erb +60 -0
- data/templates/rust/src/visitor.rs.erb +81 -0
- data/templates/src/{analyze_missing_end.c.erb → analyze/missing_end.c.erb} +9 -6
- data/templates/src/{analyze_transform.c.erb → analyze/transform.c.erb} +2 -2
- data/templates/src/ast_nodes.c.erb +34 -26
- data/templates/src/ast_pretty_print.c.erb +24 -5
- data/templates/src/errors.c.erb +60 -54
- data/templates/src/include/ast_nodes.h.erb +6 -2
- data/templates/src/include/ast_pretty_print.h.erb +5 -0
- data/templates/src/include/errors.h.erb +15 -11
- data/templates/src/include/util/hb_foreach.h.erb +20 -0
- data/templates/src/parser_match_tags.c.erb +10 -4
- data/templates/src/visitor.c.erb +2 -2
- data/templates/template.rb +204 -29
- data/templates/wasm/error_helpers.cpp.erb +9 -5
- data/templates/wasm/nodes.cpp.erb +41 -4
- metadata +57 -16
- data/src/analyze.c +0 -1608
- data/src/element_source.c +0 -12
- data/src/include/util/hb_system.h +0 -9
- data/src/util/hb_system.c +0 -30
data/src/parser_helpers.c
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
#include "include/parser_helpers.h"
|
|
2
|
-
#include "include/ast_node.h"
|
|
3
2
|
#include "include/ast_nodes.h"
|
|
4
3
|
#include "include/errors.h"
|
|
5
|
-
#include "include/html_util.h"
|
|
6
4
|
#include "include/lexer.h"
|
|
7
5
|
#include "include/parser.h"
|
|
8
6
|
#include "include/token.h"
|
|
9
|
-
#include "include/token_matchers.h"
|
|
10
7
|
#include "include/util/hb_array.h"
|
|
11
8
|
#include "include/util/hb_buffer.h"
|
|
12
9
|
#include "include/util/hb_string.h"
|
|
13
10
|
|
|
11
|
+
#include <stdarg.h>
|
|
14
12
|
#include <stdio.h>
|
|
15
13
|
|
|
16
14
|
void parser_push_open_tag(const parser_T* parser, token_T* tag_name) {
|
|
17
|
-
token_T* copy = token_copy(tag_name);
|
|
15
|
+
token_T* copy = token_copy(tag_name, parser->allocator);
|
|
18
16
|
hb_array_push(parser->open_tags_stack, copy);
|
|
19
17
|
}
|
|
20
18
|
|
|
@@ -22,9 +20,9 @@ bool parser_check_matching_tag(const parser_T* parser, hb_string_T tag_name) {
|
|
|
22
20
|
if (hb_array_size(parser->open_tags_stack) == 0) { return false; }
|
|
23
21
|
|
|
24
22
|
token_T* top_token = hb_array_last(parser->open_tags_stack);
|
|
25
|
-
if (top_token == NULL || top_token->value
|
|
23
|
+
if (top_token == NULL || hb_string_is_empty(top_token->value)) { return false; };
|
|
26
24
|
|
|
27
|
-
return hb_string_equals_case_insensitive(
|
|
25
|
+
return hb_string_equals_case_insensitive(top_token->value, tag_name);
|
|
28
26
|
}
|
|
29
27
|
|
|
30
28
|
token_T* parser_pop_open_tag(const parser_T* parser) {
|
|
@@ -47,9 +45,8 @@ bool parser_in_svg_context(const parser_T* parser) {
|
|
|
47
45
|
for (size_t i = 0; i < stack_size; i++) {
|
|
48
46
|
token_T* tag = (token_T*) hb_array_get(parser->open_tags_stack, i);
|
|
49
47
|
|
|
50
|
-
if (tag && tag->value) {
|
|
51
|
-
|
|
52
|
-
if (hb_string_equals_case_insensitive(tag_value_string, hb_string("svg"))) { return true; }
|
|
48
|
+
if (tag && !hb_string_is_empty(tag->value)) {
|
|
49
|
+
if (hb_string_equals_case_insensitive(tag->value, hb_string("svg"))) { return true; }
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
52
|
|
|
@@ -75,7 +72,7 @@ hb_string_T parser_get_foreign_content_closing_tag(foreign_content_type_T type)
|
|
|
75
72
|
switch (type) {
|
|
76
73
|
case FOREIGN_CONTENT_SCRIPT: return hb_string("script");
|
|
77
74
|
case FOREIGN_CONTENT_STYLE: return hb_string("style");
|
|
78
|
-
default: return
|
|
75
|
+
default: return HB_STRING_EMPTY;
|
|
79
76
|
}
|
|
80
77
|
}
|
|
81
78
|
|
|
@@ -93,24 +90,53 @@ void parser_exit_foreign_content(parser_T* parser) {
|
|
|
93
90
|
parser->foreign_content_type = FOREIGN_CONTENT_UNKNOWN;
|
|
94
91
|
}
|
|
95
92
|
|
|
96
|
-
void
|
|
93
|
+
void parser_append_unexpected_error_impl(
|
|
97
94
|
parser_T* parser,
|
|
95
|
+
hb_array_T* errors,
|
|
98
96
|
const char* description,
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
token_type_T first_token,
|
|
98
|
+
...
|
|
99
|
+
) {
|
|
100
|
+
token_T* token = parser_advance(parser);
|
|
101
|
+
|
|
102
|
+
va_list args;
|
|
103
|
+
va_start(args, first_token);
|
|
104
|
+
char* expected = token_types_to_friendly_string_valist(parser->allocator, first_token, args);
|
|
105
|
+
va_end(args);
|
|
106
|
+
|
|
107
|
+
append_unexpected_error(
|
|
108
|
+
hb_string(description),
|
|
109
|
+
hb_string(expected),
|
|
110
|
+
token_type_to_friendly_string(token->type),
|
|
111
|
+
token->location.start,
|
|
112
|
+
token->location.end,
|
|
113
|
+
parser->allocator,
|
|
114
|
+
errors
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
hb_allocator_dealloc(parser->allocator, expected);
|
|
118
|
+
token_free(token, parser->allocator);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
void parser_append_unexpected_error_string(
|
|
122
|
+
parser_T* parser,
|
|
123
|
+
hb_array_T* errors,
|
|
124
|
+
const char* description,
|
|
125
|
+
const char* expected
|
|
101
126
|
) {
|
|
102
127
|
token_T* token = parser_advance(parser);
|
|
103
128
|
|
|
104
129
|
append_unexpected_error(
|
|
105
|
-
description,
|
|
106
|
-
expected,
|
|
107
|
-
|
|
130
|
+
hb_string(description),
|
|
131
|
+
hb_string(expected),
|
|
132
|
+
token_type_to_friendly_string(token->type),
|
|
108
133
|
token->location.start,
|
|
109
134
|
token->location.end,
|
|
135
|
+
parser->allocator,
|
|
110
136
|
errors
|
|
111
137
|
);
|
|
112
138
|
|
|
113
|
-
token_free(token);
|
|
139
|
+
token_free(token, parser->allocator);
|
|
114
140
|
}
|
|
115
141
|
|
|
116
142
|
void parser_append_unexpected_token_error(parser_T* parser, token_type_T expected_type, hb_array_T* errors) {
|
|
@@ -119,6 +145,7 @@ void parser_append_unexpected_token_error(parser_T* parser, token_type_T expecte
|
|
|
119
145
|
parser->current_token,
|
|
120
146
|
parser->current_token->location.start,
|
|
121
147
|
parser->current_token->location.end,
|
|
148
|
+
parser->allocator,
|
|
122
149
|
errors
|
|
123
150
|
);
|
|
124
151
|
}
|
|
@@ -129,13 +156,17 @@ void parser_append_literal_node_from_buffer(
|
|
|
129
156
|
hb_array_T* children,
|
|
130
157
|
position_T start
|
|
131
158
|
) {
|
|
132
|
-
if (
|
|
159
|
+
if (buffer->length == 0) { return; }
|
|
160
|
+
|
|
161
|
+
hb_string_T content = { .data = buffer->value, .length = (uint32_t) buffer->length };
|
|
133
162
|
|
|
134
163
|
AST_LITERAL_NODE_T* literal =
|
|
135
|
-
ast_literal_node_init(
|
|
164
|
+
ast_literal_node_init(content, start, parser->current_token->location.start, NULL, parser->allocator);
|
|
136
165
|
|
|
137
166
|
if (children != NULL) { hb_array_append(children, literal); }
|
|
138
|
-
|
|
167
|
+
|
|
168
|
+
hb_buffer_free(buffer);
|
|
169
|
+
hb_buffer_init(buffer, 128, parser->allocator);
|
|
139
170
|
}
|
|
140
171
|
|
|
141
172
|
token_T* parser_advance(parser_T* parser) {
|
|
@@ -155,13 +186,21 @@ token_T* parser_consume_expected(parser_T* parser, const token_type_T expected_t
|
|
|
155
186
|
if (token == NULL) {
|
|
156
187
|
token = parser_advance(parser);
|
|
157
188
|
|
|
158
|
-
append_unexpected_token_error(
|
|
189
|
+
append_unexpected_token_error(
|
|
190
|
+
expected_type,
|
|
191
|
+
token,
|
|
192
|
+
token->location.start,
|
|
193
|
+
token->location.end,
|
|
194
|
+
parser->allocator,
|
|
195
|
+
array
|
|
196
|
+
);
|
|
159
197
|
}
|
|
160
198
|
|
|
161
199
|
return token;
|
|
162
200
|
}
|
|
163
201
|
|
|
164
202
|
AST_HTML_ELEMENT_NODE_T* parser_handle_missing_close_tag(
|
|
203
|
+
parser_T* parser,
|
|
165
204
|
AST_HTML_OPEN_TAG_NODE_T* open_tag,
|
|
166
205
|
hb_array_T* body,
|
|
167
206
|
hb_array_T* errors
|
|
@@ -170,11 +209,12 @@ AST_HTML_ELEMENT_NODE_T* parser_handle_missing_close_tag(
|
|
|
170
209
|
open_tag->tag_name,
|
|
171
210
|
open_tag->tag_name->location.start,
|
|
172
211
|
open_tag->tag_name->location.end,
|
|
212
|
+
parser->allocator,
|
|
173
213
|
errors
|
|
174
214
|
);
|
|
175
215
|
|
|
176
216
|
return ast_html_element_node_init(
|
|
177
|
-
open_tag,
|
|
217
|
+
(AST_NODE_T*) open_tag,
|
|
178
218
|
open_tag->tag_name,
|
|
179
219
|
body,
|
|
180
220
|
NULL,
|
|
@@ -182,7 +222,8 @@ AST_HTML_ELEMENT_NODE_T* parser_handle_missing_close_tag(
|
|
|
182
222
|
ELEMENT_SOURCE_HTML,
|
|
183
223
|
open_tag->base.location.start,
|
|
184
224
|
open_tag->base.location.end,
|
|
185
|
-
errors
|
|
225
|
+
errors,
|
|
226
|
+
parser->allocator
|
|
186
227
|
);
|
|
187
228
|
}
|
|
188
229
|
|
|
@@ -200,6 +241,7 @@ void parser_handle_mismatched_tags(
|
|
|
200
241
|
actual_tag,
|
|
201
242
|
actual_tag->location.start,
|
|
202
243
|
actual_tag->location.end,
|
|
244
|
+
parser->allocator,
|
|
203
245
|
errors
|
|
204
246
|
);
|
|
205
247
|
} else {
|
|
@@ -207,6 +249,7 @@ void parser_handle_mismatched_tags(
|
|
|
207
249
|
close_tag->tag_name,
|
|
208
250
|
close_tag->tag_name->location.start,
|
|
209
251
|
close_tag->tag_name->location.end,
|
|
252
|
+
parser->allocator,
|
|
210
253
|
errors
|
|
211
254
|
);
|
|
212
255
|
}
|
|
@@ -219,3 +262,47 @@ bool parser_is_expected_closing_tag_name(hb_string_T tag_name, foreign_content_t
|
|
|
219
262
|
|
|
220
263
|
return hb_string_equals_case_insensitive(expected_tag_name, tag_name);
|
|
221
264
|
}
|
|
265
|
+
|
|
266
|
+
void parser_synchronize(parser_T* parser, hb_array_T* errors) {
|
|
267
|
+
(void) errors;
|
|
268
|
+
|
|
269
|
+
while (parser->current_token->type != TOKEN_EOF) {
|
|
270
|
+
token_type_T type = parser->current_token->type;
|
|
271
|
+
|
|
272
|
+
if (type == TOKEN_HTML_TAG_START || type == TOKEN_HTML_TAG_START_CLOSE || type == TOKEN_ERB_START
|
|
273
|
+
|| type == TOKEN_HTML_COMMENT_START || type == TOKEN_HTML_DOCTYPE) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
token_T* skipped = parser_advance(parser);
|
|
278
|
+
token_free(skipped, parser->allocator);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
bool parser_can_close_ancestor(const parser_T* parser, hb_string_T tag_name) {
|
|
283
|
+
size_t stack_size = hb_array_size(parser->open_tags_stack);
|
|
284
|
+
|
|
285
|
+
for (size_t i = stack_size; i > 0; i--) {
|
|
286
|
+
token_T* open = hb_array_get(parser->open_tags_stack, i - 1);
|
|
287
|
+
|
|
288
|
+
if (open && !hb_string_is_empty(open->value) && hb_string_equals_case_insensitive(open->value, tag_name)) {
|
|
289
|
+
return true;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
size_t parser_find_ancestor_depth(const parser_T* parser, hb_string_T tag_name) {
|
|
297
|
+
size_t stack_size = hb_array_size(parser->open_tags_stack);
|
|
298
|
+
|
|
299
|
+
for (size_t i = stack_size; i > 0; i--) {
|
|
300
|
+
token_T* open = hb_array_get(parser->open_tags_stack, i - 1);
|
|
301
|
+
|
|
302
|
+
if (open && !hb_string_is_empty(open->value) && hb_string_equals_case_insensitive(open->value, tag_name)) {
|
|
303
|
+
return stack_size - i;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return (size_t) -1;
|
|
308
|
+
}
|
data/src/parser_match_tags.c
CHANGED
|
@@ -7,118 +7,161 @@
|
|
|
7
7
|
#include "include/visitor.h"
|
|
8
8
|
|
|
9
9
|
bool match_tags_visitor(const AST_NODE_T* node, void* data) {
|
|
10
|
-
|
|
10
|
+
match_tags_context_T* context = (match_tags_context_T*) data;
|
|
11
11
|
|
|
12
12
|
if (node == NULL) { return false; }
|
|
13
13
|
|
|
14
14
|
switch (node->type) {
|
|
15
15
|
|
|
16
|
+
|
|
16
17
|
case AST_DOCUMENT_NODE: {
|
|
17
18
|
const AST_DOCUMENT_NODE_T* document_node = (const AST_DOCUMENT_NODE_T*) node;
|
|
18
19
|
|
|
19
20
|
if (document_node->children != NULL) {
|
|
20
|
-
match_tags_in_node_array(document_node->children, errors);
|
|
21
|
+
match_tags_in_node_array(document_node->children, context->errors, context->options, context->allocator);
|
|
21
22
|
}
|
|
22
23
|
} break;
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
|
|
27
|
+
|
|
28
|
+
|
|
26
29
|
case AST_HTML_OPEN_TAG_NODE: {
|
|
27
30
|
const AST_HTML_OPEN_TAG_NODE_T* html_open_tag_node = (const AST_HTML_OPEN_TAG_NODE_T*) node;
|
|
28
31
|
|
|
29
32
|
if (html_open_tag_node->children != NULL) {
|
|
30
|
-
match_tags_in_node_array(html_open_tag_node->children, errors);
|
|
33
|
+
match_tags_in_node_array(html_open_tag_node->children, context->errors, context->options, context->allocator);
|
|
31
34
|
}
|
|
32
35
|
} break;
|
|
33
36
|
|
|
34
37
|
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
35
41
|
case AST_HTML_CLOSE_TAG_NODE: {
|
|
36
42
|
const AST_HTML_CLOSE_TAG_NODE_T* html_close_tag_node = (const AST_HTML_CLOSE_TAG_NODE_T*) node;
|
|
37
43
|
|
|
38
44
|
if (html_close_tag_node->children != NULL) {
|
|
39
|
-
match_tags_in_node_array(html_close_tag_node->children, errors);
|
|
45
|
+
match_tags_in_node_array(html_close_tag_node->children, context->errors, context->options, context->allocator);
|
|
40
46
|
}
|
|
41
47
|
} break;
|
|
42
48
|
|
|
43
49
|
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
44
55
|
case AST_HTML_ELEMENT_NODE: {
|
|
45
56
|
const AST_HTML_ELEMENT_NODE_T* html_element_node = (const AST_HTML_ELEMENT_NODE_T*) node;
|
|
46
57
|
|
|
47
58
|
if (html_element_node->body != NULL) {
|
|
48
|
-
match_tags_in_node_array(html_element_node->body, errors);
|
|
59
|
+
match_tags_in_node_array(html_element_node->body, context->errors, context->options, context->allocator);
|
|
49
60
|
}
|
|
50
61
|
if (html_element_node->open_tag != NULL) {
|
|
51
|
-
herb_visit_node((AST_NODE_T*) html_element_node->open_tag, match_tags_visitor,
|
|
62
|
+
herb_visit_node((AST_NODE_T*) html_element_node->open_tag, match_tags_visitor, context);
|
|
52
63
|
}
|
|
53
64
|
if (html_element_node->close_tag != NULL) {
|
|
54
|
-
herb_visit_node((AST_NODE_T*) html_element_node->close_tag, match_tags_visitor,
|
|
65
|
+
herb_visit_node((AST_NODE_T*) html_element_node->close_tag, match_tags_visitor, context);
|
|
55
66
|
}
|
|
56
67
|
} break;
|
|
57
68
|
|
|
58
69
|
|
|
70
|
+
|
|
71
|
+
case AST_HTML_CONDITIONAL_ELEMENT_NODE: {
|
|
72
|
+
const AST_HTML_CONDITIONAL_ELEMENT_NODE_T* html_conditional_element_node = (const AST_HTML_CONDITIONAL_ELEMENT_NODE_T*) node;
|
|
73
|
+
|
|
74
|
+
if (html_conditional_element_node->body != NULL) {
|
|
75
|
+
match_tags_in_node_array(html_conditional_element_node->body, context->errors, context->options, context->allocator);
|
|
76
|
+
}
|
|
77
|
+
} break;
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
59
81
|
case AST_HTML_ATTRIBUTE_VALUE_NODE: {
|
|
60
82
|
const AST_HTML_ATTRIBUTE_VALUE_NODE_T* html_attribute_value_node = (const AST_HTML_ATTRIBUTE_VALUE_NODE_T*) node;
|
|
61
83
|
|
|
62
84
|
if (html_attribute_value_node->children != NULL) {
|
|
63
|
-
match_tags_in_node_array(html_attribute_value_node->children, errors);
|
|
85
|
+
match_tags_in_node_array(html_attribute_value_node->children, context->errors, context->options, context->allocator);
|
|
64
86
|
}
|
|
65
87
|
} break;
|
|
66
88
|
|
|
67
89
|
|
|
90
|
+
|
|
68
91
|
case AST_HTML_ATTRIBUTE_NAME_NODE: {
|
|
69
92
|
const AST_HTML_ATTRIBUTE_NAME_NODE_T* html_attribute_name_node = (const AST_HTML_ATTRIBUTE_NAME_NODE_T*) node;
|
|
70
93
|
|
|
71
94
|
if (html_attribute_name_node->children != NULL) {
|
|
72
|
-
match_tags_in_node_array(html_attribute_name_node->children, errors);
|
|
95
|
+
match_tags_in_node_array(html_attribute_name_node->children, context->errors, context->options, context->allocator);
|
|
73
96
|
}
|
|
74
97
|
} break;
|
|
75
98
|
|
|
76
99
|
|
|
100
|
+
|
|
77
101
|
case AST_HTML_ATTRIBUTE_NODE: {
|
|
78
102
|
const AST_HTML_ATTRIBUTE_NODE_T* html_attribute_node = (const AST_HTML_ATTRIBUTE_NODE_T*) node;
|
|
79
103
|
|
|
80
104
|
if (html_attribute_node->name != NULL) {
|
|
81
|
-
herb_visit_node((AST_NODE_T*) html_attribute_node->name, match_tags_visitor,
|
|
105
|
+
herb_visit_node((AST_NODE_T*) html_attribute_node->name, match_tags_visitor, context);
|
|
82
106
|
}
|
|
83
107
|
if (html_attribute_node->value != NULL) {
|
|
84
|
-
herb_visit_node((AST_NODE_T*) html_attribute_node->value, match_tags_visitor,
|
|
108
|
+
herb_visit_node((AST_NODE_T*) html_attribute_node->value, match_tags_visitor, context);
|
|
85
109
|
}
|
|
86
110
|
} break;
|
|
87
111
|
|
|
88
112
|
|
|
89
113
|
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
case AST_ERB_OPEN_TAG_NODE: {
|
|
119
|
+
const AST_ERB_OPEN_TAG_NODE_T* erb_open_tag_node = (const AST_ERB_OPEN_TAG_NODE_T*) node;
|
|
120
|
+
|
|
121
|
+
if (erb_open_tag_node->children != NULL) {
|
|
122
|
+
match_tags_in_node_array(erb_open_tag_node->children, context->errors, context->options, context->allocator);
|
|
123
|
+
}
|
|
124
|
+
} break;
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
90
130
|
case AST_HTML_COMMENT_NODE: {
|
|
91
131
|
const AST_HTML_COMMENT_NODE_T* html_comment_node = (const AST_HTML_COMMENT_NODE_T*) node;
|
|
92
132
|
|
|
93
133
|
if (html_comment_node->children != NULL) {
|
|
94
|
-
match_tags_in_node_array(html_comment_node->children, errors);
|
|
134
|
+
match_tags_in_node_array(html_comment_node->children, context->errors, context->options, context->allocator);
|
|
95
135
|
}
|
|
96
136
|
} break;
|
|
97
137
|
|
|
98
138
|
|
|
139
|
+
|
|
99
140
|
case AST_HTML_DOCTYPE_NODE: {
|
|
100
141
|
const AST_HTML_DOCTYPE_NODE_T* html_doctype_node = (const AST_HTML_DOCTYPE_NODE_T*) node;
|
|
101
142
|
|
|
102
143
|
if (html_doctype_node->children != NULL) {
|
|
103
|
-
match_tags_in_node_array(html_doctype_node->children, errors);
|
|
144
|
+
match_tags_in_node_array(html_doctype_node->children, context->errors, context->options, context->allocator);
|
|
104
145
|
}
|
|
105
146
|
} break;
|
|
106
147
|
|
|
107
148
|
|
|
149
|
+
|
|
108
150
|
case AST_XML_DECLARATION_NODE: {
|
|
109
151
|
const AST_XML_DECLARATION_NODE_T* xml_declaration_node = (const AST_XML_DECLARATION_NODE_T*) node;
|
|
110
152
|
|
|
111
153
|
if (xml_declaration_node->children != NULL) {
|
|
112
|
-
match_tags_in_node_array(xml_declaration_node->children, errors);
|
|
154
|
+
match_tags_in_node_array(xml_declaration_node->children, context->errors, context->options, context->allocator);
|
|
113
155
|
}
|
|
114
156
|
} break;
|
|
115
157
|
|
|
116
158
|
|
|
159
|
+
|
|
117
160
|
case AST_CDATA_NODE: {
|
|
118
161
|
const AST_CDATA_NODE_T* cdata_node = (const AST_CDATA_NODE_T*) node;
|
|
119
162
|
|
|
120
163
|
if (cdata_node->children != NULL) {
|
|
121
|
-
match_tags_in_node_array(cdata_node->children, errors);
|
|
164
|
+
match_tags_in_node_array(cdata_node->children, context->errors, context->options, context->allocator);
|
|
122
165
|
}
|
|
123
166
|
} break;
|
|
124
167
|
|
|
@@ -126,186 +169,204 @@ bool match_tags_visitor(const AST_NODE_T* node, void* data) {
|
|
|
126
169
|
|
|
127
170
|
|
|
128
171
|
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
129
176
|
case AST_ERB_ELSE_NODE: {
|
|
130
177
|
const AST_ERB_ELSE_NODE_T* erb_else_node = (const AST_ERB_ELSE_NODE_T*) node;
|
|
131
178
|
|
|
132
179
|
if (erb_else_node->statements != NULL) {
|
|
133
|
-
match_tags_in_node_array(erb_else_node->statements, errors);
|
|
180
|
+
match_tags_in_node_array(erb_else_node->statements, context->errors, context->options, context->allocator);
|
|
134
181
|
}
|
|
135
182
|
} break;
|
|
136
183
|
|
|
137
184
|
|
|
185
|
+
|
|
138
186
|
case AST_ERB_IF_NODE: {
|
|
139
187
|
const AST_ERB_IF_NODE_T* erb_if_node = (const AST_ERB_IF_NODE_T*) node;
|
|
140
188
|
|
|
141
189
|
if (erb_if_node->statements != NULL) {
|
|
142
|
-
match_tags_in_node_array(erb_if_node->statements, errors);
|
|
190
|
+
match_tags_in_node_array(erb_if_node->statements, context->errors, context->options, context->allocator);
|
|
143
191
|
}
|
|
144
192
|
if (erb_if_node->subsequent != NULL) {
|
|
145
|
-
herb_visit_node((AST_NODE_T*) erb_if_node->subsequent, match_tags_visitor,
|
|
193
|
+
herb_visit_node((AST_NODE_T*) erb_if_node->subsequent, match_tags_visitor, context);
|
|
146
194
|
}
|
|
147
195
|
if (erb_if_node->end_node != NULL) {
|
|
148
|
-
herb_visit_node((AST_NODE_T*) erb_if_node->end_node, match_tags_visitor,
|
|
196
|
+
herb_visit_node((AST_NODE_T*) erb_if_node->end_node, match_tags_visitor, context);
|
|
149
197
|
}
|
|
150
198
|
} break;
|
|
151
199
|
|
|
152
200
|
|
|
201
|
+
|
|
153
202
|
case AST_ERB_BLOCK_NODE: {
|
|
154
203
|
const AST_ERB_BLOCK_NODE_T* erb_block_node = (const AST_ERB_BLOCK_NODE_T*) node;
|
|
155
204
|
|
|
156
205
|
if (erb_block_node->body != NULL) {
|
|
157
|
-
match_tags_in_node_array(erb_block_node->body, errors);
|
|
206
|
+
match_tags_in_node_array(erb_block_node->body, context->errors, context->options, context->allocator);
|
|
158
207
|
}
|
|
159
208
|
if (erb_block_node->end_node != NULL) {
|
|
160
|
-
herb_visit_node((AST_NODE_T*) erb_block_node->end_node, match_tags_visitor,
|
|
209
|
+
herb_visit_node((AST_NODE_T*) erb_block_node->end_node, match_tags_visitor, context);
|
|
161
210
|
}
|
|
162
211
|
} break;
|
|
163
212
|
|
|
164
213
|
|
|
214
|
+
|
|
165
215
|
case AST_ERB_WHEN_NODE: {
|
|
166
216
|
const AST_ERB_WHEN_NODE_T* erb_when_node = (const AST_ERB_WHEN_NODE_T*) node;
|
|
167
217
|
|
|
168
218
|
if (erb_when_node->statements != NULL) {
|
|
169
|
-
match_tags_in_node_array(erb_when_node->statements, errors);
|
|
219
|
+
match_tags_in_node_array(erb_when_node->statements, context->errors, context->options, context->allocator);
|
|
170
220
|
}
|
|
171
221
|
} break;
|
|
172
222
|
|
|
173
223
|
|
|
224
|
+
|
|
174
225
|
case AST_ERB_CASE_NODE: {
|
|
175
226
|
const AST_ERB_CASE_NODE_T* erb_case_node = (const AST_ERB_CASE_NODE_T*) node;
|
|
176
227
|
|
|
177
228
|
if (erb_case_node->children != NULL) {
|
|
178
|
-
match_tags_in_node_array(erb_case_node->children, errors);
|
|
229
|
+
match_tags_in_node_array(erb_case_node->children, context->errors, context->options, context->allocator);
|
|
179
230
|
}
|
|
180
231
|
if (erb_case_node->conditions != NULL) {
|
|
181
|
-
match_tags_in_node_array(erb_case_node->conditions, errors);
|
|
232
|
+
match_tags_in_node_array(erb_case_node->conditions, context->errors, context->options, context->allocator);
|
|
182
233
|
}
|
|
183
234
|
if (erb_case_node->else_clause != NULL) {
|
|
184
|
-
herb_visit_node((AST_NODE_T*) erb_case_node->else_clause, match_tags_visitor,
|
|
235
|
+
herb_visit_node((AST_NODE_T*) erb_case_node->else_clause, match_tags_visitor, context);
|
|
185
236
|
}
|
|
186
237
|
if (erb_case_node->end_node != NULL) {
|
|
187
|
-
herb_visit_node((AST_NODE_T*) erb_case_node->end_node, match_tags_visitor,
|
|
238
|
+
herb_visit_node((AST_NODE_T*) erb_case_node->end_node, match_tags_visitor, context);
|
|
188
239
|
}
|
|
189
240
|
} break;
|
|
190
241
|
|
|
191
242
|
|
|
243
|
+
|
|
192
244
|
case AST_ERB_CASE_MATCH_NODE: {
|
|
193
245
|
const AST_ERB_CASE_MATCH_NODE_T* erb_case_match_node = (const AST_ERB_CASE_MATCH_NODE_T*) node;
|
|
194
246
|
|
|
195
247
|
if (erb_case_match_node->children != NULL) {
|
|
196
|
-
match_tags_in_node_array(erb_case_match_node->children, errors);
|
|
248
|
+
match_tags_in_node_array(erb_case_match_node->children, context->errors, context->options, context->allocator);
|
|
197
249
|
}
|
|
198
250
|
if (erb_case_match_node->conditions != NULL) {
|
|
199
|
-
match_tags_in_node_array(erb_case_match_node->conditions, errors);
|
|
251
|
+
match_tags_in_node_array(erb_case_match_node->conditions, context->errors, context->options, context->allocator);
|
|
200
252
|
}
|
|
201
253
|
if (erb_case_match_node->else_clause != NULL) {
|
|
202
|
-
herb_visit_node((AST_NODE_T*) erb_case_match_node->else_clause, match_tags_visitor,
|
|
254
|
+
herb_visit_node((AST_NODE_T*) erb_case_match_node->else_clause, match_tags_visitor, context);
|
|
203
255
|
}
|
|
204
256
|
if (erb_case_match_node->end_node != NULL) {
|
|
205
|
-
herb_visit_node((AST_NODE_T*) erb_case_match_node->end_node, match_tags_visitor,
|
|
257
|
+
herb_visit_node((AST_NODE_T*) erb_case_match_node->end_node, match_tags_visitor, context);
|
|
206
258
|
}
|
|
207
259
|
} break;
|
|
208
260
|
|
|
209
261
|
|
|
262
|
+
|
|
210
263
|
case AST_ERB_WHILE_NODE: {
|
|
211
264
|
const AST_ERB_WHILE_NODE_T* erb_while_node = (const AST_ERB_WHILE_NODE_T*) node;
|
|
212
265
|
|
|
213
266
|
if (erb_while_node->statements != NULL) {
|
|
214
|
-
match_tags_in_node_array(erb_while_node->statements, errors);
|
|
267
|
+
match_tags_in_node_array(erb_while_node->statements, context->errors, context->options, context->allocator);
|
|
215
268
|
}
|
|
216
269
|
if (erb_while_node->end_node != NULL) {
|
|
217
|
-
herb_visit_node((AST_NODE_T*) erb_while_node->end_node, match_tags_visitor,
|
|
270
|
+
herb_visit_node((AST_NODE_T*) erb_while_node->end_node, match_tags_visitor, context);
|
|
218
271
|
}
|
|
219
272
|
} break;
|
|
220
273
|
|
|
221
274
|
|
|
275
|
+
|
|
222
276
|
case AST_ERB_UNTIL_NODE: {
|
|
223
277
|
const AST_ERB_UNTIL_NODE_T* erb_until_node = (const AST_ERB_UNTIL_NODE_T*) node;
|
|
224
278
|
|
|
225
279
|
if (erb_until_node->statements != NULL) {
|
|
226
|
-
match_tags_in_node_array(erb_until_node->statements, errors);
|
|
280
|
+
match_tags_in_node_array(erb_until_node->statements, context->errors, context->options, context->allocator);
|
|
227
281
|
}
|
|
228
282
|
if (erb_until_node->end_node != NULL) {
|
|
229
|
-
herb_visit_node((AST_NODE_T*) erb_until_node->end_node, match_tags_visitor,
|
|
283
|
+
herb_visit_node((AST_NODE_T*) erb_until_node->end_node, match_tags_visitor, context);
|
|
230
284
|
}
|
|
231
285
|
} break;
|
|
232
286
|
|
|
233
287
|
|
|
288
|
+
|
|
234
289
|
case AST_ERB_FOR_NODE: {
|
|
235
290
|
const AST_ERB_FOR_NODE_T* erb_for_node = (const AST_ERB_FOR_NODE_T*) node;
|
|
236
291
|
|
|
237
292
|
if (erb_for_node->statements != NULL) {
|
|
238
|
-
match_tags_in_node_array(erb_for_node->statements, errors);
|
|
293
|
+
match_tags_in_node_array(erb_for_node->statements, context->errors, context->options, context->allocator);
|
|
239
294
|
}
|
|
240
295
|
if (erb_for_node->end_node != NULL) {
|
|
241
|
-
herb_visit_node((AST_NODE_T*) erb_for_node->end_node, match_tags_visitor,
|
|
296
|
+
herb_visit_node((AST_NODE_T*) erb_for_node->end_node, match_tags_visitor, context);
|
|
242
297
|
}
|
|
243
298
|
} break;
|
|
244
299
|
|
|
245
300
|
|
|
301
|
+
|
|
246
302
|
case AST_ERB_RESCUE_NODE: {
|
|
247
303
|
const AST_ERB_RESCUE_NODE_T* erb_rescue_node = (const AST_ERB_RESCUE_NODE_T*) node;
|
|
248
304
|
|
|
249
305
|
if (erb_rescue_node->statements != NULL) {
|
|
250
|
-
match_tags_in_node_array(erb_rescue_node->statements, errors);
|
|
306
|
+
match_tags_in_node_array(erb_rescue_node->statements, context->errors, context->options, context->allocator);
|
|
251
307
|
}
|
|
252
308
|
if (erb_rescue_node->subsequent != NULL) {
|
|
253
|
-
herb_visit_node((AST_NODE_T*) erb_rescue_node->subsequent, match_tags_visitor,
|
|
309
|
+
herb_visit_node((AST_NODE_T*) erb_rescue_node->subsequent, match_tags_visitor, context);
|
|
254
310
|
}
|
|
255
311
|
} break;
|
|
256
312
|
|
|
257
313
|
|
|
314
|
+
|
|
258
315
|
case AST_ERB_ENSURE_NODE: {
|
|
259
316
|
const AST_ERB_ENSURE_NODE_T* erb_ensure_node = (const AST_ERB_ENSURE_NODE_T*) node;
|
|
260
317
|
|
|
261
318
|
if (erb_ensure_node->statements != NULL) {
|
|
262
|
-
match_tags_in_node_array(erb_ensure_node->statements, errors);
|
|
319
|
+
match_tags_in_node_array(erb_ensure_node->statements, context->errors, context->options, context->allocator);
|
|
263
320
|
}
|
|
264
321
|
} break;
|
|
265
322
|
|
|
266
323
|
|
|
324
|
+
|
|
267
325
|
case AST_ERB_BEGIN_NODE: {
|
|
268
326
|
const AST_ERB_BEGIN_NODE_T* erb_begin_node = (const AST_ERB_BEGIN_NODE_T*) node;
|
|
269
327
|
|
|
270
328
|
if (erb_begin_node->statements != NULL) {
|
|
271
|
-
match_tags_in_node_array(erb_begin_node->statements, errors);
|
|
329
|
+
match_tags_in_node_array(erb_begin_node->statements, context->errors, context->options, context->allocator);
|
|
272
330
|
}
|
|
273
331
|
if (erb_begin_node->rescue_clause != NULL) {
|
|
274
|
-
herb_visit_node((AST_NODE_T*) erb_begin_node->rescue_clause, match_tags_visitor,
|
|
332
|
+
herb_visit_node((AST_NODE_T*) erb_begin_node->rescue_clause, match_tags_visitor, context);
|
|
275
333
|
}
|
|
276
334
|
if (erb_begin_node->else_clause != NULL) {
|
|
277
|
-
herb_visit_node((AST_NODE_T*) erb_begin_node->else_clause, match_tags_visitor,
|
|
335
|
+
herb_visit_node((AST_NODE_T*) erb_begin_node->else_clause, match_tags_visitor, context);
|
|
278
336
|
}
|
|
279
337
|
if (erb_begin_node->ensure_clause != NULL) {
|
|
280
|
-
herb_visit_node((AST_NODE_T*) erb_begin_node->ensure_clause, match_tags_visitor,
|
|
338
|
+
herb_visit_node((AST_NODE_T*) erb_begin_node->ensure_clause, match_tags_visitor, context);
|
|
281
339
|
}
|
|
282
340
|
if (erb_begin_node->end_node != NULL) {
|
|
283
|
-
herb_visit_node((AST_NODE_T*) erb_begin_node->end_node, match_tags_visitor,
|
|
341
|
+
herb_visit_node((AST_NODE_T*) erb_begin_node->end_node, match_tags_visitor, context);
|
|
284
342
|
}
|
|
285
343
|
} break;
|
|
286
344
|
|
|
287
345
|
|
|
346
|
+
|
|
288
347
|
case AST_ERB_UNLESS_NODE: {
|
|
289
348
|
const AST_ERB_UNLESS_NODE_T* erb_unless_node = (const AST_ERB_UNLESS_NODE_T*) node;
|
|
290
349
|
|
|
291
350
|
if (erb_unless_node->statements != NULL) {
|
|
292
|
-
match_tags_in_node_array(erb_unless_node->statements, errors);
|
|
351
|
+
match_tags_in_node_array(erb_unless_node->statements, context->errors, context->options, context->allocator);
|
|
293
352
|
}
|
|
294
353
|
if (erb_unless_node->else_clause != NULL) {
|
|
295
|
-
herb_visit_node((AST_NODE_T*) erb_unless_node->else_clause, match_tags_visitor,
|
|
354
|
+
herb_visit_node((AST_NODE_T*) erb_unless_node->else_clause, match_tags_visitor, context);
|
|
296
355
|
}
|
|
297
356
|
if (erb_unless_node->end_node != NULL) {
|
|
298
|
-
herb_visit_node((AST_NODE_T*) erb_unless_node->end_node, match_tags_visitor,
|
|
357
|
+
herb_visit_node((AST_NODE_T*) erb_unless_node->end_node, match_tags_visitor, context);
|
|
299
358
|
}
|
|
300
359
|
} break;
|
|
301
360
|
|
|
302
361
|
|
|
303
362
|
|
|
363
|
+
|
|
364
|
+
|
|
304
365
|
case AST_ERB_IN_NODE: {
|
|
305
366
|
const AST_ERB_IN_NODE_T* erb_in_node = (const AST_ERB_IN_NODE_T*) node;
|
|
306
367
|
|
|
307
368
|
if (erb_in_node->statements != NULL) {
|
|
308
|
-
match_tags_in_node_array(erb_in_node->statements, errors);
|
|
369
|
+
match_tags_in_node_array(erb_in_node->statements, context->errors, context->options, context->allocator);
|
|
309
370
|
}
|
|
310
371
|
} break;
|
|
311
372
|
|