@herb-tools/node 0.8.10 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +27 -8
- package/dist/herb-node.cjs +41 -12
- package/dist/herb-node.cjs.map +1 -1
- package/dist/herb-node.esm.js +8 -1
- package/dist/herb-node.esm.js.map +1 -1
- package/dist/types/node-backend.d.ts +3 -1
- package/extension/error_helpers.cpp +598 -73
- package/extension/error_helpers.h +20 -3
- package/extension/extension_helpers.cpp +40 -35
- package/extension/extension_helpers.h +2 -2
- package/extension/herb.cpp +194 -64
- package/extension/libherb/analyze/action_view/attribute_extraction_helpers.c +303 -0
- package/extension/libherb/analyze/action_view/attribute_extraction_helpers.h +36 -0
- package/extension/libherb/analyze/action_view/content_tag.c +78 -0
- package/extension/libherb/analyze/action_view/link_to.c +167 -0
- package/extension/libherb/analyze/action_view/registry.c +83 -0
- package/extension/libherb/analyze/action_view/tag.c +70 -0
- package/extension/libherb/analyze/action_view/tag_helper_handler.h +43 -0
- package/extension/libherb/analyze/action_view/tag_helper_node_builders.c +305 -0
- package/extension/libherb/analyze/action_view/tag_helper_node_builders.h +70 -0
- package/extension/libherb/analyze/action_view/tag_helpers.c +815 -0
- package/extension/libherb/analyze/action_view/tag_helpers.h +38 -0
- package/extension/libherb/analyze/action_view/turbo_frame_tag.c +88 -0
- package/extension/libherb/analyze/analyze.c +885 -0
- package/extension/libherb/{include → analyze}/analyze.h +14 -4
- package/extension/libherb/{analyzed_ruby.c → analyze/analyzed_ruby.c} +13 -11
- package/extension/libherb/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
- package/extension/libherb/analyze/builders.c +343 -0
- package/extension/libherb/analyze/builders.h +27 -0
- package/extension/libherb/analyze/conditional_elements.c +594 -0
- package/extension/libherb/analyze/conditional_elements.h +9 -0
- package/extension/libherb/analyze/conditional_open_tags.c +640 -0
- package/extension/libherb/analyze/conditional_open_tags.h +9 -0
- package/extension/libherb/analyze/control_type.c +250 -0
- package/extension/libherb/analyze/control_type.h +14 -0
- package/extension/libherb/{analyze_helpers.c → analyze/helpers.c} +48 -23
- package/extension/libherb/{analyze_helpers.h → analyze/helpers.h} +4 -2
- package/extension/libherb/analyze/invalid_structures.c +193 -0
- package/extension/libherb/analyze/invalid_structures.h +11 -0
- package/extension/libherb/{analyze_missing_end.c → analyze/missing_end.c} +33 -22
- package/extension/libherb/analyze/parse_errors.c +84 -0
- package/extension/libherb/analyze/prism_annotate.c +399 -0
- package/extension/libherb/analyze/prism_annotate.h +16 -0
- package/extension/libherb/analyze/render_nodes.c +761 -0
- package/extension/libherb/analyze/render_nodes.h +11 -0
- package/extension/libherb/{analyze_transform.c → analyze/transform.c} +24 -3
- package/extension/libherb/ast_node.c +17 -7
- package/extension/libherb/ast_node.h +11 -5
- package/extension/libherb/ast_nodes.c +760 -388
- package/extension/libherb/ast_nodes.h +155 -39
- package/extension/libherb/ast_pretty_print.c +265 -7
- package/extension/libherb/ast_pretty_print.h +6 -1
- package/extension/libherb/element_source.h +3 -8
- package/extension/libherb/errors.c +1455 -520
- package/extension/libherb/errors.h +207 -56
- package/extension/libherb/extract.c +145 -49
- package/extension/libherb/extract.h +21 -5
- package/extension/libherb/herb.c +52 -34
- package/extension/libherb/herb.h +18 -6
- package/extension/libherb/herb_prism_node.h +13 -0
- package/extension/libherb/html_util.c +241 -12
- package/extension/libherb/html_util.h +7 -2
- package/extension/libherb/include/analyze/action_view/attribute_extraction_helpers.h +36 -0
- package/extension/libherb/include/analyze/action_view/tag_helper_handler.h +43 -0
- package/extension/libherb/include/analyze/action_view/tag_helper_node_builders.h +70 -0
- package/extension/libherb/include/analyze/action_view/tag_helpers.h +38 -0
- package/extension/libherb/{analyze.h → include/analyze/analyze.h} +14 -4
- package/extension/libherb/include/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
- package/extension/libherb/include/analyze/builders.h +27 -0
- package/extension/libherb/include/analyze/conditional_elements.h +9 -0
- package/extension/libherb/include/analyze/conditional_open_tags.h +9 -0
- package/extension/libherb/include/analyze/control_type.h +14 -0
- package/extension/libherb/include/{analyze_helpers.h → analyze/helpers.h} +4 -2
- package/extension/libherb/include/analyze/invalid_structures.h +11 -0
- package/extension/libherb/include/analyze/prism_annotate.h +16 -0
- package/extension/libherb/include/analyze/render_nodes.h +11 -0
- package/extension/libherb/include/ast_node.h +11 -5
- package/extension/libherb/include/ast_nodes.h +155 -39
- package/extension/libherb/include/ast_pretty_print.h +6 -1
- package/extension/libherb/include/element_source.h +3 -8
- package/extension/libherb/include/errors.h +207 -56
- package/extension/libherb/include/extract.h +21 -5
- package/extension/libherb/include/herb.h +18 -6
- package/extension/libherb/include/herb_prism_node.h +13 -0
- package/extension/libherb/include/html_util.h +7 -2
- package/extension/libherb/include/io.h +3 -1
- package/extension/libherb/include/lex_helpers.h +29 -0
- package/extension/libherb/include/lexer.h +1 -1
- package/extension/libherb/include/lexer_peek_helpers.h +87 -13
- package/extension/libherb/include/lexer_struct.h +2 -0
- package/extension/libherb/include/location.h +2 -1
- package/extension/libherb/include/parser.h +28 -2
- package/extension/libherb/include/parser_helpers.h +19 -3
- package/extension/libherb/include/pretty_print.h +10 -5
- package/extension/libherb/include/prism_context.h +45 -0
- package/extension/libherb/include/prism_helpers.h +10 -7
- package/extension/libherb/include/prism_serialized.h +12 -0
- package/extension/libherb/include/token.h +16 -4
- package/extension/libherb/include/token_struct.h +10 -3
- package/extension/libherb/include/utf8.h +2 -1
- package/extension/libherb/include/util/hb_allocator.h +78 -0
- package/extension/libherb/include/util/hb_arena.h +6 -1
- package/extension/libherb/include/util/hb_arena_debug.h +12 -1
- package/extension/libherb/include/util/hb_array.h +7 -3
- package/extension/libherb/include/util/hb_buffer.h +6 -4
- package/extension/libherb/include/util/hb_foreach.h +79 -0
- package/extension/libherb/include/util/hb_narray.h +8 -4
- package/extension/libherb/include/util/hb_string.h +56 -9
- package/extension/libherb/include/util.h +6 -3
- package/extension/libherb/include/version.h +1 -1
- package/extension/libherb/io.c +3 -2
- package/extension/libherb/io.h +3 -1
- package/extension/libherb/lex_helpers.h +29 -0
- package/extension/libherb/lexer.c +42 -30
- package/extension/libherb/lexer.h +1 -1
- package/extension/libherb/lexer_peek_helpers.c +12 -74
- package/extension/libherb/lexer_peek_helpers.h +87 -13
- package/extension/libherb/lexer_struct.h +2 -0
- package/extension/libherb/location.c +2 -2
- package/extension/libherb/location.h +2 -1
- package/extension/libherb/main.c +53 -28
- package/extension/libherb/parser.c +784 -247
- package/extension/libherb/parser.h +28 -2
- package/extension/libherb/parser_helpers.c +110 -23
- package/extension/libherb/parser_helpers.h +19 -3
- package/extension/libherb/parser_match_tags.c +130 -49
- package/extension/libherb/pretty_print.c +29 -24
- package/extension/libherb/pretty_print.h +10 -5
- package/extension/libherb/prism_context.h +45 -0
- package/extension/libherb/prism_helpers.c +30 -27
- package/extension/libherb/prism_helpers.h +10 -7
- package/extension/libherb/prism_serialized.h +12 -0
- package/extension/libherb/ruby_parser.c +2 -0
- package/extension/libherb/token.c +151 -66
- package/extension/libherb/token.h +16 -4
- package/extension/libherb/token_matchers.c +0 -1
- package/extension/libherb/token_struct.h +10 -3
- package/extension/libherb/utf8.c +7 -6
- package/extension/libherb/utf8.h +2 -1
- package/extension/libherb/util/hb_allocator.c +341 -0
- package/extension/libherb/util/hb_allocator.h +78 -0
- package/extension/libherb/util/hb_arena.c +81 -56
- package/extension/libherb/util/hb_arena.h +6 -1
- package/extension/libherb/util/hb_arena_debug.c +32 -17
- package/extension/libherb/util/hb_arena_debug.h +12 -1
- package/extension/libherb/util/hb_array.c +30 -15
- package/extension/libherb/util/hb_array.h +7 -3
- package/extension/libherb/util/hb_buffer.c +17 -21
- package/extension/libherb/util/hb_buffer.h +6 -4
- package/extension/libherb/util/hb_foreach.h +79 -0
- package/extension/libherb/util/hb_narray.c +22 -7
- package/extension/libherb/util/hb_narray.h +8 -4
- package/extension/libherb/util/hb_string.c +49 -35
- package/extension/libherb/util/hb_string.h +56 -9
- package/extension/libherb/util.c +21 -11
- package/extension/libherb/util.h +6 -3
- package/extension/libherb/version.h +1 -1
- package/extension/libherb/visitor.c +68 -1
- package/extension/nodes.cpp +593 -6
- package/extension/nodes.h +10 -1
- package/package.json +12 -8
- package/src/node-backend.ts +11 -1
- package/dist/types/index-cjs.d.cts +0 -1
- package/extension/libherb/analyze.c +0 -1608
- package/extension/libherb/element_source.c +0 -12
- package/extension/libherb/include/util/hb_system.h +0 -9
- package/extension/libherb/util/hb_system.c +0 -30
- package/extension/libherb/util/hb_system.h +0 -9
- package/src/index-cjs.cts +0 -22
- /package/dist/types/{index-esm.d.mts → index.d.ts} +0 -0
- /package/src/{index-esm.mts → index.ts} +0 -0
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.9.1/templates/src/ast_pretty_print.c.erb
|
|
3
3
|
|
|
4
|
-
#
|
|
4
|
+
#ifdef HERB_EXCLUDE_PRETTYPRINT
|
|
5
|
+
// Pretty print support excluded
|
|
6
|
+
#else
|
|
7
|
+
|
|
8
|
+
#include "include/analyze/helpers.h"
|
|
5
9
|
#include "include/ast_node.h"
|
|
6
10
|
#include "include/ast_nodes.h"
|
|
7
11
|
#include "include/errors.h"
|
|
@@ -32,14 +36,19 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
32
36
|
const AST_DOCUMENT_NODE_T* document_node = (AST_DOCUMENT_NODE_T*) node;
|
|
33
37
|
|
|
34
38
|
pretty_print_errors(node, indent, relative_indent, false, buffer);
|
|
35
|
-
pretty_print_array(hb_string("children"), document_node->children, indent, relative_indent,
|
|
39
|
+
pretty_print_array(hb_string("children"), document_node->children, indent, relative_indent, false, buffer);
|
|
40
|
+
/* prism_context is internal state, not pretty printed */
|
|
41
|
+
if (document_node->prism_node.node != NULL) {
|
|
42
|
+
pretty_print_label(hb_string("prism_node"), indent, relative_indent, true, buffer);
|
|
43
|
+
hb_buffer_append(buffer, " (pm_node_t*)\n");
|
|
44
|
+
}
|
|
36
45
|
} break;
|
|
37
46
|
|
|
38
47
|
case AST_LITERAL_NODE: {
|
|
39
48
|
const AST_LITERAL_NODE_T* literal_node = (AST_LITERAL_NODE_T*) node;
|
|
40
49
|
|
|
41
50
|
pretty_print_errors(node, indent, relative_indent, false, buffer);
|
|
42
|
-
pretty_print_string_property(
|
|
51
|
+
pretty_print_string_property(literal_node->content, hb_string("content"), indent, relative_indent, true, buffer);
|
|
43
52
|
} break;
|
|
44
53
|
|
|
45
54
|
case AST_HTML_OPEN_TAG_NODE: {
|
|
@@ -53,6 +62,29 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
53
62
|
pretty_print_boolean_property(hb_string("is_void"), html_open_tag_node->is_void, indent, relative_indent, true, buffer);
|
|
54
63
|
} break;
|
|
55
64
|
|
|
65
|
+
case AST_HTML_CONDITIONAL_OPEN_TAG_NODE: {
|
|
66
|
+
const AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T* html_conditional_open_tag_node = (AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T*) node;
|
|
67
|
+
|
|
68
|
+
pretty_print_errors(node, indent, relative_indent, false, buffer);
|
|
69
|
+
|
|
70
|
+
pretty_print_label(hb_string("conditional"), indent, relative_indent, false, buffer);
|
|
71
|
+
|
|
72
|
+
if (html_conditional_open_tag_node->conditional) {
|
|
73
|
+
hb_buffer_append(buffer, "\n");
|
|
74
|
+
pretty_print_indent(buffer, indent);
|
|
75
|
+
pretty_print_indent(buffer, relative_indent + 1);
|
|
76
|
+
|
|
77
|
+
hb_buffer_append(buffer, "└── ");
|
|
78
|
+
ast_pretty_print_node((AST_NODE_T*) html_conditional_open_tag_node->conditional, indent, relative_indent + 2, buffer);
|
|
79
|
+
} else {
|
|
80
|
+
hb_buffer_append(buffer, " ∅\n");
|
|
81
|
+
}
|
|
82
|
+
hb_buffer_append(buffer, "\n");
|
|
83
|
+
|
|
84
|
+
pretty_print_token_property(html_conditional_open_tag_node->tag_name, hb_string("tag_name"), indent, relative_indent, false, buffer);
|
|
85
|
+
pretty_print_boolean_property(hb_string("is_void"), html_conditional_open_tag_node->is_void, indent, relative_indent, true, buffer);
|
|
86
|
+
} break;
|
|
87
|
+
|
|
56
88
|
case AST_HTML_CLOSE_TAG_NODE: {
|
|
57
89
|
const AST_HTML_CLOSE_TAG_NODE_T* html_close_tag_node = (AST_HTML_CLOSE_TAG_NODE_T*) node;
|
|
58
90
|
|
|
@@ -63,6 +95,20 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
63
95
|
pretty_print_token_property(html_close_tag_node->tag_closing, hb_string("tag_closing"), indent, relative_indent, true, buffer);
|
|
64
96
|
} break;
|
|
65
97
|
|
|
98
|
+
case AST_HTML_OMITTED_CLOSE_TAG_NODE: {
|
|
99
|
+
const AST_HTML_OMITTED_CLOSE_TAG_NODE_T* html_omitted_close_tag_node = (AST_HTML_OMITTED_CLOSE_TAG_NODE_T*) node;
|
|
100
|
+
|
|
101
|
+
pretty_print_errors(node, indent, relative_indent, false, buffer);
|
|
102
|
+
pretty_print_token_property(html_omitted_close_tag_node->tag_name, hb_string("tag_name"), indent, relative_indent, true, buffer);
|
|
103
|
+
} break;
|
|
104
|
+
|
|
105
|
+
case AST_HTML_VIRTUAL_CLOSE_TAG_NODE: {
|
|
106
|
+
const AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T* html_virtual_close_tag_node = (AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T*) node;
|
|
107
|
+
|
|
108
|
+
pretty_print_errors(node, indent, relative_indent, false, buffer);
|
|
109
|
+
pretty_print_token_property(html_virtual_close_tag_node->tag_name, hb_string("tag_name"), indent, relative_indent, true, buffer);
|
|
110
|
+
} break;
|
|
111
|
+
|
|
66
112
|
case AST_HTML_ELEMENT_NODE: {
|
|
67
113
|
const AST_HTML_ELEMENT_NODE_T* html_element_node = (AST_HTML_ELEMENT_NODE_T*) node;
|
|
68
114
|
|
|
@@ -100,7 +146,77 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
100
146
|
hb_buffer_append(buffer, "\n");
|
|
101
147
|
|
|
102
148
|
pretty_print_boolean_property(hb_string("is_void"), html_element_node->is_void, indent, relative_indent, false, buffer);
|
|
103
|
-
pretty_print_string_property(
|
|
149
|
+
pretty_print_string_property(html_element_node->element_source, hb_string("element_source"), indent, relative_indent, true, buffer);
|
|
150
|
+
} break;
|
|
151
|
+
|
|
152
|
+
case AST_HTML_CONDITIONAL_ELEMENT_NODE: {
|
|
153
|
+
const AST_HTML_CONDITIONAL_ELEMENT_NODE_T* html_conditional_element_node = (AST_HTML_CONDITIONAL_ELEMENT_NODE_T*) node;
|
|
154
|
+
|
|
155
|
+
pretty_print_errors(node, indent, relative_indent, false, buffer);
|
|
156
|
+
pretty_print_string_property(html_conditional_element_node->condition, hb_string("condition"), indent, relative_indent, false, buffer);
|
|
157
|
+
|
|
158
|
+
pretty_print_label(hb_string("open_conditional"), indent, relative_indent, false, buffer);
|
|
159
|
+
|
|
160
|
+
if (html_conditional_element_node->open_conditional) {
|
|
161
|
+
hb_buffer_append(buffer, "\n");
|
|
162
|
+
pretty_print_indent(buffer, indent);
|
|
163
|
+
pretty_print_indent(buffer, relative_indent + 1);
|
|
164
|
+
|
|
165
|
+
hb_buffer_append(buffer, "└── ");
|
|
166
|
+
ast_pretty_print_node((AST_NODE_T*) html_conditional_element_node->open_conditional, indent, relative_indent + 2, buffer);
|
|
167
|
+
} else {
|
|
168
|
+
hb_buffer_append(buffer, " ∅\n");
|
|
169
|
+
}
|
|
170
|
+
hb_buffer_append(buffer, "\n");
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
pretty_print_label(hb_string("open_tag"), indent, relative_indent, false, buffer);
|
|
174
|
+
|
|
175
|
+
if (html_conditional_element_node->open_tag) {
|
|
176
|
+
hb_buffer_append(buffer, "\n");
|
|
177
|
+
pretty_print_indent(buffer, indent);
|
|
178
|
+
pretty_print_indent(buffer, relative_indent + 1);
|
|
179
|
+
|
|
180
|
+
hb_buffer_append(buffer, "└── ");
|
|
181
|
+
ast_pretty_print_node((AST_NODE_T*) html_conditional_element_node->open_tag, indent, relative_indent + 2, buffer);
|
|
182
|
+
} else {
|
|
183
|
+
hb_buffer_append(buffer, " ∅\n");
|
|
184
|
+
}
|
|
185
|
+
hb_buffer_append(buffer, "\n");
|
|
186
|
+
|
|
187
|
+
pretty_print_array(hb_string("body"), html_conditional_element_node->body, indent, relative_indent, false, buffer);
|
|
188
|
+
|
|
189
|
+
pretty_print_label(hb_string("close_tag"), indent, relative_indent, false, buffer);
|
|
190
|
+
|
|
191
|
+
if (html_conditional_element_node->close_tag) {
|
|
192
|
+
hb_buffer_append(buffer, "\n");
|
|
193
|
+
pretty_print_indent(buffer, indent);
|
|
194
|
+
pretty_print_indent(buffer, relative_indent + 1);
|
|
195
|
+
|
|
196
|
+
hb_buffer_append(buffer, "└── ");
|
|
197
|
+
ast_pretty_print_node((AST_NODE_T*) html_conditional_element_node->close_tag, indent, relative_indent + 2, buffer);
|
|
198
|
+
} else {
|
|
199
|
+
hb_buffer_append(buffer, " ∅\n");
|
|
200
|
+
}
|
|
201
|
+
hb_buffer_append(buffer, "\n");
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
pretty_print_label(hb_string("close_conditional"), indent, relative_indent, false, buffer);
|
|
205
|
+
|
|
206
|
+
if (html_conditional_element_node->close_conditional) {
|
|
207
|
+
hb_buffer_append(buffer, "\n");
|
|
208
|
+
pretty_print_indent(buffer, indent);
|
|
209
|
+
pretty_print_indent(buffer, relative_indent + 1);
|
|
210
|
+
|
|
211
|
+
hb_buffer_append(buffer, "└── ");
|
|
212
|
+
ast_pretty_print_node((AST_NODE_T*) html_conditional_element_node->close_conditional, indent, relative_indent + 2, buffer);
|
|
213
|
+
} else {
|
|
214
|
+
hb_buffer_append(buffer, " ∅\n");
|
|
215
|
+
}
|
|
216
|
+
hb_buffer_append(buffer, "\n");
|
|
217
|
+
|
|
218
|
+
pretty_print_token_property(html_conditional_element_node->tag_name, hb_string("tag_name"), indent, relative_indent, false, buffer);
|
|
219
|
+
pretty_print_string_property(html_conditional_element_node->element_source, hb_string("element_source"), indent, relative_indent, true, buffer);
|
|
104
220
|
} break;
|
|
105
221
|
|
|
106
222
|
case AST_HTML_ATTRIBUTE_VALUE_NODE: {
|
|
@@ -157,11 +273,37 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
157
273
|
|
|
158
274
|
} break;
|
|
159
275
|
|
|
276
|
+
case AST_RUBY_LITERAL_NODE: {
|
|
277
|
+
const AST_RUBY_LITERAL_NODE_T* ruby_literal_node = (AST_RUBY_LITERAL_NODE_T*) node;
|
|
278
|
+
|
|
279
|
+
pretty_print_errors(node, indent, relative_indent, false, buffer);
|
|
280
|
+
pretty_print_string_property(ruby_literal_node->content, hb_string("content"), indent, relative_indent, true, buffer);
|
|
281
|
+
} break;
|
|
282
|
+
|
|
283
|
+
case AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE: {
|
|
284
|
+
const AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T* ruby_html_attributes_splat_node = (AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T*) node;
|
|
285
|
+
|
|
286
|
+
pretty_print_errors(node, indent, relative_indent, false, buffer);
|
|
287
|
+
pretty_print_string_property(ruby_html_attributes_splat_node->content, hb_string("content"), indent, relative_indent, false, buffer);
|
|
288
|
+
pretty_print_string_property(ruby_html_attributes_splat_node->prefix, hb_string("prefix"), indent, relative_indent, true, buffer);
|
|
289
|
+
} break;
|
|
290
|
+
|
|
291
|
+
case AST_ERB_OPEN_TAG_NODE: {
|
|
292
|
+
const AST_ERB_OPEN_TAG_NODE_T* erb_open_tag_node = (AST_ERB_OPEN_TAG_NODE_T*) node;
|
|
293
|
+
|
|
294
|
+
pretty_print_errors(node, indent, relative_indent, false, buffer);
|
|
295
|
+
pretty_print_token_property(erb_open_tag_node->tag_opening, hb_string("tag_opening"), indent, relative_indent, false, buffer);
|
|
296
|
+
pretty_print_token_property(erb_open_tag_node->content, hb_string("content"), indent, relative_indent, false, buffer);
|
|
297
|
+
pretty_print_token_property(erb_open_tag_node->tag_closing, hb_string("tag_closing"), indent, relative_indent, false, buffer);
|
|
298
|
+
pretty_print_token_property(erb_open_tag_node->tag_name, hb_string("tag_name"), indent, relative_indent, false, buffer);
|
|
299
|
+
pretty_print_array(hb_string("children"), erb_open_tag_node->children, indent, relative_indent, true, buffer);
|
|
300
|
+
} break;
|
|
301
|
+
|
|
160
302
|
case AST_HTML_TEXT_NODE: {
|
|
161
303
|
const AST_HTML_TEXT_NODE_T* html_text_node = (AST_HTML_TEXT_NODE_T*) node;
|
|
162
304
|
|
|
163
305
|
pretty_print_errors(node, indent, relative_indent, false, buffer);
|
|
164
|
-
pretty_print_string_property(
|
|
306
|
+
pretty_print_string_property(html_text_node->content, hb_string("content"), indent, relative_indent, true, buffer);
|
|
165
307
|
} break;
|
|
166
308
|
|
|
167
309
|
case AST_HTML_COMMENT_NODE: {
|
|
@@ -236,7 +378,11 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
236
378
|
}
|
|
237
379
|
|
|
238
380
|
pretty_print_boolean_property(hb_string("parsed"), erb_content_node->parsed, indent, relative_indent, false, buffer);
|
|
239
|
-
pretty_print_boolean_property(hb_string("valid"), erb_content_node->valid, indent, relative_indent,
|
|
381
|
+
pretty_print_boolean_property(hb_string("valid"), erb_content_node->valid, indent, relative_indent, false, buffer);
|
|
382
|
+
if (erb_content_node->prism_node.node != NULL) {
|
|
383
|
+
pretty_print_label(hb_string("prism_node"), indent, relative_indent, true, buffer);
|
|
384
|
+
hb_buffer_append(buffer, " (pm_node_t*)\n");
|
|
385
|
+
}
|
|
240
386
|
} break;
|
|
241
387
|
|
|
242
388
|
case AST_ERB_END_NODE: {
|
|
@@ -278,6 +424,10 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
278
424
|
hb_buffer_append(buffer, " ∅\n");
|
|
279
425
|
}
|
|
280
426
|
|
|
427
|
+
if (erb_if_node->prism_node.node != NULL) {
|
|
428
|
+
pretty_print_label(hb_string("prism_node"), indent, relative_indent, false, buffer);
|
|
429
|
+
hb_buffer_append(buffer, " (pm_node_t*)\n");
|
|
430
|
+
}
|
|
281
431
|
pretty_print_array(hb_string("statements"), erb_if_node->statements, indent, relative_indent, false, buffer);
|
|
282
432
|
|
|
283
433
|
pretty_print_label(hb_string("subsequent"), indent, relative_indent, false, buffer);
|
|
@@ -318,6 +468,10 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
318
468
|
pretty_print_token_property(erb_block_node->tag_opening, hb_string("tag_opening"), indent, relative_indent, false, buffer);
|
|
319
469
|
pretty_print_token_property(erb_block_node->content, hb_string("content"), indent, relative_indent, false, buffer);
|
|
320
470
|
pretty_print_token_property(erb_block_node->tag_closing, hb_string("tag_closing"), indent, relative_indent, false, buffer);
|
|
471
|
+
if (erb_block_node->prism_node.node != NULL) {
|
|
472
|
+
pretty_print_label(hb_string("prism_node"), indent, relative_indent, false, buffer);
|
|
473
|
+
hb_buffer_append(buffer, " (pm_node_t*)\n");
|
|
474
|
+
}
|
|
321
475
|
pretty_print_array(hb_string("body"), erb_block_node->body, indent, relative_indent, false, buffer);
|
|
322
476
|
|
|
323
477
|
pretty_print_label(hb_string("end_node"), indent, relative_indent, true, buffer);
|
|
@@ -367,6 +521,10 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
367
521
|
pretty_print_token_property(erb_case_node->content, hb_string("content"), indent, relative_indent, false, buffer);
|
|
368
522
|
pretty_print_token_property(erb_case_node->tag_closing, hb_string("tag_closing"), indent, relative_indent, false, buffer);
|
|
369
523
|
pretty_print_array(hb_string("children"), erb_case_node->children, indent, relative_indent, false, buffer);
|
|
524
|
+
if (erb_case_node->prism_node.node != NULL) {
|
|
525
|
+
pretty_print_label(hb_string("prism_node"), indent, relative_indent, false, buffer);
|
|
526
|
+
hb_buffer_append(buffer, " (pm_node_t*)\n");
|
|
527
|
+
}
|
|
370
528
|
pretty_print_array(hb_string("conditions"), erb_case_node->conditions, indent, relative_indent, false, buffer);
|
|
371
529
|
|
|
372
530
|
pretty_print_label(hb_string("else_clause"), indent, relative_indent, false, buffer);
|
|
@@ -408,6 +566,10 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
408
566
|
pretty_print_token_property(erb_case_match_node->content, hb_string("content"), indent, relative_indent, false, buffer);
|
|
409
567
|
pretty_print_token_property(erb_case_match_node->tag_closing, hb_string("tag_closing"), indent, relative_indent, false, buffer);
|
|
410
568
|
pretty_print_array(hb_string("children"), erb_case_match_node->children, indent, relative_indent, false, buffer);
|
|
569
|
+
if (erb_case_match_node->prism_node.node != NULL) {
|
|
570
|
+
pretty_print_label(hb_string("prism_node"), indent, relative_indent, false, buffer);
|
|
571
|
+
hb_buffer_append(buffer, " (pm_node_t*)\n");
|
|
572
|
+
}
|
|
411
573
|
pretty_print_array(hb_string("conditions"), erb_case_match_node->conditions, indent, relative_indent, false, buffer);
|
|
412
574
|
|
|
413
575
|
pretty_print_label(hb_string("else_clause"), indent, relative_indent, false, buffer);
|
|
@@ -448,6 +610,10 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
448
610
|
pretty_print_token_property(erb_while_node->tag_opening, hb_string("tag_opening"), indent, relative_indent, false, buffer);
|
|
449
611
|
pretty_print_token_property(erb_while_node->content, hb_string("content"), indent, relative_indent, false, buffer);
|
|
450
612
|
pretty_print_token_property(erb_while_node->tag_closing, hb_string("tag_closing"), indent, relative_indent, false, buffer);
|
|
613
|
+
if (erb_while_node->prism_node.node != NULL) {
|
|
614
|
+
pretty_print_label(hb_string("prism_node"), indent, relative_indent, false, buffer);
|
|
615
|
+
hb_buffer_append(buffer, " (pm_node_t*)\n");
|
|
616
|
+
}
|
|
451
617
|
pretty_print_array(hb_string("statements"), erb_while_node->statements, indent, relative_indent, false, buffer);
|
|
452
618
|
|
|
453
619
|
pretty_print_label(hb_string("end_node"), indent, relative_indent, true, buffer);
|
|
@@ -473,6 +639,10 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
473
639
|
pretty_print_token_property(erb_until_node->tag_opening, hb_string("tag_opening"), indent, relative_indent, false, buffer);
|
|
474
640
|
pretty_print_token_property(erb_until_node->content, hb_string("content"), indent, relative_indent, false, buffer);
|
|
475
641
|
pretty_print_token_property(erb_until_node->tag_closing, hb_string("tag_closing"), indent, relative_indent, false, buffer);
|
|
642
|
+
if (erb_until_node->prism_node.node != NULL) {
|
|
643
|
+
pretty_print_label(hb_string("prism_node"), indent, relative_indent, false, buffer);
|
|
644
|
+
hb_buffer_append(buffer, " (pm_node_t*)\n");
|
|
645
|
+
}
|
|
476
646
|
pretty_print_array(hb_string("statements"), erb_until_node->statements, indent, relative_indent, false, buffer);
|
|
477
647
|
|
|
478
648
|
pretty_print_label(hb_string("end_node"), indent, relative_indent, true, buffer);
|
|
@@ -498,6 +668,10 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
498
668
|
pretty_print_token_property(erb_for_node->tag_opening, hb_string("tag_opening"), indent, relative_indent, false, buffer);
|
|
499
669
|
pretty_print_token_property(erb_for_node->content, hb_string("content"), indent, relative_indent, false, buffer);
|
|
500
670
|
pretty_print_token_property(erb_for_node->tag_closing, hb_string("tag_closing"), indent, relative_indent, false, buffer);
|
|
671
|
+
if (erb_for_node->prism_node.node != NULL) {
|
|
672
|
+
pretty_print_label(hb_string("prism_node"), indent, relative_indent, false, buffer);
|
|
673
|
+
hb_buffer_append(buffer, " (pm_node_t*)\n");
|
|
674
|
+
}
|
|
501
675
|
pretty_print_array(hb_string("statements"), erb_for_node->statements, indent, relative_indent, false, buffer);
|
|
502
676
|
|
|
503
677
|
pretty_print_label(hb_string("end_node"), indent, relative_indent, true, buffer);
|
|
@@ -558,6 +732,10 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
558
732
|
pretty_print_token_property(erb_begin_node->tag_opening, hb_string("tag_opening"), indent, relative_indent, false, buffer);
|
|
559
733
|
pretty_print_token_property(erb_begin_node->content, hb_string("content"), indent, relative_indent, false, buffer);
|
|
560
734
|
pretty_print_token_property(erb_begin_node->tag_closing, hb_string("tag_closing"), indent, relative_indent, false, buffer);
|
|
735
|
+
if (erb_begin_node->prism_node.node != NULL) {
|
|
736
|
+
pretty_print_label(hb_string("prism_node"), indent, relative_indent, false, buffer);
|
|
737
|
+
hb_buffer_append(buffer, " (pm_node_t*)\n");
|
|
738
|
+
}
|
|
561
739
|
pretty_print_array(hb_string("statements"), erb_begin_node->statements, indent, relative_indent, false, buffer);
|
|
562
740
|
|
|
563
741
|
pretty_print_label(hb_string("rescue_clause"), indent, relative_indent, false, buffer);
|
|
@@ -641,6 +819,10 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
641
819
|
hb_buffer_append(buffer, " ∅\n");
|
|
642
820
|
}
|
|
643
821
|
|
|
822
|
+
if (erb_unless_node->prism_node.node != NULL) {
|
|
823
|
+
pretty_print_label(hb_string("prism_node"), indent, relative_indent, false, buffer);
|
|
824
|
+
hb_buffer_append(buffer, " (pm_node_t*)\n");
|
|
825
|
+
}
|
|
644
826
|
pretty_print_array(hb_string("statements"), erb_unless_node->statements, indent, relative_indent, false, buffer);
|
|
645
827
|
|
|
646
828
|
pretty_print_label(hb_string("else_clause"), indent, relative_indent, false, buffer);
|
|
@@ -674,6 +856,80 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
674
856
|
|
|
675
857
|
} break;
|
|
676
858
|
|
|
859
|
+
case AST_RUBY_RENDER_LOCAL_NODE: {
|
|
860
|
+
const AST_RUBY_RENDER_LOCAL_NODE_T* ruby_render_local_node = (AST_RUBY_RENDER_LOCAL_NODE_T*) node;
|
|
861
|
+
|
|
862
|
+
pretty_print_errors(node, indent, relative_indent, false, buffer);
|
|
863
|
+
pretty_print_token_property(ruby_render_local_node->name, hb_string("name"), indent, relative_indent, false, buffer);
|
|
864
|
+
|
|
865
|
+
pretty_print_label(hb_string("value"), indent, relative_indent, true, buffer);
|
|
866
|
+
|
|
867
|
+
if (ruby_render_local_node->value) {
|
|
868
|
+
hb_buffer_append(buffer, "\n");
|
|
869
|
+
pretty_print_indent(buffer, indent);
|
|
870
|
+
pretty_print_indent(buffer, relative_indent + 1);
|
|
871
|
+
|
|
872
|
+
hb_buffer_append(buffer, "└── ");
|
|
873
|
+
ast_pretty_print_node((AST_NODE_T*) ruby_render_local_node->value, indent, relative_indent + 2, buffer);
|
|
874
|
+
} else {
|
|
875
|
+
hb_buffer_append(buffer, " ∅\n");
|
|
876
|
+
}
|
|
877
|
+
hb_buffer_append(buffer, "\n");
|
|
878
|
+
|
|
879
|
+
} break;
|
|
880
|
+
|
|
881
|
+
case AST_ERB_RENDER_NODE: {
|
|
882
|
+
const AST_ERB_RENDER_NODE_T* erb_render_node = (AST_ERB_RENDER_NODE_T*) node;
|
|
883
|
+
|
|
884
|
+
pretty_print_errors(node, indent, relative_indent, false, buffer);
|
|
885
|
+
pretty_print_token_property(erb_render_node->tag_opening, hb_string("tag_opening"), indent, relative_indent, false, buffer);
|
|
886
|
+
pretty_print_token_property(erb_render_node->content, hb_string("content"), indent, relative_indent, false, buffer);
|
|
887
|
+
pretty_print_token_property(erb_render_node->tag_closing, hb_string("tag_closing"), indent, relative_indent, false, buffer);
|
|
888
|
+
if (erb_render_node->analyzed_ruby) {
|
|
889
|
+
pretty_print_boolean_property(hb_string("if_node"), has_if_node(erb_render_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
890
|
+
pretty_print_boolean_property(hb_string("elsif_node"), has_elsif_node(erb_render_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
891
|
+
pretty_print_boolean_property(hb_string("else_node"), has_else_node(erb_render_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
892
|
+
pretty_print_boolean_property(hb_string("end"), has_end(erb_render_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
893
|
+
pretty_print_boolean_property(hb_string("block_node"), has_block_node(erb_render_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
894
|
+
pretty_print_boolean_property(hb_string("block_closing"), has_block_closing(erb_render_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
895
|
+
pretty_print_boolean_property(hb_string("case_node"), has_case_node(erb_render_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
896
|
+
pretty_print_boolean_property(hb_string("when_node"), has_when_node(erb_render_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
897
|
+
pretty_print_boolean_property(hb_string("for_node"), has_for_node(erb_render_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
898
|
+
pretty_print_boolean_property(hb_string("while_node"), has_while_node(erb_render_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
899
|
+
pretty_print_boolean_property(hb_string("until_node"), has_until_node(erb_render_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
900
|
+
pretty_print_boolean_property(hb_string("begin_node"), has_begin_node(erb_render_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
901
|
+
pretty_print_boolean_property(hb_string("rescue_node"), has_rescue_node(erb_render_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
902
|
+
pretty_print_boolean_property(hb_string("ensure_node"), has_ensure_node(erb_render_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
903
|
+
pretty_print_boolean_property(hb_string("unless_node"), has_unless_node(erb_render_node->analyzed_ruby), indent, relative_indent, false, buffer);
|
|
904
|
+
} else {
|
|
905
|
+
pretty_print_label(hb_string("analyzed_ruby"), indent, relative_indent, false, buffer);
|
|
906
|
+
hb_buffer_append(buffer, " ∅\n");
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
if (erb_render_node->prism_node.node != NULL) {
|
|
910
|
+
pretty_print_label(hb_string("prism_node"), indent, relative_indent, false, buffer);
|
|
911
|
+
hb_buffer_append(buffer, " (pm_node_t*)\n");
|
|
912
|
+
}
|
|
913
|
+
pretty_print_token_property(erb_render_node->partial, hb_string("partial"), indent, relative_indent, false, buffer);
|
|
914
|
+
pretty_print_token_property(erb_render_node->template_path, hb_string("template_path"), indent, relative_indent, false, buffer);
|
|
915
|
+
pretty_print_token_property(erb_render_node->layout, hb_string("layout"), indent, relative_indent, false, buffer);
|
|
916
|
+
pretty_print_token_property(erb_render_node->file, hb_string("file"), indent, relative_indent, false, buffer);
|
|
917
|
+
pretty_print_token_property(erb_render_node->inline_template, hb_string("inline_template"), indent, relative_indent, false, buffer);
|
|
918
|
+
pretty_print_token_property(erb_render_node->body, hb_string("body"), indent, relative_indent, false, buffer);
|
|
919
|
+
pretty_print_token_property(erb_render_node->plain, hb_string("plain"), indent, relative_indent, false, buffer);
|
|
920
|
+
pretty_print_token_property(erb_render_node->html, hb_string("html"), indent, relative_indent, false, buffer);
|
|
921
|
+
pretty_print_token_property(erb_render_node->renderable, hb_string("renderable"), indent, relative_indent, false, buffer);
|
|
922
|
+
pretty_print_token_property(erb_render_node->collection, hb_string("collection"), indent, relative_indent, false, buffer);
|
|
923
|
+
pretty_print_token_property(erb_render_node->object, hb_string("object"), indent, relative_indent, false, buffer);
|
|
924
|
+
pretty_print_token_property(erb_render_node->as_name, hb_string("as_name"), indent, relative_indent, false, buffer);
|
|
925
|
+
pretty_print_token_property(erb_render_node->spacer_template, hb_string("spacer_template"), indent, relative_indent, false, buffer);
|
|
926
|
+
pretty_print_token_property(erb_render_node->formats, hb_string("formats"), indent, relative_indent, false, buffer);
|
|
927
|
+
pretty_print_token_property(erb_render_node->variants, hb_string("variants"), indent, relative_indent, false, buffer);
|
|
928
|
+
pretty_print_token_property(erb_render_node->handlers, hb_string("handlers"), indent, relative_indent, false, buffer);
|
|
929
|
+
pretty_print_token_property(erb_render_node->content_type, hb_string("content_type"), indent, relative_indent, false, buffer);
|
|
930
|
+
pretty_print_array(hb_string("locals"), erb_render_node->locals, indent, relative_indent, true, buffer);
|
|
931
|
+
} break;
|
|
932
|
+
|
|
677
933
|
case AST_ERB_YIELD_NODE: {
|
|
678
934
|
const AST_ERB_YIELD_NODE_T* erb_yield_node = (AST_ERB_YIELD_NODE_T*) node;
|
|
679
935
|
|
|
@@ -708,3 +964,5 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
708
964
|
|
|
709
965
|
}
|
|
710
966
|
}
|
|
967
|
+
|
|
968
|
+
#endif
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.9.1/templates/src/include/ast_pretty_print.h.erb
|
|
3
3
|
|
|
4
4
|
#ifndef HERB_AST_PRETTY_PRINT_H
|
|
5
5
|
#define HERB_AST_PRETTY_PRINT_H
|
|
6
6
|
|
|
7
|
+
#ifdef HERB_EXCLUDE_PRETTYPRINT
|
|
8
|
+
// Pretty print support excluded
|
|
9
|
+
#else
|
|
10
|
+
|
|
7
11
|
#include "ast_nodes.h"
|
|
8
12
|
#include "util/hb_buffer.h"
|
|
9
13
|
|
|
@@ -15,3 +19,4 @@ void ast_pretty_print_node(
|
|
|
15
19
|
);
|
|
16
20
|
|
|
17
21
|
#endif
|
|
22
|
+
#endif
|
|
@@ -3,13 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
#include "util/hb_string.h"
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
ELEMENT_SOURCE_HAML,
|
|
10
|
-
ELEMENT_SOURCE_SLIM
|
|
11
|
-
} element_source_t;
|
|
12
|
-
|
|
13
|
-
hb_string_T element_source_to_string(element_source_t source);
|
|
6
|
+
#define ELEMENT_SOURCE_HTML hb_string("HTML")
|
|
7
|
+
#define ELEMENT_SOURCE_HAML hb_string("Haml")
|
|
8
|
+
#define ELEMENT_SOURCE_SLIM hb_string("Slim")
|
|
14
9
|
|
|
15
10
|
#endif
|