@herb-tools/node 0.8.4 → 0.8.5
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/dist/herb-node.esm.js +1 -1
- package/extension/error_helpers.cpp +27 -1
- package/extension/error_helpers.h +2 -1
- package/extension/libherb/analyze.c +12 -1
- package/extension/libherb/analyze_helpers.c +179 -84
- package/extension/libherb/analyze_helpers.h +1 -0
- package/extension/libherb/analyze_missing_end.c +1 -1
- package/extension/libherb/analyze_transform.c +1 -1
- package/extension/libherb/analyzed_ruby.c +26 -25
- package/extension/libherb/analyzed_ruby.h +19 -18
- package/extension/libherb/ast_nodes.c +1 -1
- package/extension/libherb/ast_nodes.h +1 -1
- package/extension/libherb/ast_pretty_print.c +17 -16
- package/extension/libherb/ast_pretty_print.h +1 -1
- package/extension/libherb/errors.c +38 -1
- package/extension/libherb/errors.h +9 -1
- package/extension/libherb/extract.c +2 -1
- package/extension/libherb/include/analyze_helpers.h +1 -0
- package/extension/libherb/include/analyzed_ruby.h +19 -18
- package/extension/libherb/include/ast_nodes.h +1 -1
- package/extension/libherb/include/ast_pretty_print.h +1 -1
- package/extension/libherb/include/errors.h +9 -1
- package/extension/libherb/include/version.h +1 -1
- package/extension/libherb/lexer.c +3 -3
- package/extension/libherb/parser.c +4 -2
- package/extension/libherb/parser_helpers.c +5 -5
- package/extension/libherb/parser_match_tags.c +1 -1
- package/extension/libherb/version.h +1 -1
- package/extension/libherb/visitor.c +1 -1
- package/extension/nodes.cpp +1 -1
- package/extension/nodes.h +1 -1
- package/package.json +2 -2
- package/CHANGELOG.md +0 -19
package/dist/herb-node.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/javascript/packages/node/extension/error_helpers.cpp.erb
|
|
3
3
|
|
|
4
4
|
#include <node_api.h>
|
|
5
5
|
#include "error_helpers.h"
|
|
@@ -331,6 +331,29 @@ napi_value MissingERBEndTagErrorFromCStruct(napi_env env, MISSINGERB_END_TAG_ERR
|
|
|
331
331
|
return result;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
+
napi_value ERBMultipleBlocksInTagErrorFromCStruct(napi_env env, ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* erb_multiple_blocks_in_tag_error) {
|
|
335
|
+
if (!erb_multiple_blocks_in_tag_error) {
|
|
336
|
+
napi_value null_value;
|
|
337
|
+
napi_get_null(env, &null_value);
|
|
338
|
+
return null_value;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
napi_value result;
|
|
342
|
+
napi_create_object(env, &result);
|
|
343
|
+
|
|
344
|
+
napi_value type = CreateString(env, error_type_to_string(&erb_multiple_blocks_in_tag_error->base));
|
|
345
|
+
napi_set_named_property(env, result, "type", type);
|
|
346
|
+
|
|
347
|
+
napi_value message = CreateString(env, erb_multiple_blocks_in_tag_error->base.message);
|
|
348
|
+
napi_set_named_property(env, result, "message", message);
|
|
349
|
+
|
|
350
|
+
napi_value location = CreateLocation(env, erb_multiple_blocks_in_tag_error->base.location);
|
|
351
|
+
napi_set_named_property(env, result, "location", location);
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
return result;
|
|
355
|
+
}
|
|
356
|
+
|
|
334
357
|
|
|
335
358
|
napi_value ErrorsArrayFromCArray(napi_env env, hb_array_T* array) {
|
|
336
359
|
napi_value result;
|
|
@@ -390,6 +413,9 @@ napi_value ErrorFromCStruct(napi_env env, ERROR_T* error) {
|
|
|
390
413
|
case MISSINGERB_END_TAG_ERROR:
|
|
391
414
|
return MissingERBEndTagErrorFromCStruct(env, (MISSINGERB_END_TAG_ERROR_T*) error);
|
|
392
415
|
break;
|
|
416
|
+
case ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR:
|
|
417
|
+
return ERBMultipleBlocksInTagErrorFromCStruct(env, (ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T*) error);
|
|
418
|
+
break;
|
|
393
419
|
default:
|
|
394
420
|
napi_value null_value;
|
|
395
421
|
napi_get_null(env, &null_value);
|
|
@@ -1,5 +1,5 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/javascript/packages/node/extension/error_helpers.h.erb
|
|
3
3
|
|
|
4
4
|
#ifndef HERB_EXTENSION_ERRORS_H
|
|
5
5
|
#define HERB_EXTENSION_ERRORS_H
|
|
@@ -24,5 +24,6 @@ napi_value UnclosedElementErrorFromCStruct(napi_env env, UNCLOSED_ELEMENT_ERROR_
|
|
|
24
24
|
napi_value RubyParseErrorFromCStruct(napi_env env, RUBY_PARSE_ERROR_T* ruby_parse_error);
|
|
25
25
|
napi_value ERBControlFlowScopeErrorFromCStruct(napi_env env, ERB_CONTROL_FLOW_SCOPE_ERROR_T* erb_control_flow_scope_error);
|
|
26
26
|
napi_value MissingERBEndTagErrorFromCStruct(napi_env env, MISSINGERB_END_TAG_ERROR_T* missingerb_end_tag_error);
|
|
27
|
+
napi_value ERBMultipleBlocksInTagErrorFromCStruct(napi_env env, ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* erb_multiple_blocks_in_tag_error);
|
|
27
28
|
|
|
28
29
|
#endif
|
|
@@ -45,6 +45,8 @@ static analyzed_ruby_T* herb_analyze_ruby(hb_string_T source) {
|
|
|
45
45
|
search_yield_nodes(analyzed->root, analyzed);
|
|
46
46
|
search_block_closing_nodes(analyzed);
|
|
47
47
|
|
|
48
|
+
if (!analyzed->valid) { pm_visit_node(analyzed->root, search_unclosed_control_flows, analyzed); }
|
|
49
|
+
|
|
48
50
|
return analyzed;
|
|
49
51
|
}
|
|
50
52
|
|
|
@@ -54,12 +56,21 @@ static bool analyze_erb_content(const AST_NODE_T* node, void* data) {
|
|
|
54
56
|
|
|
55
57
|
const char* opening = erb_content_node->tag_opening->value;
|
|
56
58
|
|
|
57
|
-
if (strcmp(opening, "<%%") != 0 && strcmp(opening, "<%%=") != 0 && strcmp(opening, "<%#") != 0
|
|
59
|
+
if (strcmp(opening, "<%%") != 0 && strcmp(opening, "<%%=") != 0 && strcmp(opening, "<%#") != 0
|
|
60
|
+
&& strcmp(opening, "<%graphql") != 0) {
|
|
58
61
|
analyzed_ruby_T* analyzed = herb_analyze_ruby(hb_string(erb_content_node->content->value));
|
|
59
62
|
|
|
60
63
|
erb_content_node->parsed = true;
|
|
61
64
|
erb_content_node->valid = analyzed->valid;
|
|
62
65
|
erb_content_node->analyzed_ruby = analyzed;
|
|
66
|
+
|
|
67
|
+
if (!analyzed->valid && analyzed->unclosed_control_flow_count >= 2) {
|
|
68
|
+
append_erb_multiple_blocks_in_tag_error(
|
|
69
|
+
erb_content_node->base.location.start,
|
|
70
|
+
erb_content_node->base.location.end,
|
|
71
|
+
erb_content_node->base.errors
|
|
72
|
+
);
|
|
73
|
+
}
|
|
63
74
|
} else {
|
|
64
75
|
erb_content_node->parsed = false;
|
|
65
76
|
erb_content_node->valid = true;
|
|
@@ -5,75 +5,75 @@
|
|
|
5
5
|
#include "include/analyzed_ruby.h"
|
|
6
6
|
|
|
7
7
|
bool has_if_node(analyzed_ruby_T* analyzed) {
|
|
8
|
-
return analyzed->
|
|
8
|
+
return analyzed->if_node_count > 0;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
bool has_elsif_node(analyzed_ruby_T* analyzed) {
|
|
12
|
-
return analyzed->
|
|
12
|
+
return analyzed->elsif_node_count > 0;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
bool has_else_node(analyzed_ruby_T* analyzed) {
|
|
16
|
-
return analyzed->
|
|
16
|
+
return analyzed->else_node_count > 0;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
bool has_end(analyzed_ruby_T* analyzed) {
|
|
20
|
-
return analyzed->
|
|
20
|
+
return analyzed->end_count > 0;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
bool has_block_node(analyzed_ruby_T* analyzed) {
|
|
24
|
-
return analyzed->
|
|
24
|
+
return analyzed->block_node_count > 0;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
bool has_block_closing(analyzed_ruby_T* analyzed) {
|
|
28
|
-
return analyzed->
|
|
28
|
+
return analyzed->block_closing_count > 0;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
bool has_case_node(analyzed_ruby_T* analyzed) {
|
|
32
|
-
return analyzed->
|
|
32
|
+
return analyzed->case_node_count > 0;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
bool has_case_match_node(analyzed_ruby_T* analyzed) {
|
|
36
|
-
return analyzed->
|
|
36
|
+
return analyzed->case_match_node_count > 0;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
bool has_when_node(analyzed_ruby_T* analyzed) {
|
|
40
|
-
return analyzed->
|
|
40
|
+
return analyzed->when_node_count > 0;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
bool has_in_node(analyzed_ruby_T* analyzed) {
|
|
44
|
-
return analyzed->
|
|
44
|
+
return analyzed->in_node_count > 0;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
bool has_for_node(analyzed_ruby_T* analyzed) {
|
|
48
|
-
return analyzed->
|
|
48
|
+
return analyzed->for_node_count > 0;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
bool has_while_node(analyzed_ruby_T* analyzed) {
|
|
52
|
-
return analyzed->
|
|
52
|
+
return analyzed->while_node_count > 0;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
bool has_until_node(analyzed_ruby_T* analyzed) {
|
|
56
|
-
return analyzed->
|
|
56
|
+
return analyzed->until_node_count > 0;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
bool has_begin_node(analyzed_ruby_T* analyzed) {
|
|
60
|
-
return analyzed->
|
|
60
|
+
return analyzed->begin_node_count > 0;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
bool has_rescue_node(analyzed_ruby_T* analyzed) {
|
|
64
|
-
return analyzed->
|
|
64
|
+
return analyzed->rescue_node_count > 0;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
bool has_ensure_node(analyzed_ruby_T* analyzed) {
|
|
68
|
-
return analyzed->
|
|
68
|
+
return analyzed->ensure_node_count > 0;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
bool has_unless_node(analyzed_ruby_T* analyzed) {
|
|
72
|
-
return analyzed->
|
|
72
|
+
return analyzed->unless_node_count > 0;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
bool has_yield_node(analyzed_ruby_T* analyzed) {
|
|
76
|
-
return analyzed->
|
|
76
|
+
return analyzed->yield_node_count > 0;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
bool has_error_message(analyzed_ruby_T* anlayzed, const char* message) {
|
|
@@ -94,11 +94,7 @@ bool search_if_nodes(const pm_node_t* node, void* data) {
|
|
|
94
94
|
bool has_if_keyword = if_node->if_keyword_loc.start != NULL && if_node->if_keyword_loc.end != NULL;
|
|
95
95
|
bool has_end_keyword = if_node->end_keyword_loc.start != NULL && if_node->end_keyword_loc.end != NULL;
|
|
96
96
|
|
|
97
|
-
if (has_if_keyword && has_end_keyword) {
|
|
98
|
-
analyzed->has_if_node = true;
|
|
99
|
-
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
97
|
+
if (has_if_keyword && has_end_keyword) { analyzed->if_node_count++; }
|
|
102
98
|
}
|
|
103
99
|
|
|
104
100
|
pm_visit_child_nodes(node, search_if_nodes, analyzed);
|
|
@@ -106,20 +102,32 @@ bool search_if_nodes(const pm_node_t* node, void* data) {
|
|
|
106
102
|
return false;
|
|
107
103
|
}
|
|
108
104
|
|
|
105
|
+
static bool is_do_block(pm_location_t opening_location) {
|
|
106
|
+
size_t length = opening_location.end - opening_location.start;
|
|
107
|
+
|
|
108
|
+
return length == 2 && opening_location.start[0] == 'd' && opening_location.start[1] == 'o';
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
static bool is_brace_block(pm_location_t opening_location) {
|
|
112
|
+
size_t length = opening_location.end - opening_location.start;
|
|
113
|
+
|
|
114
|
+
return length == 1 && opening_location.start[0] == '{';
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static bool has_location(pm_location_t location) {
|
|
118
|
+
return location.start != NULL && location.end != NULL && (location.end - location.start) > 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
109
121
|
bool search_block_nodes(const pm_node_t* node, void* data) {
|
|
110
122
|
analyzed_ruby_T* analyzed = (analyzed_ruby_T*) data;
|
|
111
123
|
|
|
112
124
|
if (node->type == PM_BLOCK_NODE) {
|
|
113
125
|
pm_block_node_t* block_node = (pm_block_node_t*) node;
|
|
114
126
|
|
|
115
|
-
|
|
127
|
+
bool has_opening = is_do_block(block_node->opening_loc) || is_brace_block(block_node->opening_loc);
|
|
128
|
+
bool is_unclosed = !has_location(block_node->closing_loc);
|
|
116
129
|
|
|
117
|
-
if (
|
|
118
|
-
|| (opening_length == 1 && block_node->opening_loc.start[0] == '{')) {
|
|
119
|
-
analyzed->has_block_node = true;
|
|
120
|
-
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
130
|
+
if (has_opening && is_unclosed) { analyzed->block_node_count++; }
|
|
123
131
|
}
|
|
124
132
|
|
|
125
133
|
pm_visit_child_nodes(node, search_block_nodes, analyzed);
|
|
@@ -130,12 +138,9 @@ bool search_block_nodes(const pm_node_t* node, void* data) {
|
|
|
130
138
|
bool search_case_nodes(const pm_node_t* node, void* data) {
|
|
131
139
|
analyzed_ruby_T* analyzed = (analyzed_ruby_T*) data;
|
|
132
140
|
|
|
133
|
-
if (node->type == PM_CASE_NODE) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
} else {
|
|
137
|
-
pm_visit_child_nodes(node, search_case_nodes, analyzed);
|
|
138
|
-
}
|
|
141
|
+
if (node->type == PM_CASE_NODE) { analyzed->case_node_count++; }
|
|
142
|
+
|
|
143
|
+
pm_visit_child_nodes(node, search_case_nodes, analyzed);
|
|
139
144
|
|
|
140
145
|
return false;
|
|
141
146
|
}
|
|
@@ -143,12 +148,9 @@ bool search_case_nodes(const pm_node_t* node, void* data) {
|
|
|
143
148
|
bool search_case_match_nodes(const pm_node_t* node, void* data) {
|
|
144
149
|
analyzed_ruby_T* analyzed = (analyzed_ruby_T*) data;
|
|
145
150
|
|
|
146
|
-
if (node->type == PM_CASE_MATCH_NODE) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
} else {
|
|
150
|
-
pm_visit_child_nodes(node, search_case_match_nodes, analyzed);
|
|
151
|
-
}
|
|
151
|
+
if (node->type == PM_CASE_MATCH_NODE) { analyzed->case_match_node_count++; }
|
|
152
|
+
|
|
153
|
+
pm_visit_child_nodes(node, search_case_match_nodes, analyzed);
|
|
152
154
|
|
|
153
155
|
return false;
|
|
154
156
|
}
|
|
@@ -156,12 +158,9 @@ bool search_case_match_nodes(const pm_node_t* node, void* data) {
|
|
|
156
158
|
bool search_while_nodes(const pm_node_t* node, void* data) {
|
|
157
159
|
analyzed_ruby_T* analyzed = (analyzed_ruby_T*) data;
|
|
158
160
|
|
|
159
|
-
if (node->type == PM_WHILE_NODE) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
} else {
|
|
163
|
-
pm_visit_child_nodes(node, search_while_nodes, analyzed);
|
|
164
|
-
}
|
|
161
|
+
if (node->type == PM_WHILE_NODE) { analyzed->while_node_count++; }
|
|
162
|
+
|
|
163
|
+
pm_visit_child_nodes(node, search_while_nodes, analyzed);
|
|
165
164
|
|
|
166
165
|
return false;
|
|
167
166
|
}
|
|
@@ -169,12 +168,9 @@ bool search_while_nodes(const pm_node_t* node, void* data) {
|
|
|
169
168
|
bool search_for_nodes(const pm_node_t* node, void* data) {
|
|
170
169
|
analyzed_ruby_T* analyzed = (analyzed_ruby_T*) data;
|
|
171
170
|
|
|
172
|
-
if (node->type == PM_FOR_NODE) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
} else {
|
|
176
|
-
pm_visit_child_nodes(node, search_for_nodes, analyzed);
|
|
177
|
-
}
|
|
171
|
+
if (node->type == PM_FOR_NODE) { analyzed->for_node_count++; }
|
|
172
|
+
|
|
173
|
+
pm_visit_child_nodes(node, search_for_nodes, analyzed);
|
|
178
174
|
|
|
179
175
|
return false;
|
|
180
176
|
}
|
|
@@ -182,12 +178,9 @@ bool search_for_nodes(const pm_node_t* node, void* data) {
|
|
|
182
178
|
bool search_until_nodes(const pm_node_t* node, void* data) {
|
|
183
179
|
analyzed_ruby_T* analyzed = (analyzed_ruby_T*) data;
|
|
184
180
|
|
|
185
|
-
if (node->type == PM_UNTIL_NODE) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
} else {
|
|
189
|
-
pm_visit_child_nodes(node, search_until_nodes, analyzed);
|
|
190
|
-
}
|
|
181
|
+
if (node->type == PM_UNTIL_NODE) { analyzed->until_node_count++; }
|
|
182
|
+
|
|
183
|
+
pm_visit_child_nodes(node, search_until_nodes, analyzed);
|
|
191
184
|
|
|
192
185
|
return false;
|
|
193
186
|
}
|
|
@@ -195,12 +188,9 @@ bool search_until_nodes(const pm_node_t* node, void* data) {
|
|
|
195
188
|
bool search_begin_nodes(const pm_node_t* node, void* data) {
|
|
196
189
|
analyzed_ruby_T* analyzed = (analyzed_ruby_T*) data;
|
|
197
190
|
|
|
198
|
-
if (node->type == PM_BEGIN_NODE) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
} else {
|
|
202
|
-
pm_visit_child_nodes(node, search_begin_nodes, analyzed);
|
|
203
|
-
}
|
|
191
|
+
if (node->type == PM_BEGIN_NODE) { analyzed->begin_node_count++; }
|
|
192
|
+
|
|
193
|
+
pm_visit_child_nodes(node, search_begin_nodes, analyzed);
|
|
204
194
|
|
|
205
195
|
return false;
|
|
206
196
|
}
|
|
@@ -214,11 +204,7 @@ bool search_unless_nodes(const pm_node_t* node, void* data) {
|
|
|
214
204
|
bool has_if_keyword = unless_node->keyword_loc.start != NULL && unless_node->keyword_loc.end != NULL;
|
|
215
205
|
bool has_end_keyword = unless_node->end_keyword_loc.start != NULL && unless_node->end_keyword_loc.end != NULL;
|
|
216
206
|
|
|
217
|
-
if (has_if_keyword && has_end_keyword) {
|
|
218
|
-
analyzed->has_unless_node = true;
|
|
219
|
-
|
|
220
|
-
return true;
|
|
221
|
-
}
|
|
207
|
+
if (has_if_keyword && has_end_keyword) { analyzed->unless_node_count++; }
|
|
222
208
|
}
|
|
223
209
|
|
|
224
210
|
pm_visit_child_nodes(node, search_unless_nodes, analyzed);
|
|
@@ -228,7 +214,7 @@ bool search_unless_nodes(const pm_node_t* node, void* data) {
|
|
|
228
214
|
|
|
229
215
|
bool search_elsif_nodes(analyzed_ruby_T* analyzed) {
|
|
230
216
|
if (has_error_message(analyzed, "unexpected 'elsif', ignoring it")) {
|
|
231
|
-
analyzed->
|
|
217
|
+
analyzed->elsif_node_count++;
|
|
232
218
|
return true;
|
|
233
219
|
}
|
|
234
220
|
|
|
@@ -237,7 +223,7 @@ bool search_elsif_nodes(analyzed_ruby_T* analyzed) {
|
|
|
237
223
|
|
|
238
224
|
bool search_else_nodes(analyzed_ruby_T* analyzed) {
|
|
239
225
|
if (has_error_message(analyzed, "unexpected 'else', ignoring it")) {
|
|
240
|
-
analyzed->
|
|
226
|
+
analyzed->else_node_count++;
|
|
241
227
|
return true;
|
|
242
228
|
}
|
|
243
229
|
|
|
@@ -251,7 +237,7 @@ bool search_end_nodes(analyzed_ruby_T* analyzed) {
|
|
|
251
237
|
return false;
|
|
252
238
|
}
|
|
253
239
|
|
|
254
|
-
analyzed->
|
|
240
|
+
analyzed->end_count++;
|
|
255
241
|
return true;
|
|
256
242
|
}
|
|
257
243
|
|
|
@@ -260,7 +246,7 @@ bool search_end_nodes(analyzed_ruby_T* analyzed) {
|
|
|
260
246
|
|
|
261
247
|
bool search_block_closing_nodes(analyzed_ruby_T* analyzed) {
|
|
262
248
|
if (has_error_message(analyzed, "unexpected '}', ignoring it")) {
|
|
263
|
-
analyzed->
|
|
249
|
+
analyzed->block_closing_count++;
|
|
264
250
|
return true;
|
|
265
251
|
}
|
|
266
252
|
|
|
@@ -269,7 +255,7 @@ bool search_block_closing_nodes(analyzed_ruby_T* analyzed) {
|
|
|
269
255
|
|
|
270
256
|
bool search_when_nodes(analyzed_ruby_T* analyzed) {
|
|
271
257
|
if (has_error_message(analyzed, "unexpected 'when', ignoring it")) {
|
|
272
|
-
analyzed->
|
|
258
|
+
analyzed->when_node_count++;
|
|
273
259
|
return true;
|
|
274
260
|
}
|
|
275
261
|
|
|
@@ -278,7 +264,7 @@ bool search_when_nodes(analyzed_ruby_T* analyzed) {
|
|
|
278
264
|
|
|
279
265
|
bool search_in_nodes(analyzed_ruby_T* analyzed) {
|
|
280
266
|
if (has_error_message(analyzed, "unexpected 'in', ignoring it")) {
|
|
281
|
-
analyzed->
|
|
267
|
+
analyzed->in_node_count++;
|
|
282
268
|
return true;
|
|
283
269
|
}
|
|
284
270
|
|
|
@@ -287,7 +273,7 @@ bool search_in_nodes(analyzed_ruby_T* analyzed) {
|
|
|
287
273
|
|
|
288
274
|
bool search_rescue_nodes(analyzed_ruby_T* analyzed) {
|
|
289
275
|
if (has_error_message(analyzed, "unexpected 'rescue', ignoring it")) {
|
|
290
|
-
analyzed->
|
|
276
|
+
analyzed->rescue_node_count++;
|
|
291
277
|
return true;
|
|
292
278
|
}
|
|
293
279
|
|
|
@@ -296,7 +282,7 @@ bool search_rescue_nodes(analyzed_ruby_T* analyzed) {
|
|
|
296
282
|
|
|
297
283
|
bool search_ensure_nodes(analyzed_ruby_T* analyzed) {
|
|
298
284
|
if (has_error_message(analyzed, "unexpected 'ensure', ignoring it")) {
|
|
299
|
-
analyzed->
|
|
285
|
+
analyzed->ensure_node_count++;
|
|
300
286
|
return true;
|
|
301
287
|
}
|
|
302
288
|
|
|
@@ -306,12 +292,121 @@ bool search_ensure_nodes(analyzed_ruby_T* analyzed) {
|
|
|
306
292
|
bool search_yield_nodes(const pm_node_t* node, void* data) {
|
|
307
293
|
analyzed_ruby_T* analyzed = (analyzed_ruby_T*) data;
|
|
308
294
|
|
|
309
|
-
if (node->type == PM_YIELD_NODE) {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
295
|
+
if (node->type == PM_YIELD_NODE) { analyzed->yield_node_count++; }
|
|
296
|
+
|
|
297
|
+
pm_visit_child_nodes(node, search_yield_nodes, analyzed);
|
|
298
|
+
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
static bool is_postfix_conditional(const pm_statements_node_t* statements, pm_location_t keyword_location) {
|
|
303
|
+
if (statements == NULL) { return false; }
|
|
304
|
+
|
|
305
|
+
return statements->base.location.start < keyword_location.start;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
bool search_unclosed_control_flows(const pm_node_t* node, void* data) {
|
|
309
|
+
analyzed_ruby_T* analyzed = (analyzed_ruby_T*) data;
|
|
310
|
+
|
|
311
|
+
if (analyzed->unclosed_control_flow_count >= 2) { return false; }
|
|
312
|
+
|
|
313
|
+
switch (node->type) {
|
|
314
|
+
case PM_IF_NODE: {
|
|
315
|
+
const pm_if_node_t* if_node = (const pm_if_node_t*) node;
|
|
316
|
+
|
|
317
|
+
if (has_location(if_node->if_keyword_loc) && !has_location(if_node->end_keyword_loc)) {
|
|
318
|
+
if (!is_postfix_conditional(if_node->statements, if_node->if_keyword_loc)) {
|
|
319
|
+
analyzed->unclosed_control_flow_count++;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
case PM_UNLESS_NODE: {
|
|
327
|
+
const pm_unless_node_t* unless_node = (const pm_unless_node_t*) node;
|
|
328
|
+
|
|
329
|
+
if (has_location(unless_node->keyword_loc) && !has_location(unless_node->end_keyword_loc)) {
|
|
330
|
+
if (!is_postfix_conditional(unless_node->statements, unless_node->keyword_loc)) {
|
|
331
|
+
analyzed->unclosed_control_flow_count++;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
case PM_CASE_NODE: {
|
|
339
|
+
const pm_case_node_t* case_node = (const pm_case_node_t*) node;
|
|
340
|
+
|
|
341
|
+
if (has_location(case_node->case_keyword_loc) && !has_location(case_node->end_keyword_loc)) {
|
|
342
|
+
analyzed->unclosed_control_flow_count++;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
case PM_CASE_MATCH_NODE: {
|
|
349
|
+
const pm_case_match_node_t* case_match_node = (const pm_case_match_node_t*) node;
|
|
350
|
+
|
|
351
|
+
if (has_location(case_match_node->case_keyword_loc) && !has_location(case_match_node->end_keyword_loc)) {
|
|
352
|
+
analyzed->unclosed_control_flow_count++;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
case PM_WHILE_NODE: {
|
|
359
|
+
const pm_while_node_t* while_node = (const pm_while_node_t*) node;
|
|
360
|
+
|
|
361
|
+
if (has_location(while_node->keyword_loc) && !has_location(while_node->closing_loc)) {
|
|
362
|
+
analyzed->unclosed_control_flow_count++;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
case PM_UNTIL_NODE: {
|
|
369
|
+
const pm_until_node_t* until_node = (const pm_until_node_t*) node;
|
|
370
|
+
|
|
371
|
+
if (has_location(until_node->keyword_loc) && !has_location(until_node->closing_loc)) {
|
|
372
|
+
analyzed->unclosed_control_flow_count++;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
break;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
case PM_FOR_NODE: {
|
|
379
|
+
const pm_for_node_t* for_node = (const pm_for_node_t*) node;
|
|
380
|
+
|
|
381
|
+
if (has_location(for_node->for_keyword_loc) && !has_location(for_node->end_keyword_loc)) {
|
|
382
|
+
analyzed->unclosed_control_flow_count++;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
case PM_BEGIN_NODE: {
|
|
389
|
+
const pm_begin_node_t* begin_node = (const pm_begin_node_t*) node;
|
|
390
|
+
|
|
391
|
+
if (has_location(begin_node->begin_keyword_loc) && !has_location(begin_node->end_keyword_loc)) {
|
|
392
|
+
analyzed->unclosed_control_flow_count++;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
case PM_BLOCK_NODE: {
|
|
399
|
+
const pm_block_node_t* block_node = (const pm_block_node_t*) node;
|
|
400
|
+
bool has_opening = is_do_block(block_node->opening_loc) || is_brace_block(block_node->opening_loc);
|
|
401
|
+
|
|
402
|
+
if (has_opening && !has_location(block_node->closing_loc)) { analyzed->unclosed_control_flow_count++; }
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
default: break;
|
|
314
407
|
}
|
|
315
408
|
|
|
409
|
+
pm_visit_child_nodes(node, search_unclosed_control_flows, analyzed);
|
|
410
|
+
|
|
316
411
|
return false;
|
|
317
412
|
}
|
|
@@ -46,6 +46,7 @@ bool search_in_nodes(analyzed_ruby_T* analyzed);
|
|
|
46
46
|
bool search_rescue_nodes(analyzed_ruby_T* analyzed);
|
|
47
47
|
bool search_ensure_nodes(analyzed_ruby_T* analyzed);
|
|
48
48
|
bool search_yield_nodes(const pm_node_t* node, void* data);
|
|
49
|
+
bool search_unclosed_control_flows(const pm_node_t* node, void* data);
|
|
49
50
|
|
|
50
51
|
void check_erb_node_for_missing_end(const AST_NODE_T* node);
|
|
51
52
|
|
|
@@ -1,5 +1,5 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/src/analyze_missing_end.c.erb
|
|
3
3
|
|
|
4
4
|
#include "include/analyze_helpers.h"
|
|
5
5
|
#include "include/errors.h"
|
|
@@ -1,5 +1,5 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/src/analyze_transform.c.erb
|
|
3
3
|
|
|
4
4
|
#include "include/analyze.h"
|
|
5
5
|
#include "include/visitor.h"
|
|
@@ -12,24 +12,25 @@ analyzed_ruby_T* init_analyzed_ruby(hb_string_T source) {
|
|
|
12
12
|
analyzed->root = pm_parse(&analyzed->parser);
|
|
13
13
|
analyzed->valid = (analyzed->parser.error_list.size == 0);
|
|
14
14
|
analyzed->parsed = true;
|
|
15
|
-
analyzed->
|
|
16
|
-
analyzed->
|
|
17
|
-
analyzed->
|
|
18
|
-
analyzed->
|
|
19
|
-
analyzed->
|
|
20
|
-
analyzed->
|
|
21
|
-
analyzed->
|
|
22
|
-
analyzed->
|
|
23
|
-
analyzed->
|
|
24
|
-
analyzed->
|
|
25
|
-
analyzed->
|
|
26
|
-
analyzed->
|
|
27
|
-
analyzed->
|
|
28
|
-
analyzed->
|
|
29
|
-
analyzed->
|
|
30
|
-
analyzed->
|
|
31
|
-
analyzed->
|
|
32
|
-
analyzed->
|
|
15
|
+
analyzed->if_node_count = 0;
|
|
16
|
+
analyzed->elsif_node_count = 0;
|
|
17
|
+
analyzed->else_node_count = 0;
|
|
18
|
+
analyzed->end_count = 0;
|
|
19
|
+
analyzed->block_node_count = 0;
|
|
20
|
+
analyzed->block_closing_count = 0;
|
|
21
|
+
analyzed->case_node_count = 0;
|
|
22
|
+
analyzed->case_match_node_count = 0;
|
|
23
|
+
analyzed->when_node_count = 0;
|
|
24
|
+
analyzed->in_node_count = 0;
|
|
25
|
+
analyzed->for_node_count = 0;
|
|
26
|
+
analyzed->while_node_count = 0;
|
|
27
|
+
analyzed->until_node_count = 0;
|
|
28
|
+
analyzed->begin_node_count = 0;
|
|
29
|
+
analyzed->rescue_node_count = 0;
|
|
30
|
+
analyzed->ensure_node_count = 0;
|
|
31
|
+
analyzed->unless_node_count = 0;
|
|
32
|
+
analyzed->yield_node_count = 0;
|
|
33
|
+
analyzed->unclosed_control_flow_count = 0;
|
|
33
34
|
|
|
34
35
|
return analyzed;
|
|
35
36
|
}
|
|
@@ -45,19 +46,19 @@ void free_analyzed_ruby(analyzed_ruby_T* analyzed) {
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
const char* erb_keyword_from_analyzed_ruby(const analyzed_ruby_T* analyzed) {
|
|
48
|
-
if (analyzed->
|
|
49
|
+
if (analyzed->end_count > 0) {
|
|
49
50
|
return "`<% end %>`";
|
|
50
|
-
} else if (analyzed->
|
|
51
|
+
} else if (analyzed->else_node_count > 0) {
|
|
51
52
|
return "`<% else %>`";
|
|
52
|
-
} else if (analyzed->
|
|
53
|
+
} else if (analyzed->elsif_node_count > 0) {
|
|
53
54
|
return "`<% elsif %>`";
|
|
54
|
-
} else if (analyzed->
|
|
55
|
+
} else if (analyzed->when_node_count > 0) {
|
|
55
56
|
return "`<% when %>`";
|
|
56
|
-
} else if (analyzed->
|
|
57
|
+
} else if (analyzed->in_node_count > 0) {
|
|
57
58
|
return "`<% in %>`";
|
|
58
|
-
} else if (analyzed->
|
|
59
|
+
} else if (analyzed->rescue_node_count > 0) {
|
|
59
60
|
return "`<% rescue %>`";
|
|
60
|
-
} else if (analyzed->
|
|
61
|
+
} else if (analyzed->ensure_node_count > 0) {
|
|
61
62
|
return "`<% ensure %>`";
|
|
62
63
|
}
|
|
63
64
|
|
|
@@ -11,24 +11,25 @@ typedef struct ANALYZED_RUBY_STRUCT {
|
|
|
11
11
|
pm_node_t* root;
|
|
12
12
|
bool valid;
|
|
13
13
|
bool parsed;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
14
|
+
int if_node_count;
|
|
15
|
+
int elsif_node_count;
|
|
16
|
+
int else_node_count;
|
|
17
|
+
int end_count;
|
|
18
|
+
int block_closing_count;
|
|
19
|
+
int block_node_count;
|
|
20
|
+
int case_node_count;
|
|
21
|
+
int case_match_node_count;
|
|
22
|
+
int when_node_count;
|
|
23
|
+
int in_node_count;
|
|
24
|
+
int for_node_count;
|
|
25
|
+
int while_node_count;
|
|
26
|
+
int until_node_count;
|
|
27
|
+
int begin_node_count;
|
|
28
|
+
int rescue_node_count;
|
|
29
|
+
int ensure_node_count;
|
|
30
|
+
int unless_node_count;
|
|
31
|
+
int yield_node_count;
|
|
32
|
+
int unclosed_control_flow_count;
|
|
32
33
|
} analyzed_ruby_T;
|
|
33
34
|
|
|
34
35
|
analyzed_ruby_T* init_analyzed_ruby(hb_string_T source);
|
|
@@ -1,5 +1,5 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/src/ast_nodes.c.erb
|
|
3
3
|
|
|
4
4
|
#include <stdio.h>
|
|
5
5
|
#include <stdbool.h>
|
|
@@ -1,5 +1,5 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/src/include/ast_nodes.h.erb
|
|
3
3
|
|
|
4
4
|
#ifndef HERB_AST_NODES_H
|
|
5
5
|
#define HERB_AST_NODES_H
|
|
@@ -1,6 +1,7 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/src/ast_pretty_print.c.erb
|
|
3
3
|
|
|
4
|
+
#include "include/analyze_helpers.h"
|
|
4
5
|
#include "include/ast_node.h"
|
|
5
6
|
#include "include/ast_nodes.h"
|
|
6
7
|
#include "include/errors.h"
|
|
@@ -214,21 +215,21 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
214
215
|
pretty_print_token_property(erb_content_node->content, hb_string("content"), indent, relative_indent, false, buffer);
|
|
215
216
|
pretty_print_token_property(erb_content_node->tag_closing, hb_string("tag_closing"), indent, relative_indent, false, buffer);
|
|
216
217
|
if (erb_content_node->analyzed_ruby) {
|
|
217
|
-
pretty_print_boolean_property(hb_string("if_node"), erb_content_node->analyzed_ruby
|
|
218
|
-
pretty_print_boolean_property(hb_string("elsif_node"), erb_content_node->analyzed_ruby
|
|
219
|
-
pretty_print_boolean_property(hb_string("else_node"), erb_content_node->analyzed_ruby
|
|
220
|
-
pretty_print_boolean_property(hb_string("end"), erb_content_node->analyzed_ruby
|
|
221
|
-
pretty_print_boolean_property(hb_string("block_node"), erb_content_node->analyzed_ruby
|
|
222
|
-
pretty_print_boolean_property(hb_string("block_closing"), erb_content_node->analyzed_ruby
|
|
223
|
-
pretty_print_boolean_property(hb_string("case_node"), erb_content_node->analyzed_ruby
|
|
224
|
-
pretty_print_boolean_property(hb_string("when_node"), erb_content_node->analyzed_ruby
|
|
225
|
-
pretty_print_boolean_property(hb_string("for_node"), erb_content_node->analyzed_ruby
|
|
226
|
-
pretty_print_boolean_property(hb_string("while_node"), erb_content_node->analyzed_ruby
|
|
227
|
-
pretty_print_boolean_property(hb_string("until_node"), erb_content_node->analyzed_ruby
|
|
228
|
-
pretty_print_boolean_property(hb_string("begin_node"), erb_content_node->analyzed_ruby
|
|
229
|
-
pretty_print_boolean_property(hb_string("rescue_node"), erb_content_node->analyzed_ruby
|
|
230
|
-
pretty_print_boolean_property(hb_string("ensure_node"), erb_content_node->analyzed_ruby
|
|
231
|
-
pretty_print_boolean_property(hb_string("unless_node"), erb_content_node->analyzed_ruby
|
|
218
|
+
pretty_print_boolean_property(hb_string("if_node"), has_if_node(erb_content_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
219
|
+
pretty_print_boolean_property(hb_string("elsif_node"), has_elsif_node(erb_content_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
220
|
+
pretty_print_boolean_property(hb_string("else_node"), has_else_node(erb_content_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
221
|
+
pretty_print_boolean_property(hb_string("end"), has_end(erb_content_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
222
|
+
pretty_print_boolean_property(hb_string("block_node"), has_block_node(erb_content_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
223
|
+
pretty_print_boolean_property(hb_string("block_closing"), has_block_closing(erb_content_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
224
|
+
pretty_print_boolean_property(hb_string("case_node"), has_case_node(erb_content_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
225
|
+
pretty_print_boolean_property(hb_string("when_node"), has_when_node(erb_content_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
226
|
+
pretty_print_boolean_property(hb_string("for_node"), has_for_node(erb_content_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
227
|
+
pretty_print_boolean_property(hb_string("while_node"), has_while_node(erb_content_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
228
|
+
pretty_print_boolean_property(hb_string("until_node"), has_until_node(erb_content_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
229
|
+
pretty_print_boolean_property(hb_string("begin_node"), has_begin_node(erb_content_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
230
|
+
pretty_print_boolean_property(hb_string("rescue_node"), has_rescue_node(erb_content_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
231
|
+
pretty_print_boolean_property(hb_string("ensure_node"), has_ensure_node(erb_content_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
232
|
+
pretty_print_boolean_property(hb_string("unless_node"), has_unless_node(erb_content_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
232
233
|
} else {
|
|
233
234
|
pretty_print_label(hb_string("analyzed_ruby"), indent, relative_indent, false, buffer);
|
|
234
235
|
hb_buffer_append(buffer, " ∅\n");
|
|
@@ -1,5 +1,5 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/src/include/ast_pretty_print.h.erb
|
|
3
3
|
|
|
4
4
|
#ifndef HERB_AST_PRETTY_PRINT_H
|
|
5
5
|
#define HERB_AST_PRETTY_PRINT_H
|
|
@@ -1,5 +1,5 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/src/errors.c.erb
|
|
3
3
|
|
|
4
4
|
#include "include/errors.h"
|
|
5
5
|
#include "include/location.h"
|
|
@@ -497,6 +497,20 @@ void append_missingerb_end_tag_error(const char* keyword, position_T start, posi
|
|
|
497
497
|
hb_array_append(errors, missingerb_end_tag_error_init(keyword, start, end));
|
|
498
498
|
}
|
|
499
499
|
|
|
500
|
+
ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* erb_multiple_blocks_in_tag_error_init(position_T start, position_T end) {
|
|
501
|
+
ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* erb_multiple_blocks_in_tag_error = malloc(sizeof(ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T));
|
|
502
|
+
|
|
503
|
+
error_init(&erb_multiple_blocks_in_tag_error->base, ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR, start, end);
|
|
504
|
+
|
|
505
|
+
erb_multiple_blocks_in_tag_error->base.message = herb_strdup("Multiple unclosed control flow blocks in a single ERB tag. Split each block into its own ERB tag, or close all blocks within the same tag.");
|
|
506
|
+
|
|
507
|
+
return erb_multiple_blocks_in_tag_error;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
void append_erb_multiple_blocks_in_tag_error(position_T start, position_T end, hb_array_T* errors) {
|
|
511
|
+
hb_array_append(errors, erb_multiple_blocks_in_tag_error_init(start, end));
|
|
512
|
+
}
|
|
513
|
+
|
|
500
514
|
const char* error_type_to_string(ERROR_T* error) {
|
|
501
515
|
switch (error->type) {
|
|
502
516
|
case UNEXPECTED_ERROR: return "UNEXPECTED_ERROR";
|
|
@@ -510,6 +524,7 @@ const char* error_type_to_string(ERROR_T* error) {
|
|
|
510
524
|
case RUBY_PARSE_ERROR: return "RUBY_PARSE_ERROR";
|
|
511
525
|
case ERB_CONTROL_FLOW_SCOPE_ERROR: return "ERB_CONTROL_FLOW_SCOPE_ERROR";
|
|
512
526
|
case MISSINGERB_END_TAG_ERROR: return "MISSINGERB_END_TAG_ERROR";
|
|
527
|
+
case ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR: return "ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR";
|
|
513
528
|
}
|
|
514
529
|
|
|
515
530
|
return "Unknown error_type_T";
|
|
@@ -528,6 +543,7 @@ const char* error_human_type(ERROR_T* error) {
|
|
|
528
543
|
case RUBY_PARSE_ERROR: return "RubyParseError";
|
|
529
544
|
case ERB_CONTROL_FLOW_SCOPE_ERROR: return "ERBControlFlowScopeError";
|
|
530
545
|
case MISSINGERB_END_TAG_ERROR: return "MissingERBEndTagError";
|
|
546
|
+
case ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR: return "ERBMultipleBlocksInTagError";
|
|
531
547
|
}
|
|
532
548
|
|
|
533
549
|
return "Unknown error_type_T";
|
|
@@ -616,6 +632,12 @@ static void error_free_missingerb_end_tag_error(MISSINGERB_END_TAG_ERROR_T* miss
|
|
|
616
632
|
error_free_base_error(&missingerb_end_tag_error->base);
|
|
617
633
|
}
|
|
618
634
|
|
|
635
|
+
static void error_free_erb_multiple_blocks_in_tag_error(ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* erb_multiple_blocks_in_tag_error) {
|
|
636
|
+
/* no ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T specific fields to free up */
|
|
637
|
+
|
|
638
|
+
error_free_base_error(&erb_multiple_blocks_in_tag_error->base);
|
|
639
|
+
}
|
|
640
|
+
|
|
619
641
|
void error_free(ERROR_T* error) {
|
|
620
642
|
if (!error) { return; }
|
|
621
643
|
|
|
@@ -631,6 +653,7 @@ void error_free(ERROR_T* error) {
|
|
|
631
653
|
case RUBY_PARSE_ERROR: error_free_ruby_parse_error((RUBY_PARSE_ERROR_T*) error); break;
|
|
632
654
|
case ERB_CONTROL_FLOW_SCOPE_ERROR: error_free_erb_control_flow_scope_error((ERB_CONTROL_FLOW_SCOPE_ERROR_T*) error); break;
|
|
633
655
|
case MISSINGERB_END_TAG_ERROR: error_free_missingerb_end_tag_error((MISSINGERB_END_TAG_ERROR_T*) error); break;
|
|
656
|
+
case ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR: error_free_erb_multiple_blocks_in_tag_error((ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T*) error); break;
|
|
634
657
|
}
|
|
635
658
|
}
|
|
636
659
|
|
|
@@ -841,6 +864,19 @@ static void error_pretty_print_missingerb_end_tag_error(MISSINGERB_END_TAG_ERROR
|
|
|
841
864
|
pretty_print_quoted_property(hb_string("keyword"), hb_string(error->keyword), indent, relative_indent, true, buffer);
|
|
842
865
|
}
|
|
843
866
|
|
|
867
|
+
static void error_pretty_print_erb_multiple_blocks_in_tag_error(ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
|
|
868
|
+
if (!error) { return; }
|
|
869
|
+
|
|
870
|
+
hb_buffer_append(buffer, "@ ");
|
|
871
|
+
hb_buffer_append(buffer, error_human_type((ERROR_T*) error));
|
|
872
|
+
hb_buffer_append(buffer, " ");
|
|
873
|
+
|
|
874
|
+
pretty_print_location(error->base.location, buffer);
|
|
875
|
+
hb_buffer_append(buffer, "\n");
|
|
876
|
+
|
|
877
|
+
pretty_print_quoted_property(hb_string("message"), hb_string(error->base.message), indent, relative_indent, true, buffer);
|
|
878
|
+
}
|
|
879
|
+
|
|
844
880
|
void error_pretty_print(ERROR_T* error, const size_t indent, const size_t relative_indent, hb_buffer_T* buffer) {
|
|
845
881
|
if (!error) { return; }
|
|
846
882
|
|
|
@@ -856,5 +892,6 @@ void error_pretty_print(ERROR_T* error, const size_t indent, const size_t relati
|
|
|
856
892
|
case RUBY_PARSE_ERROR: error_pretty_print_ruby_parse_error((RUBY_PARSE_ERROR_T*) error, indent, relative_indent, buffer); break;
|
|
857
893
|
case ERB_CONTROL_FLOW_SCOPE_ERROR: error_pretty_print_erb_control_flow_scope_error((ERB_CONTROL_FLOW_SCOPE_ERROR_T*) error, indent, relative_indent, buffer); break;
|
|
858
894
|
case MISSINGERB_END_TAG_ERROR: error_pretty_print_missingerb_end_tag_error((MISSINGERB_END_TAG_ERROR_T*) error, indent, relative_indent, buffer); break;
|
|
895
|
+
case ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR: error_pretty_print_erb_multiple_blocks_in_tag_error((ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T*) error, indent, relative_indent, buffer); break;
|
|
859
896
|
}
|
|
860
897
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/src/include/errors.h.erb
|
|
3
3
|
|
|
4
4
|
#ifndef HERB_ERRORS_H
|
|
5
5
|
#define HERB_ERRORS_H
|
|
@@ -23,6 +23,7 @@ typedef enum {
|
|
|
23
23
|
RUBY_PARSE_ERROR,
|
|
24
24
|
ERB_CONTROL_FLOW_SCOPE_ERROR,
|
|
25
25
|
MISSINGERB_END_TAG_ERROR,
|
|
26
|
+
ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR,
|
|
26
27
|
} error_type_T;
|
|
27
28
|
|
|
28
29
|
typedef struct ERROR_STRUCT {
|
|
@@ -96,6 +97,11 @@ typedef struct {
|
|
|
96
97
|
const char* keyword;
|
|
97
98
|
} MISSINGERB_END_TAG_ERROR_T;
|
|
98
99
|
|
|
100
|
+
typedef struct {
|
|
101
|
+
ERROR_T base;
|
|
102
|
+
/* no additional fields */
|
|
103
|
+
} ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T;
|
|
104
|
+
|
|
99
105
|
UNEXPECTED_ERROR_T* unexpected_error_init(const char* description, const char* expected, const char* found, position_T start, position_T end);
|
|
100
106
|
void append_unexpected_error(const char* description, const char* expected, const char* found, position_T start, position_T end, hb_array_T* errors);
|
|
101
107
|
UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error_init(token_type_T expected_type, token_T* found, position_T start, position_T end);
|
|
@@ -118,6 +124,8 @@ ERB_CONTROL_FLOW_SCOPE_ERROR_T* erb_control_flow_scope_error_init(const char* ke
|
|
|
118
124
|
void append_erb_control_flow_scope_error(const char* keyword, position_T start, position_T end, hb_array_T* errors);
|
|
119
125
|
MISSINGERB_END_TAG_ERROR_T* missingerb_end_tag_error_init(const char* keyword, position_T start, position_T end);
|
|
120
126
|
void append_missingerb_end_tag_error(const char* keyword, position_T start, position_T end, hb_array_T* errors);
|
|
127
|
+
ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* erb_multiple_blocks_in_tag_error_init(position_T start, position_T end);
|
|
128
|
+
void append_erb_multiple_blocks_in_tag_error(position_T start, position_T end, hb_array_T* errors);
|
|
121
129
|
|
|
122
130
|
void error_init(ERROR_T* error, error_type_T type, position_T start, position_T end);
|
|
123
131
|
|
|
@@ -25,7 +25,8 @@ void herb_extract_ruby_to_buffer(const char* source, hb_buffer_T* output) {
|
|
|
25
25
|
if (strcmp(token->value, "<%#") == 0) {
|
|
26
26
|
skip_erb_content = true;
|
|
27
27
|
is_comment_tag = true;
|
|
28
|
-
} else if (strcmp(token->value, "<%%") == 0 || strcmp(token->value, "<%%=") == 0
|
|
28
|
+
} else if (strcmp(token->value, "<%%") == 0 || strcmp(token->value, "<%%=") == 0
|
|
29
|
+
|| strcmp(token->value, "<%graphql") == 0) {
|
|
29
30
|
skip_erb_content = true;
|
|
30
31
|
is_comment_tag = false;
|
|
31
32
|
} else {
|
|
@@ -46,6 +46,7 @@ bool search_in_nodes(analyzed_ruby_T* analyzed);
|
|
|
46
46
|
bool search_rescue_nodes(analyzed_ruby_T* analyzed);
|
|
47
47
|
bool search_ensure_nodes(analyzed_ruby_T* analyzed);
|
|
48
48
|
bool search_yield_nodes(const pm_node_t* node, void* data);
|
|
49
|
+
bool search_unclosed_control_flows(const pm_node_t* node, void* data);
|
|
49
50
|
|
|
50
51
|
void check_erb_node_for_missing_end(const AST_NODE_T* node);
|
|
51
52
|
|
|
@@ -11,24 +11,25 @@ typedef struct ANALYZED_RUBY_STRUCT {
|
|
|
11
11
|
pm_node_t* root;
|
|
12
12
|
bool valid;
|
|
13
13
|
bool parsed;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
14
|
+
int if_node_count;
|
|
15
|
+
int elsif_node_count;
|
|
16
|
+
int else_node_count;
|
|
17
|
+
int end_count;
|
|
18
|
+
int block_closing_count;
|
|
19
|
+
int block_node_count;
|
|
20
|
+
int case_node_count;
|
|
21
|
+
int case_match_node_count;
|
|
22
|
+
int when_node_count;
|
|
23
|
+
int in_node_count;
|
|
24
|
+
int for_node_count;
|
|
25
|
+
int while_node_count;
|
|
26
|
+
int until_node_count;
|
|
27
|
+
int begin_node_count;
|
|
28
|
+
int rescue_node_count;
|
|
29
|
+
int ensure_node_count;
|
|
30
|
+
int unless_node_count;
|
|
31
|
+
int yield_node_count;
|
|
32
|
+
int unclosed_control_flow_count;
|
|
32
33
|
} analyzed_ruby_T;
|
|
33
34
|
|
|
34
35
|
analyzed_ruby_T* init_analyzed_ruby(hb_string_T source);
|
|
@@ -1,5 +1,5 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/src/include/ast_nodes.h.erb
|
|
3
3
|
|
|
4
4
|
#ifndef HERB_AST_NODES_H
|
|
5
5
|
#define HERB_AST_NODES_H
|
|
@@ -1,5 +1,5 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/src/include/ast_pretty_print.h.erb
|
|
3
3
|
|
|
4
4
|
#ifndef HERB_AST_PRETTY_PRINT_H
|
|
5
5
|
#define HERB_AST_PRETTY_PRINT_H
|
|
@@ -1,5 +1,5 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/src/include/errors.h.erb
|
|
3
3
|
|
|
4
4
|
#ifndef HERB_ERRORS_H
|
|
5
5
|
#define HERB_ERRORS_H
|
|
@@ -23,6 +23,7 @@ typedef enum {
|
|
|
23
23
|
RUBY_PARSE_ERROR,
|
|
24
24
|
ERB_CONTROL_FLOW_SCOPE_ERROR,
|
|
25
25
|
MISSINGERB_END_TAG_ERROR,
|
|
26
|
+
ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR,
|
|
26
27
|
} error_type_T;
|
|
27
28
|
|
|
28
29
|
typedef struct ERROR_STRUCT {
|
|
@@ -96,6 +97,11 @@ typedef struct {
|
|
|
96
97
|
const char* keyword;
|
|
97
98
|
} MISSINGERB_END_TAG_ERROR_T;
|
|
98
99
|
|
|
100
|
+
typedef struct {
|
|
101
|
+
ERROR_T base;
|
|
102
|
+
/* no additional fields */
|
|
103
|
+
} ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T;
|
|
104
|
+
|
|
99
105
|
UNEXPECTED_ERROR_T* unexpected_error_init(const char* description, const char* expected, const char* found, position_T start, position_T end);
|
|
100
106
|
void append_unexpected_error(const char* description, const char* expected, const char* found, position_T start, position_T end, hb_array_T* errors);
|
|
101
107
|
UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error_init(token_type_T expected_type, token_T* found, position_T start, position_T end);
|
|
@@ -118,6 +124,8 @@ ERB_CONTROL_FLOW_SCOPE_ERROR_T* erb_control_flow_scope_error_init(const char* ke
|
|
|
118
124
|
void append_erb_control_flow_scope_error(const char* keyword, position_T start, position_T end, hb_array_T* errors);
|
|
119
125
|
MISSINGERB_END_TAG_ERROR_T* missingerb_end_tag_error_init(const char* keyword, position_T start, position_T end);
|
|
120
126
|
void append_missingerb_end_tag_error(const char* keyword, position_T start, position_T end, hb_array_T* errors);
|
|
127
|
+
ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* erb_multiple_blocks_in_tag_error_init(position_T start, position_T end);
|
|
128
|
+
void append_erb_multiple_blocks_in_tag_error(position_T start, position_T end, hb_array_T* errors);
|
|
121
129
|
|
|
122
130
|
void error_init(ERROR_T* error, error_type_T type, position_T start, position_T end);
|
|
123
131
|
|
|
@@ -185,8 +185,8 @@ static token_T* lexer_parse_identifier(lexer_T* lexer) {
|
|
|
185
185
|
// ===== ERB Parsing
|
|
186
186
|
|
|
187
187
|
static token_T* lexer_parse_erb_open(lexer_T* lexer) {
|
|
188
|
-
hb_string_T erb_patterns[] = { hb_string("<%=="), hb_string("<%%="), hb_string("<%="),
|
|
189
|
-
hb_string("<%-"), hb_string("<%%"), hb_string("<%") };
|
|
188
|
+
hb_string_T erb_patterns[] = { hb_string("<%=="), hb_string("<%%="), hb_string("<%="), hb_string("<%#"),
|
|
189
|
+
hb_string("<%-"), hb_string("<%%"), hb_string("<%graphql"), hb_string("<%") };
|
|
190
190
|
|
|
191
191
|
lexer->state = STATE_ERB_CONTENT;
|
|
192
192
|
|
|
@@ -278,7 +278,7 @@ token_T* lexer_next_token(lexer_T* lexer) {
|
|
|
278
278
|
return lexer_advance_with_next(lexer, strlen("<![CDATA["), TOKEN_CDATA_START);
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
if (
|
|
281
|
+
if (isalpha(lexer_peek(lexer, 1))) { return lexer_advance_current(lexer, TOKEN_HTML_TAG_START); }
|
|
282
282
|
|
|
283
283
|
if (lexer_peek_for_html_comment_start(lexer, 0)) {
|
|
284
284
|
return lexer_advance_with(lexer, hb_string("<!--"), TOKEN_HTML_COMMENT_START);
|
|
@@ -1115,7 +1115,9 @@ static void parser_parse_in_data_state(parser_T* parser, hb_array_T* children, h
|
|
|
1115
1115
|
TOKEN_DASH,
|
|
1116
1116
|
TOKEN_EQUALS,
|
|
1117
1117
|
TOKEN_EXCLAMATION,
|
|
1118
|
+
TOKEN_HTML_TAG_END,
|
|
1118
1119
|
TOKEN_IDENTIFIER,
|
|
1120
|
+
TOKEN_LT,
|
|
1119
1121
|
TOKEN_NBSP,
|
|
1120
1122
|
TOKEN_NEWLINE,
|
|
1121
1123
|
TOKEN_PERCENT,
|
|
@@ -1149,11 +1151,11 @@ static size_t find_matching_close_tag(hb_array_T* nodes, size_t start_idx, hb_st
|
|
|
1149
1151
|
if (node->type == AST_HTML_OPEN_TAG_NODE) {
|
|
1150
1152
|
AST_HTML_OPEN_TAG_NODE_T* open = (AST_HTML_OPEN_TAG_NODE_T*) node;
|
|
1151
1153
|
|
|
1152
|
-
if (
|
|
1154
|
+
if (hb_string_equals_case_insensitive(hb_string(open->tag_name->value), tag_name)) { depth++; }
|
|
1153
1155
|
} else if (node->type == AST_HTML_CLOSE_TAG_NODE) {
|
|
1154
1156
|
AST_HTML_CLOSE_TAG_NODE_T* close = (AST_HTML_CLOSE_TAG_NODE_T*) node;
|
|
1155
1157
|
|
|
1156
|
-
if (
|
|
1158
|
+
if (hb_string_equals_case_insensitive(hb_string(close->tag_name->value), tag_name)) {
|
|
1157
1159
|
if (depth == 0) { return i; }
|
|
1158
1160
|
depth--;
|
|
1159
1161
|
}
|
|
@@ -24,7 +24,7 @@ bool parser_check_matching_tag(const parser_T* parser, hb_string_T tag_name) {
|
|
|
24
24
|
token_T* top_token = hb_array_last(parser->open_tags_stack);
|
|
25
25
|
if (top_token == NULL || top_token->value == NULL) { return false; };
|
|
26
26
|
|
|
27
|
-
return
|
|
27
|
+
return hb_string_equals_case_insensitive(hb_string(top_token->value), tag_name);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
token_T* parser_pop_open_tag(const parser_T* parser) {
|
|
@@ -49,7 +49,7 @@ bool parser_in_svg_context(const parser_T* parser) {
|
|
|
49
49
|
|
|
50
50
|
if (tag && tag->value) {
|
|
51
51
|
hb_string_T tag_value_string = hb_string(tag->value);
|
|
52
|
-
if (
|
|
52
|
+
if (hb_string_equals_case_insensitive(tag_value_string, hb_string("svg"))) { return true; }
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -61,8 +61,8 @@ bool parser_in_svg_context(const parser_T* parser) {
|
|
|
61
61
|
foreign_content_type_T parser_get_foreign_content_type(hb_string_T tag_name) {
|
|
62
62
|
if (hb_string_is_empty(tag_name)) { return FOREIGN_CONTENT_UNKNOWN; }
|
|
63
63
|
|
|
64
|
-
if (
|
|
65
|
-
if (
|
|
64
|
+
if (hb_string_equals_case_insensitive(tag_name, hb_string("script"))) { return FOREIGN_CONTENT_SCRIPT; }
|
|
65
|
+
if (hb_string_equals_case_insensitive(tag_name, hb_string("style"))) { return FOREIGN_CONTENT_STYLE; }
|
|
66
66
|
|
|
67
67
|
return FOREIGN_CONTENT_UNKNOWN;
|
|
68
68
|
}
|
|
@@ -217,5 +217,5 @@ bool parser_is_expected_closing_tag_name(hb_string_T tag_name, foreign_content_t
|
|
|
217
217
|
|
|
218
218
|
if (hb_string_is_empty(tag_name) || hb_string_is_empty(expected_tag_name)) { return false; }
|
|
219
219
|
|
|
220
|
-
return
|
|
220
|
+
return hb_string_equals_case_insensitive(expected_tag_name, tag_name);
|
|
221
221
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/src/parser_match_tags.c.erb
|
|
3
3
|
|
|
4
4
|
#include "include/parser.h"
|
|
5
5
|
#include "include/ast_nodes.h"
|
|
@@ -1,5 +1,5 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/src/visitor.c.erb
|
|
3
3
|
|
|
4
4
|
#include <stdio.h>
|
|
5
5
|
|
package/extension/nodes.cpp
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/javascript/packages/node/extension/nodes.cpp.erb
|
|
3
3
|
|
|
4
4
|
#include <node_api.h>
|
|
5
5
|
#include "error_helpers.h"
|
package/extension/nodes.h
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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.8.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.8.5/templates/javascript/packages/node/extension/nodes.h.erb
|
|
3
3
|
|
|
4
4
|
#ifndef HERB_EXTENSION_NODES_H
|
|
5
5
|
#define HERB_EXTENSION_NODES_H
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herb-tools/node",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"description": "Native Node.js addon for HTML-aware ERB parsing using Herb.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"host": "https://github.com/marcoroth/herb/releases/download/"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@herb-tools/core": "0.8.
|
|
51
|
+
"@herb-tools/core": "0.8.5",
|
|
52
52
|
"@mapbox/node-pre-gyp": "^2.0.0",
|
|
53
53
|
"node-addon-api": "^8.5.0",
|
|
54
54
|
"node-pre-gyp-github": "^2.0.0"
|
package/CHANGELOG.md
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
## 0.3.1 (2025-06-23)
|
|
2
|
-
|
|
3
|
-
This was a version bump only for @herb-tools/node to align it with other projects, there were no code changes.
|
|
4
|
-
|
|
5
|
-
## 0.3.0 (2025-06-21)
|
|
6
|
-
|
|
7
|
-
This was a version bump only for @herb-tools/node to align it with other projects, there were no code changes.
|
|
8
|
-
|
|
9
|
-
## 0.2.0 (2025-06-11)
|
|
10
|
-
|
|
11
|
-
This was a version bump only for @herb-tools/node to align it with other projects, there were no code changes.
|
|
12
|
-
|
|
13
|
-
## 0.1.1 (2025-04-20)
|
|
14
|
-
|
|
15
|
-
This was a version bump only for @herb-tools/node to align it with other projects, there were no code changes.
|
|
16
|
-
|
|
17
|
-
## 0.1.0 (2025-04-15)
|
|
18
|
-
|
|
19
|
-
This was a version bump only for @herb-tools/node to align it with other projects, there were no code changes.
|