herb 0.9.6-arm-linux-gnu → 0.10.0-arm-linux-gnu
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/ext/herb/extconf.rb +1 -0
- data/ext/herb/extension.c +108 -0
- data/herb.gemspec +1 -1
- data/lib/herb/3.2/herb.so +0 -0
- data/lib/herb/3.3/herb.so +0 -0
- data/lib/herb/3.4/herb.so +0 -0
- data/lib/herb/4.0/herb.so +0 -0
- data/lib/herb/action_view/render_analyzer.rb +1057 -0
- data/lib/herb/ast/erb_render_node.rb +155 -0
- data/lib/herb/bootstrap.rb +0 -1
- data/lib/herb/cli.rb +253 -19
- data/lib/herb/colors.rb +18 -0
- data/lib/herb/configuration.rb +49 -13
- data/lib/herb/defaults.yml +3 -0
- data/lib/herb/dev/runner.rb +445 -0
- data/lib/herb/dev/server.rb +207 -0
- data/lib/herb/dev/server_entry.rb +128 -0
- data/lib/herb/diff_operation.rb +34 -0
- data/lib/herb/diff_result.rb +59 -0
- data/lib/herb/engine/compiler.rb +56 -3
- data/lib/herb/engine/validators/render_validator.rb +92 -0
- data/lib/herb/engine.rb +58 -4
- data/lib/herb/html/util.rb +16 -0
- data/lib/herb/project.rb +1 -6
- data/lib/herb/version.rb +1 -1
- data/lib/herb.rb +41 -5
- data/sig/herb/action_view/render_analyzer.rbs +122 -0
- data/sig/herb/ast/erb_render_node.rbs +29 -0
- data/sig/herb/colors.rbs +12 -0
- data/sig/herb/configuration.rbs +20 -1
- data/sig/herb/dev/runner.rbs +59 -0
- data/sig/herb/dev/server.rbs +50 -0
- data/sig/herb/dev/server_entry.rbs +51 -0
- data/sig/herb/diff_operation.rbs +34 -0
- data/sig/herb/diff_result.rbs +34 -0
- data/sig/herb/engine/compiler.rbs +6 -0
- data/sig/herb/engine/validators/render_validator.rbs +21 -0
- data/sig/herb/engine.rbs +15 -0
- data/sig/herb/html/util.rbs +13 -0
- data/sig/herb.rbs +12 -2
- data/sig/herb_c_extension.rbs +1 -1
- data/sig/vendor/did_you_mean.rbs +6 -0
- data/sig/vendor/parallel.rbs +4 -0
- data/src/analyze/action_view/attribute_extraction_helpers.c +3 -2
- data/src/diff/herb_diff.c +137 -0
- data/src/diff/herb_diff_attributes.c +207 -0
- data/src/diff/herb_diff_children.c +518 -0
- data/src/diff/herb_diff_helpers.c +114 -0
- data/src/diff/herb_diff_nodes.c +707 -0
- data/src/diff/herb_hash.c +42 -0
- data/src/diff/herb_hash_index_map.c +47 -0
- data/src/diff/herb_hash_map.c +104 -0
- data/src/diff/herb_hash_tree.c +680 -0
- data/src/include/diff/herb_diff.h +118 -0
- data/src/include/diff/herb_hash.h +25 -0
- data/src/include/diff/herb_hash_index_map.h +32 -0
- data/src/include/diff/herb_hash_map.h +30 -0
- data/src/include/herb.h +1 -0
- data/src/include/version.h +1 -1
- data/templates/javascript/packages/core/src/config.ts.erb +43 -0
- data/templates/rust/src/ast/nodes.rs.erb +1 -1
- data/templates/rust/src/config.rs.erb +50 -0
- data/templates/src/diff/herb_diff_helpers.c.erb +38 -0
- data/templates/src/diff/herb_diff_nodes.c.erb +224 -0
- data/templates/src/diff/herb_hash_tree.c.erb +147 -0
- data/templates/template.rb +4 -4
- metadata +40 -4
- data/lib/herb/3.0/herb.so +0 -0
- data/lib/herb/3.1/herb.so +0 -0
|
@@ -0,0 +1,707 @@
|
|
|
1
|
+
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2
|
+
// be modified manually. See /home/runner/work/herb/herb/templates/src/diff/herb_diff_nodes.c.erb
|
|
3
|
+
|
|
4
|
+
#include "../include/diff/herb_diff.h"
|
|
5
|
+
#include "../include/lib/hb_string.h"
|
|
6
|
+
|
|
7
|
+
static bool tokens_equal(const token_T* old_token, const token_T* new_token) {
|
|
8
|
+
if (old_token == NULL && new_token == NULL) { return true; }
|
|
9
|
+
if (old_token == NULL || new_token == NULL) { return false; }
|
|
10
|
+
|
|
11
|
+
return hb_string_equals(old_token->value, new_token->value);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static void diff_element_node(
|
|
15
|
+
const AST_HTML_ELEMENT_NODE_T* old_element,
|
|
16
|
+
const AST_HTML_ELEMENT_NODE_T* new_element,
|
|
17
|
+
const herb_diff_path_T path,
|
|
18
|
+
const herb_hash_map_T* old_hashes,
|
|
19
|
+
const herb_hash_map_T* new_hashes,
|
|
20
|
+
herb_diff_result_T* result
|
|
21
|
+
) {
|
|
22
|
+
if (!tokens_equal(old_element->tag_name, new_element->tag_name)) {
|
|
23
|
+
herb_diff_emit_operation(result, HERB_DIFF_TAG_NAME_CHANGED, path, (const AST_NODE_T*) old_element, (const AST_NODE_T*) new_element, 0, 0);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (old_element->open_tag != NULL && new_element->open_tag != NULL) {
|
|
27
|
+
herb_hash_T old_open_hash = herb_hash_map_get(old_hashes, old_element->open_tag);
|
|
28
|
+
herb_hash_T new_open_hash = herb_hash_map_get(new_hashes, new_element->open_tag);
|
|
29
|
+
|
|
30
|
+
if (old_open_hash != new_open_hash) {
|
|
31
|
+
const AST_HTML_OPEN_TAG_NODE_T* old_open_tag = (const AST_HTML_OPEN_TAG_NODE_T*) old_element->open_tag;
|
|
32
|
+
const AST_HTML_OPEN_TAG_NODE_T* new_open_tag = (const AST_HTML_OPEN_TAG_NODE_T*) new_element->open_tag;
|
|
33
|
+
|
|
34
|
+
herb_diff_attributes(old_open_tag->children, new_open_tag->children, path, old_hashes, new_hashes, result);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (old_element->body != NULL && new_element->body != NULL) {
|
|
39
|
+
herb_diff_children(old_element->body, new_element->body, path, old_hashes, new_hashes, result);
|
|
40
|
+
} else if (old_element->body == NULL && new_element->body != NULL) {
|
|
41
|
+
for (size_t index = 0; index < hb_array_size(new_element->body); index++) {
|
|
42
|
+
const AST_NODE_T* new_child = (const AST_NODE_T*) hb_array_get(new_element->body, index);
|
|
43
|
+
herb_diff_emit_operation(result, HERB_DIFF_NODE_INSERTED, herb_diff_path_append(path, (uint32_t) index), NULL, new_child, 0, (uint32_t) index);
|
|
44
|
+
}
|
|
45
|
+
} else if (old_element->body != NULL && new_element->body == NULL) {
|
|
46
|
+
for (size_t index = 0; index < hb_array_size(old_element->body); index++) {
|
|
47
|
+
const AST_NODE_T* old_child = (const AST_NODE_T*) hb_array_get(old_element->body, index);
|
|
48
|
+
herb_diff_emit_operation(result, HERB_DIFF_NODE_REMOVED, herb_diff_path_append(path, (uint32_t) index), old_child, NULL, (uint32_t) index, 0);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static void diff_conditional_element_node(
|
|
54
|
+
const AST_HTML_CONDITIONAL_ELEMENT_NODE_T* old_element,
|
|
55
|
+
const AST_HTML_CONDITIONAL_ELEMENT_NODE_T* new_element,
|
|
56
|
+
const herb_diff_path_T path,
|
|
57
|
+
const herb_hash_map_T* old_hashes,
|
|
58
|
+
const herb_hash_map_T* new_hashes,
|
|
59
|
+
herb_diff_result_T* result
|
|
60
|
+
) {
|
|
61
|
+
if (!tokens_equal(old_element->tag_name, new_element->tag_name)) {
|
|
62
|
+
herb_diff_emit_operation(result, HERB_DIFF_TAG_NAME_CHANGED, path, (const AST_NODE_T*) old_element, (const AST_NODE_T*) new_element, 0, 0);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (old_element->open_tag != NULL && new_element->open_tag != NULL) {
|
|
66
|
+
herb_hash_T old_open_hash = herb_hash_map_get(old_hashes, (const AST_NODE_T*) old_element->open_tag);
|
|
67
|
+
herb_hash_T new_open_hash = herb_hash_map_get(new_hashes, (const AST_NODE_T*) new_element->open_tag);
|
|
68
|
+
|
|
69
|
+
if (old_open_hash != new_open_hash) {
|
|
70
|
+
herb_diff_attributes(old_element->open_tag->children, new_element->open_tag->children, path, old_hashes, new_hashes, result);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (old_element->body != NULL && new_element->body != NULL) {
|
|
75
|
+
herb_diff_children(old_element->body, new_element->body, path, old_hashes, new_hashes, result);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
static void diff_children_nullable(
|
|
80
|
+
const hb_array_T* old_children,
|
|
81
|
+
const hb_array_T* new_children,
|
|
82
|
+
const herb_diff_path_T path,
|
|
83
|
+
const herb_hash_map_T* old_hashes,
|
|
84
|
+
const herb_hash_map_T* new_hashes,
|
|
85
|
+
herb_diff_result_T* result
|
|
86
|
+
) {
|
|
87
|
+
if (old_children != NULL && new_children != NULL) {
|
|
88
|
+
herb_diff_children(old_children, new_children, path, old_hashes, new_hashes, result);
|
|
89
|
+
} else if (old_children == NULL && new_children != NULL) {
|
|
90
|
+
for (size_t index = 0; index < hb_array_size(new_children); index++) {
|
|
91
|
+
const AST_NODE_T* new_child = (const AST_NODE_T*) hb_array_get(new_children, index);
|
|
92
|
+
herb_diff_emit_operation(result, HERB_DIFF_NODE_INSERTED, herb_diff_path_append(path, (uint32_t) index), NULL, new_child, 0, (uint32_t) index);
|
|
93
|
+
}
|
|
94
|
+
} else if (old_children != NULL && new_children == NULL) {
|
|
95
|
+
for (size_t index = 0; index < hb_array_size(old_children); index++) {
|
|
96
|
+
const AST_NODE_T* old_child = (const AST_NODE_T*) hb_array_get(old_children, index);
|
|
97
|
+
herb_diff_emit_operation(result, HERB_DIFF_NODE_REMOVED, herb_diff_path_append(path, (uint32_t) index), old_child, NULL, (uint32_t) index, 0);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
void herb_diff_node(
|
|
103
|
+
const AST_NODE_T* old_node,
|
|
104
|
+
const AST_NODE_T* new_node,
|
|
105
|
+
const herb_diff_path_T path,
|
|
106
|
+
const herb_hash_map_T* old_hashes,
|
|
107
|
+
const herb_hash_map_T* new_hashes,
|
|
108
|
+
herb_diff_result_T* result
|
|
109
|
+
) {
|
|
110
|
+
if (old_node == NULL && new_node == NULL) { return; }
|
|
111
|
+
|
|
112
|
+
if (old_node == NULL) {
|
|
113
|
+
herb_diff_emit_operation(result, HERB_DIFF_NODE_INSERTED, path, NULL, new_node, 0, 0);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (new_node == NULL) {
|
|
118
|
+
herb_diff_emit_operation(result, HERB_DIFF_NODE_REMOVED, path, old_node, NULL, 0, 0);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
herb_hash_T old_hash = herb_hash_map_get(old_hashes, old_node);
|
|
123
|
+
herb_hash_T new_hash = herb_hash_map_get(new_hashes, new_node);
|
|
124
|
+
|
|
125
|
+
if (old_hash == new_hash) { return; }
|
|
126
|
+
|
|
127
|
+
if (old_node->type != new_node->type) {
|
|
128
|
+
herb_diff_emit_operation(result, HERB_DIFF_NODE_REPLACED, path, old_node, new_node, 0, 0);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
switch (old_node->type) {
|
|
133
|
+
case AST_DOCUMENT_NODE: {
|
|
134
|
+
const AST_DOCUMENT_NODE_T* old_document_node = (const AST_DOCUMENT_NODE_T*) old_node;
|
|
135
|
+
const AST_DOCUMENT_NODE_T* new_document_node = (const AST_DOCUMENT_NODE_T*) new_node;
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
diff_children_nullable(old_document_node->children, new_document_node->children, path, old_hashes, new_hashes, result);
|
|
140
|
+
|
|
141
|
+
} break;
|
|
142
|
+
|
|
143
|
+
case AST_LITERAL_NODE: {
|
|
144
|
+
const AST_LITERAL_NODE_T* old_literal_node = (const AST_LITERAL_NODE_T*) old_node;
|
|
145
|
+
const AST_LITERAL_NODE_T* new_literal_node = (const AST_LITERAL_NODE_T*) new_node;
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
if (!hb_string_equals(old_literal_node->content, new_literal_node->content)) {
|
|
149
|
+
herb_diff_emit_operation(result, HERB_DIFF_TEXT_CHANGED, path, old_node, new_node, 0, 0);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
} break;
|
|
155
|
+
|
|
156
|
+
case AST_HTML_OPEN_TAG_NODE: {
|
|
157
|
+
const AST_HTML_OPEN_TAG_NODE_T* old_open_tag = (const AST_HTML_OPEN_TAG_NODE_T*) old_node;
|
|
158
|
+
const AST_HTML_OPEN_TAG_NODE_T* new_open_tag = (const AST_HTML_OPEN_TAG_NODE_T*) new_node;
|
|
159
|
+
|
|
160
|
+
herb_diff_attributes(old_open_tag->children, new_open_tag->children, path, old_hashes, new_hashes, result);
|
|
161
|
+
} break;
|
|
162
|
+
|
|
163
|
+
case AST_HTML_CONDITIONAL_OPEN_TAG_NODE: {
|
|
164
|
+
const AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T* old_html_conditional_open_tag_node = (const AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T*) old_node;
|
|
165
|
+
const AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T* new_html_conditional_open_tag_node = (const AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T*) new_node;
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
herb_diff_node((const AST_NODE_T*) old_html_conditional_open_tag_node->conditional, (const AST_NODE_T*) new_html_conditional_open_tag_node->conditional, path, old_hashes, new_hashes, result);
|
|
171
|
+
} break;
|
|
172
|
+
|
|
173
|
+
case AST_HTML_CLOSE_TAG_NODE: {
|
|
174
|
+
const AST_HTML_CLOSE_TAG_NODE_T* old_html_close_tag_node = (const AST_HTML_CLOSE_TAG_NODE_T*) old_node;
|
|
175
|
+
const AST_HTML_CLOSE_TAG_NODE_T* new_html_close_tag_node = (const AST_HTML_CLOSE_TAG_NODE_T*) new_node;
|
|
176
|
+
|
|
177
|
+
if (!tokens_equal(old_html_close_tag_node->tag_opening, new_html_close_tag_node->tag_opening)) {
|
|
178
|
+
herb_diff_emit_operation(result, HERB_DIFF_TEXT_CHANGED, path, old_node, new_node, 0, 0);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
diff_children_nullable(old_html_close_tag_node->children, new_html_close_tag_node->children, path, old_hashes, new_hashes, result);
|
|
184
|
+
|
|
185
|
+
} break;
|
|
186
|
+
|
|
187
|
+
case AST_HTML_OMITTED_CLOSE_TAG_NODE: {
|
|
188
|
+
herb_diff_emit_operation(result, HERB_DIFF_NODE_REPLACED, path, old_node, new_node, 0, 0);
|
|
189
|
+
} break;
|
|
190
|
+
|
|
191
|
+
case AST_HTML_VIRTUAL_CLOSE_TAG_NODE: {
|
|
192
|
+
herb_diff_emit_operation(result, HERB_DIFF_NODE_REPLACED, path, old_node, new_node, 0, 0);
|
|
193
|
+
} break;
|
|
194
|
+
|
|
195
|
+
case AST_HTML_ELEMENT_NODE: {
|
|
196
|
+
diff_element_node(
|
|
197
|
+
(const AST_HTML_ELEMENT_NODE_T*) old_node,
|
|
198
|
+
(const AST_HTML_ELEMENT_NODE_T*) new_node,
|
|
199
|
+
path, old_hashes, new_hashes, result
|
|
200
|
+
);
|
|
201
|
+
} break;
|
|
202
|
+
|
|
203
|
+
case AST_HTML_CONDITIONAL_ELEMENT_NODE: {
|
|
204
|
+
diff_conditional_element_node(
|
|
205
|
+
(const AST_HTML_CONDITIONAL_ELEMENT_NODE_T*) old_node,
|
|
206
|
+
(const AST_HTML_CONDITIONAL_ELEMENT_NODE_T*) new_node,
|
|
207
|
+
path, old_hashes, new_hashes, result
|
|
208
|
+
);
|
|
209
|
+
} break;
|
|
210
|
+
|
|
211
|
+
case AST_HTML_ATTRIBUTE_VALUE_NODE: {
|
|
212
|
+
const AST_HTML_ATTRIBUTE_VALUE_NODE_T* old_html_attribute_value_node = (const AST_HTML_ATTRIBUTE_VALUE_NODE_T*) old_node;
|
|
213
|
+
const AST_HTML_ATTRIBUTE_VALUE_NODE_T* new_html_attribute_value_node = (const AST_HTML_ATTRIBUTE_VALUE_NODE_T*) new_node;
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
diff_children_nullable(old_html_attribute_value_node->children, new_html_attribute_value_node->children, path, old_hashes, new_hashes, result);
|
|
218
|
+
|
|
219
|
+
} break;
|
|
220
|
+
|
|
221
|
+
case AST_HTML_ATTRIBUTE_NAME_NODE: {
|
|
222
|
+
const AST_HTML_ATTRIBUTE_NAME_NODE_T* old_html_attribute_name_node = (const AST_HTML_ATTRIBUTE_NAME_NODE_T*) old_node;
|
|
223
|
+
const AST_HTML_ATTRIBUTE_NAME_NODE_T* new_html_attribute_name_node = (const AST_HTML_ATTRIBUTE_NAME_NODE_T*) new_node;
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
diff_children_nullable(old_html_attribute_name_node->children, new_html_attribute_name_node->children, path, old_hashes, new_hashes, result);
|
|
228
|
+
|
|
229
|
+
} break;
|
|
230
|
+
|
|
231
|
+
case AST_HTML_ATTRIBUTE_NODE: {
|
|
232
|
+
const AST_HTML_ATTRIBUTE_NODE_T* old_attribute = (const AST_HTML_ATTRIBUTE_NODE_T*) old_node;
|
|
233
|
+
const AST_HTML_ATTRIBUTE_NODE_T* new_attribute = (const AST_HTML_ATTRIBUTE_NODE_T*) new_node;
|
|
234
|
+
|
|
235
|
+
herb_hash_T old_name_hash = herb_hash_map_get(old_hashes, (const AST_NODE_T*) old_attribute->name);
|
|
236
|
+
herb_hash_T new_name_hash = herb_hash_map_get(new_hashes, (const AST_NODE_T*) new_attribute->name);
|
|
237
|
+
|
|
238
|
+
if (old_name_hash != new_name_hash) {
|
|
239
|
+
herb_diff_emit_operation(result, HERB_DIFF_NODE_REPLACED, path, old_node, new_node, 0, 0);
|
|
240
|
+
} else {
|
|
241
|
+
herb_hash_T old_value_hash = herb_hash_map_get(old_hashes, (const AST_NODE_T*) old_attribute->value);
|
|
242
|
+
herb_hash_T new_value_hash = herb_hash_map_get(new_hashes, (const AST_NODE_T*) new_attribute->value);
|
|
243
|
+
|
|
244
|
+
if (old_value_hash != new_value_hash) {
|
|
245
|
+
herb_diff_emit_operation(result, HERB_DIFF_ATTRIBUTE_VALUE_CHANGED, path, old_node, new_node, 0, 0);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
} break;
|
|
249
|
+
|
|
250
|
+
case AST_RUBY_LITERAL_NODE: {
|
|
251
|
+
const AST_RUBY_LITERAL_NODE_T* old_ruby_literal_node = (const AST_RUBY_LITERAL_NODE_T*) old_node;
|
|
252
|
+
const AST_RUBY_LITERAL_NODE_T* new_ruby_literal_node = (const AST_RUBY_LITERAL_NODE_T*) new_node;
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
if (!hb_string_equals(old_ruby_literal_node->content, new_ruby_literal_node->content)) {
|
|
256
|
+
herb_diff_emit_operation(result, HERB_DIFF_TEXT_CHANGED, path, old_node, new_node, 0, 0);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
} break;
|
|
262
|
+
|
|
263
|
+
case AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE: {
|
|
264
|
+
const AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T* old_ruby_html_attributes_splat_node = (const AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T*) old_node;
|
|
265
|
+
const AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T* new_ruby_html_attributes_splat_node = (const AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T*) new_node;
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
if (!hb_string_equals(old_ruby_html_attributes_splat_node->content, new_ruby_html_attributes_splat_node->content)
|
|
269
|
+
|| !hb_string_equals(old_ruby_html_attributes_splat_node->prefix, new_ruby_html_attributes_splat_node->prefix)) {
|
|
270
|
+
herb_diff_emit_operation(result, HERB_DIFF_TEXT_CHANGED, path, old_node, new_node, 0, 0);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
} break;
|
|
276
|
+
|
|
277
|
+
case AST_ERB_OPEN_TAG_NODE: {
|
|
278
|
+
const AST_ERB_OPEN_TAG_NODE_T* old_erb_open_tag_node = (const AST_ERB_OPEN_TAG_NODE_T*) old_node;
|
|
279
|
+
const AST_ERB_OPEN_TAG_NODE_T* new_erb_open_tag_node = (const AST_ERB_OPEN_TAG_NODE_T*) new_node;
|
|
280
|
+
|
|
281
|
+
if (!tokens_equal(old_erb_open_tag_node->tag_opening, new_erb_open_tag_node->tag_opening)
|
|
282
|
+
|| !tokens_equal(old_erb_open_tag_node->content, new_erb_open_tag_node->content)) {
|
|
283
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
diff_children_nullable(old_erb_open_tag_node->children, new_erb_open_tag_node->children, path, old_hashes, new_hashes, result);
|
|
289
|
+
|
|
290
|
+
} break;
|
|
291
|
+
|
|
292
|
+
case AST_HTML_TEXT_NODE: {
|
|
293
|
+
const AST_HTML_TEXT_NODE_T* old_html_text_node = (const AST_HTML_TEXT_NODE_T*) old_node;
|
|
294
|
+
const AST_HTML_TEXT_NODE_T* new_html_text_node = (const AST_HTML_TEXT_NODE_T*) new_node;
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
if (!hb_string_equals(old_html_text_node->content, new_html_text_node->content)) {
|
|
298
|
+
herb_diff_emit_operation(result, HERB_DIFF_TEXT_CHANGED, path, old_node, new_node, 0, 0);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
} break;
|
|
304
|
+
|
|
305
|
+
case AST_HTML_COMMENT_NODE: {
|
|
306
|
+
const AST_HTML_COMMENT_NODE_T* old_html_comment_node = (const AST_HTML_COMMENT_NODE_T*) old_node;
|
|
307
|
+
const AST_HTML_COMMENT_NODE_T* new_html_comment_node = (const AST_HTML_COMMENT_NODE_T*) new_node;
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
diff_children_nullable(old_html_comment_node->children, new_html_comment_node->children, path, old_hashes, new_hashes, result);
|
|
312
|
+
|
|
313
|
+
} break;
|
|
314
|
+
|
|
315
|
+
case AST_HTML_DOCTYPE_NODE: {
|
|
316
|
+
const AST_HTML_DOCTYPE_NODE_T* old_html_doctype_node = (const AST_HTML_DOCTYPE_NODE_T*) old_node;
|
|
317
|
+
const AST_HTML_DOCTYPE_NODE_T* new_html_doctype_node = (const AST_HTML_DOCTYPE_NODE_T*) new_node;
|
|
318
|
+
|
|
319
|
+
if (!tokens_equal(old_html_doctype_node->tag_opening, new_html_doctype_node->tag_opening)) {
|
|
320
|
+
herb_diff_emit_operation(result, HERB_DIFF_TEXT_CHANGED, path, old_node, new_node, 0, 0);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
diff_children_nullable(old_html_doctype_node->children, new_html_doctype_node->children, path, old_hashes, new_hashes, result);
|
|
326
|
+
|
|
327
|
+
} break;
|
|
328
|
+
|
|
329
|
+
case AST_XML_DECLARATION_NODE: {
|
|
330
|
+
const AST_XML_DECLARATION_NODE_T* old_xml_declaration_node = (const AST_XML_DECLARATION_NODE_T*) old_node;
|
|
331
|
+
const AST_XML_DECLARATION_NODE_T* new_xml_declaration_node = (const AST_XML_DECLARATION_NODE_T*) new_node;
|
|
332
|
+
|
|
333
|
+
if (!tokens_equal(old_xml_declaration_node->tag_opening, new_xml_declaration_node->tag_opening)) {
|
|
334
|
+
herb_diff_emit_operation(result, HERB_DIFF_TEXT_CHANGED, path, old_node, new_node, 0, 0);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
diff_children_nullable(old_xml_declaration_node->children, new_xml_declaration_node->children, path, old_hashes, new_hashes, result);
|
|
340
|
+
|
|
341
|
+
} break;
|
|
342
|
+
|
|
343
|
+
case AST_CDATA_NODE: {
|
|
344
|
+
const AST_CDATA_NODE_T* old_cdata_node = (const AST_CDATA_NODE_T*) old_node;
|
|
345
|
+
const AST_CDATA_NODE_T* new_cdata_node = (const AST_CDATA_NODE_T*) new_node;
|
|
346
|
+
|
|
347
|
+
if (!tokens_equal(old_cdata_node->tag_opening, new_cdata_node->tag_opening)) {
|
|
348
|
+
herb_diff_emit_operation(result, HERB_DIFF_TEXT_CHANGED, path, old_node, new_node, 0, 0);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
diff_children_nullable(old_cdata_node->children, new_cdata_node->children, path, old_hashes, new_hashes, result);
|
|
354
|
+
|
|
355
|
+
} break;
|
|
356
|
+
|
|
357
|
+
case AST_WHITESPACE_NODE: {
|
|
358
|
+
herb_diff_emit_operation(result, HERB_DIFF_NODE_REPLACED, path, old_node, new_node, 0, 0);
|
|
359
|
+
} break;
|
|
360
|
+
|
|
361
|
+
case AST_ERB_CONTENT_NODE: {
|
|
362
|
+
const AST_ERB_CONTENT_NODE_T* old_erb_content_node = (const AST_ERB_CONTENT_NODE_T*) old_node;
|
|
363
|
+
const AST_ERB_CONTENT_NODE_T* new_erb_content_node = (const AST_ERB_CONTENT_NODE_T*) new_node;
|
|
364
|
+
|
|
365
|
+
if (!tokens_equal(old_erb_content_node->tag_opening, new_erb_content_node->tag_opening)
|
|
366
|
+
|| !tokens_equal(old_erb_content_node->content, new_erb_content_node->content)) {
|
|
367
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
} break;
|
|
374
|
+
|
|
375
|
+
case AST_ERB_END_NODE: {
|
|
376
|
+
const AST_ERB_END_NODE_T* old_erb_end_node = (const AST_ERB_END_NODE_T*) old_node;
|
|
377
|
+
const AST_ERB_END_NODE_T* new_erb_end_node = (const AST_ERB_END_NODE_T*) new_node;
|
|
378
|
+
|
|
379
|
+
if (!tokens_equal(old_erb_end_node->tag_opening, new_erb_end_node->tag_opening)
|
|
380
|
+
|| !tokens_equal(old_erb_end_node->content, new_erb_end_node->content)) {
|
|
381
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
} break;
|
|
388
|
+
|
|
389
|
+
case AST_ERB_ELSE_NODE: {
|
|
390
|
+
const AST_ERB_ELSE_NODE_T* old_erb_else_node = (const AST_ERB_ELSE_NODE_T*) old_node;
|
|
391
|
+
const AST_ERB_ELSE_NODE_T* new_erb_else_node = (const AST_ERB_ELSE_NODE_T*) new_node;
|
|
392
|
+
|
|
393
|
+
if (!tokens_equal(old_erb_else_node->tag_opening, new_erb_else_node->tag_opening)
|
|
394
|
+
|| !tokens_equal(old_erb_else_node->content, new_erb_else_node->content)) {
|
|
395
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
diff_children_nullable(old_erb_else_node->statements, new_erb_else_node->statements, path, old_hashes, new_hashes, result);
|
|
401
|
+
|
|
402
|
+
} break;
|
|
403
|
+
|
|
404
|
+
case AST_ERB_IF_NODE: {
|
|
405
|
+
const AST_ERB_IF_NODE_T* old_erb_if_node = (const AST_ERB_IF_NODE_T*) old_node;
|
|
406
|
+
const AST_ERB_IF_NODE_T* new_erb_if_node = (const AST_ERB_IF_NODE_T*) new_node;
|
|
407
|
+
|
|
408
|
+
if (!tokens_equal(old_erb_if_node->tag_opening, new_erb_if_node->tag_opening)
|
|
409
|
+
|| !tokens_equal(old_erb_if_node->content, new_erb_if_node->content)) {
|
|
410
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
diff_children_nullable(old_erb_if_node->statements, new_erb_if_node->statements, path, old_hashes, new_hashes, result);
|
|
416
|
+
|
|
417
|
+
herb_diff_node((const AST_NODE_T*) old_erb_if_node->subsequent, (const AST_NODE_T*) new_erb_if_node->subsequent, path, old_hashes, new_hashes, result);
|
|
418
|
+
herb_diff_node((const AST_NODE_T*) old_erb_if_node->end_node, (const AST_NODE_T*) new_erb_if_node->end_node, path, old_hashes, new_hashes, result);
|
|
419
|
+
} break;
|
|
420
|
+
|
|
421
|
+
case AST_ERB_BLOCK_NODE: {
|
|
422
|
+
const AST_ERB_BLOCK_NODE_T* old_erb_block_node = (const AST_ERB_BLOCK_NODE_T*) old_node;
|
|
423
|
+
const AST_ERB_BLOCK_NODE_T* new_erb_block_node = (const AST_ERB_BLOCK_NODE_T*) new_node;
|
|
424
|
+
|
|
425
|
+
if (!tokens_equal(old_erb_block_node->tag_opening, new_erb_block_node->tag_opening)
|
|
426
|
+
|| !tokens_equal(old_erb_block_node->content, new_erb_block_node->content)) {
|
|
427
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
diff_children_nullable(old_erb_block_node->body, new_erb_block_node->body, path, old_hashes, new_hashes, result);
|
|
433
|
+
diff_children_nullable(old_erb_block_node->block_arguments, new_erb_block_node->block_arguments, path, old_hashes, new_hashes, result);
|
|
434
|
+
|
|
435
|
+
herb_diff_node((const AST_NODE_T*) old_erb_block_node->rescue_clause, (const AST_NODE_T*) new_erb_block_node->rescue_clause, path, old_hashes, new_hashes, result);
|
|
436
|
+
herb_diff_node((const AST_NODE_T*) old_erb_block_node->else_clause, (const AST_NODE_T*) new_erb_block_node->else_clause, path, old_hashes, new_hashes, result);
|
|
437
|
+
herb_diff_node((const AST_NODE_T*) old_erb_block_node->ensure_clause, (const AST_NODE_T*) new_erb_block_node->ensure_clause, path, old_hashes, new_hashes, result);
|
|
438
|
+
herb_diff_node((const AST_NODE_T*) old_erb_block_node->end_node, (const AST_NODE_T*) new_erb_block_node->end_node, path, old_hashes, new_hashes, result);
|
|
439
|
+
} break;
|
|
440
|
+
|
|
441
|
+
case AST_ERB_WHEN_NODE: {
|
|
442
|
+
const AST_ERB_WHEN_NODE_T* old_erb_when_node = (const AST_ERB_WHEN_NODE_T*) old_node;
|
|
443
|
+
const AST_ERB_WHEN_NODE_T* new_erb_when_node = (const AST_ERB_WHEN_NODE_T*) new_node;
|
|
444
|
+
|
|
445
|
+
if (!tokens_equal(old_erb_when_node->tag_opening, new_erb_when_node->tag_opening)
|
|
446
|
+
|| !tokens_equal(old_erb_when_node->content, new_erb_when_node->content)) {
|
|
447
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
diff_children_nullable(old_erb_when_node->statements, new_erb_when_node->statements, path, old_hashes, new_hashes, result);
|
|
453
|
+
|
|
454
|
+
} break;
|
|
455
|
+
|
|
456
|
+
case AST_ERB_CASE_NODE: {
|
|
457
|
+
const AST_ERB_CASE_NODE_T* old_erb_case_node = (const AST_ERB_CASE_NODE_T*) old_node;
|
|
458
|
+
const AST_ERB_CASE_NODE_T* new_erb_case_node = (const AST_ERB_CASE_NODE_T*) new_node;
|
|
459
|
+
|
|
460
|
+
if (!tokens_equal(old_erb_case_node->tag_opening, new_erb_case_node->tag_opening)
|
|
461
|
+
|| !tokens_equal(old_erb_case_node->content, new_erb_case_node->content)) {
|
|
462
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
diff_children_nullable(old_erb_case_node->children, new_erb_case_node->children, path, old_hashes, new_hashes, result);
|
|
468
|
+
diff_children_nullable(old_erb_case_node->conditions, new_erb_case_node->conditions, path, old_hashes, new_hashes, result);
|
|
469
|
+
|
|
470
|
+
herb_diff_node((const AST_NODE_T*) old_erb_case_node->else_clause, (const AST_NODE_T*) new_erb_case_node->else_clause, path, old_hashes, new_hashes, result);
|
|
471
|
+
herb_diff_node((const AST_NODE_T*) old_erb_case_node->end_node, (const AST_NODE_T*) new_erb_case_node->end_node, path, old_hashes, new_hashes, result);
|
|
472
|
+
} break;
|
|
473
|
+
|
|
474
|
+
case AST_ERB_CASE_MATCH_NODE: {
|
|
475
|
+
const AST_ERB_CASE_MATCH_NODE_T* old_erb_case_match_node = (const AST_ERB_CASE_MATCH_NODE_T*) old_node;
|
|
476
|
+
const AST_ERB_CASE_MATCH_NODE_T* new_erb_case_match_node = (const AST_ERB_CASE_MATCH_NODE_T*) new_node;
|
|
477
|
+
|
|
478
|
+
if (!tokens_equal(old_erb_case_match_node->tag_opening, new_erb_case_match_node->tag_opening)
|
|
479
|
+
|| !tokens_equal(old_erb_case_match_node->content, new_erb_case_match_node->content)) {
|
|
480
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
diff_children_nullable(old_erb_case_match_node->children, new_erb_case_match_node->children, path, old_hashes, new_hashes, result);
|
|
486
|
+
diff_children_nullable(old_erb_case_match_node->conditions, new_erb_case_match_node->conditions, path, old_hashes, new_hashes, result);
|
|
487
|
+
|
|
488
|
+
herb_diff_node((const AST_NODE_T*) old_erb_case_match_node->else_clause, (const AST_NODE_T*) new_erb_case_match_node->else_clause, path, old_hashes, new_hashes, result);
|
|
489
|
+
herb_diff_node((const AST_NODE_T*) old_erb_case_match_node->end_node, (const AST_NODE_T*) new_erb_case_match_node->end_node, path, old_hashes, new_hashes, result);
|
|
490
|
+
} break;
|
|
491
|
+
|
|
492
|
+
case AST_ERB_WHILE_NODE: {
|
|
493
|
+
const AST_ERB_WHILE_NODE_T* old_erb_while_node = (const AST_ERB_WHILE_NODE_T*) old_node;
|
|
494
|
+
const AST_ERB_WHILE_NODE_T* new_erb_while_node = (const AST_ERB_WHILE_NODE_T*) new_node;
|
|
495
|
+
|
|
496
|
+
if (!tokens_equal(old_erb_while_node->tag_opening, new_erb_while_node->tag_opening)
|
|
497
|
+
|| !tokens_equal(old_erb_while_node->content, new_erb_while_node->content)) {
|
|
498
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
diff_children_nullable(old_erb_while_node->statements, new_erb_while_node->statements, path, old_hashes, new_hashes, result);
|
|
504
|
+
|
|
505
|
+
herb_diff_node((const AST_NODE_T*) old_erb_while_node->end_node, (const AST_NODE_T*) new_erb_while_node->end_node, path, old_hashes, new_hashes, result);
|
|
506
|
+
} break;
|
|
507
|
+
|
|
508
|
+
case AST_ERB_UNTIL_NODE: {
|
|
509
|
+
const AST_ERB_UNTIL_NODE_T* old_erb_until_node = (const AST_ERB_UNTIL_NODE_T*) old_node;
|
|
510
|
+
const AST_ERB_UNTIL_NODE_T* new_erb_until_node = (const AST_ERB_UNTIL_NODE_T*) new_node;
|
|
511
|
+
|
|
512
|
+
if (!tokens_equal(old_erb_until_node->tag_opening, new_erb_until_node->tag_opening)
|
|
513
|
+
|| !tokens_equal(old_erb_until_node->content, new_erb_until_node->content)) {
|
|
514
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
diff_children_nullable(old_erb_until_node->statements, new_erb_until_node->statements, path, old_hashes, new_hashes, result);
|
|
520
|
+
|
|
521
|
+
herb_diff_node((const AST_NODE_T*) old_erb_until_node->end_node, (const AST_NODE_T*) new_erb_until_node->end_node, path, old_hashes, new_hashes, result);
|
|
522
|
+
} break;
|
|
523
|
+
|
|
524
|
+
case AST_ERB_FOR_NODE: {
|
|
525
|
+
const AST_ERB_FOR_NODE_T* old_erb_for_node = (const AST_ERB_FOR_NODE_T*) old_node;
|
|
526
|
+
const AST_ERB_FOR_NODE_T* new_erb_for_node = (const AST_ERB_FOR_NODE_T*) new_node;
|
|
527
|
+
|
|
528
|
+
if (!tokens_equal(old_erb_for_node->tag_opening, new_erb_for_node->tag_opening)
|
|
529
|
+
|| !tokens_equal(old_erb_for_node->content, new_erb_for_node->content)) {
|
|
530
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
diff_children_nullable(old_erb_for_node->statements, new_erb_for_node->statements, path, old_hashes, new_hashes, result);
|
|
536
|
+
|
|
537
|
+
herb_diff_node((const AST_NODE_T*) old_erb_for_node->end_node, (const AST_NODE_T*) new_erb_for_node->end_node, path, old_hashes, new_hashes, result);
|
|
538
|
+
} break;
|
|
539
|
+
|
|
540
|
+
case AST_ERB_RESCUE_NODE: {
|
|
541
|
+
const AST_ERB_RESCUE_NODE_T* old_erb_rescue_node = (const AST_ERB_RESCUE_NODE_T*) old_node;
|
|
542
|
+
const AST_ERB_RESCUE_NODE_T* new_erb_rescue_node = (const AST_ERB_RESCUE_NODE_T*) new_node;
|
|
543
|
+
|
|
544
|
+
if (!tokens_equal(old_erb_rescue_node->tag_opening, new_erb_rescue_node->tag_opening)
|
|
545
|
+
|| !tokens_equal(old_erb_rescue_node->content, new_erb_rescue_node->content)) {
|
|
546
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
diff_children_nullable(old_erb_rescue_node->statements, new_erb_rescue_node->statements, path, old_hashes, new_hashes, result);
|
|
552
|
+
|
|
553
|
+
herb_diff_node((const AST_NODE_T*) old_erb_rescue_node->subsequent, (const AST_NODE_T*) new_erb_rescue_node->subsequent, path, old_hashes, new_hashes, result);
|
|
554
|
+
} break;
|
|
555
|
+
|
|
556
|
+
case AST_ERB_ENSURE_NODE: {
|
|
557
|
+
const AST_ERB_ENSURE_NODE_T* old_erb_ensure_node = (const AST_ERB_ENSURE_NODE_T*) old_node;
|
|
558
|
+
const AST_ERB_ENSURE_NODE_T* new_erb_ensure_node = (const AST_ERB_ENSURE_NODE_T*) new_node;
|
|
559
|
+
|
|
560
|
+
if (!tokens_equal(old_erb_ensure_node->tag_opening, new_erb_ensure_node->tag_opening)
|
|
561
|
+
|| !tokens_equal(old_erb_ensure_node->content, new_erb_ensure_node->content)) {
|
|
562
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
diff_children_nullable(old_erb_ensure_node->statements, new_erb_ensure_node->statements, path, old_hashes, new_hashes, result);
|
|
568
|
+
|
|
569
|
+
} break;
|
|
570
|
+
|
|
571
|
+
case AST_ERB_BEGIN_NODE: {
|
|
572
|
+
const AST_ERB_BEGIN_NODE_T* old_erb_begin_node = (const AST_ERB_BEGIN_NODE_T*) old_node;
|
|
573
|
+
const AST_ERB_BEGIN_NODE_T* new_erb_begin_node = (const AST_ERB_BEGIN_NODE_T*) new_node;
|
|
574
|
+
|
|
575
|
+
if (!tokens_equal(old_erb_begin_node->tag_opening, new_erb_begin_node->tag_opening)
|
|
576
|
+
|| !tokens_equal(old_erb_begin_node->content, new_erb_begin_node->content)) {
|
|
577
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
diff_children_nullable(old_erb_begin_node->statements, new_erb_begin_node->statements, path, old_hashes, new_hashes, result);
|
|
583
|
+
|
|
584
|
+
herb_diff_node((const AST_NODE_T*) old_erb_begin_node->rescue_clause, (const AST_NODE_T*) new_erb_begin_node->rescue_clause, path, old_hashes, new_hashes, result);
|
|
585
|
+
herb_diff_node((const AST_NODE_T*) old_erb_begin_node->else_clause, (const AST_NODE_T*) new_erb_begin_node->else_clause, path, old_hashes, new_hashes, result);
|
|
586
|
+
herb_diff_node((const AST_NODE_T*) old_erb_begin_node->ensure_clause, (const AST_NODE_T*) new_erb_begin_node->ensure_clause, path, old_hashes, new_hashes, result);
|
|
587
|
+
herb_diff_node((const AST_NODE_T*) old_erb_begin_node->end_node, (const AST_NODE_T*) new_erb_begin_node->end_node, path, old_hashes, new_hashes, result);
|
|
588
|
+
} break;
|
|
589
|
+
|
|
590
|
+
case AST_ERB_UNLESS_NODE: {
|
|
591
|
+
const AST_ERB_UNLESS_NODE_T* old_erb_unless_node = (const AST_ERB_UNLESS_NODE_T*) old_node;
|
|
592
|
+
const AST_ERB_UNLESS_NODE_T* new_erb_unless_node = (const AST_ERB_UNLESS_NODE_T*) new_node;
|
|
593
|
+
|
|
594
|
+
if (!tokens_equal(old_erb_unless_node->tag_opening, new_erb_unless_node->tag_opening)
|
|
595
|
+
|| !tokens_equal(old_erb_unless_node->content, new_erb_unless_node->content)) {
|
|
596
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
diff_children_nullable(old_erb_unless_node->statements, new_erb_unless_node->statements, path, old_hashes, new_hashes, result);
|
|
602
|
+
|
|
603
|
+
herb_diff_node((const AST_NODE_T*) old_erb_unless_node->else_clause, (const AST_NODE_T*) new_erb_unless_node->else_clause, path, old_hashes, new_hashes, result);
|
|
604
|
+
herb_diff_node((const AST_NODE_T*) old_erb_unless_node->end_node, (const AST_NODE_T*) new_erb_unless_node->end_node, path, old_hashes, new_hashes, result);
|
|
605
|
+
} break;
|
|
606
|
+
|
|
607
|
+
case AST_RUBY_RENDER_LOCAL_NODE: {
|
|
608
|
+
const AST_RUBY_RENDER_LOCAL_NODE_T* old_ruby_render_local_node = (const AST_RUBY_RENDER_LOCAL_NODE_T*) old_node;
|
|
609
|
+
const AST_RUBY_RENDER_LOCAL_NODE_T* new_ruby_render_local_node = (const AST_RUBY_RENDER_LOCAL_NODE_T*) new_node;
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
herb_diff_node((const AST_NODE_T*) old_ruby_render_local_node->value, (const AST_NODE_T*) new_ruby_render_local_node->value, path, old_hashes, new_hashes, result);
|
|
615
|
+
} break;
|
|
616
|
+
|
|
617
|
+
case AST_RUBY_RENDER_KEYWORDS_NODE: {
|
|
618
|
+
const AST_RUBY_RENDER_KEYWORDS_NODE_T* old_ruby_render_keywords_node = (const AST_RUBY_RENDER_KEYWORDS_NODE_T*) old_node;
|
|
619
|
+
const AST_RUBY_RENDER_KEYWORDS_NODE_T* new_ruby_render_keywords_node = (const AST_RUBY_RENDER_KEYWORDS_NODE_T*) new_node;
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
diff_children_nullable(old_ruby_render_keywords_node->locals, new_ruby_render_keywords_node->locals, path, old_hashes, new_hashes, result);
|
|
624
|
+
|
|
625
|
+
} break;
|
|
626
|
+
|
|
627
|
+
case AST_ERB_RENDER_NODE: {
|
|
628
|
+
const AST_ERB_RENDER_NODE_T* old_erb_render_node = (const AST_ERB_RENDER_NODE_T*) old_node;
|
|
629
|
+
const AST_ERB_RENDER_NODE_T* new_erb_render_node = (const AST_ERB_RENDER_NODE_T*) new_node;
|
|
630
|
+
|
|
631
|
+
if (!tokens_equal(old_erb_render_node->tag_opening, new_erb_render_node->tag_opening)
|
|
632
|
+
|| !tokens_equal(old_erb_render_node->content, new_erb_render_node->content)) {
|
|
633
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
diff_children_nullable(old_erb_render_node->body, new_erb_render_node->body, path, old_hashes, new_hashes, result);
|
|
639
|
+
diff_children_nullable(old_erb_render_node->block_arguments, new_erb_render_node->block_arguments, path, old_hashes, new_hashes, result);
|
|
640
|
+
|
|
641
|
+
herb_diff_node((const AST_NODE_T*) old_erb_render_node->keywords, (const AST_NODE_T*) new_erb_render_node->keywords, path, old_hashes, new_hashes, result);
|
|
642
|
+
herb_diff_node((const AST_NODE_T*) old_erb_render_node->rescue_clause, (const AST_NODE_T*) new_erb_render_node->rescue_clause, path, old_hashes, new_hashes, result);
|
|
643
|
+
herb_diff_node((const AST_NODE_T*) old_erb_render_node->else_clause, (const AST_NODE_T*) new_erb_render_node->else_clause, path, old_hashes, new_hashes, result);
|
|
644
|
+
herb_diff_node((const AST_NODE_T*) old_erb_render_node->ensure_clause, (const AST_NODE_T*) new_erb_render_node->ensure_clause, path, old_hashes, new_hashes, result);
|
|
645
|
+
herb_diff_node((const AST_NODE_T*) old_erb_render_node->end_node, (const AST_NODE_T*) new_erb_render_node->end_node, path, old_hashes, new_hashes, result);
|
|
646
|
+
} break;
|
|
647
|
+
|
|
648
|
+
case AST_RUBY_PARAMETER_NODE: {
|
|
649
|
+
const AST_RUBY_PARAMETER_NODE_T* old_ruby_parameter_node = (const AST_RUBY_PARAMETER_NODE_T*) old_node;
|
|
650
|
+
const AST_RUBY_PARAMETER_NODE_T* new_ruby_parameter_node = (const AST_RUBY_PARAMETER_NODE_T*) new_node;
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
if (!hb_string_equals(old_ruby_parameter_node->kind, new_ruby_parameter_node->kind)) {
|
|
654
|
+
herb_diff_emit_operation(result, HERB_DIFF_TEXT_CHANGED, path, old_node, new_node, 0, 0);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
herb_diff_node((const AST_NODE_T*) old_ruby_parameter_node->default_value, (const AST_NODE_T*) new_ruby_parameter_node->default_value, path, old_hashes, new_hashes, result);
|
|
660
|
+
} break;
|
|
661
|
+
|
|
662
|
+
case AST_ERB_STRICT_LOCALS_NODE: {
|
|
663
|
+
const AST_ERB_STRICT_LOCALS_NODE_T* old_erb_strict_locals_node = (const AST_ERB_STRICT_LOCALS_NODE_T*) old_node;
|
|
664
|
+
const AST_ERB_STRICT_LOCALS_NODE_T* new_erb_strict_locals_node = (const AST_ERB_STRICT_LOCALS_NODE_T*) new_node;
|
|
665
|
+
|
|
666
|
+
if (!tokens_equal(old_erb_strict_locals_node->tag_opening, new_erb_strict_locals_node->tag_opening)
|
|
667
|
+
|| !tokens_equal(old_erb_strict_locals_node->content, new_erb_strict_locals_node->content)) {
|
|
668
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
diff_children_nullable(old_erb_strict_locals_node->locals, new_erb_strict_locals_node->locals, path, old_hashes, new_hashes, result);
|
|
674
|
+
|
|
675
|
+
} break;
|
|
676
|
+
|
|
677
|
+
case AST_ERB_YIELD_NODE: {
|
|
678
|
+
const AST_ERB_YIELD_NODE_T* old_erb_yield_node = (const AST_ERB_YIELD_NODE_T*) old_node;
|
|
679
|
+
const AST_ERB_YIELD_NODE_T* new_erb_yield_node = (const AST_ERB_YIELD_NODE_T*) new_node;
|
|
680
|
+
|
|
681
|
+
if (!tokens_equal(old_erb_yield_node->tag_opening, new_erb_yield_node->tag_opening)
|
|
682
|
+
|| !tokens_equal(old_erb_yield_node->content, new_erb_yield_node->content)) {
|
|
683
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
} break;
|
|
690
|
+
|
|
691
|
+
case AST_ERB_IN_NODE: {
|
|
692
|
+
const AST_ERB_IN_NODE_T* old_erb_in_node = (const AST_ERB_IN_NODE_T*) old_node;
|
|
693
|
+
const AST_ERB_IN_NODE_T* new_erb_in_node = (const AST_ERB_IN_NODE_T*) new_node;
|
|
694
|
+
|
|
695
|
+
if (!tokens_equal(old_erb_in_node->tag_opening, new_erb_in_node->tag_opening)
|
|
696
|
+
|| !tokens_equal(old_erb_in_node->content, new_erb_in_node->content)) {
|
|
697
|
+
herb_diff_emit_operation(result, HERB_DIFF_ERB_CONTENT_CHANGED, path, old_node, new_node, 0, 0);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
diff_children_nullable(old_erb_in_node->statements, new_erb_in_node->statements, path, old_hashes, new_hashes, result);
|
|
703
|
+
|
|
704
|
+
} break;
|
|
705
|
+
|
|
706
|
+
}
|
|
707
|
+
}
|