@herb-tools/node 0.8.10 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +27 -8
- package/dist/herb-node.cjs +41 -12
- package/dist/herb-node.cjs.map +1 -1
- package/dist/herb-node.esm.js +8 -1
- package/dist/herb-node.esm.js.map +1 -1
- package/dist/types/node-backend.d.ts +3 -1
- package/extension/error_helpers.cpp +598 -73
- package/extension/error_helpers.h +20 -3
- package/extension/extension_helpers.cpp +40 -35
- package/extension/extension_helpers.h +2 -2
- package/extension/herb.cpp +194 -64
- package/extension/libherb/analyze/action_view/attribute_extraction_helpers.c +303 -0
- package/extension/libherb/analyze/action_view/attribute_extraction_helpers.h +36 -0
- package/extension/libherb/analyze/action_view/content_tag.c +78 -0
- package/extension/libherb/analyze/action_view/link_to.c +167 -0
- package/extension/libherb/analyze/action_view/registry.c +83 -0
- package/extension/libherb/analyze/action_view/tag.c +70 -0
- package/extension/libherb/analyze/action_view/tag_helper_handler.h +43 -0
- package/extension/libherb/analyze/action_view/tag_helper_node_builders.c +305 -0
- package/extension/libherb/analyze/action_view/tag_helper_node_builders.h +70 -0
- package/extension/libherb/analyze/action_view/tag_helpers.c +815 -0
- package/extension/libherb/analyze/action_view/tag_helpers.h +38 -0
- package/extension/libherb/analyze/action_view/turbo_frame_tag.c +88 -0
- package/extension/libherb/analyze/analyze.c +885 -0
- package/extension/libherb/{include → analyze}/analyze.h +14 -4
- package/extension/libherb/{analyzed_ruby.c → analyze/analyzed_ruby.c} +13 -11
- package/extension/libherb/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
- package/extension/libherb/analyze/builders.c +343 -0
- package/extension/libherb/analyze/builders.h +27 -0
- package/extension/libherb/analyze/conditional_elements.c +594 -0
- package/extension/libherb/analyze/conditional_elements.h +9 -0
- package/extension/libherb/analyze/conditional_open_tags.c +640 -0
- package/extension/libherb/analyze/conditional_open_tags.h +9 -0
- package/extension/libherb/analyze/control_type.c +250 -0
- package/extension/libherb/analyze/control_type.h +14 -0
- package/extension/libherb/{analyze_helpers.c → analyze/helpers.c} +48 -23
- package/extension/libherb/{analyze_helpers.h → analyze/helpers.h} +4 -2
- package/extension/libherb/analyze/invalid_structures.c +193 -0
- package/extension/libherb/analyze/invalid_structures.h +11 -0
- package/extension/libherb/{analyze_missing_end.c → analyze/missing_end.c} +33 -22
- package/extension/libherb/analyze/parse_errors.c +84 -0
- package/extension/libherb/analyze/prism_annotate.c +399 -0
- package/extension/libherb/analyze/prism_annotate.h +16 -0
- package/extension/libherb/analyze/render_nodes.c +761 -0
- package/extension/libherb/analyze/render_nodes.h +11 -0
- package/extension/libherb/{analyze_transform.c → analyze/transform.c} +24 -3
- package/extension/libherb/ast_node.c +17 -7
- package/extension/libherb/ast_node.h +11 -5
- package/extension/libherb/ast_nodes.c +760 -388
- package/extension/libherb/ast_nodes.h +155 -39
- package/extension/libherb/ast_pretty_print.c +265 -7
- package/extension/libherb/ast_pretty_print.h +6 -1
- package/extension/libherb/element_source.h +3 -8
- package/extension/libherb/errors.c +1455 -520
- package/extension/libherb/errors.h +207 -56
- package/extension/libherb/extract.c +145 -49
- package/extension/libherb/extract.h +21 -5
- package/extension/libherb/herb.c +52 -34
- package/extension/libherb/herb.h +18 -6
- package/extension/libherb/herb_prism_node.h +13 -0
- package/extension/libherb/html_util.c +241 -12
- package/extension/libherb/html_util.h +7 -2
- package/extension/libherb/include/analyze/action_view/attribute_extraction_helpers.h +36 -0
- package/extension/libherb/include/analyze/action_view/tag_helper_handler.h +43 -0
- package/extension/libherb/include/analyze/action_view/tag_helper_node_builders.h +70 -0
- package/extension/libherb/include/analyze/action_view/tag_helpers.h +38 -0
- package/extension/libherb/{analyze.h → include/analyze/analyze.h} +14 -4
- package/extension/libherb/include/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
- package/extension/libherb/include/analyze/builders.h +27 -0
- package/extension/libherb/include/analyze/conditional_elements.h +9 -0
- package/extension/libherb/include/analyze/conditional_open_tags.h +9 -0
- package/extension/libherb/include/analyze/control_type.h +14 -0
- package/extension/libherb/include/{analyze_helpers.h → analyze/helpers.h} +4 -2
- package/extension/libherb/include/analyze/invalid_structures.h +11 -0
- package/extension/libherb/include/analyze/prism_annotate.h +16 -0
- package/extension/libherb/include/analyze/render_nodes.h +11 -0
- package/extension/libherb/include/ast_node.h +11 -5
- package/extension/libherb/include/ast_nodes.h +155 -39
- package/extension/libherb/include/ast_pretty_print.h +6 -1
- package/extension/libherb/include/element_source.h +3 -8
- package/extension/libherb/include/errors.h +207 -56
- package/extension/libherb/include/extract.h +21 -5
- package/extension/libherb/include/herb.h +18 -6
- package/extension/libherb/include/herb_prism_node.h +13 -0
- package/extension/libherb/include/html_util.h +7 -2
- package/extension/libherb/include/io.h +3 -1
- package/extension/libherb/include/lex_helpers.h +29 -0
- package/extension/libherb/include/lexer.h +1 -1
- package/extension/libherb/include/lexer_peek_helpers.h +87 -13
- package/extension/libherb/include/lexer_struct.h +2 -0
- package/extension/libherb/include/location.h +2 -1
- package/extension/libherb/include/parser.h +28 -2
- package/extension/libherb/include/parser_helpers.h +19 -3
- package/extension/libherb/include/pretty_print.h +10 -5
- package/extension/libherb/include/prism_context.h +45 -0
- package/extension/libherb/include/prism_helpers.h +10 -7
- package/extension/libherb/include/prism_serialized.h +12 -0
- package/extension/libherb/include/token.h +16 -4
- package/extension/libherb/include/token_struct.h +10 -3
- package/extension/libherb/include/utf8.h +2 -1
- package/extension/libherb/include/util/hb_allocator.h +78 -0
- package/extension/libherb/include/util/hb_arena.h +6 -1
- package/extension/libherb/include/util/hb_arena_debug.h +12 -1
- package/extension/libherb/include/util/hb_array.h +7 -3
- package/extension/libherb/include/util/hb_buffer.h +6 -4
- package/extension/libherb/include/util/hb_foreach.h +79 -0
- package/extension/libherb/include/util/hb_narray.h +8 -4
- package/extension/libherb/include/util/hb_string.h +56 -9
- package/extension/libherb/include/util.h +6 -3
- package/extension/libherb/include/version.h +1 -1
- package/extension/libherb/io.c +3 -2
- package/extension/libherb/io.h +3 -1
- package/extension/libherb/lex_helpers.h +29 -0
- package/extension/libherb/lexer.c +42 -30
- package/extension/libherb/lexer.h +1 -1
- package/extension/libherb/lexer_peek_helpers.c +12 -74
- package/extension/libherb/lexer_peek_helpers.h +87 -13
- package/extension/libherb/lexer_struct.h +2 -0
- package/extension/libherb/location.c +2 -2
- package/extension/libherb/location.h +2 -1
- package/extension/libherb/main.c +53 -28
- package/extension/libherb/parser.c +784 -247
- package/extension/libherb/parser.h +28 -2
- package/extension/libherb/parser_helpers.c +110 -23
- package/extension/libherb/parser_helpers.h +19 -3
- package/extension/libherb/parser_match_tags.c +130 -49
- package/extension/libherb/pretty_print.c +29 -24
- package/extension/libherb/pretty_print.h +10 -5
- package/extension/libherb/prism_context.h +45 -0
- package/extension/libherb/prism_helpers.c +30 -27
- package/extension/libherb/prism_helpers.h +10 -7
- package/extension/libherb/prism_serialized.h +12 -0
- package/extension/libherb/ruby_parser.c +2 -0
- package/extension/libherb/token.c +151 -66
- package/extension/libherb/token.h +16 -4
- package/extension/libherb/token_matchers.c +0 -1
- package/extension/libherb/token_struct.h +10 -3
- package/extension/libherb/utf8.c +7 -6
- package/extension/libherb/utf8.h +2 -1
- package/extension/libherb/util/hb_allocator.c +341 -0
- package/extension/libherb/util/hb_allocator.h +78 -0
- package/extension/libherb/util/hb_arena.c +81 -56
- package/extension/libherb/util/hb_arena.h +6 -1
- package/extension/libherb/util/hb_arena_debug.c +32 -17
- package/extension/libherb/util/hb_arena_debug.h +12 -1
- package/extension/libherb/util/hb_array.c +30 -15
- package/extension/libherb/util/hb_array.h +7 -3
- package/extension/libherb/util/hb_buffer.c +17 -21
- package/extension/libherb/util/hb_buffer.h +6 -4
- package/extension/libherb/util/hb_foreach.h +79 -0
- package/extension/libherb/util/hb_narray.c +22 -7
- package/extension/libherb/util/hb_narray.h +8 -4
- package/extension/libherb/util/hb_string.c +49 -35
- package/extension/libherb/util/hb_string.h +56 -9
- package/extension/libherb/util.c +21 -11
- package/extension/libherb/util.h +6 -3
- package/extension/libherb/version.h +1 -1
- package/extension/libherb/visitor.c +68 -1
- package/extension/nodes.cpp +593 -6
- package/extension/nodes.h +10 -1
- package/package.json +12 -8
- package/src/node-backend.ts +11 -1
- package/dist/types/index-cjs.d.cts +0 -1
- package/extension/libherb/analyze.c +0 -1608
- package/extension/libherb/element_source.c +0 -12
- package/extension/libherb/include/util/hb_system.h +0 -9
- package/extension/libherb/util/hb_system.c +0 -30
- package/extension/libherb/util/hb_system.h +0 -9
- package/src/index-cjs.cts +0 -22
- /package/dist/types/{index-esm.d.mts → index.d.ts} +0 -0
- /package/src/{index-esm.mts → index.ts} +0 -0
|
@@ -1,234 +1,374 @@
|
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.9.1/templates/src/ast_nodes.c.erb
|
|
3
3
|
|
|
4
4
|
#include <stdio.h>
|
|
5
5
|
#include <stdbool.h>
|
|
6
6
|
|
|
7
7
|
#include <prism.h>
|
|
8
8
|
|
|
9
|
-
#include "include/analyzed_ruby.h"
|
|
9
|
+
#include "include/analyze/analyzed_ruby.h"
|
|
10
10
|
#include "include/ast_node.h"
|
|
11
11
|
#include "include/ast_nodes.h"
|
|
12
12
|
#include "include/errors.h"
|
|
13
13
|
#include "include/token.h"
|
|
14
14
|
#include "include/util.h"
|
|
15
|
+
#include "include/util/hb_allocator.h"
|
|
15
16
|
#include "include/util/hb_array.h"
|
|
17
|
+
#include "include/util/hb_string.h"
|
|
16
18
|
|
|
17
19
|
|
|
18
|
-
AST_DOCUMENT_NODE_T* ast_document_node_init(hb_array_T* children, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
19
|
-
AST_DOCUMENT_NODE_T* document_node =
|
|
20
|
+
AST_DOCUMENT_NODE_T* ast_document_node_init(hb_array_T* children, herb_prism_context_T* prism_context, herb_prism_node_T prism_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
21
|
+
AST_DOCUMENT_NODE_T* document_node = hb_allocator_alloc(allocator, sizeof(AST_DOCUMENT_NODE_T));
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
if (!document_node) { return NULL; }
|
|
24
|
+
|
|
25
|
+
ast_node_init(&document_node->base, AST_DOCUMENT_NODE, start_position, end_position, errors, allocator);
|
|
22
26
|
|
|
23
27
|
document_node->children = children;
|
|
28
|
+
document_node->prism_context = prism_context;
|
|
29
|
+
document_node->prism_node = prism_node;
|
|
24
30
|
|
|
25
31
|
return document_node;
|
|
26
32
|
}
|
|
27
33
|
|
|
28
|
-
AST_LITERAL_NODE_T* ast_literal_node_init(
|
|
29
|
-
AST_LITERAL_NODE_T* literal_node =
|
|
34
|
+
AST_LITERAL_NODE_T* ast_literal_node_init(hb_string_T content, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
35
|
+
AST_LITERAL_NODE_T* literal_node = hb_allocator_alloc(allocator, sizeof(AST_LITERAL_NODE_T));
|
|
36
|
+
|
|
37
|
+
if (!literal_node) { return NULL; }
|
|
30
38
|
|
|
31
|
-
ast_node_init(&literal_node->base, AST_LITERAL_NODE, start_position, end_position, errors);
|
|
39
|
+
ast_node_init(&literal_node->base, AST_LITERAL_NODE, start_position, end_position, errors, allocator);
|
|
32
40
|
|
|
33
|
-
literal_node->content =
|
|
41
|
+
literal_node->content = hb_string_copy(content, allocator);
|
|
34
42
|
|
|
35
43
|
return literal_node;
|
|
36
44
|
}
|
|
37
45
|
|
|
38
|
-
AST_HTML_OPEN_TAG_NODE_T* ast_html_open_tag_node_init(token_T* tag_opening, token_T* tag_name, token_T* tag_closing, hb_array_T* children, bool is_void, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
39
|
-
AST_HTML_OPEN_TAG_NODE_T* html_open_tag_node =
|
|
46
|
+
AST_HTML_OPEN_TAG_NODE_T* ast_html_open_tag_node_init(token_T* tag_opening, token_T* tag_name, token_T* tag_closing, hb_array_T* children, bool is_void, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
47
|
+
AST_HTML_OPEN_TAG_NODE_T* html_open_tag_node = hb_allocator_alloc(allocator, sizeof(AST_HTML_OPEN_TAG_NODE_T));
|
|
40
48
|
|
|
41
|
-
|
|
49
|
+
if (!html_open_tag_node) { return NULL; }
|
|
42
50
|
|
|
43
|
-
html_open_tag_node->
|
|
44
|
-
|
|
45
|
-
html_open_tag_node->
|
|
51
|
+
ast_node_init(&html_open_tag_node->base, AST_HTML_OPEN_TAG_NODE, start_position, end_position, errors, allocator);
|
|
52
|
+
|
|
53
|
+
html_open_tag_node->tag_opening = token_copy(tag_opening, allocator);
|
|
54
|
+
html_open_tag_node->tag_name = token_copy(tag_name, allocator);
|
|
55
|
+
html_open_tag_node->tag_closing = token_copy(tag_closing, allocator);
|
|
46
56
|
html_open_tag_node->children = children;
|
|
47
57
|
html_open_tag_node->is_void = is_void;
|
|
48
58
|
|
|
49
59
|
return html_open_tag_node;
|
|
50
60
|
}
|
|
51
61
|
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T* ast_html_conditional_open_tag_node_init(AST_NODE_T* conditional, token_T* tag_name, bool is_void, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
63
|
+
AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T* html_conditional_open_tag_node = hb_allocator_alloc(allocator, sizeof(AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T));
|
|
64
|
+
|
|
65
|
+
if (!html_conditional_open_tag_node) { return NULL; }
|
|
66
|
+
|
|
67
|
+
ast_node_init(&html_conditional_open_tag_node->base, AST_HTML_CONDITIONAL_OPEN_TAG_NODE, start_position, end_position, errors, allocator);
|
|
68
|
+
|
|
69
|
+
html_conditional_open_tag_node->conditional = conditional;
|
|
70
|
+
html_conditional_open_tag_node->tag_name = token_copy(tag_name, allocator);
|
|
71
|
+
html_conditional_open_tag_node->is_void = is_void;
|
|
72
|
+
|
|
73
|
+
return html_conditional_open_tag_node;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
AST_HTML_CLOSE_TAG_NODE_T* ast_html_close_tag_node_init(token_T* tag_opening, token_T* tag_name, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
77
|
+
AST_HTML_CLOSE_TAG_NODE_T* html_close_tag_node = hb_allocator_alloc(allocator, sizeof(AST_HTML_CLOSE_TAG_NODE_T));
|
|
78
|
+
|
|
79
|
+
if (!html_close_tag_node) { return NULL; }
|
|
54
80
|
|
|
55
|
-
ast_node_init(&html_close_tag_node->base, AST_HTML_CLOSE_TAG_NODE, start_position, end_position, errors);
|
|
81
|
+
ast_node_init(&html_close_tag_node->base, AST_HTML_CLOSE_TAG_NODE, start_position, end_position, errors, allocator);
|
|
56
82
|
|
|
57
|
-
html_close_tag_node->tag_opening = token_copy(tag_opening);
|
|
58
|
-
html_close_tag_node->tag_name = token_copy(tag_name);
|
|
83
|
+
html_close_tag_node->tag_opening = token_copy(tag_opening, allocator);
|
|
84
|
+
html_close_tag_node->tag_name = token_copy(tag_name, allocator);
|
|
59
85
|
html_close_tag_node->children = children;
|
|
60
|
-
html_close_tag_node->tag_closing = token_copy(tag_closing);
|
|
86
|
+
html_close_tag_node->tag_closing = token_copy(tag_closing, allocator);
|
|
61
87
|
|
|
62
88
|
return html_close_tag_node;
|
|
63
89
|
}
|
|
64
90
|
|
|
65
|
-
|
|
66
|
-
|
|
91
|
+
AST_HTML_OMITTED_CLOSE_TAG_NODE_T* ast_html_omitted_close_tag_node_init(token_T* tag_name, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
92
|
+
AST_HTML_OMITTED_CLOSE_TAG_NODE_T* html_omitted_close_tag_node = hb_allocator_alloc(allocator, sizeof(AST_HTML_OMITTED_CLOSE_TAG_NODE_T));
|
|
93
|
+
|
|
94
|
+
if (!html_omitted_close_tag_node) { return NULL; }
|
|
95
|
+
|
|
96
|
+
ast_node_init(&html_omitted_close_tag_node->base, AST_HTML_OMITTED_CLOSE_TAG_NODE, start_position, end_position, errors, allocator);
|
|
97
|
+
|
|
98
|
+
html_omitted_close_tag_node->tag_name = token_copy(tag_name, allocator);
|
|
99
|
+
|
|
100
|
+
return html_omitted_close_tag_node;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T* ast_html_virtual_close_tag_node_init(token_T* tag_name, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
104
|
+
AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T* html_virtual_close_tag_node = hb_allocator_alloc(allocator, sizeof(AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T));
|
|
67
105
|
|
|
68
|
-
|
|
106
|
+
if (!html_virtual_close_tag_node) { return NULL; }
|
|
107
|
+
|
|
108
|
+
ast_node_init(&html_virtual_close_tag_node->base, AST_HTML_VIRTUAL_CLOSE_TAG_NODE, start_position, end_position, errors, allocator);
|
|
109
|
+
|
|
110
|
+
html_virtual_close_tag_node->tag_name = token_copy(tag_name, allocator);
|
|
111
|
+
|
|
112
|
+
return html_virtual_close_tag_node;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(AST_NODE_T* open_tag, token_T* tag_name, hb_array_T* body, AST_NODE_T* close_tag, bool is_void, hb_string_T element_source, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
116
|
+
AST_HTML_ELEMENT_NODE_T* html_element_node = hb_allocator_alloc(allocator, sizeof(AST_HTML_ELEMENT_NODE_T));
|
|
117
|
+
|
|
118
|
+
if (!html_element_node) { return NULL; }
|
|
119
|
+
|
|
120
|
+
ast_node_init(&html_element_node->base, AST_HTML_ELEMENT_NODE, start_position, end_position, errors, allocator);
|
|
69
121
|
|
|
70
122
|
html_element_node->open_tag = open_tag;
|
|
71
|
-
html_element_node->tag_name = token_copy(tag_name);
|
|
123
|
+
html_element_node->tag_name = token_copy(tag_name, allocator);
|
|
72
124
|
html_element_node->body = body;
|
|
73
125
|
html_element_node->close_tag = close_tag;
|
|
74
126
|
html_element_node->is_void = is_void;
|
|
75
|
-
html_element_node->
|
|
127
|
+
html_element_node->element_source = element_source;
|
|
76
128
|
|
|
77
129
|
return html_element_node;
|
|
78
130
|
}
|
|
79
131
|
|
|
80
|
-
|
|
81
|
-
|
|
132
|
+
AST_HTML_CONDITIONAL_ELEMENT_NODE_T* ast_html_conditional_element_node_init(hb_string_T condition, AST_NODE_T* open_conditional, struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag, hb_array_T* body, AST_NODE_T* close_tag, AST_NODE_T* close_conditional, token_T* tag_name, hb_string_T element_source, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
133
|
+
AST_HTML_CONDITIONAL_ELEMENT_NODE_T* html_conditional_element_node = hb_allocator_alloc(allocator, sizeof(AST_HTML_CONDITIONAL_ELEMENT_NODE_T));
|
|
134
|
+
|
|
135
|
+
if (!html_conditional_element_node) { return NULL; }
|
|
82
136
|
|
|
83
|
-
ast_node_init(&
|
|
137
|
+
ast_node_init(&html_conditional_element_node->base, AST_HTML_CONDITIONAL_ELEMENT_NODE, start_position, end_position, errors, allocator);
|
|
84
138
|
|
|
85
|
-
|
|
139
|
+
html_conditional_element_node->condition = hb_string_copy(condition, allocator);
|
|
140
|
+
html_conditional_element_node->open_conditional = open_conditional;
|
|
141
|
+
html_conditional_element_node->open_tag = open_tag;
|
|
142
|
+
html_conditional_element_node->body = body;
|
|
143
|
+
html_conditional_element_node->close_tag = close_tag;
|
|
144
|
+
html_conditional_element_node->close_conditional = close_conditional;
|
|
145
|
+
html_conditional_element_node->tag_name = token_copy(tag_name, allocator);
|
|
146
|
+
html_conditional_element_node->element_source = element_source;
|
|
147
|
+
|
|
148
|
+
return html_conditional_element_node;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
AST_HTML_ATTRIBUTE_VALUE_NODE_T* ast_html_attribute_value_node_init(token_T* open_quote, hb_array_T* children, token_T* close_quote, bool quoted, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
152
|
+
AST_HTML_ATTRIBUTE_VALUE_NODE_T* html_attribute_value_node = hb_allocator_alloc(allocator, sizeof(AST_HTML_ATTRIBUTE_VALUE_NODE_T));
|
|
153
|
+
|
|
154
|
+
if (!html_attribute_value_node) { return NULL; }
|
|
155
|
+
|
|
156
|
+
ast_node_init(&html_attribute_value_node->base, AST_HTML_ATTRIBUTE_VALUE_NODE, start_position, end_position, errors, allocator);
|
|
157
|
+
|
|
158
|
+
html_attribute_value_node->open_quote = token_copy(open_quote, allocator);
|
|
86
159
|
html_attribute_value_node->children = children;
|
|
87
|
-
html_attribute_value_node->close_quote = token_copy(close_quote);
|
|
160
|
+
html_attribute_value_node->close_quote = token_copy(close_quote, allocator);
|
|
88
161
|
html_attribute_value_node->quoted = quoted;
|
|
89
162
|
|
|
90
163
|
return html_attribute_value_node;
|
|
91
164
|
}
|
|
92
165
|
|
|
93
|
-
AST_HTML_ATTRIBUTE_NAME_NODE_T* ast_html_attribute_name_node_init(hb_array_T* children, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
94
|
-
AST_HTML_ATTRIBUTE_NAME_NODE_T* html_attribute_name_node =
|
|
166
|
+
AST_HTML_ATTRIBUTE_NAME_NODE_T* ast_html_attribute_name_node_init(hb_array_T* children, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
167
|
+
AST_HTML_ATTRIBUTE_NAME_NODE_T* html_attribute_name_node = hb_allocator_alloc(allocator, sizeof(AST_HTML_ATTRIBUTE_NAME_NODE_T));
|
|
168
|
+
|
|
169
|
+
if (!html_attribute_name_node) { return NULL; }
|
|
95
170
|
|
|
96
|
-
ast_node_init(&html_attribute_name_node->base, AST_HTML_ATTRIBUTE_NAME_NODE, start_position, end_position, errors);
|
|
171
|
+
ast_node_init(&html_attribute_name_node->base, AST_HTML_ATTRIBUTE_NAME_NODE, start_position, end_position, errors, allocator);
|
|
97
172
|
|
|
98
173
|
html_attribute_name_node->children = children;
|
|
99
174
|
|
|
100
175
|
return html_attribute_name_node;
|
|
101
176
|
}
|
|
102
177
|
|
|
103
|
-
AST_HTML_ATTRIBUTE_NODE_T* ast_html_attribute_node_init(struct AST_HTML_ATTRIBUTE_NAME_NODE_STRUCT* name, token_T* equals, struct AST_HTML_ATTRIBUTE_VALUE_NODE_STRUCT* value, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
104
|
-
AST_HTML_ATTRIBUTE_NODE_T* html_attribute_node =
|
|
178
|
+
AST_HTML_ATTRIBUTE_NODE_T* ast_html_attribute_node_init(struct AST_HTML_ATTRIBUTE_NAME_NODE_STRUCT* name, token_T* equals, struct AST_HTML_ATTRIBUTE_VALUE_NODE_STRUCT* value, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
179
|
+
AST_HTML_ATTRIBUTE_NODE_T* html_attribute_node = hb_allocator_alloc(allocator, sizeof(AST_HTML_ATTRIBUTE_NODE_T));
|
|
105
180
|
|
|
106
|
-
|
|
181
|
+
if (!html_attribute_node) { return NULL; }
|
|
182
|
+
|
|
183
|
+
ast_node_init(&html_attribute_node->base, AST_HTML_ATTRIBUTE_NODE, start_position, end_position, errors, allocator);
|
|
107
184
|
|
|
108
185
|
html_attribute_node->name = name;
|
|
109
|
-
html_attribute_node->equals = token_copy(equals);
|
|
186
|
+
html_attribute_node->equals = token_copy(equals, allocator);
|
|
110
187
|
html_attribute_node->value = value;
|
|
111
188
|
|
|
112
189
|
return html_attribute_node;
|
|
113
190
|
}
|
|
114
191
|
|
|
115
|
-
|
|
116
|
-
|
|
192
|
+
AST_RUBY_LITERAL_NODE_T* ast_ruby_literal_node_init(hb_string_T content, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
193
|
+
AST_RUBY_LITERAL_NODE_T* ruby_literal_node = hb_allocator_alloc(allocator, sizeof(AST_RUBY_LITERAL_NODE_T));
|
|
194
|
+
|
|
195
|
+
if (!ruby_literal_node) { return NULL; }
|
|
196
|
+
|
|
197
|
+
ast_node_init(&ruby_literal_node->base, AST_RUBY_LITERAL_NODE, start_position, end_position, errors, allocator);
|
|
198
|
+
|
|
199
|
+
ruby_literal_node->content = hb_string_copy(content, allocator);
|
|
200
|
+
|
|
201
|
+
return ruby_literal_node;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T* ast_ruby_html_attributes_splat_node_init(hb_string_T content, hb_string_T prefix, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
205
|
+
AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T* ruby_html_attributes_splat_node = hb_allocator_alloc(allocator, sizeof(AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T));
|
|
206
|
+
|
|
207
|
+
if (!ruby_html_attributes_splat_node) { return NULL; }
|
|
208
|
+
|
|
209
|
+
ast_node_init(&ruby_html_attributes_splat_node->base, AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE, start_position, end_position, errors, allocator);
|
|
210
|
+
|
|
211
|
+
ruby_html_attributes_splat_node->content = hb_string_copy(content, allocator);
|
|
212
|
+
ruby_html_attributes_splat_node->prefix = hb_string_copy(prefix, allocator);
|
|
213
|
+
|
|
214
|
+
return ruby_html_attributes_splat_node;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
AST_ERB_OPEN_TAG_NODE_T* ast_erb_open_tag_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, token_T* tag_name, hb_array_T* children, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
218
|
+
AST_ERB_OPEN_TAG_NODE_T* erb_open_tag_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_OPEN_TAG_NODE_T));
|
|
219
|
+
|
|
220
|
+
if (!erb_open_tag_node) { return NULL; }
|
|
221
|
+
|
|
222
|
+
ast_node_init(&erb_open_tag_node->base, AST_ERB_OPEN_TAG_NODE, start_position, end_position, errors, allocator);
|
|
223
|
+
|
|
224
|
+
erb_open_tag_node->tag_opening = token_copy(tag_opening, allocator);
|
|
225
|
+
erb_open_tag_node->content = token_copy(content, allocator);
|
|
226
|
+
erb_open_tag_node->tag_closing = token_copy(tag_closing, allocator);
|
|
227
|
+
erb_open_tag_node->tag_name = token_copy(tag_name, allocator);
|
|
228
|
+
erb_open_tag_node->children = children;
|
|
229
|
+
|
|
230
|
+
return erb_open_tag_node;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
AST_HTML_TEXT_NODE_T* ast_html_text_node_init(hb_string_T content, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
234
|
+
AST_HTML_TEXT_NODE_T* html_text_node = hb_allocator_alloc(allocator, sizeof(AST_HTML_TEXT_NODE_T));
|
|
117
235
|
|
|
118
|
-
|
|
236
|
+
if (!html_text_node) { return NULL; }
|
|
119
237
|
|
|
120
|
-
html_text_node->
|
|
238
|
+
ast_node_init(&html_text_node->base, AST_HTML_TEXT_NODE, start_position, end_position, errors, allocator);
|
|
239
|
+
|
|
240
|
+
html_text_node->content = hb_string_copy(content, allocator);
|
|
121
241
|
|
|
122
242
|
return html_text_node;
|
|
123
243
|
}
|
|
124
244
|
|
|
125
|
-
AST_HTML_COMMENT_NODE_T* ast_html_comment_node_init(token_T* comment_start, hb_array_T* children, token_T* comment_end, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
126
|
-
AST_HTML_COMMENT_NODE_T* html_comment_node =
|
|
245
|
+
AST_HTML_COMMENT_NODE_T* ast_html_comment_node_init(token_T* comment_start, hb_array_T* children, token_T* comment_end, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
246
|
+
AST_HTML_COMMENT_NODE_T* html_comment_node = hb_allocator_alloc(allocator, sizeof(AST_HTML_COMMENT_NODE_T));
|
|
247
|
+
|
|
248
|
+
if (!html_comment_node) { return NULL; }
|
|
127
249
|
|
|
128
|
-
ast_node_init(&html_comment_node->base, AST_HTML_COMMENT_NODE, start_position, end_position, errors);
|
|
250
|
+
ast_node_init(&html_comment_node->base, AST_HTML_COMMENT_NODE, start_position, end_position, errors, allocator);
|
|
129
251
|
|
|
130
|
-
html_comment_node->comment_start = token_copy(comment_start);
|
|
252
|
+
html_comment_node->comment_start = token_copy(comment_start, allocator);
|
|
131
253
|
html_comment_node->children = children;
|
|
132
|
-
html_comment_node->comment_end = token_copy(comment_end);
|
|
254
|
+
html_comment_node->comment_end = token_copy(comment_end, allocator);
|
|
133
255
|
|
|
134
256
|
return html_comment_node;
|
|
135
257
|
}
|
|
136
258
|
|
|
137
|
-
AST_HTML_DOCTYPE_NODE_T* ast_html_doctype_node_init(token_T* tag_opening, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
138
|
-
AST_HTML_DOCTYPE_NODE_T* html_doctype_node =
|
|
259
|
+
AST_HTML_DOCTYPE_NODE_T* ast_html_doctype_node_init(token_T* tag_opening, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
260
|
+
AST_HTML_DOCTYPE_NODE_T* html_doctype_node = hb_allocator_alloc(allocator, sizeof(AST_HTML_DOCTYPE_NODE_T));
|
|
139
261
|
|
|
140
|
-
|
|
262
|
+
if (!html_doctype_node) { return NULL; }
|
|
141
263
|
|
|
142
|
-
html_doctype_node->
|
|
264
|
+
ast_node_init(&html_doctype_node->base, AST_HTML_DOCTYPE_NODE, start_position, end_position, errors, allocator);
|
|
265
|
+
|
|
266
|
+
html_doctype_node->tag_opening = token_copy(tag_opening, allocator);
|
|
143
267
|
html_doctype_node->children = children;
|
|
144
|
-
html_doctype_node->tag_closing = token_copy(tag_closing);
|
|
268
|
+
html_doctype_node->tag_closing = token_copy(tag_closing, allocator);
|
|
145
269
|
|
|
146
270
|
return html_doctype_node;
|
|
147
271
|
}
|
|
148
272
|
|
|
149
|
-
AST_XML_DECLARATION_NODE_T* ast_xml_declaration_node_init(token_T* tag_opening, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
150
|
-
AST_XML_DECLARATION_NODE_T* xml_declaration_node =
|
|
273
|
+
AST_XML_DECLARATION_NODE_T* ast_xml_declaration_node_init(token_T* tag_opening, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
274
|
+
AST_XML_DECLARATION_NODE_T* xml_declaration_node = hb_allocator_alloc(allocator, sizeof(AST_XML_DECLARATION_NODE_T));
|
|
275
|
+
|
|
276
|
+
if (!xml_declaration_node) { return NULL; }
|
|
151
277
|
|
|
152
|
-
ast_node_init(&xml_declaration_node->base, AST_XML_DECLARATION_NODE, start_position, end_position, errors);
|
|
278
|
+
ast_node_init(&xml_declaration_node->base, AST_XML_DECLARATION_NODE, start_position, end_position, errors, allocator);
|
|
153
279
|
|
|
154
|
-
xml_declaration_node->tag_opening = token_copy(tag_opening);
|
|
280
|
+
xml_declaration_node->tag_opening = token_copy(tag_opening, allocator);
|
|
155
281
|
xml_declaration_node->children = children;
|
|
156
|
-
xml_declaration_node->tag_closing = token_copy(tag_closing);
|
|
282
|
+
xml_declaration_node->tag_closing = token_copy(tag_closing, allocator);
|
|
157
283
|
|
|
158
284
|
return xml_declaration_node;
|
|
159
285
|
}
|
|
160
286
|
|
|
161
|
-
AST_CDATA_NODE_T* ast_cdata_node_init(token_T* tag_opening, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
162
|
-
AST_CDATA_NODE_T* cdata_node =
|
|
287
|
+
AST_CDATA_NODE_T* ast_cdata_node_init(token_T* tag_opening, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
288
|
+
AST_CDATA_NODE_T* cdata_node = hb_allocator_alloc(allocator, sizeof(AST_CDATA_NODE_T));
|
|
163
289
|
|
|
164
|
-
|
|
290
|
+
if (!cdata_node) { return NULL; }
|
|
165
291
|
|
|
166
|
-
cdata_node->
|
|
292
|
+
ast_node_init(&cdata_node->base, AST_CDATA_NODE, start_position, end_position, errors, allocator);
|
|
293
|
+
|
|
294
|
+
cdata_node->tag_opening = token_copy(tag_opening, allocator);
|
|
167
295
|
cdata_node->children = children;
|
|
168
|
-
cdata_node->tag_closing = token_copy(tag_closing);
|
|
296
|
+
cdata_node->tag_closing = token_copy(tag_closing, allocator);
|
|
169
297
|
|
|
170
298
|
return cdata_node;
|
|
171
299
|
}
|
|
172
300
|
|
|
173
|
-
AST_WHITESPACE_NODE_T* ast_whitespace_node_init(token_T* value, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
174
|
-
AST_WHITESPACE_NODE_T* whitespace_node =
|
|
301
|
+
AST_WHITESPACE_NODE_T* ast_whitespace_node_init(token_T* value, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
302
|
+
AST_WHITESPACE_NODE_T* whitespace_node = hb_allocator_alloc(allocator, sizeof(AST_WHITESPACE_NODE_T));
|
|
303
|
+
|
|
304
|
+
if (!whitespace_node) { return NULL; }
|
|
175
305
|
|
|
176
|
-
ast_node_init(&whitespace_node->base, AST_WHITESPACE_NODE, start_position, end_position, errors);
|
|
306
|
+
ast_node_init(&whitespace_node->base, AST_WHITESPACE_NODE, start_position, end_position, errors, allocator);
|
|
177
307
|
|
|
178
|
-
whitespace_node->value = token_copy(value);
|
|
308
|
+
whitespace_node->value = token_copy(value, allocator);
|
|
179
309
|
|
|
180
310
|
return whitespace_node;
|
|
181
311
|
}
|
|
182
312
|
|
|
183
|
-
AST_ERB_CONTENT_NODE_T* ast_erb_content_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, analyzed_ruby_T* analyzed_ruby, bool parsed, bool valid, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
184
|
-
AST_ERB_CONTENT_NODE_T* erb_content_node =
|
|
313
|
+
AST_ERB_CONTENT_NODE_T* ast_erb_content_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, analyzed_ruby_T* analyzed_ruby, bool parsed, bool valid, herb_prism_node_T prism_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
314
|
+
AST_ERB_CONTENT_NODE_T* erb_content_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_CONTENT_NODE_T));
|
|
185
315
|
|
|
186
|
-
|
|
316
|
+
if (!erb_content_node) { return NULL; }
|
|
187
317
|
|
|
188
|
-
erb_content_node->
|
|
189
|
-
|
|
190
|
-
erb_content_node->
|
|
318
|
+
ast_node_init(&erb_content_node->base, AST_ERB_CONTENT_NODE, start_position, end_position, errors, allocator);
|
|
319
|
+
|
|
320
|
+
erb_content_node->tag_opening = token_copy(tag_opening, allocator);
|
|
321
|
+
erb_content_node->content = token_copy(content, allocator);
|
|
322
|
+
erb_content_node->tag_closing = token_copy(tag_closing, allocator);
|
|
191
323
|
erb_content_node->analyzed_ruby = analyzed_ruby;
|
|
192
324
|
erb_content_node->parsed = parsed;
|
|
193
325
|
erb_content_node->valid = valid;
|
|
326
|
+
erb_content_node->prism_node = prism_node;
|
|
194
327
|
|
|
195
328
|
return erb_content_node;
|
|
196
329
|
}
|
|
197
330
|
|
|
198
|
-
AST_ERB_END_NODE_T* ast_erb_end_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
199
|
-
AST_ERB_END_NODE_T* erb_end_node =
|
|
331
|
+
AST_ERB_END_NODE_T* ast_erb_end_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
332
|
+
AST_ERB_END_NODE_T* erb_end_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_END_NODE_T));
|
|
333
|
+
|
|
334
|
+
if (!erb_end_node) { return NULL; }
|
|
200
335
|
|
|
201
|
-
ast_node_init(&erb_end_node->base, AST_ERB_END_NODE, start_position, end_position, errors);
|
|
336
|
+
ast_node_init(&erb_end_node->base, AST_ERB_END_NODE, start_position, end_position, errors, allocator);
|
|
202
337
|
|
|
203
|
-
erb_end_node->tag_opening = token_copy(tag_opening);
|
|
204
|
-
erb_end_node->content = token_copy(content);
|
|
205
|
-
erb_end_node->tag_closing = token_copy(tag_closing);
|
|
338
|
+
erb_end_node->tag_opening = token_copy(tag_opening, allocator);
|
|
339
|
+
erb_end_node->content = token_copy(content, allocator);
|
|
340
|
+
erb_end_node->tag_closing = token_copy(tag_closing, allocator);
|
|
206
341
|
|
|
207
342
|
return erb_end_node;
|
|
208
343
|
}
|
|
209
344
|
|
|
210
|
-
AST_ERB_ELSE_NODE_T* ast_erb_else_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
211
|
-
AST_ERB_ELSE_NODE_T* erb_else_node =
|
|
345
|
+
AST_ERB_ELSE_NODE_T* ast_erb_else_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
346
|
+
AST_ERB_ELSE_NODE_T* erb_else_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_ELSE_NODE_T));
|
|
212
347
|
|
|
213
|
-
|
|
348
|
+
if (!erb_else_node) { return NULL; }
|
|
214
349
|
|
|
215
|
-
erb_else_node->
|
|
216
|
-
|
|
217
|
-
erb_else_node->
|
|
350
|
+
ast_node_init(&erb_else_node->base, AST_ERB_ELSE_NODE, start_position, end_position, errors, allocator);
|
|
351
|
+
|
|
352
|
+
erb_else_node->tag_opening = token_copy(tag_opening, allocator);
|
|
353
|
+
erb_else_node->content = token_copy(content, allocator);
|
|
354
|
+
erb_else_node->tag_closing = token_copy(tag_closing, allocator);
|
|
218
355
|
erb_else_node->statements = statements;
|
|
219
356
|
|
|
220
357
|
return erb_else_node;
|
|
221
358
|
}
|
|
222
359
|
|
|
223
|
-
AST_ERB_IF_NODE_T* ast_erb_if_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, hb_array_T* statements,
|
|
224
|
-
AST_ERB_IF_NODE_T* erb_if_node =
|
|
360
|
+
AST_ERB_IF_NODE_T* ast_erb_if_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, herb_prism_node_T prism_node, hb_array_T* statements, AST_NODE_T* subsequent, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
361
|
+
AST_ERB_IF_NODE_T* erb_if_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_IF_NODE_T));
|
|
362
|
+
|
|
363
|
+
if (!erb_if_node) { return NULL; }
|
|
225
364
|
|
|
226
|
-
ast_node_init(&erb_if_node->base, AST_ERB_IF_NODE, start_position, end_position, errors);
|
|
365
|
+
ast_node_init(&erb_if_node->base, AST_ERB_IF_NODE, start_position, end_position, errors, allocator);
|
|
227
366
|
|
|
228
|
-
erb_if_node->tag_opening = token_copy(tag_opening);
|
|
229
|
-
erb_if_node->content = token_copy(content);
|
|
230
|
-
erb_if_node->tag_closing = token_copy(tag_closing);
|
|
367
|
+
erb_if_node->tag_opening = token_copy(tag_opening, allocator);
|
|
368
|
+
erb_if_node->content = token_copy(content, allocator);
|
|
369
|
+
erb_if_node->tag_closing = token_copy(tag_closing, allocator);
|
|
231
370
|
erb_if_node->then_keyword = then_keyword;
|
|
371
|
+
erb_if_node->prism_node = prism_node;
|
|
232
372
|
erb_if_node->statements = statements;
|
|
233
373
|
erb_if_node->subsequent = subsequent;
|
|
234
374
|
erb_if_node->end_node = end_node;
|
|
@@ -236,43 +376,51 @@ AST_ERB_IF_NODE_T* ast_erb_if_node_init(token_T* tag_opening, token_T* content,
|
|
|
236
376
|
return erb_if_node;
|
|
237
377
|
}
|
|
238
378
|
|
|
239
|
-
AST_ERB_BLOCK_NODE_T* ast_erb_block_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* body, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
240
|
-
AST_ERB_BLOCK_NODE_T* erb_block_node =
|
|
379
|
+
AST_ERB_BLOCK_NODE_T* ast_erb_block_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, hb_array_T* body, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
380
|
+
AST_ERB_BLOCK_NODE_T* erb_block_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_BLOCK_NODE_T));
|
|
381
|
+
|
|
382
|
+
if (!erb_block_node) { return NULL; }
|
|
241
383
|
|
|
242
|
-
ast_node_init(&erb_block_node->base, AST_ERB_BLOCK_NODE, start_position, end_position, errors);
|
|
384
|
+
ast_node_init(&erb_block_node->base, AST_ERB_BLOCK_NODE, start_position, end_position, errors, allocator);
|
|
243
385
|
|
|
244
|
-
erb_block_node->tag_opening = token_copy(tag_opening);
|
|
245
|
-
erb_block_node->content = token_copy(content);
|
|
246
|
-
erb_block_node->tag_closing = token_copy(tag_closing);
|
|
386
|
+
erb_block_node->tag_opening = token_copy(tag_opening, allocator);
|
|
387
|
+
erb_block_node->content = token_copy(content, allocator);
|
|
388
|
+
erb_block_node->tag_closing = token_copy(tag_closing, allocator);
|
|
389
|
+
erb_block_node->prism_node = prism_node;
|
|
247
390
|
erb_block_node->body = body;
|
|
248
391
|
erb_block_node->end_node = end_node;
|
|
249
392
|
|
|
250
393
|
return erb_block_node;
|
|
251
394
|
}
|
|
252
395
|
|
|
253
|
-
AST_ERB_WHEN_NODE_T* ast_erb_when_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
254
|
-
AST_ERB_WHEN_NODE_T* erb_when_node =
|
|
396
|
+
AST_ERB_WHEN_NODE_T* ast_erb_when_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
397
|
+
AST_ERB_WHEN_NODE_T* erb_when_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_WHEN_NODE_T));
|
|
255
398
|
|
|
256
|
-
|
|
399
|
+
if (!erb_when_node) { return NULL; }
|
|
257
400
|
|
|
258
|
-
erb_when_node->
|
|
259
|
-
|
|
260
|
-
erb_when_node->
|
|
401
|
+
ast_node_init(&erb_when_node->base, AST_ERB_WHEN_NODE, start_position, end_position, errors, allocator);
|
|
402
|
+
|
|
403
|
+
erb_when_node->tag_opening = token_copy(tag_opening, allocator);
|
|
404
|
+
erb_when_node->content = token_copy(content, allocator);
|
|
405
|
+
erb_when_node->tag_closing = token_copy(tag_closing, allocator);
|
|
261
406
|
erb_when_node->then_keyword = then_keyword;
|
|
262
407
|
erb_when_node->statements = statements;
|
|
263
408
|
|
|
264
409
|
return erb_when_node;
|
|
265
410
|
}
|
|
266
411
|
|
|
267
|
-
AST_ERB_CASE_NODE_T* ast_erb_case_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* children, hb_array_T* conditions, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
268
|
-
AST_ERB_CASE_NODE_T* erb_case_node =
|
|
412
|
+
AST_ERB_CASE_NODE_T* ast_erb_case_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* children, herb_prism_node_T prism_node, hb_array_T* conditions, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
413
|
+
AST_ERB_CASE_NODE_T* erb_case_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_CASE_NODE_T));
|
|
414
|
+
|
|
415
|
+
if (!erb_case_node) { return NULL; }
|
|
269
416
|
|
|
270
|
-
ast_node_init(&erb_case_node->base, AST_ERB_CASE_NODE, start_position, end_position, errors);
|
|
417
|
+
ast_node_init(&erb_case_node->base, AST_ERB_CASE_NODE, start_position, end_position, errors, allocator);
|
|
271
418
|
|
|
272
|
-
erb_case_node->tag_opening = token_copy(tag_opening);
|
|
273
|
-
erb_case_node->content = token_copy(content);
|
|
274
|
-
erb_case_node->tag_closing = token_copy(tag_closing);
|
|
419
|
+
erb_case_node->tag_opening = token_copy(tag_opening, allocator);
|
|
420
|
+
erb_case_node->content = token_copy(content, allocator);
|
|
421
|
+
erb_case_node->tag_closing = token_copy(tag_closing, allocator);
|
|
275
422
|
erb_case_node->children = children;
|
|
423
|
+
erb_case_node->prism_node = prism_node;
|
|
276
424
|
erb_case_node->conditions = conditions;
|
|
277
425
|
erb_case_node->else_clause = else_clause;
|
|
278
426
|
erb_case_node->end_node = end_node;
|
|
@@ -280,15 +428,18 @@ AST_ERB_CASE_NODE_T* ast_erb_case_node_init(token_T* tag_opening, token_T* conte
|
|
|
280
428
|
return erb_case_node;
|
|
281
429
|
}
|
|
282
430
|
|
|
283
|
-
AST_ERB_CASE_MATCH_NODE_T* ast_erb_case_match_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* children, hb_array_T* conditions, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
284
|
-
AST_ERB_CASE_MATCH_NODE_T* erb_case_match_node =
|
|
431
|
+
AST_ERB_CASE_MATCH_NODE_T* ast_erb_case_match_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* children, herb_prism_node_T prism_node, hb_array_T* conditions, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
432
|
+
AST_ERB_CASE_MATCH_NODE_T* erb_case_match_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_CASE_MATCH_NODE_T));
|
|
285
433
|
|
|
286
|
-
|
|
434
|
+
if (!erb_case_match_node) { return NULL; }
|
|
287
435
|
|
|
288
|
-
erb_case_match_node->
|
|
289
|
-
|
|
290
|
-
erb_case_match_node->
|
|
436
|
+
ast_node_init(&erb_case_match_node->base, AST_ERB_CASE_MATCH_NODE, start_position, end_position, errors, allocator);
|
|
437
|
+
|
|
438
|
+
erb_case_match_node->tag_opening = token_copy(tag_opening, allocator);
|
|
439
|
+
erb_case_match_node->content = token_copy(content, allocator);
|
|
440
|
+
erb_case_match_node->tag_closing = token_copy(tag_closing, allocator);
|
|
291
441
|
erb_case_match_node->children = children;
|
|
442
|
+
erb_case_match_node->prism_node = prism_node;
|
|
292
443
|
erb_case_match_node->conditions = conditions;
|
|
293
444
|
erb_case_match_node->else_clause = else_clause;
|
|
294
445
|
erb_case_match_node->end_node = end_node;
|
|
@@ -296,83 +447,99 @@ AST_ERB_CASE_MATCH_NODE_T* ast_erb_case_match_node_init(token_T* tag_opening, to
|
|
|
296
447
|
return erb_case_match_node;
|
|
297
448
|
}
|
|
298
449
|
|
|
299
|
-
AST_ERB_WHILE_NODE_T* ast_erb_while_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
300
|
-
AST_ERB_WHILE_NODE_T* erb_while_node =
|
|
450
|
+
AST_ERB_WHILE_NODE_T* ast_erb_while_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, hb_array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
451
|
+
AST_ERB_WHILE_NODE_T* erb_while_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_WHILE_NODE_T));
|
|
452
|
+
|
|
453
|
+
if (!erb_while_node) { return NULL; }
|
|
301
454
|
|
|
302
|
-
ast_node_init(&erb_while_node->base, AST_ERB_WHILE_NODE, start_position, end_position, errors);
|
|
455
|
+
ast_node_init(&erb_while_node->base, AST_ERB_WHILE_NODE, start_position, end_position, errors, allocator);
|
|
303
456
|
|
|
304
|
-
erb_while_node->tag_opening = token_copy(tag_opening);
|
|
305
|
-
erb_while_node->content = token_copy(content);
|
|
306
|
-
erb_while_node->tag_closing = token_copy(tag_closing);
|
|
457
|
+
erb_while_node->tag_opening = token_copy(tag_opening, allocator);
|
|
458
|
+
erb_while_node->content = token_copy(content, allocator);
|
|
459
|
+
erb_while_node->tag_closing = token_copy(tag_closing, allocator);
|
|
460
|
+
erb_while_node->prism_node = prism_node;
|
|
307
461
|
erb_while_node->statements = statements;
|
|
308
462
|
erb_while_node->end_node = end_node;
|
|
309
463
|
|
|
310
464
|
return erb_while_node;
|
|
311
465
|
}
|
|
312
466
|
|
|
313
|
-
AST_ERB_UNTIL_NODE_T* ast_erb_until_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
314
|
-
AST_ERB_UNTIL_NODE_T* erb_until_node =
|
|
467
|
+
AST_ERB_UNTIL_NODE_T* ast_erb_until_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, hb_array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
468
|
+
AST_ERB_UNTIL_NODE_T* erb_until_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_UNTIL_NODE_T));
|
|
315
469
|
|
|
316
|
-
|
|
470
|
+
if (!erb_until_node) { return NULL; }
|
|
317
471
|
|
|
318
|
-
erb_until_node->
|
|
319
|
-
|
|
320
|
-
erb_until_node->
|
|
472
|
+
ast_node_init(&erb_until_node->base, AST_ERB_UNTIL_NODE, start_position, end_position, errors, allocator);
|
|
473
|
+
|
|
474
|
+
erb_until_node->tag_opening = token_copy(tag_opening, allocator);
|
|
475
|
+
erb_until_node->content = token_copy(content, allocator);
|
|
476
|
+
erb_until_node->tag_closing = token_copy(tag_closing, allocator);
|
|
477
|
+
erb_until_node->prism_node = prism_node;
|
|
321
478
|
erb_until_node->statements = statements;
|
|
322
479
|
erb_until_node->end_node = end_node;
|
|
323
480
|
|
|
324
481
|
return erb_until_node;
|
|
325
482
|
}
|
|
326
483
|
|
|
327
|
-
AST_ERB_FOR_NODE_T* ast_erb_for_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
328
|
-
AST_ERB_FOR_NODE_T* erb_for_node =
|
|
484
|
+
AST_ERB_FOR_NODE_T* ast_erb_for_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, hb_array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
485
|
+
AST_ERB_FOR_NODE_T* erb_for_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_FOR_NODE_T));
|
|
486
|
+
|
|
487
|
+
if (!erb_for_node) { return NULL; }
|
|
329
488
|
|
|
330
|
-
ast_node_init(&erb_for_node->base, AST_ERB_FOR_NODE, start_position, end_position, errors);
|
|
489
|
+
ast_node_init(&erb_for_node->base, AST_ERB_FOR_NODE, start_position, end_position, errors, allocator);
|
|
331
490
|
|
|
332
|
-
erb_for_node->tag_opening = token_copy(tag_opening);
|
|
333
|
-
erb_for_node->content = token_copy(content);
|
|
334
|
-
erb_for_node->tag_closing = token_copy(tag_closing);
|
|
491
|
+
erb_for_node->tag_opening = token_copy(tag_opening, allocator);
|
|
492
|
+
erb_for_node->content = token_copy(content, allocator);
|
|
493
|
+
erb_for_node->tag_closing = token_copy(tag_closing, allocator);
|
|
494
|
+
erb_for_node->prism_node = prism_node;
|
|
335
495
|
erb_for_node->statements = statements;
|
|
336
496
|
erb_for_node->end_node = end_node;
|
|
337
497
|
|
|
338
498
|
return erb_for_node;
|
|
339
499
|
}
|
|
340
500
|
|
|
341
|
-
AST_ERB_RESCUE_NODE_T* ast_erb_rescue_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, struct AST_ERB_RESCUE_NODE_STRUCT* subsequent, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
342
|
-
AST_ERB_RESCUE_NODE_T* erb_rescue_node =
|
|
501
|
+
AST_ERB_RESCUE_NODE_T* ast_erb_rescue_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, struct AST_ERB_RESCUE_NODE_STRUCT* subsequent, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
502
|
+
AST_ERB_RESCUE_NODE_T* erb_rescue_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_RESCUE_NODE_T));
|
|
343
503
|
|
|
344
|
-
|
|
504
|
+
if (!erb_rescue_node) { return NULL; }
|
|
345
505
|
|
|
346
|
-
erb_rescue_node->
|
|
347
|
-
|
|
348
|
-
erb_rescue_node->
|
|
506
|
+
ast_node_init(&erb_rescue_node->base, AST_ERB_RESCUE_NODE, start_position, end_position, errors, allocator);
|
|
507
|
+
|
|
508
|
+
erb_rescue_node->tag_opening = token_copy(tag_opening, allocator);
|
|
509
|
+
erb_rescue_node->content = token_copy(content, allocator);
|
|
510
|
+
erb_rescue_node->tag_closing = token_copy(tag_closing, allocator);
|
|
349
511
|
erb_rescue_node->statements = statements;
|
|
350
512
|
erb_rescue_node->subsequent = subsequent;
|
|
351
513
|
|
|
352
514
|
return erb_rescue_node;
|
|
353
515
|
}
|
|
354
516
|
|
|
355
|
-
AST_ERB_ENSURE_NODE_T* ast_erb_ensure_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
356
|
-
AST_ERB_ENSURE_NODE_T* erb_ensure_node =
|
|
517
|
+
AST_ERB_ENSURE_NODE_T* ast_erb_ensure_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
518
|
+
AST_ERB_ENSURE_NODE_T* erb_ensure_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_ENSURE_NODE_T));
|
|
519
|
+
|
|
520
|
+
if (!erb_ensure_node) { return NULL; }
|
|
357
521
|
|
|
358
|
-
ast_node_init(&erb_ensure_node->base, AST_ERB_ENSURE_NODE, start_position, end_position, errors);
|
|
522
|
+
ast_node_init(&erb_ensure_node->base, AST_ERB_ENSURE_NODE, start_position, end_position, errors, allocator);
|
|
359
523
|
|
|
360
|
-
erb_ensure_node->tag_opening = token_copy(tag_opening);
|
|
361
|
-
erb_ensure_node->content = token_copy(content);
|
|
362
|
-
erb_ensure_node->tag_closing = token_copy(tag_closing);
|
|
524
|
+
erb_ensure_node->tag_opening = token_copy(tag_opening, allocator);
|
|
525
|
+
erb_ensure_node->content = token_copy(content, allocator);
|
|
526
|
+
erb_ensure_node->tag_closing = token_copy(tag_closing, allocator);
|
|
363
527
|
erb_ensure_node->statements = statements;
|
|
364
528
|
|
|
365
529
|
return erb_ensure_node;
|
|
366
530
|
}
|
|
367
531
|
|
|
368
|
-
AST_ERB_BEGIN_NODE_T* ast_erb_begin_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, struct AST_ERB_RESCUE_NODE_STRUCT* rescue_clause, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_ENSURE_NODE_STRUCT* ensure_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
369
|
-
AST_ERB_BEGIN_NODE_T* erb_begin_node =
|
|
532
|
+
AST_ERB_BEGIN_NODE_T* ast_erb_begin_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, hb_array_T* statements, struct AST_ERB_RESCUE_NODE_STRUCT* rescue_clause, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_ENSURE_NODE_STRUCT* ensure_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
533
|
+
AST_ERB_BEGIN_NODE_T* erb_begin_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_BEGIN_NODE_T));
|
|
370
534
|
|
|
371
|
-
|
|
535
|
+
if (!erb_begin_node) { return NULL; }
|
|
372
536
|
|
|
373
|
-
erb_begin_node->
|
|
374
|
-
|
|
375
|
-
erb_begin_node->
|
|
537
|
+
ast_node_init(&erb_begin_node->base, AST_ERB_BEGIN_NODE, start_position, end_position, errors, allocator);
|
|
538
|
+
|
|
539
|
+
erb_begin_node->tag_opening = token_copy(tag_opening, allocator);
|
|
540
|
+
erb_begin_node->content = token_copy(content, allocator);
|
|
541
|
+
erb_begin_node->tag_closing = token_copy(tag_closing, allocator);
|
|
542
|
+
erb_begin_node->prism_node = prism_node;
|
|
376
543
|
erb_begin_node->statements = statements;
|
|
377
544
|
erb_begin_node->rescue_clause = rescue_clause;
|
|
378
545
|
erb_begin_node->else_clause = else_clause;
|
|
@@ -382,15 +549,18 @@ AST_ERB_BEGIN_NODE_T* ast_erb_begin_node_init(token_T* tag_opening, token_T* con
|
|
|
382
549
|
return erb_begin_node;
|
|
383
550
|
}
|
|
384
551
|
|
|
385
|
-
AST_ERB_UNLESS_NODE_T* ast_erb_unless_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, hb_array_T* statements, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
386
|
-
AST_ERB_UNLESS_NODE_T* erb_unless_node =
|
|
552
|
+
AST_ERB_UNLESS_NODE_T* ast_erb_unless_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, herb_prism_node_T prism_node, hb_array_T* statements, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
553
|
+
AST_ERB_UNLESS_NODE_T* erb_unless_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_UNLESS_NODE_T));
|
|
554
|
+
|
|
555
|
+
if (!erb_unless_node) { return NULL; }
|
|
387
556
|
|
|
388
|
-
ast_node_init(&erb_unless_node->base, AST_ERB_UNLESS_NODE, start_position, end_position, errors);
|
|
557
|
+
ast_node_init(&erb_unless_node->base, AST_ERB_UNLESS_NODE, start_position, end_position, errors, allocator);
|
|
389
558
|
|
|
390
|
-
erb_unless_node->tag_opening = token_copy(tag_opening);
|
|
391
|
-
erb_unless_node->content = token_copy(content);
|
|
392
|
-
erb_unless_node->tag_closing = token_copy(tag_closing);
|
|
559
|
+
erb_unless_node->tag_opening = token_copy(tag_opening, allocator);
|
|
560
|
+
erb_unless_node->content = token_copy(content, allocator);
|
|
561
|
+
erb_unless_node->tag_closing = token_copy(tag_closing, allocator);
|
|
393
562
|
erb_unless_node->then_keyword = then_keyword;
|
|
563
|
+
erb_unless_node->prism_node = prism_node;
|
|
394
564
|
erb_unless_node->statements = statements;
|
|
395
565
|
erb_unless_node->else_clause = else_clause;
|
|
396
566
|
erb_unless_node->end_node = end_node;
|
|
@@ -398,26 +568,77 @@ AST_ERB_UNLESS_NODE_T* ast_erb_unless_node_init(token_T* tag_opening, token_T* c
|
|
|
398
568
|
return erb_unless_node;
|
|
399
569
|
}
|
|
400
570
|
|
|
401
|
-
|
|
402
|
-
|
|
571
|
+
AST_RUBY_RENDER_LOCAL_NODE_T* ast_ruby_render_local_node_init(token_T* name, struct AST_RUBY_LITERAL_NODE_STRUCT* value, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
572
|
+
AST_RUBY_RENDER_LOCAL_NODE_T* ruby_render_local_node = hb_allocator_alloc(allocator, sizeof(AST_RUBY_RENDER_LOCAL_NODE_T));
|
|
573
|
+
|
|
574
|
+
if (!ruby_render_local_node) { return NULL; }
|
|
575
|
+
|
|
576
|
+
ast_node_init(&ruby_render_local_node->base, AST_RUBY_RENDER_LOCAL_NODE, start_position, end_position, errors, allocator);
|
|
577
|
+
|
|
578
|
+
ruby_render_local_node->name = token_copy(name, allocator);
|
|
579
|
+
ruby_render_local_node->value = value;
|
|
580
|
+
|
|
581
|
+
return ruby_render_local_node;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
AST_ERB_RENDER_NODE_T* ast_erb_render_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, analyzed_ruby_T* analyzed_ruby, herb_prism_node_T prism_node, token_T* partial, token_T* template_path, token_T* layout, token_T* file, token_T* inline_template, token_T* body, token_T* plain, token_T* html, token_T* renderable, token_T* collection, token_T* object, token_T* as_name, token_T* spacer_template, token_T* formats, token_T* variants, token_T* handlers, token_T* content_type, hb_array_T* locals, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
585
|
+
AST_ERB_RENDER_NODE_T* erb_render_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_RENDER_NODE_T));
|
|
403
586
|
|
|
404
|
-
|
|
587
|
+
if (!erb_render_node) { return NULL; }
|
|
405
588
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
589
|
+
ast_node_init(&erb_render_node->base, AST_ERB_RENDER_NODE, start_position, end_position, errors, allocator);
|
|
590
|
+
|
|
591
|
+
erb_render_node->tag_opening = token_copy(tag_opening, allocator);
|
|
592
|
+
erb_render_node->content = token_copy(content, allocator);
|
|
593
|
+
erb_render_node->tag_closing = token_copy(tag_closing, allocator);
|
|
594
|
+
erb_render_node->analyzed_ruby = analyzed_ruby;
|
|
595
|
+
erb_render_node->prism_node = prism_node;
|
|
596
|
+
erb_render_node->partial = token_copy(partial, allocator);
|
|
597
|
+
erb_render_node->template_path = token_copy(template_path, allocator);
|
|
598
|
+
erb_render_node->layout = token_copy(layout, allocator);
|
|
599
|
+
erb_render_node->file = token_copy(file, allocator);
|
|
600
|
+
erb_render_node->inline_template = token_copy(inline_template, allocator);
|
|
601
|
+
erb_render_node->body = token_copy(body, allocator);
|
|
602
|
+
erb_render_node->plain = token_copy(plain, allocator);
|
|
603
|
+
erb_render_node->html = token_copy(html, allocator);
|
|
604
|
+
erb_render_node->renderable = token_copy(renderable, allocator);
|
|
605
|
+
erb_render_node->collection = token_copy(collection, allocator);
|
|
606
|
+
erb_render_node->object = token_copy(object, allocator);
|
|
607
|
+
erb_render_node->as_name = token_copy(as_name, allocator);
|
|
608
|
+
erb_render_node->spacer_template = token_copy(spacer_template, allocator);
|
|
609
|
+
erb_render_node->formats = token_copy(formats, allocator);
|
|
610
|
+
erb_render_node->variants = token_copy(variants, allocator);
|
|
611
|
+
erb_render_node->handlers = token_copy(handlers, allocator);
|
|
612
|
+
erb_render_node->content_type = token_copy(content_type, allocator);
|
|
613
|
+
erb_render_node->locals = locals;
|
|
614
|
+
|
|
615
|
+
return erb_render_node;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
AST_ERB_YIELD_NODE_T* ast_erb_yield_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
619
|
+
AST_ERB_YIELD_NODE_T* erb_yield_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_YIELD_NODE_T));
|
|
620
|
+
|
|
621
|
+
if (!erb_yield_node) { return NULL; }
|
|
622
|
+
|
|
623
|
+
ast_node_init(&erb_yield_node->base, AST_ERB_YIELD_NODE, start_position, end_position, errors, allocator);
|
|
624
|
+
|
|
625
|
+
erb_yield_node->tag_opening = token_copy(tag_opening, allocator);
|
|
626
|
+
erb_yield_node->content = token_copy(content, allocator);
|
|
627
|
+
erb_yield_node->tag_closing = token_copy(tag_closing, allocator);
|
|
409
628
|
|
|
410
629
|
return erb_yield_node;
|
|
411
630
|
}
|
|
412
631
|
|
|
413
|
-
AST_ERB_IN_NODE_T* ast_erb_in_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors) {
|
|
414
|
-
AST_ERB_IN_NODE_T* erb_in_node =
|
|
632
|
+
AST_ERB_IN_NODE_T* ast_erb_in_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator) {
|
|
633
|
+
AST_ERB_IN_NODE_T* erb_in_node = hb_allocator_alloc(allocator, sizeof(AST_ERB_IN_NODE_T));
|
|
634
|
+
|
|
635
|
+
if (!erb_in_node) { return NULL; }
|
|
415
636
|
|
|
416
|
-
ast_node_init(&erb_in_node->base, AST_ERB_IN_NODE, start_position, end_position, errors);
|
|
637
|
+
ast_node_init(&erb_in_node->base, AST_ERB_IN_NODE, start_position, end_position, errors, allocator);
|
|
417
638
|
|
|
418
|
-
erb_in_node->tag_opening = token_copy(tag_opening);
|
|
419
|
-
erb_in_node->content = token_copy(content);
|
|
420
|
-
erb_in_node->tag_closing = token_copy(tag_closing);
|
|
639
|
+
erb_in_node->tag_opening = token_copy(tag_opening, allocator);
|
|
640
|
+
erb_in_node->content = token_copy(content, allocator);
|
|
641
|
+
erb_in_node->tag_closing = token_copy(tag_closing, allocator);
|
|
421
642
|
erb_in_node->then_keyword = then_keyword;
|
|
422
643
|
erb_in_node->statements = statements;
|
|
423
644
|
|
|
@@ -429,11 +650,18 @@ hb_string_T ast_node_type_to_string(AST_NODE_T* node) {
|
|
|
429
650
|
case AST_DOCUMENT_NODE: return hb_string("AST_DOCUMENT_NODE");
|
|
430
651
|
case AST_LITERAL_NODE: return hb_string("AST_LITERAL_NODE");
|
|
431
652
|
case AST_HTML_OPEN_TAG_NODE: return hb_string("AST_HTML_OPEN_TAG_NODE");
|
|
653
|
+
case AST_HTML_CONDITIONAL_OPEN_TAG_NODE: return hb_string("AST_HTML_CONDITIONAL_OPEN_TAG_NODE");
|
|
432
654
|
case AST_HTML_CLOSE_TAG_NODE: return hb_string("AST_HTML_CLOSE_TAG_NODE");
|
|
655
|
+
case AST_HTML_OMITTED_CLOSE_TAG_NODE: return hb_string("AST_HTML_OMITTED_CLOSE_TAG_NODE");
|
|
656
|
+
case AST_HTML_VIRTUAL_CLOSE_TAG_NODE: return hb_string("AST_HTML_VIRTUAL_CLOSE_TAG_NODE");
|
|
433
657
|
case AST_HTML_ELEMENT_NODE: return hb_string("AST_HTML_ELEMENT_NODE");
|
|
658
|
+
case AST_HTML_CONDITIONAL_ELEMENT_NODE: return hb_string("AST_HTML_CONDITIONAL_ELEMENT_NODE");
|
|
434
659
|
case AST_HTML_ATTRIBUTE_VALUE_NODE: return hb_string("AST_HTML_ATTRIBUTE_VALUE_NODE");
|
|
435
660
|
case AST_HTML_ATTRIBUTE_NAME_NODE: return hb_string("AST_HTML_ATTRIBUTE_NAME_NODE");
|
|
436
661
|
case AST_HTML_ATTRIBUTE_NODE: return hb_string("AST_HTML_ATTRIBUTE_NODE");
|
|
662
|
+
case AST_RUBY_LITERAL_NODE: return hb_string("AST_RUBY_LITERAL_NODE");
|
|
663
|
+
case AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE: return hb_string("AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE");
|
|
664
|
+
case AST_ERB_OPEN_TAG_NODE: return hb_string("AST_ERB_OPEN_TAG_NODE");
|
|
437
665
|
case AST_HTML_TEXT_NODE: return hb_string("AST_HTML_TEXT_NODE");
|
|
438
666
|
case AST_HTML_COMMENT_NODE: return hb_string("AST_HTML_COMMENT_NODE");
|
|
439
667
|
case AST_HTML_DOCTYPE_NODE: return hb_string("AST_HTML_DOCTYPE_NODE");
|
|
@@ -455,6 +683,8 @@ hb_string_T ast_node_type_to_string(AST_NODE_T* node) {
|
|
|
455
683
|
case AST_ERB_ENSURE_NODE: return hb_string("AST_ERB_ENSURE_NODE");
|
|
456
684
|
case AST_ERB_BEGIN_NODE: return hb_string("AST_ERB_BEGIN_NODE");
|
|
457
685
|
case AST_ERB_UNLESS_NODE: return hb_string("AST_ERB_UNLESS_NODE");
|
|
686
|
+
case AST_RUBY_RENDER_LOCAL_NODE: return hb_string("AST_RUBY_RENDER_LOCAL_NODE");
|
|
687
|
+
case AST_ERB_RENDER_NODE: return hb_string("AST_ERB_RENDER_NODE");
|
|
458
688
|
case AST_ERB_YIELD_NODE: return hb_string("AST_ERB_YIELD_NODE");
|
|
459
689
|
case AST_ERB_IN_NODE: return hb_string("AST_ERB_IN_NODE");
|
|
460
690
|
}
|
|
@@ -467,11 +697,18 @@ hb_string_T ast_node_human_type(AST_NODE_T* node) {
|
|
|
467
697
|
case AST_DOCUMENT_NODE: return hb_string("DocumentNode");
|
|
468
698
|
case AST_LITERAL_NODE: return hb_string("LiteralNode");
|
|
469
699
|
case AST_HTML_OPEN_TAG_NODE: return hb_string("HTMLOpenTagNode");
|
|
700
|
+
case AST_HTML_CONDITIONAL_OPEN_TAG_NODE: return hb_string("HTMLConditionalOpenTagNode");
|
|
470
701
|
case AST_HTML_CLOSE_TAG_NODE: return hb_string("HTMLCloseTagNode");
|
|
702
|
+
case AST_HTML_OMITTED_CLOSE_TAG_NODE: return hb_string("HTMLOmittedCloseTagNode");
|
|
703
|
+
case AST_HTML_VIRTUAL_CLOSE_TAG_NODE: return hb_string("HTMLVirtualCloseTagNode");
|
|
471
704
|
case AST_HTML_ELEMENT_NODE: return hb_string("HTMLElementNode");
|
|
705
|
+
case AST_HTML_CONDITIONAL_ELEMENT_NODE: return hb_string("HTMLConditionalElementNode");
|
|
472
706
|
case AST_HTML_ATTRIBUTE_VALUE_NODE: return hb_string("HTMLAttributeValueNode");
|
|
473
707
|
case AST_HTML_ATTRIBUTE_NAME_NODE: return hb_string("HTMLAttributeNameNode");
|
|
474
708
|
case AST_HTML_ATTRIBUTE_NODE: return hb_string("HTMLAttributeNode");
|
|
709
|
+
case AST_RUBY_LITERAL_NODE: return hb_string("RubyLiteralNode");
|
|
710
|
+
case AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE: return hb_string("RubyHTMLAttributesSplatNode");
|
|
711
|
+
case AST_ERB_OPEN_TAG_NODE: return hb_string("ERBOpenTagNode");
|
|
475
712
|
case AST_HTML_TEXT_NODE: return hb_string("HTMLTextNode");
|
|
476
713
|
case AST_HTML_COMMENT_NODE: return hb_string("HTMLCommentNode");
|
|
477
714
|
case AST_HTML_DOCTYPE_NODE: return hb_string("HTMLDoctypeNode");
|
|
@@ -493,6 +730,8 @@ hb_string_T ast_node_human_type(AST_NODE_T* node) {
|
|
|
493
730
|
case AST_ERB_ENSURE_NODE: return hb_string("ERBEnsureNode");
|
|
494
731
|
case AST_ERB_BEGIN_NODE: return hb_string("ERBBeginNode");
|
|
495
732
|
case AST_ERB_UNLESS_NODE: return hb_string("ERBUnlessNode");
|
|
733
|
+
case AST_RUBY_RENDER_LOCAL_NODE: return hb_string("RubyRenderLocalNode");
|
|
734
|
+
case AST_ERB_RENDER_NODE: return hb_string("ERBRenderNode");
|
|
496
735
|
case AST_ERB_YIELD_NODE: return hb_string("ERBYieldNode");
|
|
497
736
|
case AST_ERB_IN_NODE: return hb_string("ERBInNode");
|
|
498
737
|
}
|
|
@@ -500,519 +739,652 @@ hb_string_T ast_node_human_type(AST_NODE_T* node) {
|
|
|
500
739
|
return hb_string("Unknown ast_node_type_T");
|
|
501
740
|
}
|
|
502
741
|
|
|
503
|
-
void ast_free_base_node(AST_NODE_T* node) {
|
|
742
|
+
void ast_free_base_node(AST_NODE_T* node, hb_allocator_T* allocator) {
|
|
504
743
|
if (node == NULL) { return; }
|
|
505
744
|
|
|
506
745
|
if (node->errors) {
|
|
507
746
|
for (size_t i = 0; i < hb_array_size(node->errors); i++) {
|
|
508
747
|
ERROR_T* child = hb_array_get(node->errors, i);
|
|
509
|
-
if (child != NULL) { error_free(child); }
|
|
748
|
+
if (child != NULL) { error_free(child, allocator); }
|
|
510
749
|
}
|
|
511
750
|
|
|
512
751
|
hb_array_free(&node->errors);
|
|
513
752
|
}
|
|
514
753
|
|
|
515
|
-
|
|
754
|
+
hb_allocator_dealloc(allocator, node);
|
|
516
755
|
}
|
|
517
756
|
|
|
518
757
|
|
|
519
|
-
static void ast_free_document_node(AST_DOCUMENT_NODE_T* document_node) {
|
|
758
|
+
static void ast_free_document_node(AST_DOCUMENT_NODE_T* document_node, hb_allocator_T* allocator) {
|
|
520
759
|
if (document_node->children != NULL) {
|
|
521
760
|
for (size_t i = 0; i < hb_array_size(document_node->children); i++) {
|
|
522
761
|
AST_NODE_T* child = hb_array_get(document_node->children, i);
|
|
523
|
-
if (child) { ast_node_free(child); }
|
|
762
|
+
if (child) { ast_node_free(child, allocator); }
|
|
524
763
|
}
|
|
525
764
|
|
|
526
765
|
hb_array_free(&document_node->children);
|
|
527
766
|
}
|
|
767
|
+
if (document_node->prism_context != NULL) { herb_prism_context_free(document_node->prism_context); }
|
|
768
|
+
/* prism_node is a borrowed reference into the prism context, not freed here */
|
|
528
769
|
|
|
529
|
-
ast_free_base_node(&document_node->base);
|
|
770
|
+
ast_free_base_node(&document_node->base, allocator);
|
|
530
771
|
}
|
|
531
772
|
|
|
532
|
-
static void ast_free_literal_node(AST_LITERAL_NODE_T* literal_node) {
|
|
533
|
-
if (literal_node->content != NULL) {
|
|
773
|
+
static void ast_free_literal_node(AST_LITERAL_NODE_T* literal_node, hb_allocator_T* allocator) {
|
|
774
|
+
if (literal_node->content.data != NULL) { hb_allocator_dealloc(allocator, literal_node->content.data); }
|
|
534
775
|
|
|
535
|
-
ast_free_base_node(&literal_node->base);
|
|
776
|
+
ast_free_base_node(&literal_node->base, allocator);
|
|
536
777
|
}
|
|
537
778
|
|
|
538
|
-
static void ast_free_html_open_tag_node(AST_HTML_OPEN_TAG_NODE_T* html_open_tag_node) {
|
|
539
|
-
if (html_open_tag_node->tag_opening != NULL) { token_free(html_open_tag_node->tag_opening); }
|
|
540
|
-
if (html_open_tag_node->tag_name != NULL) { token_free(html_open_tag_node->tag_name); }
|
|
541
|
-
if (html_open_tag_node->tag_closing != NULL) { token_free(html_open_tag_node->tag_closing); }
|
|
779
|
+
static void ast_free_html_open_tag_node(AST_HTML_OPEN_TAG_NODE_T* html_open_tag_node, hb_allocator_T* allocator) {
|
|
780
|
+
if (html_open_tag_node->tag_opening != NULL) { token_free(html_open_tag_node->tag_opening, allocator); }
|
|
781
|
+
if (html_open_tag_node->tag_name != NULL) { token_free(html_open_tag_node->tag_name, allocator); }
|
|
782
|
+
if (html_open_tag_node->tag_closing != NULL) { token_free(html_open_tag_node->tag_closing, allocator); }
|
|
542
783
|
if (html_open_tag_node->children != NULL) {
|
|
543
784
|
for (size_t i = 0; i < hb_array_size(html_open_tag_node->children); i++) {
|
|
544
785
|
AST_NODE_T* child = hb_array_get(html_open_tag_node->children, i);
|
|
545
|
-
if (child) { ast_node_free(child); }
|
|
786
|
+
if (child) { ast_node_free(child, allocator); }
|
|
546
787
|
}
|
|
547
788
|
|
|
548
789
|
hb_array_free(&html_open_tag_node->children);
|
|
549
790
|
}
|
|
550
791
|
|
|
551
|
-
ast_free_base_node(&html_open_tag_node->base);
|
|
792
|
+
ast_free_base_node(&html_open_tag_node->base, allocator);
|
|
552
793
|
}
|
|
553
794
|
|
|
554
|
-
static void
|
|
555
|
-
|
|
556
|
-
if (
|
|
795
|
+
static void ast_free_html_conditional_open_tag_node(AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T* html_conditional_open_tag_node, hb_allocator_T* allocator) {
|
|
796
|
+
ast_node_free((AST_NODE_T*) html_conditional_open_tag_node->conditional, allocator);
|
|
797
|
+
if (html_conditional_open_tag_node->tag_name != NULL) { token_free(html_conditional_open_tag_node->tag_name, allocator); }
|
|
798
|
+
|
|
799
|
+
ast_free_base_node(&html_conditional_open_tag_node->base, allocator);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
static void ast_free_html_close_tag_node(AST_HTML_CLOSE_TAG_NODE_T* html_close_tag_node, hb_allocator_T* allocator) {
|
|
803
|
+
if (html_close_tag_node->tag_opening != NULL) { token_free(html_close_tag_node->tag_opening, allocator); }
|
|
804
|
+
if (html_close_tag_node->tag_name != NULL) { token_free(html_close_tag_node->tag_name, allocator); }
|
|
557
805
|
if (html_close_tag_node->children != NULL) {
|
|
558
806
|
for (size_t i = 0; i < hb_array_size(html_close_tag_node->children); i++) {
|
|
559
807
|
AST_NODE_T* child = hb_array_get(html_close_tag_node->children, i);
|
|
560
|
-
if (child) { ast_node_free(child); }
|
|
808
|
+
if (child) { ast_node_free(child, allocator); }
|
|
561
809
|
}
|
|
562
810
|
|
|
563
811
|
hb_array_free(&html_close_tag_node->children);
|
|
564
812
|
}
|
|
565
|
-
if (html_close_tag_node->tag_closing != NULL) { token_free(html_close_tag_node->tag_closing); }
|
|
813
|
+
if (html_close_tag_node->tag_closing != NULL) { token_free(html_close_tag_node->tag_closing, allocator); }
|
|
566
814
|
|
|
567
|
-
ast_free_base_node(&html_close_tag_node->base);
|
|
815
|
+
ast_free_base_node(&html_close_tag_node->base, allocator);
|
|
568
816
|
}
|
|
569
817
|
|
|
570
|
-
static void
|
|
571
|
-
|
|
572
|
-
|
|
818
|
+
static void ast_free_html_omitted_close_tag_node(AST_HTML_OMITTED_CLOSE_TAG_NODE_T* html_omitted_close_tag_node, hb_allocator_T* allocator) {
|
|
819
|
+
if (html_omitted_close_tag_node->tag_name != NULL) { token_free(html_omitted_close_tag_node->tag_name, allocator); }
|
|
820
|
+
|
|
821
|
+
ast_free_base_node(&html_omitted_close_tag_node->base, allocator);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
static void ast_free_html_virtual_close_tag_node(AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T* html_virtual_close_tag_node, hb_allocator_T* allocator) {
|
|
825
|
+
if (html_virtual_close_tag_node->tag_name != NULL) { token_free(html_virtual_close_tag_node->tag_name, allocator); }
|
|
826
|
+
|
|
827
|
+
ast_free_base_node(&html_virtual_close_tag_node->base, allocator);
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
static void ast_free_html_element_node(AST_HTML_ELEMENT_NODE_T* html_element_node, hb_allocator_T* allocator) {
|
|
831
|
+
ast_node_free((AST_NODE_T*) html_element_node->open_tag, allocator);
|
|
832
|
+
if (html_element_node->tag_name != NULL) { token_free(html_element_node->tag_name, allocator); }
|
|
573
833
|
if (html_element_node->body != NULL) {
|
|
574
834
|
for (size_t i = 0; i < hb_array_size(html_element_node->body); i++) {
|
|
575
835
|
AST_NODE_T* child = hb_array_get(html_element_node->body, i);
|
|
576
|
-
if (child) { ast_node_free(child); }
|
|
836
|
+
if (child) { ast_node_free(child, allocator); }
|
|
577
837
|
}
|
|
578
838
|
|
|
579
839
|
hb_array_free(&html_element_node->body);
|
|
580
840
|
}
|
|
581
|
-
ast_node_free((AST_NODE_T*) html_element_node->close_tag);
|
|
841
|
+
ast_node_free((AST_NODE_T*) html_element_node->close_tag, allocator);
|
|
842
|
+
|
|
843
|
+
ast_free_base_node(&html_element_node->base, allocator);
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
static void ast_free_html_conditional_element_node(AST_HTML_CONDITIONAL_ELEMENT_NODE_T* html_conditional_element_node, hb_allocator_T* allocator) {
|
|
847
|
+
if (html_conditional_element_node->condition.data != NULL) { hb_allocator_dealloc(allocator, html_conditional_element_node->condition.data); }
|
|
848
|
+
ast_node_free((AST_NODE_T*) html_conditional_element_node->open_conditional, allocator);
|
|
849
|
+
/* open_tag is a borrowed reference, not freed here (owned by another field) */
|
|
850
|
+
if (html_conditional_element_node->body != NULL) {
|
|
851
|
+
for (size_t i = 0; i < hb_array_size(html_conditional_element_node->body); i++) {
|
|
852
|
+
AST_NODE_T* child = hb_array_get(html_conditional_element_node->body, i);
|
|
853
|
+
if (child) { ast_node_free(child, allocator); }
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
hb_array_free(&html_conditional_element_node->body);
|
|
857
|
+
}
|
|
858
|
+
/* close_tag is a borrowed reference, not freed here (owned by another field) */
|
|
859
|
+
ast_node_free((AST_NODE_T*) html_conditional_element_node->close_conditional, allocator);
|
|
860
|
+
if (html_conditional_element_node->tag_name != NULL) { token_free(html_conditional_element_node->tag_name, allocator); }
|
|
582
861
|
|
|
583
|
-
ast_free_base_node(&
|
|
862
|
+
ast_free_base_node(&html_conditional_element_node->base, allocator);
|
|
584
863
|
}
|
|
585
864
|
|
|
586
|
-
static void ast_free_html_attribute_value_node(AST_HTML_ATTRIBUTE_VALUE_NODE_T* html_attribute_value_node) {
|
|
587
|
-
if (html_attribute_value_node->open_quote != NULL) { token_free(html_attribute_value_node->open_quote); }
|
|
865
|
+
static void ast_free_html_attribute_value_node(AST_HTML_ATTRIBUTE_VALUE_NODE_T* html_attribute_value_node, hb_allocator_T* allocator) {
|
|
866
|
+
if (html_attribute_value_node->open_quote != NULL) { token_free(html_attribute_value_node->open_quote, allocator); }
|
|
588
867
|
if (html_attribute_value_node->children != NULL) {
|
|
589
868
|
for (size_t i = 0; i < hb_array_size(html_attribute_value_node->children); i++) {
|
|
590
869
|
AST_NODE_T* child = hb_array_get(html_attribute_value_node->children, i);
|
|
591
|
-
if (child) { ast_node_free(child); }
|
|
870
|
+
if (child) { ast_node_free(child, allocator); }
|
|
592
871
|
}
|
|
593
872
|
|
|
594
873
|
hb_array_free(&html_attribute_value_node->children);
|
|
595
874
|
}
|
|
596
|
-
if (html_attribute_value_node->close_quote != NULL) { token_free(html_attribute_value_node->close_quote); }
|
|
875
|
+
if (html_attribute_value_node->close_quote != NULL) { token_free(html_attribute_value_node->close_quote, allocator); }
|
|
597
876
|
|
|
598
|
-
ast_free_base_node(&html_attribute_value_node->base);
|
|
877
|
+
ast_free_base_node(&html_attribute_value_node->base, allocator);
|
|
599
878
|
}
|
|
600
879
|
|
|
601
|
-
static void ast_free_html_attribute_name_node(AST_HTML_ATTRIBUTE_NAME_NODE_T* html_attribute_name_node) {
|
|
880
|
+
static void ast_free_html_attribute_name_node(AST_HTML_ATTRIBUTE_NAME_NODE_T* html_attribute_name_node, hb_allocator_T* allocator) {
|
|
602
881
|
if (html_attribute_name_node->children != NULL) {
|
|
603
882
|
for (size_t i = 0; i < hb_array_size(html_attribute_name_node->children); i++) {
|
|
604
883
|
AST_NODE_T* child = hb_array_get(html_attribute_name_node->children, i);
|
|
605
|
-
if (child) { ast_node_free(child); }
|
|
884
|
+
if (child) { ast_node_free(child, allocator); }
|
|
606
885
|
}
|
|
607
886
|
|
|
608
887
|
hb_array_free(&html_attribute_name_node->children);
|
|
609
888
|
}
|
|
610
889
|
|
|
611
|
-
ast_free_base_node(&html_attribute_name_node->base);
|
|
890
|
+
ast_free_base_node(&html_attribute_name_node->base, allocator);
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
static void ast_free_html_attribute_node(AST_HTML_ATTRIBUTE_NODE_T* html_attribute_node, hb_allocator_T* allocator) {
|
|
894
|
+
ast_node_free((AST_NODE_T*) html_attribute_node->name, allocator);
|
|
895
|
+
if (html_attribute_node->equals != NULL) { token_free(html_attribute_node->equals, allocator); }
|
|
896
|
+
ast_node_free((AST_NODE_T*) html_attribute_node->value, allocator);
|
|
897
|
+
|
|
898
|
+
ast_free_base_node(&html_attribute_node->base, allocator);
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
static void ast_free_ruby_literal_node(AST_RUBY_LITERAL_NODE_T* ruby_literal_node, hb_allocator_T* allocator) {
|
|
902
|
+
if (ruby_literal_node->content.data != NULL) { hb_allocator_dealloc(allocator, ruby_literal_node->content.data); }
|
|
903
|
+
|
|
904
|
+
ast_free_base_node(&ruby_literal_node->base, allocator);
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
static void ast_free_ruby_html_attributes_splat_node(AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T* ruby_html_attributes_splat_node, hb_allocator_T* allocator) {
|
|
908
|
+
if (ruby_html_attributes_splat_node->content.data != NULL) { hb_allocator_dealloc(allocator, ruby_html_attributes_splat_node->content.data); }
|
|
909
|
+
if (ruby_html_attributes_splat_node->prefix.data != NULL) { hb_allocator_dealloc(allocator, ruby_html_attributes_splat_node->prefix.data); }
|
|
910
|
+
|
|
911
|
+
ast_free_base_node(&ruby_html_attributes_splat_node->base, allocator);
|
|
612
912
|
}
|
|
613
913
|
|
|
614
|
-
static void
|
|
615
|
-
|
|
616
|
-
if (
|
|
617
|
-
|
|
914
|
+
static void ast_free_erb_open_tag_node(AST_ERB_OPEN_TAG_NODE_T* erb_open_tag_node, hb_allocator_T* allocator) {
|
|
915
|
+
if (erb_open_tag_node->tag_opening != NULL) { token_free(erb_open_tag_node->tag_opening, allocator); }
|
|
916
|
+
if (erb_open_tag_node->content != NULL) { token_free(erb_open_tag_node->content, allocator); }
|
|
917
|
+
if (erb_open_tag_node->tag_closing != NULL) { token_free(erb_open_tag_node->tag_closing, allocator); }
|
|
918
|
+
if (erb_open_tag_node->tag_name != NULL) { token_free(erb_open_tag_node->tag_name, allocator); }
|
|
919
|
+
if (erb_open_tag_node->children != NULL) {
|
|
920
|
+
for (size_t i = 0; i < hb_array_size(erb_open_tag_node->children); i++) {
|
|
921
|
+
AST_NODE_T* child = hb_array_get(erb_open_tag_node->children, i);
|
|
922
|
+
if (child) { ast_node_free(child, allocator); }
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
hb_array_free(&erb_open_tag_node->children);
|
|
926
|
+
}
|
|
618
927
|
|
|
619
|
-
ast_free_base_node(&
|
|
928
|
+
ast_free_base_node(&erb_open_tag_node->base, allocator);
|
|
620
929
|
}
|
|
621
930
|
|
|
622
|
-
static void ast_free_html_text_node(AST_HTML_TEXT_NODE_T* html_text_node) {
|
|
623
|
-
if (html_text_node->content != NULL) {
|
|
931
|
+
static void ast_free_html_text_node(AST_HTML_TEXT_NODE_T* html_text_node, hb_allocator_T* allocator) {
|
|
932
|
+
if (html_text_node->content.data != NULL) { hb_allocator_dealloc(allocator, html_text_node->content.data); }
|
|
624
933
|
|
|
625
|
-
ast_free_base_node(&html_text_node->base);
|
|
934
|
+
ast_free_base_node(&html_text_node->base, allocator);
|
|
626
935
|
}
|
|
627
936
|
|
|
628
|
-
static void ast_free_html_comment_node(AST_HTML_COMMENT_NODE_T* html_comment_node) {
|
|
629
|
-
if (html_comment_node->comment_start != NULL) { token_free(html_comment_node->comment_start); }
|
|
937
|
+
static void ast_free_html_comment_node(AST_HTML_COMMENT_NODE_T* html_comment_node, hb_allocator_T* allocator) {
|
|
938
|
+
if (html_comment_node->comment_start != NULL) { token_free(html_comment_node->comment_start, allocator); }
|
|
630
939
|
if (html_comment_node->children != NULL) {
|
|
631
940
|
for (size_t i = 0; i < hb_array_size(html_comment_node->children); i++) {
|
|
632
941
|
AST_NODE_T* child = hb_array_get(html_comment_node->children, i);
|
|
633
|
-
if (child) { ast_node_free(child); }
|
|
942
|
+
if (child) { ast_node_free(child, allocator); }
|
|
634
943
|
}
|
|
635
944
|
|
|
636
945
|
hb_array_free(&html_comment_node->children);
|
|
637
946
|
}
|
|
638
|
-
if (html_comment_node->comment_end != NULL) { token_free(html_comment_node->comment_end); }
|
|
947
|
+
if (html_comment_node->comment_end != NULL) { token_free(html_comment_node->comment_end, allocator); }
|
|
639
948
|
|
|
640
|
-
ast_free_base_node(&html_comment_node->base);
|
|
949
|
+
ast_free_base_node(&html_comment_node->base, allocator);
|
|
641
950
|
}
|
|
642
951
|
|
|
643
|
-
static void ast_free_html_doctype_node(AST_HTML_DOCTYPE_NODE_T* html_doctype_node) {
|
|
644
|
-
if (html_doctype_node->tag_opening != NULL) { token_free(html_doctype_node->tag_opening); }
|
|
952
|
+
static void ast_free_html_doctype_node(AST_HTML_DOCTYPE_NODE_T* html_doctype_node, hb_allocator_T* allocator) {
|
|
953
|
+
if (html_doctype_node->tag_opening != NULL) { token_free(html_doctype_node->tag_opening, allocator); }
|
|
645
954
|
if (html_doctype_node->children != NULL) {
|
|
646
955
|
for (size_t i = 0; i < hb_array_size(html_doctype_node->children); i++) {
|
|
647
956
|
AST_NODE_T* child = hb_array_get(html_doctype_node->children, i);
|
|
648
|
-
if (child) { ast_node_free(child); }
|
|
957
|
+
if (child) { ast_node_free(child, allocator); }
|
|
649
958
|
}
|
|
650
959
|
|
|
651
960
|
hb_array_free(&html_doctype_node->children);
|
|
652
961
|
}
|
|
653
|
-
if (html_doctype_node->tag_closing != NULL) { token_free(html_doctype_node->tag_closing); }
|
|
962
|
+
if (html_doctype_node->tag_closing != NULL) { token_free(html_doctype_node->tag_closing, allocator); }
|
|
654
963
|
|
|
655
|
-
ast_free_base_node(&html_doctype_node->base);
|
|
964
|
+
ast_free_base_node(&html_doctype_node->base, allocator);
|
|
656
965
|
}
|
|
657
966
|
|
|
658
|
-
static void ast_free_xml_declaration_node(AST_XML_DECLARATION_NODE_T* xml_declaration_node) {
|
|
659
|
-
if (xml_declaration_node->tag_opening != NULL) { token_free(xml_declaration_node->tag_opening); }
|
|
967
|
+
static void ast_free_xml_declaration_node(AST_XML_DECLARATION_NODE_T* xml_declaration_node, hb_allocator_T* allocator) {
|
|
968
|
+
if (xml_declaration_node->tag_opening != NULL) { token_free(xml_declaration_node->tag_opening, allocator); }
|
|
660
969
|
if (xml_declaration_node->children != NULL) {
|
|
661
970
|
for (size_t i = 0; i < hb_array_size(xml_declaration_node->children); i++) {
|
|
662
971
|
AST_NODE_T* child = hb_array_get(xml_declaration_node->children, i);
|
|
663
|
-
if (child) { ast_node_free(child); }
|
|
972
|
+
if (child) { ast_node_free(child, allocator); }
|
|
664
973
|
}
|
|
665
974
|
|
|
666
975
|
hb_array_free(&xml_declaration_node->children);
|
|
667
976
|
}
|
|
668
|
-
if (xml_declaration_node->tag_closing != NULL) { token_free(xml_declaration_node->tag_closing); }
|
|
977
|
+
if (xml_declaration_node->tag_closing != NULL) { token_free(xml_declaration_node->tag_closing, allocator); }
|
|
669
978
|
|
|
670
|
-
ast_free_base_node(&xml_declaration_node->base);
|
|
979
|
+
ast_free_base_node(&xml_declaration_node->base, allocator);
|
|
671
980
|
}
|
|
672
981
|
|
|
673
|
-
static void ast_free_cdata_node(AST_CDATA_NODE_T* cdata_node) {
|
|
674
|
-
if (cdata_node->tag_opening != NULL) { token_free(cdata_node->tag_opening); }
|
|
982
|
+
static void ast_free_cdata_node(AST_CDATA_NODE_T* cdata_node, hb_allocator_T* allocator) {
|
|
983
|
+
if (cdata_node->tag_opening != NULL) { token_free(cdata_node->tag_opening, allocator); }
|
|
675
984
|
if (cdata_node->children != NULL) {
|
|
676
985
|
for (size_t i = 0; i < hb_array_size(cdata_node->children); i++) {
|
|
677
986
|
AST_NODE_T* child = hb_array_get(cdata_node->children, i);
|
|
678
|
-
if (child) { ast_node_free(child); }
|
|
987
|
+
if (child) { ast_node_free(child, allocator); }
|
|
679
988
|
}
|
|
680
989
|
|
|
681
990
|
hb_array_free(&cdata_node->children);
|
|
682
991
|
}
|
|
683
|
-
if (cdata_node->tag_closing != NULL) { token_free(cdata_node->tag_closing); }
|
|
992
|
+
if (cdata_node->tag_closing != NULL) { token_free(cdata_node->tag_closing, allocator); }
|
|
684
993
|
|
|
685
|
-
ast_free_base_node(&cdata_node->base);
|
|
994
|
+
ast_free_base_node(&cdata_node->base, allocator);
|
|
686
995
|
}
|
|
687
996
|
|
|
688
|
-
static void ast_free_whitespace_node(AST_WHITESPACE_NODE_T* whitespace_node) {
|
|
689
|
-
if (whitespace_node->value != NULL) { token_free(whitespace_node->value); }
|
|
997
|
+
static void ast_free_whitespace_node(AST_WHITESPACE_NODE_T* whitespace_node, hb_allocator_T* allocator) {
|
|
998
|
+
if (whitespace_node->value != NULL) { token_free(whitespace_node->value, allocator); }
|
|
690
999
|
|
|
691
|
-
ast_free_base_node(&whitespace_node->base);
|
|
1000
|
+
ast_free_base_node(&whitespace_node->base, allocator);
|
|
692
1001
|
}
|
|
693
1002
|
|
|
694
|
-
static void ast_free_erb_content_node(AST_ERB_CONTENT_NODE_T* erb_content_node) {
|
|
695
|
-
if (erb_content_node->tag_opening != NULL) { token_free(erb_content_node->tag_opening); }
|
|
696
|
-
if (erb_content_node->content != NULL) { token_free(erb_content_node->content); }
|
|
697
|
-
if (erb_content_node->tag_closing != NULL) { token_free(erb_content_node->tag_closing); }
|
|
1003
|
+
static void ast_free_erb_content_node(AST_ERB_CONTENT_NODE_T* erb_content_node, hb_allocator_T* allocator) {
|
|
1004
|
+
if (erb_content_node->tag_opening != NULL) { token_free(erb_content_node->tag_opening, allocator); }
|
|
1005
|
+
if (erb_content_node->content != NULL) { token_free(erb_content_node->content, allocator); }
|
|
1006
|
+
if (erb_content_node->tag_closing != NULL) { token_free(erb_content_node->tag_closing, allocator); }
|
|
698
1007
|
if (erb_content_node->analyzed_ruby != NULL) {
|
|
699
1008
|
free_analyzed_ruby(erb_content_node->analyzed_ruby);
|
|
700
1009
|
}
|
|
1010
|
+
/* prism_node is a borrowed reference into the prism context, not freed here */
|
|
701
1011
|
|
|
702
|
-
ast_free_base_node(&erb_content_node->base);
|
|
1012
|
+
ast_free_base_node(&erb_content_node->base, allocator);
|
|
703
1013
|
}
|
|
704
1014
|
|
|
705
|
-
static void ast_free_erb_end_node(AST_ERB_END_NODE_T* erb_end_node) {
|
|
706
|
-
if (erb_end_node->tag_opening != NULL) { token_free(erb_end_node->tag_opening); }
|
|
707
|
-
if (erb_end_node->content != NULL) { token_free(erb_end_node->content); }
|
|
708
|
-
if (erb_end_node->tag_closing != NULL) { token_free(erb_end_node->tag_closing); }
|
|
1015
|
+
static void ast_free_erb_end_node(AST_ERB_END_NODE_T* erb_end_node, hb_allocator_T* allocator) {
|
|
1016
|
+
if (erb_end_node->tag_opening != NULL) { token_free(erb_end_node->tag_opening, allocator); }
|
|
1017
|
+
if (erb_end_node->content != NULL) { token_free(erb_end_node->content, allocator); }
|
|
1018
|
+
if (erb_end_node->tag_closing != NULL) { token_free(erb_end_node->tag_closing, allocator); }
|
|
709
1019
|
|
|
710
|
-
ast_free_base_node(&erb_end_node->base);
|
|
1020
|
+
ast_free_base_node(&erb_end_node->base, allocator);
|
|
711
1021
|
}
|
|
712
1022
|
|
|
713
|
-
static void ast_free_erb_else_node(AST_ERB_ELSE_NODE_T* erb_else_node) {
|
|
714
|
-
if (erb_else_node->tag_opening != NULL) { token_free(erb_else_node->tag_opening); }
|
|
715
|
-
if (erb_else_node->content != NULL) { token_free(erb_else_node->content); }
|
|
716
|
-
if (erb_else_node->tag_closing != NULL) { token_free(erb_else_node->tag_closing); }
|
|
1023
|
+
static void ast_free_erb_else_node(AST_ERB_ELSE_NODE_T* erb_else_node, hb_allocator_T* allocator) {
|
|
1024
|
+
if (erb_else_node->tag_opening != NULL) { token_free(erb_else_node->tag_opening, allocator); }
|
|
1025
|
+
if (erb_else_node->content != NULL) { token_free(erb_else_node->content, allocator); }
|
|
1026
|
+
if (erb_else_node->tag_closing != NULL) { token_free(erb_else_node->tag_closing, allocator); }
|
|
717
1027
|
if (erb_else_node->statements != NULL) {
|
|
718
1028
|
for (size_t i = 0; i < hb_array_size(erb_else_node->statements); i++) {
|
|
719
1029
|
AST_NODE_T* child = hb_array_get(erb_else_node->statements, i);
|
|
720
|
-
if (child) { ast_node_free(child); }
|
|
1030
|
+
if (child) { ast_node_free(child, allocator); }
|
|
721
1031
|
}
|
|
722
1032
|
|
|
723
1033
|
hb_array_free(&erb_else_node->statements);
|
|
724
1034
|
}
|
|
725
1035
|
|
|
726
|
-
ast_free_base_node(&erb_else_node->base);
|
|
1036
|
+
ast_free_base_node(&erb_else_node->base, allocator);
|
|
727
1037
|
}
|
|
728
1038
|
|
|
729
|
-
static void ast_free_erb_if_node(AST_ERB_IF_NODE_T* erb_if_node) {
|
|
730
|
-
if (erb_if_node->tag_opening != NULL) { token_free(erb_if_node->tag_opening); }
|
|
731
|
-
if (erb_if_node->content != NULL) { token_free(erb_if_node->content); }
|
|
732
|
-
if (erb_if_node->tag_closing != NULL) { token_free(erb_if_node->tag_closing); }
|
|
733
|
-
if (erb_if_node->then_keyword != NULL) {
|
|
1039
|
+
static void ast_free_erb_if_node(AST_ERB_IF_NODE_T* erb_if_node, hb_allocator_T* allocator) {
|
|
1040
|
+
if (erb_if_node->tag_opening != NULL) { token_free(erb_if_node->tag_opening, allocator); }
|
|
1041
|
+
if (erb_if_node->content != NULL) { token_free(erb_if_node->content, allocator); }
|
|
1042
|
+
if (erb_if_node->tag_closing != NULL) { token_free(erb_if_node->tag_closing, allocator); }
|
|
1043
|
+
if (erb_if_node->then_keyword != NULL) { hb_allocator_dealloc(allocator, erb_if_node->then_keyword); }
|
|
1044
|
+
/* prism_node is a borrowed reference into the prism context, not freed here */
|
|
734
1045
|
if (erb_if_node->statements != NULL) {
|
|
735
1046
|
for (size_t i = 0; i < hb_array_size(erb_if_node->statements); i++) {
|
|
736
1047
|
AST_NODE_T* child = hb_array_get(erb_if_node->statements, i);
|
|
737
|
-
if (child) { ast_node_free(child); }
|
|
1048
|
+
if (child) { ast_node_free(child, allocator); }
|
|
738
1049
|
}
|
|
739
1050
|
|
|
740
1051
|
hb_array_free(&erb_if_node->statements);
|
|
741
1052
|
}
|
|
742
|
-
ast_node_free((AST_NODE_T*) erb_if_node->subsequent);
|
|
743
|
-
ast_node_free((AST_NODE_T*) erb_if_node->end_node);
|
|
1053
|
+
ast_node_free((AST_NODE_T*) erb_if_node->subsequent, allocator);
|
|
1054
|
+
ast_node_free((AST_NODE_T*) erb_if_node->end_node, allocator);
|
|
744
1055
|
|
|
745
|
-
ast_free_base_node(&erb_if_node->base);
|
|
1056
|
+
ast_free_base_node(&erb_if_node->base, allocator);
|
|
746
1057
|
}
|
|
747
1058
|
|
|
748
|
-
static void ast_free_erb_block_node(AST_ERB_BLOCK_NODE_T* erb_block_node) {
|
|
749
|
-
if (erb_block_node->tag_opening != NULL) { token_free(erb_block_node->tag_opening); }
|
|
750
|
-
if (erb_block_node->content != NULL) { token_free(erb_block_node->content); }
|
|
751
|
-
if (erb_block_node->tag_closing != NULL) { token_free(erb_block_node->tag_closing); }
|
|
1059
|
+
static void ast_free_erb_block_node(AST_ERB_BLOCK_NODE_T* erb_block_node, hb_allocator_T* allocator) {
|
|
1060
|
+
if (erb_block_node->tag_opening != NULL) { token_free(erb_block_node->tag_opening, allocator); }
|
|
1061
|
+
if (erb_block_node->content != NULL) { token_free(erb_block_node->content, allocator); }
|
|
1062
|
+
if (erb_block_node->tag_closing != NULL) { token_free(erb_block_node->tag_closing, allocator); }
|
|
1063
|
+
/* prism_node is a borrowed reference into the prism context, not freed here */
|
|
752
1064
|
if (erb_block_node->body != NULL) {
|
|
753
1065
|
for (size_t i = 0; i < hb_array_size(erb_block_node->body); i++) {
|
|
754
1066
|
AST_NODE_T* child = hb_array_get(erb_block_node->body, i);
|
|
755
|
-
if (child) { ast_node_free(child); }
|
|
1067
|
+
if (child) { ast_node_free(child, allocator); }
|
|
756
1068
|
}
|
|
757
1069
|
|
|
758
1070
|
hb_array_free(&erb_block_node->body);
|
|
759
1071
|
}
|
|
760
|
-
ast_node_free((AST_NODE_T*) erb_block_node->end_node);
|
|
1072
|
+
ast_node_free((AST_NODE_T*) erb_block_node->end_node, allocator);
|
|
761
1073
|
|
|
762
|
-
ast_free_base_node(&erb_block_node->base);
|
|
1074
|
+
ast_free_base_node(&erb_block_node->base, allocator);
|
|
763
1075
|
}
|
|
764
1076
|
|
|
765
|
-
static void ast_free_erb_when_node(AST_ERB_WHEN_NODE_T* erb_when_node) {
|
|
766
|
-
if (erb_when_node->tag_opening != NULL) { token_free(erb_when_node->tag_opening); }
|
|
767
|
-
if (erb_when_node->content != NULL) { token_free(erb_when_node->content); }
|
|
768
|
-
if (erb_when_node->tag_closing != NULL) { token_free(erb_when_node->tag_closing); }
|
|
769
|
-
if (erb_when_node->then_keyword != NULL) {
|
|
1077
|
+
static void ast_free_erb_when_node(AST_ERB_WHEN_NODE_T* erb_when_node, hb_allocator_T* allocator) {
|
|
1078
|
+
if (erb_when_node->tag_opening != NULL) { token_free(erb_when_node->tag_opening, allocator); }
|
|
1079
|
+
if (erb_when_node->content != NULL) { token_free(erb_when_node->content, allocator); }
|
|
1080
|
+
if (erb_when_node->tag_closing != NULL) { token_free(erb_when_node->tag_closing, allocator); }
|
|
1081
|
+
if (erb_when_node->then_keyword != NULL) { hb_allocator_dealloc(allocator, erb_when_node->then_keyword); }
|
|
770
1082
|
if (erb_when_node->statements != NULL) {
|
|
771
1083
|
for (size_t i = 0; i < hb_array_size(erb_when_node->statements); i++) {
|
|
772
1084
|
AST_NODE_T* child = hb_array_get(erb_when_node->statements, i);
|
|
773
|
-
if (child) { ast_node_free(child); }
|
|
1085
|
+
if (child) { ast_node_free(child, allocator); }
|
|
774
1086
|
}
|
|
775
1087
|
|
|
776
1088
|
hb_array_free(&erb_when_node->statements);
|
|
777
1089
|
}
|
|
778
1090
|
|
|
779
|
-
ast_free_base_node(&erb_when_node->base);
|
|
1091
|
+
ast_free_base_node(&erb_when_node->base, allocator);
|
|
780
1092
|
}
|
|
781
1093
|
|
|
782
|
-
static void ast_free_erb_case_node(AST_ERB_CASE_NODE_T* erb_case_node) {
|
|
783
|
-
if (erb_case_node->tag_opening != NULL) { token_free(erb_case_node->tag_opening); }
|
|
784
|
-
if (erb_case_node->content != NULL) { token_free(erb_case_node->content); }
|
|
785
|
-
if (erb_case_node->tag_closing != NULL) { token_free(erb_case_node->tag_closing); }
|
|
1094
|
+
static void ast_free_erb_case_node(AST_ERB_CASE_NODE_T* erb_case_node, hb_allocator_T* allocator) {
|
|
1095
|
+
if (erb_case_node->tag_opening != NULL) { token_free(erb_case_node->tag_opening, allocator); }
|
|
1096
|
+
if (erb_case_node->content != NULL) { token_free(erb_case_node->content, allocator); }
|
|
1097
|
+
if (erb_case_node->tag_closing != NULL) { token_free(erb_case_node->tag_closing, allocator); }
|
|
786
1098
|
if (erb_case_node->children != NULL) {
|
|
787
1099
|
for (size_t i = 0; i < hb_array_size(erb_case_node->children); i++) {
|
|
788
1100
|
AST_NODE_T* child = hb_array_get(erb_case_node->children, i);
|
|
789
|
-
if (child) { ast_node_free(child); }
|
|
1101
|
+
if (child) { ast_node_free(child, allocator); }
|
|
790
1102
|
}
|
|
791
1103
|
|
|
792
1104
|
hb_array_free(&erb_case_node->children);
|
|
793
1105
|
}
|
|
1106
|
+
/* prism_node is a borrowed reference into the prism context, not freed here */
|
|
794
1107
|
if (erb_case_node->conditions != NULL) {
|
|
795
1108
|
for (size_t i = 0; i < hb_array_size(erb_case_node->conditions); i++) {
|
|
796
1109
|
AST_NODE_T* child = hb_array_get(erb_case_node->conditions, i);
|
|
797
|
-
if (child) { ast_node_free(child); }
|
|
1110
|
+
if (child) { ast_node_free(child, allocator); }
|
|
798
1111
|
}
|
|
799
1112
|
|
|
800
1113
|
hb_array_free(&erb_case_node->conditions);
|
|
801
1114
|
}
|
|
802
|
-
ast_node_free((AST_NODE_T*) erb_case_node->else_clause);
|
|
803
|
-
ast_node_free((AST_NODE_T*) erb_case_node->end_node);
|
|
1115
|
+
ast_node_free((AST_NODE_T*) erb_case_node->else_clause, allocator);
|
|
1116
|
+
ast_node_free((AST_NODE_T*) erb_case_node->end_node, allocator);
|
|
804
1117
|
|
|
805
|
-
ast_free_base_node(&erb_case_node->base);
|
|
1118
|
+
ast_free_base_node(&erb_case_node->base, allocator);
|
|
806
1119
|
}
|
|
807
1120
|
|
|
808
|
-
static void ast_free_erb_case_match_node(AST_ERB_CASE_MATCH_NODE_T* erb_case_match_node) {
|
|
809
|
-
if (erb_case_match_node->tag_opening != NULL) { token_free(erb_case_match_node->tag_opening); }
|
|
810
|
-
if (erb_case_match_node->content != NULL) { token_free(erb_case_match_node->content); }
|
|
811
|
-
if (erb_case_match_node->tag_closing != NULL) { token_free(erb_case_match_node->tag_closing); }
|
|
1121
|
+
static void ast_free_erb_case_match_node(AST_ERB_CASE_MATCH_NODE_T* erb_case_match_node, hb_allocator_T* allocator) {
|
|
1122
|
+
if (erb_case_match_node->tag_opening != NULL) { token_free(erb_case_match_node->tag_opening, allocator); }
|
|
1123
|
+
if (erb_case_match_node->content != NULL) { token_free(erb_case_match_node->content, allocator); }
|
|
1124
|
+
if (erb_case_match_node->tag_closing != NULL) { token_free(erb_case_match_node->tag_closing, allocator); }
|
|
812
1125
|
if (erb_case_match_node->children != NULL) {
|
|
813
1126
|
for (size_t i = 0; i < hb_array_size(erb_case_match_node->children); i++) {
|
|
814
1127
|
AST_NODE_T* child = hb_array_get(erb_case_match_node->children, i);
|
|
815
|
-
if (child) { ast_node_free(child); }
|
|
1128
|
+
if (child) { ast_node_free(child, allocator); }
|
|
816
1129
|
}
|
|
817
1130
|
|
|
818
1131
|
hb_array_free(&erb_case_match_node->children);
|
|
819
1132
|
}
|
|
1133
|
+
/* prism_node is a borrowed reference into the prism context, not freed here */
|
|
820
1134
|
if (erb_case_match_node->conditions != NULL) {
|
|
821
1135
|
for (size_t i = 0; i < hb_array_size(erb_case_match_node->conditions); i++) {
|
|
822
1136
|
AST_NODE_T* child = hb_array_get(erb_case_match_node->conditions, i);
|
|
823
|
-
if (child) { ast_node_free(child); }
|
|
1137
|
+
if (child) { ast_node_free(child, allocator); }
|
|
824
1138
|
}
|
|
825
1139
|
|
|
826
1140
|
hb_array_free(&erb_case_match_node->conditions);
|
|
827
1141
|
}
|
|
828
|
-
ast_node_free((AST_NODE_T*) erb_case_match_node->else_clause);
|
|
829
|
-
ast_node_free((AST_NODE_T*) erb_case_match_node->end_node);
|
|
1142
|
+
ast_node_free((AST_NODE_T*) erb_case_match_node->else_clause, allocator);
|
|
1143
|
+
ast_node_free((AST_NODE_T*) erb_case_match_node->end_node, allocator);
|
|
830
1144
|
|
|
831
|
-
ast_free_base_node(&erb_case_match_node->base);
|
|
1145
|
+
ast_free_base_node(&erb_case_match_node->base, allocator);
|
|
832
1146
|
}
|
|
833
1147
|
|
|
834
|
-
static void ast_free_erb_while_node(AST_ERB_WHILE_NODE_T* erb_while_node) {
|
|
835
|
-
if (erb_while_node->tag_opening != NULL) { token_free(erb_while_node->tag_opening); }
|
|
836
|
-
if (erb_while_node->content != NULL) { token_free(erb_while_node->content); }
|
|
837
|
-
if (erb_while_node->tag_closing != NULL) { token_free(erb_while_node->tag_closing); }
|
|
1148
|
+
static void ast_free_erb_while_node(AST_ERB_WHILE_NODE_T* erb_while_node, hb_allocator_T* allocator) {
|
|
1149
|
+
if (erb_while_node->tag_opening != NULL) { token_free(erb_while_node->tag_opening, allocator); }
|
|
1150
|
+
if (erb_while_node->content != NULL) { token_free(erb_while_node->content, allocator); }
|
|
1151
|
+
if (erb_while_node->tag_closing != NULL) { token_free(erb_while_node->tag_closing, allocator); }
|
|
1152
|
+
/* prism_node is a borrowed reference into the prism context, not freed here */
|
|
838
1153
|
if (erb_while_node->statements != NULL) {
|
|
839
1154
|
for (size_t i = 0; i < hb_array_size(erb_while_node->statements); i++) {
|
|
840
1155
|
AST_NODE_T* child = hb_array_get(erb_while_node->statements, i);
|
|
841
|
-
if (child) { ast_node_free(child); }
|
|
1156
|
+
if (child) { ast_node_free(child, allocator); }
|
|
842
1157
|
}
|
|
843
1158
|
|
|
844
1159
|
hb_array_free(&erb_while_node->statements);
|
|
845
1160
|
}
|
|
846
|
-
ast_node_free((AST_NODE_T*) erb_while_node->end_node);
|
|
1161
|
+
ast_node_free((AST_NODE_T*) erb_while_node->end_node, allocator);
|
|
847
1162
|
|
|
848
|
-
ast_free_base_node(&erb_while_node->base);
|
|
1163
|
+
ast_free_base_node(&erb_while_node->base, allocator);
|
|
849
1164
|
}
|
|
850
1165
|
|
|
851
|
-
static void ast_free_erb_until_node(AST_ERB_UNTIL_NODE_T* erb_until_node) {
|
|
852
|
-
if (erb_until_node->tag_opening != NULL) { token_free(erb_until_node->tag_opening); }
|
|
853
|
-
if (erb_until_node->content != NULL) { token_free(erb_until_node->content); }
|
|
854
|
-
if (erb_until_node->tag_closing != NULL) { token_free(erb_until_node->tag_closing); }
|
|
1166
|
+
static void ast_free_erb_until_node(AST_ERB_UNTIL_NODE_T* erb_until_node, hb_allocator_T* allocator) {
|
|
1167
|
+
if (erb_until_node->tag_opening != NULL) { token_free(erb_until_node->tag_opening, allocator); }
|
|
1168
|
+
if (erb_until_node->content != NULL) { token_free(erb_until_node->content, allocator); }
|
|
1169
|
+
if (erb_until_node->tag_closing != NULL) { token_free(erb_until_node->tag_closing, allocator); }
|
|
1170
|
+
/* prism_node is a borrowed reference into the prism context, not freed here */
|
|
855
1171
|
if (erb_until_node->statements != NULL) {
|
|
856
1172
|
for (size_t i = 0; i < hb_array_size(erb_until_node->statements); i++) {
|
|
857
1173
|
AST_NODE_T* child = hb_array_get(erb_until_node->statements, i);
|
|
858
|
-
if (child) { ast_node_free(child); }
|
|
1174
|
+
if (child) { ast_node_free(child, allocator); }
|
|
859
1175
|
}
|
|
860
1176
|
|
|
861
1177
|
hb_array_free(&erb_until_node->statements);
|
|
862
1178
|
}
|
|
863
|
-
ast_node_free((AST_NODE_T*) erb_until_node->end_node);
|
|
1179
|
+
ast_node_free((AST_NODE_T*) erb_until_node->end_node, allocator);
|
|
864
1180
|
|
|
865
|
-
ast_free_base_node(&erb_until_node->base);
|
|
1181
|
+
ast_free_base_node(&erb_until_node->base, allocator);
|
|
866
1182
|
}
|
|
867
1183
|
|
|
868
|
-
static void ast_free_erb_for_node(AST_ERB_FOR_NODE_T* erb_for_node) {
|
|
869
|
-
if (erb_for_node->tag_opening != NULL) { token_free(erb_for_node->tag_opening); }
|
|
870
|
-
if (erb_for_node->content != NULL) { token_free(erb_for_node->content); }
|
|
871
|
-
if (erb_for_node->tag_closing != NULL) { token_free(erb_for_node->tag_closing); }
|
|
1184
|
+
static void ast_free_erb_for_node(AST_ERB_FOR_NODE_T* erb_for_node, hb_allocator_T* allocator) {
|
|
1185
|
+
if (erb_for_node->tag_opening != NULL) { token_free(erb_for_node->tag_opening, allocator); }
|
|
1186
|
+
if (erb_for_node->content != NULL) { token_free(erb_for_node->content, allocator); }
|
|
1187
|
+
if (erb_for_node->tag_closing != NULL) { token_free(erb_for_node->tag_closing, allocator); }
|
|
1188
|
+
/* prism_node is a borrowed reference into the prism context, not freed here */
|
|
872
1189
|
if (erb_for_node->statements != NULL) {
|
|
873
1190
|
for (size_t i = 0; i < hb_array_size(erb_for_node->statements); i++) {
|
|
874
1191
|
AST_NODE_T* child = hb_array_get(erb_for_node->statements, i);
|
|
875
|
-
if (child) { ast_node_free(child); }
|
|
1192
|
+
if (child) { ast_node_free(child, allocator); }
|
|
876
1193
|
}
|
|
877
1194
|
|
|
878
1195
|
hb_array_free(&erb_for_node->statements);
|
|
879
1196
|
}
|
|
880
|
-
ast_node_free((AST_NODE_T*) erb_for_node->end_node);
|
|
1197
|
+
ast_node_free((AST_NODE_T*) erb_for_node->end_node, allocator);
|
|
881
1198
|
|
|
882
|
-
ast_free_base_node(&erb_for_node->base);
|
|
1199
|
+
ast_free_base_node(&erb_for_node->base, allocator);
|
|
883
1200
|
}
|
|
884
1201
|
|
|
885
|
-
static void ast_free_erb_rescue_node(AST_ERB_RESCUE_NODE_T* erb_rescue_node) {
|
|
886
|
-
if (erb_rescue_node->tag_opening != NULL) { token_free(erb_rescue_node->tag_opening); }
|
|
887
|
-
if (erb_rescue_node->content != NULL) { token_free(erb_rescue_node->content); }
|
|
888
|
-
if (erb_rescue_node->tag_closing != NULL) { token_free(erb_rescue_node->tag_closing); }
|
|
1202
|
+
static void ast_free_erb_rescue_node(AST_ERB_RESCUE_NODE_T* erb_rescue_node, hb_allocator_T* allocator) {
|
|
1203
|
+
if (erb_rescue_node->tag_opening != NULL) { token_free(erb_rescue_node->tag_opening, allocator); }
|
|
1204
|
+
if (erb_rescue_node->content != NULL) { token_free(erb_rescue_node->content, allocator); }
|
|
1205
|
+
if (erb_rescue_node->tag_closing != NULL) { token_free(erb_rescue_node->tag_closing, allocator); }
|
|
889
1206
|
if (erb_rescue_node->statements != NULL) {
|
|
890
1207
|
for (size_t i = 0; i < hb_array_size(erb_rescue_node->statements); i++) {
|
|
891
1208
|
AST_NODE_T* child = hb_array_get(erb_rescue_node->statements, i);
|
|
892
|
-
if (child) { ast_node_free(child); }
|
|
1209
|
+
if (child) { ast_node_free(child, allocator); }
|
|
893
1210
|
}
|
|
894
1211
|
|
|
895
1212
|
hb_array_free(&erb_rescue_node->statements);
|
|
896
1213
|
}
|
|
897
|
-
ast_node_free((AST_NODE_T*) erb_rescue_node->subsequent);
|
|
1214
|
+
ast_node_free((AST_NODE_T*) erb_rescue_node->subsequent, allocator);
|
|
898
1215
|
|
|
899
|
-
ast_free_base_node(&erb_rescue_node->base);
|
|
1216
|
+
ast_free_base_node(&erb_rescue_node->base, allocator);
|
|
900
1217
|
}
|
|
901
1218
|
|
|
902
|
-
static void ast_free_erb_ensure_node(AST_ERB_ENSURE_NODE_T* erb_ensure_node) {
|
|
903
|
-
if (erb_ensure_node->tag_opening != NULL) { token_free(erb_ensure_node->tag_opening); }
|
|
904
|
-
if (erb_ensure_node->content != NULL) { token_free(erb_ensure_node->content); }
|
|
905
|
-
if (erb_ensure_node->tag_closing != NULL) { token_free(erb_ensure_node->tag_closing); }
|
|
1219
|
+
static void ast_free_erb_ensure_node(AST_ERB_ENSURE_NODE_T* erb_ensure_node, hb_allocator_T* allocator) {
|
|
1220
|
+
if (erb_ensure_node->tag_opening != NULL) { token_free(erb_ensure_node->tag_opening, allocator); }
|
|
1221
|
+
if (erb_ensure_node->content != NULL) { token_free(erb_ensure_node->content, allocator); }
|
|
1222
|
+
if (erb_ensure_node->tag_closing != NULL) { token_free(erb_ensure_node->tag_closing, allocator); }
|
|
906
1223
|
if (erb_ensure_node->statements != NULL) {
|
|
907
1224
|
for (size_t i = 0; i < hb_array_size(erb_ensure_node->statements); i++) {
|
|
908
1225
|
AST_NODE_T* child = hb_array_get(erb_ensure_node->statements, i);
|
|
909
|
-
if (child) { ast_node_free(child); }
|
|
1226
|
+
if (child) { ast_node_free(child, allocator); }
|
|
910
1227
|
}
|
|
911
1228
|
|
|
912
1229
|
hb_array_free(&erb_ensure_node->statements);
|
|
913
1230
|
}
|
|
914
1231
|
|
|
915
|
-
ast_free_base_node(&erb_ensure_node->base);
|
|
1232
|
+
ast_free_base_node(&erb_ensure_node->base, allocator);
|
|
916
1233
|
}
|
|
917
1234
|
|
|
918
|
-
static void ast_free_erb_begin_node(AST_ERB_BEGIN_NODE_T* erb_begin_node) {
|
|
919
|
-
if (erb_begin_node->tag_opening != NULL) { token_free(erb_begin_node->tag_opening); }
|
|
920
|
-
if (erb_begin_node->content != NULL) { token_free(erb_begin_node->content); }
|
|
921
|
-
if (erb_begin_node->tag_closing != NULL) { token_free(erb_begin_node->tag_closing); }
|
|
1235
|
+
static void ast_free_erb_begin_node(AST_ERB_BEGIN_NODE_T* erb_begin_node, hb_allocator_T* allocator) {
|
|
1236
|
+
if (erb_begin_node->tag_opening != NULL) { token_free(erb_begin_node->tag_opening, allocator); }
|
|
1237
|
+
if (erb_begin_node->content != NULL) { token_free(erb_begin_node->content, allocator); }
|
|
1238
|
+
if (erb_begin_node->tag_closing != NULL) { token_free(erb_begin_node->tag_closing, allocator); }
|
|
1239
|
+
/* prism_node is a borrowed reference into the prism context, not freed here */
|
|
922
1240
|
if (erb_begin_node->statements != NULL) {
|
|
923
1241
|
for (size_t i = 0; i < hb_array_size(erb_begin_node->statements); i++) {
|
|
924
1242
|
AST_NODE_T* child = hb_array_get(erb_begin_node->statements, i);
|
|
925
|
-
if (child) { ast_node_free(child); }
|
|
1243
|
+
if (child) { ast_node_free(child, allocator); }
|
|
926
1244
|
}
|
|
927
1245
|
|
|
928
1246
|
hb_array_free(&erb_begin_node->statements);
|
|
929
1247
|
}
|
|
930
|
-
ast_node_free((AST_NODE_T*) erb_begin_node->rescue_clause);
|
|
931
|
-
ast_node_free((AST_NODE_T*) erb_begin_node->else_clause);
|
|
932
|
-
ast_node_free((AST_NODE_T*) erb_begin_node->ensure_clause);
|
|
933
|
-
ast_node_free((AST_NODE_T*) erb_begin_node->end_node);
|
|
1248
|
+
ast_node_free((AST_NODE_T*) erb_begin_node->rescue_clause, allocator);
|
|
1249
|
+
ast_node_free((AST_NODE_T*) erb_begin_node->else_clause, allocator);
|
|
1250
|
+
ast_node_free((AST_NODE_T*) erb_begin_node->ensure_clause, allocator);
|
|
1251
|
+
ast_node_free((AST_NODE_T*) erb_begin_node->end_node, allocator);
|
|
934
1252
|
|
|
935
|
-
ast_free_base_node(&erb_begin_node->base);
|
|
1253
|
+
ast_free_base_node(&erb_begin_node->base, allocator);
|
|
936
1254
|
}
|
|
937
1255
|
|
|
938
|
-
static void ast_free_erb_unless_node(AST_ERB_UNLESS_NODE_T* erb_unless_node) {
|
|
939
|
-
if (erb_unless_node->tag_opening != NULL) { token_free(erb_unless_node->tag_opening); }
|
|
940
|
-
if (erb_unless_node->content != NULL) { token_free(erb_unless_node->content); }
|
|
941
|
-
if (erb_unless_node->tag_closing != NULL) { token_free(erb_unless_node->tag_closing); }
|
|
942
|
-
if (erb_unless_node->then_keyword != NULL) {
|
|
1256
|
+
static void ast_free_erb_unless_node(AST_ERB_UNLESS_NODE_T* erb_unless_node, hb_allocator_T* allocator) {
|
|
1257
|
+
if (erb_unless_node->tag_opening != NULL) { token_free(erb_unless_node->tag_opening, allocator); }
|
|
1258
|
+
if (erb_unless_node->content != NULL) { token_free(erb_unless_node->content, allocator); }
|
|
1259
|
+
if (erb_unless_node->tag_closing != NULL) { token_free(erb_unless_node->tag_closing, allocator); }
|
|
1260
|
+
if (erb_unless_node->then_keyword != NULL) { hb_allocator_dealloc(allocator, erb_unless_node->then_keyword); }
|
|
1261
|
+
/* prism_node is a borrowed reference into the prism context, not freed here */
|
|
943
1262
|
if (erb_unless_node->statements != NULL) {
|
|
944
1263
|
for (size_t i = 0; i < hb_array_size(erb_unless_node->statements); i++) {
|
|
945
1264
|
AST_NODE_T* child = hb_array_get(erb_unless_node->statements, i);
|
|
946
|
-
if (child) { ast_node_free(child); }
|
|
1265
|
+
if (child) { ast_node_free(child, allocator); }
|
|
947
1266
|
}
|
|
948
1267
|
|
|
949
1268
|
hb_array_free(&erb_unless_node->statements);
|
|
950
1269
|
}
|
|
951
|
-
ast_node_free((AST_NODE_T*) erb_unless_node->else_clause);
|
|
952
|
-
ast_node_free((AST_NODE_T*) erb_unless_node->end_node);
|
|
1270
|
+
ast_node_free((AST_NODE_T*) erb_unless_node->else_clause, allocator);
|
|
1271
|
+
ast_node_free((AST_NODE_T*) erb_unless_node->end_node, allocator);
|
|
1272
|
+
|
|
1273
|
+
ast_free_base_node(&erb_unless_node->base, allocator);
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
static void ast_free_ruby_render_local_node(AST_RUBY_RENDER_LOCAL_NODE_T* ruby_render_local_node, hb_allocator_T* allocator) {
|
|
1277
|
+
if (ruby_render_local_node->name != NULL) { token_free(ruby_render_local_node->name, allocator); }
|
|
1278
|
+
ast_node_free((AST_NODE_T*) ruby_render_local_node->value, allocator);
|
|
1279
|
+
|
|
1280
|
+
ast_free_base_node(&ruby_render_local_node->base, allocator);
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
static void ast_free_erb_render_node(AST_ERB_RENDER_NODE_T* erb_render_node, hb_allocator_T* allocator) {
|
|
1284
|
+
if (erb_render_node->tag_opening != NULL) { token_free(erb_render_node->tag_opening, allocator); }
|
|
1285
|
+
if (erb_render_node->content != NULL) { token_free(erb_render_node->content, allocator); }
|
|
1286
|
+
if (erb_render_node->tag_closing != NULL) { token_free(erb_render_node->tag_closing, allocator); }
|
|
1287
|
+
if (erb_render_node->analyzed_ruby != NULL) {
|
|
1288
|
+
free_analyzed_ruby(erb_render_node->analyzed_ruby);
|
|
1289
|
+
}
|
|
1290
|
+
/* prism_node is a borrowed reference into the prism context, not freed here */
|
|
1291
|
+
if (erb_render_node->partial != NULL) { token_free(erb_render_node->partial, allocator); }
|
|
1292
|
+
if (erb_render_node->template_path != NULL) { token_free(erb_render_node->template_path, allocator); }
|
|
1293
|
+
if (erb_render_node->layout != NULL) { token_free(erb_render_node->layout, allocator); }
|
|
1294
|
+
if (erb_render_node->file != NULL) { token_free(erb_render_node->file, allocator); }
|
|
1295
|
+
if (erb_render_node->inline_template != NULL) { token_free(erb_render_node->inline_template, allocator); }
|
|
1296
|
+
if (erb_render_node->body != NULL) { token_free(erb_render_node->body, allocator); }
|
|
1297
|
+
if (erb_render_node->plain != NULL) { token_free(erb_render_node->plain, allocator); }
|
|
1298
|
+
if (erb_render_node->html != NULL) { token_free(erb_render_node->html, allocator); }
|
|
1299
|
+
if (erb_render_node->renderable != NULL) { token_free(erb_render_node->renderable, allocator); }
|
|
1300
|
+
if (erb_render_node->collection != NULL) { token_free(erb_render_node->collection, allocator); }
|
|
1301
|
+
if (erb_render_node->object != NULL) { token_free(erb_render_node->object, allocator); }
|
|
1302
|
+
if (erb_render_node->as_name != NULL) { token_free(erb_render_node->as_name, allocator); }
|
|
1303
|
+
if (erb_render_node->spacer_template != NULL) { token_free(erb_render_node->spacer_template, allocator); }
|
|
1304
|
+
if (erb_render_node->formats != NULL) { token_free(erb_render_node->formats, allocator); }
|
|
1305
|
+
if (erb_render_node->variants != NULL) { token_free(erb_render_node->variants, allocator); }
|
|
1306
|
+
if (erb_render_node->handlers != NULL) { token_free(erb_render_node->handlers, allocator); }
|
|
1307
|
+
if (erb_render_node->content_type != NULL) { token_free(erb_render_node->content_type, allocator); }
|
|
1308
|
+
if (erb_render_node->locals != NULL) {
|
|
1309
|
+
for (size_t i = 0; i < hb_array_size(erb_render_node->locals); i++) {
|
|
1310
|
+
AST_NODE_T* child = hb_array_get(erb_render_node->locals, i);
|
|
1311
|
+
if (child) { ast_node_free(child, allocator); }
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
hb_array_free(&erb_render_node->locals);
|
|
1315
|
+
}
|
|
953
1316
|
|
|
954
|
-
ast_free_base_node(&
|
|
1317
|
+
ast_free_base_node(&erb_render_node->base, allocator);
|
|
955
1318
|
}
|
|
956
1319
|
|
|
957
|
-
static void ast_free_erb_yield_node(AST_ERB_YIELD_NODE_T* erb_yield_node) {
|
|
958
|
-
if (erb_yield_node->tag_opening != NULL) { token_free(erb_yield_node->tag_opening); }
|
|
959
|
-
if (erb_yield_node->content != NULL) { token_free(erb_yield_node->content); }
|
|
960
|
-
if (erb_yield_node->tag_closing != NULL) { token_free(erb_yield_node->tag_closing); }
|
|
1320
|
+
static void ast_free_erb_yield_node(AST_ERB_YIELD_NODE_T* erb_yield_node, hb_allocator_T* allocator) {
|
|
1321
|
+
if (erb_yield_node->tag_opening != NULL) { token_free(erb_yield_node->tag_opening, allocator); }
|
|
1322
|
+
if (erb_yield_node->content != NULL) { token_free(erb_yield_node->content, allocator); }
|
|
1323
|
+
if (erb_yield_node->tag_closing != NULL) { token_free(erb_yield_node->tag_closing, allocator); }
|
|
961
1324
|
|
|
962
|
-
ast_free_base_node(&erb_yield_node->base);
|
|
1325
|
+
ast_free_base_node(&erb_yield_node->base, allocator);
|
|
963
1326
|
}
|
|
964
1327
|
|
|
965
|
-
static void ast_free_erb_in_node(AST_ERB_IN_NODE_T* erb_in_node) {
|
|
966
|
-
if (erb_in_node->tag_opening != NULL) { token_free(erb_in_node->tag_opening); }
|
|
967
|
-
if (erb_in_node->content != NULL) { token_free(erb_in_node->content); }
|
|
968
|
-
if (erb_in_node->tag_closing != NULL) { token_free(erb_in_node->tag_closing); }
|
|
969
|
-
if (erb_in_node->then_keyword != NULL) {
|
|
1328
|
+
static void ast_free_erb_in_node(AST_ERB_IN_NODE_T* erb_in_node, hb_allocator_T* allocator) {
|
|
1329
|
+
if (erb_in_node->tag_opening != NULL) { token_free(erb_in_node->tag_opening, allocator); }
|
|
1330
|
+
if (erb_in_node->content != NULL) { token_free(erb_in_node->content, allocator); }
|
|
1331
|
+
if (erb_in_node->tag_closing != NULL) { token_free(erb_in_node->tag_closing, allocator); }
|
|
1332
|
+
if (erb_in_node->then_keyword != NULL) { hb_allocator_dealloc(allocator, erb_in_node->then_keyword); }
|
|
970
1333
|
if (erb_in_node->statements != NULL) {
|
|
971
1334
|
for (size_t i = 0; i < hb_array_size(erb_in_node->statements); i++) {
|
|
972
1335
|
AST_NODE_T* child = hb_array_get(erb_in_node->statements, i);
|
|
973
|
-
if (child) { ast_node_free(child); }
|
|
1336
|
+
if (child) { ast_node_free(child, allocator); }
|
|
974
1337
|
}
|
|
975
1338
|
|
|
976
1339
|
hb_array_free(&erb_in_node->statements);
|
|
977
1340
|
}
|
|
978
1341
|
|
|
979
|
-
ast_free_base_node(&erb_in_node->base);
|
|
1342
|
+
ast_free_base_node(&erb_in_node->base, allocator);
|
|
980
1343
|
}
|
|
981
1344
|
|
|
982
|
-
void ast_node_free(AST_NODE_T* node) {
|
|
1345
|
+
void ast_node_free(AST_NODE_T* node, hb_allocator_T* allocator) {
|
|
983
1346
|
if (!node) { return; }
|
|
984
1347
|
|
|
985
1348
|
switch (node->type) {
|
|
986
|
-
case AST_DOCUMENT_NODE: ast_free_document_node((AST_DOCUMENT_NODE_T*) node); break;
|
|
987
|
-
case AST_LITERAL_NODE: ast_free_literal_node((AST_LITERAL_NODE_T*) node); break;
|
|
988
|
-
case AST_HTML_OPEN_TAG_NODE: ast_free_html_open_tag_node((AST_HTML_OPEN_TAG_NODE_T*) node); break;
|
|
989
|
-
case
|
|
990
|
-
case
|
|
991
|
-
case
|
|
992
|
-
case
|
|
993
|
-
case
|
|
994
|
-
case
|
|
995
|
-
case
|
|
996
|
-
case
|
|
997
|
-
case
|
|
998
|
-
case
|
|
999
|
-
case
|
|
1000
|
-
case
|
|
1001
|
-
case
|
|
1002
|
-
case
|
|
1003
|
-
case
|
|
1004
|
-
case
|
|
1005
|
-
case
|
|
1006
|
-
case
|
|
1007
|
-
case
|
|
1008
|
-
case
|
|
1009
|
-
case
|
|
1010
|
-
case
|
|
1011
|
-
case
|
|
1012
|
-
case
|
|
1013
|
-
case
|
|
1014
|
-
case
|
|
1015
|
-
case
|
|
1016
|
-
case
|
|
1349
|
+
case AST_DOCUMENT_NODE: ast_free_document_node((AST_DOCUMENT_NODE_T*) node, allocator); break;
|
|
1350
|
+
case AST_LITERAL_NODE: ast_free_literal_node((AST_LITERAL_NODE_T*) node, allocator); break;
|
|
1351
|
+
case AST_HTML_OPEN_TAG_NODE: ast_free_html_open_tag_node((AST_HTML_OPEN_TAG_NODE_T*) node, allocator); break;
|
|
1352
|
+
case AST_HTML_CONDITIONAL_OPEN_TAG_NODE: ast_free_html_conditional_open_tag_node((AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T*) node, allocator); break;
|
|
1353
|
+
case AST_HTML_CLOSE_TAG_NODE: ast_free_html_close_tag_node((AST_HTML_CLOSE_TAG_NODE_T*) node, allocator); break;
|
|
1354
|
+
case AST_HTML_OMITTED_CLOSE_TAG_NODE: ast_free_html_omitted_close_tag_node((AST_HTML_OMITTED_CLOSE_TAG_NODE_T*) node, allocator); break;
|
|
1355
|
+
case AST_HTML_VIRTUAL_CLOSE_TAG_NODE: ast_free_html_virtual_close_tag_node((AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T*) node, allocator); break;
|
|
1356
|
+
case AST_HTML_ELEMENT_NODE: ast_free_html_element_node((AST_HTML_ELEMENT_NODE_T*) node, allocator); break;
|
|
1357
|
+
case AST_HTML_CONDITIONAL_ELEMENT_NODE: ast_free_html_conditional_element_node((AST_HTML_CONDITIONAL_ELEMENT_NODE_T*) node, allocator); break;
|
|
1358
|
+
case AST_HTML_ATTRIBUTE_VALUE_NODE: ast_free_html_attribute_value_node((AST_HTML_ATTRIBUTE_VALUE_NODE_T*) node, allocator); break;
|
|
1359
|
+
case AST_HTML_ATTRIBUTE_NAME_NODE: ast_free_html_attribute_name_node((AST_HTML_ATTRIBUTE_NAME_NODE_T*) node, allocator); break;
|
|
1360
|
+
case AST_HTML_ATTRIBUTE_NODE: ast_free_html_attribute_node((AST_HTML_ATTRIBUTE_NODE_T*) node, allocator); break;
|
|
1361
|
+
case AST_RUBY_LITERAL_NODE: ast_free_ruby_literal_node((AST_RUBY_LITERAL_NODE_T*) node, allocator); break;
|
|
1362
|
+
case AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE: ast_free_ruby_html_attributes_splat_node((AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T*) node, allocator); break;
|
|
1363
|
+
case AST_ERB_OPEN_TAG_NODE: ast_free_erb_open_tag_node((AST_ERB_OPEN_TAG_NODE_T*) node, allocator); break;
|
|
1364
|
+
case AST_HTML_TEXT_NODE: ast_free_html_text_node((AST_HTML_TEXT_NODE_T*) node, allocator); break;
|
|
1365
|
+
case AST_HTML_COMMENT_NODE: ast_free_html_comment_node((AST_HTML_COMMENT_NODE_T*) node, allocator); break;
|
|
1366
|
+
case AST_HTML_DOCTYPE_NODE: ast_free_html_doctype_node((AST_HTML_DOCTYPE_NODE_T*) node, allocator); break;
|
|
1367
|
+
case AST_XML_DECLARATION_NODE: ast_free_xml_declaration_node((AST_XML_DECLARATION_NODE_T*) node, allocator); break;
|
|
1368
|
+
case AST_CDATA_NODE: ast_free_cdata_node((AST_CDATA_NODE_T*) node, allocator); break;
|
|
1369
|
+
case AST_WHITESPACE_NODE: ast_free_whitespace_node((AST_WHITESPACE_NODE_T*) node, allocator); break;
|
|
1370
|
+
case AST_ERB_CONTENT_NODE: ast_free_erb_content_node((AST_ERB_CONTENT_NODE_T*) node, allocator); break;
|
|
1371
|
+
case AST_ERB_END_NODE: ast_free_erb_end_node((AST_ERB_END_NODE_T*) node, allocator); break;
|
|
1372
|
+
case AST_ERB_ELSE_NODE: ast_free_erb_else_node((AST_ERB_ELSE_NODE_T*) node, allocator); break;
|
|
1373
|
+
case AST_ERB_IF_NODE: ast_free_erb_if_node((AST_ERB_IF_NODE_T*) node, allocator); break;
|
|
1374
|
+
case AST_ERB_BLOCK_NODE: ast_free_erb_block_node((AST_ERB_BLOCK_NODE_T*) node, allocator); break;
|
|
1375
|
+
case AST_ERB_WHEN_NODE: ast_free_erb_when_node((AST_ERB_WHEN_NODE_T*) node, allocator); break;
|
|
1376
|
+
case AST_ERB_CASE_NODE: ast_free_erb_case_node((AST_ERB_CASE_NODE_T*) node, allocator); break;
|
|
1377
|
+
case AST_ERB_CASE_MATCH_NODE: ast_free_erb_case_match_node((AST_ERB_CASE_MATCH_NODE_T*) node, allocator); break;
|
|
1378
|
+
case AST_ERB_WHILE_NODE: ast_free_erb_while_node((AST_ERB_WHILE_NODE_T*) node, allocator); break;
|
|
1379
|
+
case AST_ERB_UNTIL_NODE: ast_free_erb_until_node((AST_ERB_UNTIL_NODE_T*) node, allocator); break;
|
|
1380
|
+
case AST_ERB_FOR_NODE: ast_free_erb_for_node((AST_ERB_FOR_NODE_T*) node, allocator); break;
|
|
1381
|
+
case AST_ERB_RESCUE_NODE: ast_free_erb_rescue_node((AST_ERB_RESCUE_NODE_T*) node, allocator); break;
|
|
1382
|
+
case AST_ERB_ENSURE_NODE: ast_free_erb_ensure_node((AST_ERB_ENSURE_NODE_T*) node, allocator); break;
|
|
1383
|
+
case AST_ERB_BEGIN_NODE: ast_free_erb_begin_node((AST_ERB_BEGIN_NODE_T*) node, allocator); break;
|
|
1384
|
+
case AST_ERB_UNLESS_NODE: ast_free_erb_unless_node((AST_ERB_UNLESS_NODE_T*) node, allocator); break;
|
|
1385
|
+
case AST_RUBY_RENDER_LOCAL_NODE: ast_free_ruby_render_local_node((AST_RUBY_RENDER_LOCAL_NODE_T*) node, allocator); break;
|
|
1386
|
+
case AST_ERB_RENDER_NODE: ast_free_erb_render_node((AST_ERB_RENDER_NODE_T*) node, allocator); break;
|
|
1387
|
+
case AST_ERB_YIELD_NODE: ast_free_erb_yield_node((AST_ERB_YIELD_NODE_T*) node, allocator); break;
|
|
1388
|
+
case AST_ERB_IN_NODE: ast_free_erb_in_node((AST_ERB_IN_NODE_T*) node, allocator); break;
|
|
1017
1389
|
}
|
|
1018
1390
|
}
|