@herb-tools/node 0.8.10 → 0.9.0
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/CHANGELOG.md +19 -0
- package/binding.gyp +26 -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 +395 -73
- package/extension/error_helpers.h +13 -3
- package/extension/extension_helpers.cpp +38 -35
- package/extension/extension_helpers.h +2 -2
- package/extension/herb.cpp +183 -64
- package/extension/libherb/analyze/action_view/attribute_extraction_helpers.c +290 -0
- package/extension/libherb/analyze/action_view/attribute_extraction_helpers.h +36 -0
- package/extension/libherb/analyze/action_view/content_tag.c +70 -0
- package/extension/libherb/analyze/action_view/link_to.c +143 -0
- package/extension/libherb/analyze/action_view/registry.c +60 -0
- package/extension/libherb/analyze/action_view/tag.c +64 -0
- package/extension/libherb/analyze/action_view/tag_helper_handler.h +41 -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 +748 -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 +882 -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 +397 -0
- package/extension/libherb/analyze/prism_annotate.h +16 -0
- package/extension/libherb/{analyze_transform.c → analyze/transform.c} +17 -3
- package/extension/libherb/ast_node.c +17 -7
- package/extension/libherb/ast_node.h +11 -5
- package/extension/libherb/ast_nodes.c +663 -388
- package/extension/libherb/ast_nodes.h +118 -39
- package/extension/libherb/ast_pretty_print.c +191 -7
- package/extension/libherb/ast_pretty_print.h +6 -1
- package/extension/libherb/element_source.h +3 -8
- package/extension/libherb/errors.c +1077 -521
- package/extension/libherb/errors.h +149 -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 +41 -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/ast_node.h +11 -5
- package/extension/libherb/include/ast_nodes.h +118 -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 +149 -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 +27 -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 +783 -247
- package/extension/libherb/parser.h +27 -2
- package/extension/libherb/parser_helpers.c +110 -23
- package/extension/libherb/parser_helpers.h +19 -3
- package/extension/libherb/parser_match_tags.c +110 -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 +48 -1
- package/extension/nodes.cpp +451 -6
- package/extension/nodes.h +8 -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,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.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.9.0/templates/src/include/ast_nodes.h.erb
|
|
3
3
|
|
|
4
4
|
#ifndef HERB_AST_NODES_H
|
|
5
5
|
#define HERB_AST_NODES_H
|
|
@@ -7,11 +7,15 @@
|
|
|
7
7
|
#include <stdbool.h>
|
|
8
8
|
#include <prism.h>
|
|
9
9
|
|
|
10
|
-
#include "analyzed_ruby.h"
|
|
10
|
+
#include "analyze/analyzed_ruby.h"
|
|
11
11
|
#include "element_source.h"
|
|
12
|
+
#include "herb_prism_node.h"
|
|
13
|
+
#include "prism_context.h"
|
|
14
|
+
#include "prism_serialized.h"
|
|
12
15
|
#include "location.h"
|
|
13
16
|
#include "position.h"
|
|
14
17
|
#include "token_struct.h"
|
|
18
|
+
#include "util/hb_allocator.h"
|
|
15
19
|
#include "util/hb_array.h"
|
|
16
20
|
#include "util/hb_buffer.h"
|
|
17
21
|
#include "util/hb_string.h"
|
|
@@ -20,11 +24,18 @@ typedef enum {
|
|
|
20
24
|
AST_DOCUMENT_NODE,
|
|
21
25
|
AST_LITERAL_NODE,
|
|
22
26
|
AST_HTML_OPEN_TAG_NODE,
|
|
27
|
+
AST_HTML_CONDITIONAL_OPEN_TAG_NODE,
|
|
23
28
|
AST_HTML_CLOSE_TAG_NODE,
|
|
29
|
+
AST_HTML_OMITTED_CLOSE_TAG_NODE,
|
|
30
|
+
AST_HTML_VIRTUAL_CLOSE_TAG_NODE,
|
|
24
31
|
AST_HTML_ELEMENT_NODE,
|
|
32
|
+
AST_HTML_CONDITIONAL_ELEMENT_NODE,
|
|
25
33
|
AST_HTML_ATTRIBUTE_VALUE_NODE,
|
|
26
34
|
AST_HTML_ATTRIBUTE_NAME_NODE,
|
|
27
35
|
AST_HTML_ATTRIBUTE_NODE,
|
|
36
|
+
AST_RUBY_LITERAL_NODE,
|
|
37
|
+
AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE,
|
|
38
|
+
AST_ERB_OPEN_TAG_NODE,
|
|
28
39
|
AST_HTML_TEXT_NODE,
|
|
29
40
|
AST_HTML_COMMENT_NODE,
|
|
30
41
|
AST_HTML_DOCTYPE_NODE,
|
|
@@ -61,11 +72,13 @@ typedef struct AST_NODE_STRUCT {
|
|
|
61
72
|
typedef struct AST_DOCUMENT_NODE_STRUCT {
|
|
62
73
|
AST_NODE_T base;
|
|
63
74
|
hb_array_T* children;
|
|
75
|
+
herb_prism_context_T* prism_context;
|
|
76
|
+
herb_prism_node_T prism_node;
|
|
64
77
|
} AST_DOCUMENT_NODE_T;
|
|
65
78
|
|
|
66
79
|
typedef struct AST_LITERAL_NODE_STRUCT {
|
|
67
80
|
AST_NODE_T base;
|
|
68
|
-
|
|
81
|
+
hb_string_T content;
|
|
69
82
|
} AST_LITERAL_NODE_T;
|
|
70
83
|
|
|
71
84
|
typedef struct AST_HTML_OPEN_TAG_NODE_STRUCT {
|
|
@@ -77,6 +90,13 @@ typedef struct AST_HTML_OPEN_TAG_NODE_STRUCT {
|
|
|
77
90
|
bool is_void;
|
|
78
91
|
} AST_HTML_OPEN_TAG_NODE_T;
|
|
79
92
|
|
|
93
|
+
typedef struct AST_HTML_CONDITIONAL_OPEN_TAG_NODE_STRUCT {
|
|
94
|
+
AST_NODE_T base;
|
|
95
|
+
AST_NODE_T* conditional;
|
|
96
|
+
token_T* tag_name;
|
|
97
|
+
bool is_void;
|
|
98
|
+
} AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T;
|
|
99
|
+
|
|
80
100
|
typedef struct AST_HTML_CLOSE_TAG_NODE_STRUCT {
|
|
81
101
|
AST_NODE_T base;
|
|
82
102
|
token_T* tag_opening;
|
|
@@ -85,16 +105,38 @@ typedef struct AST_HTML_CLOSE_TAG_NODE_STRUCT {
|
|
|
85
105
|
token_T* tag_closing;
|
|
86
106
|
} AST_HTML_CLOSE_TAG_NODE_T;
|
|
87
107
|
|
|
108
|
+
typedef struct AST_HTML_OMITTED_CLOSE_TAG_NODE_STRUCT {
|
|
109
|
+
AST_NODE_T base;
|
|
110
|
+
token_T* tag_name;
|
|
111
|
+
} AST_HTML_OMITTED_CLOSE_TAG_NODE_T;
|
|
112
|
+
|
|
113
|
+
typedef struct AST_HTML_VIRTUAL_CLOSE_TAG_NODE_STRUCT {
|
|
114
|
+
AST_NODE_T base;
|
|
115
|
+
token_T* tag_name;
|
|
116
|
+
} AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T;
|
|
117
|
+
|
|
88
118
|
typedef struct AST_HTML_ELEMENT_NODE_STRUCT {
|
|
89
119
|
AST_NODE_T base;
|
|
90
|
-
|
|
120
|
+
AST_NODE_T* open_tag;
|
|
91
121
|
token_T* tag_name;
|
|
92
122
|
hb_array_T* body;
|
|
93
|
-
|
|
123
|
+
AST_NODE_T* close_tag;
|
|
94
124
|
bool is_void;
|
|
95
|
-
|
|
125
|
+
hb_string_T element_source;
|
|
96
126
|
} AST_HTML_ELEMENT_NODE_T;
|
|
97
127
|
|
|
128
|
+
typedef struct AST_HTML_CONDITIONAL_ELEMENT_NODE_STRUCT {
|
|
129
|
+
AST_NODE_T base;
|
|
130
|
+
hb_string_T condition;
|
|
131
|
+
AST_NODE_T* open_conditional;
|
|
132
|
+
struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag;
|
|
133
|
+
hb_array_T* body;
|
|
134
|
+
AST_NODE_T* close_tag;
|
|
135
|
+
AST_NODE_T* close_conditional;
|
|
136
|
+
token_T* tag_name;
|
|
137
|
+
hb_string_T element_source;
|
|
138
|
+
} AST_HTML_CONDITIONAL_ELEMENT_NODE_T;
|
|
139
|
+
|
|
98
140
|
typedef struct AST_HTML_ATTRIBUTE_VALUE_NODE_STRUCT {
|
|
99
141
|
AST_NODE_T base;
|
|
100
142
|
token_T* open_quote;
|
|
@@ -115,9 +157,29 @@ typedef struct AST_HTML_ATTRIBUTE_NODE_STRUCT {
|
|
|
115
157
|
struct AST_HTML_ATTRIBUTE_VALUE_NODE_STRUCT* value;
|
|
116
158
|
} AST_HTML_ATTRIBUTE_NODE_T;
|
|
117
159
|
|
|
160
|
+
typedef struct AST_RUBY_LITERAL_NODE_STRUCT {
|
|
161
|
+
AST_NODE_T base;
|
|
162
|
+
hb_string_T content;
|
|
163
|
+
} AST_RUBY_LITERAL_NODE_T;
|
|
164
|
+
|
|
165
|
+
typedef struct AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_STRUCT {
|
|
166
|
+
AST_NODE_T base;
|
|
167
|
+
hb_string_T content;
|
|
168
|
+
hb_string_T prefix;
|
|
169
|
+
} AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T;
|
|
170
|
+
|
|
171
|
+
typedef struct AST_ERB_OPEN_TAG_NODE_STRUCT {
|
|
172
|
+
AST_NODE_T base;
|
|
173
|
+
token_T* tag_opening;
|
|
174
|
+
token_T* content;
|
|
175
|
+
token_T* tag_closing;
|
|
176
|
+
token_T* tag_name;
|
|
177
|
+
hb_array_T* children;
|
|
178
|
+
} AST_ERB_OPEN_TAG_NODE_T;
|
|
179
|
+
|
|
118
180
|
typedef struct AST_HTML_TEXT_NODE_STRUCT {
|
|
119
181
|
AST_NODE_T base;
|
|
120
|
-
|
|
182
|
+
hb_string_T content;
|
|
121
183
|
} AST_HTML_TEXT_NODE_T;
|
|
122
184
|
|
|
123
185
|
typedef struct AST_HTML_COMMENT_NODE_STRUCT {
|
|
@@ -161,6 +223,7 @@ typedef struct AST_ERB_CONTENT_NODE_STRUCT {
|
|
|
161
223
|
analyzed_ruby_T* analyzed_ruby;
|
|
162
224
|
bool parsed;
|
|
163
225
|
bool valid;
|
|
226
|
+
herb_prism_node_T prism_node;
|
|
164
227
|
} AST_ERB_CONTENT_NODE_T;
|
|
165
228
|
|
|
166
229
|
typedef struct AST_ERB_END_NODE_STRUCT {
|
|
@@ -184,8 +247,9 @@ typedef struct AST_ERB_IF_NODE_STRUCT {
|
|
|
184
247
|
token_T* content;
|
|
185
248
|
token_T* tag_closing;
|
|
186
249
|
location_T* then_keyword;
|
|
250
|
+
herb_prism_node_T prism_node;
|
|
187
251
|
hb_array_T* statements;
|
|
188
|
-
|
|
252
|
+
AST_NODE_T* subsequent;
|
|
189
253
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
190
254
|
} AST_ERB_IF_NODE_T;
|
|
191
255
|
|
|
@@ -194,6 +258,7 @@ typedef struct AST_ERB_BLOCK_NODE_STRUCT {
|
|
|
194
258
|
token_T* tag_opening;
|
|
195
259
|
token_T* content;
|
|
196
260
|
token_T* tag_closing;
|
|
261
|
+
herb_prism_node_T prism_node;
|
|
197
262
|
hb_array_T* body;
|
|
198
263
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
199
264
|
} AST_ERB_BLOCK_NODE_T;
|
|
@@ -213,6 +278,7 @@ typedef struct AST_ERB_CASE_NODE_STRUCT {
|
|
|
213
278
|
token_T* content;
|
|
214
279
|
token_T* tag_closing;
|
|
215
280
|
hb_array_T* children;
|
|
281
|
+
herb_prism_node_T prism_node;
|
|
216
282
|
hb_array_T* conditions;
|
|
217
283
|
struct AST_ERB_ELSE_NODE_STRUCT* else_clause;
|
|
218
284
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
@@ -224,6 +290,7 @@ typedef struct AST_ERB_CASE_MATCH_NODE_STRUCT {
|
|
|
224
290
|
token_T* content;
|
|
225
291
|
token_T* tag_closing;
|
|
226
292
|
hb_array_T* children;
|
|
293
|
+
herb_prism_node_T prism_node;
|
|
227
294
|
hb_array_T* conditions;
|
|
228
295
|
struct AST_ERB_ELSE_NODE_STRUCT* else_clause;
|
|
229
296
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
@@ -234,6 +301,7 @@ typedef struct AST_ERB_WHILE_NODE_STRUCT {
|
|
|
234
301
|
token_T* tag_opening;
|
|
235
302
|
token_T* content;
|
|
236
303
|
token_T* tag_closing;
|
|
304
|
+
herb_prism_node_T prism_node;
|
|
237
305
|
hb_array_T* statements;
|
|
238
306
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
239
307
|
} AST_ERB_WHILE_NODE_T;
|
|
@@ -243,6 +311,7 @@ typedef struct AST_ERB_UNTIL_NODE_STRUCT {
|
|
|
243
311
|
token_T* tag_opening;
|
|
244
312
|
token_T* content;
|
|
245
313
|
token_T* tag_closing;
|
|
314
|
+
herb_prism_node_T prism_node;
|
|
246
315
|
hb_array_T* statements;
|
|
247
316
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
248
317
|
} AST_ERB_UNTIL_NODE_T;
|
|
@@ -252,6 +321,7 @@ typedef struct AST_ERB_FOR_NODE_STRUCT {
|
|
|
252
321
|
token_T* tag_opening;
|
|
253
322
|
token_T* content;
|
|
254
323
|
token_T* tag_closing;
|
|
324
|
+
herb_prism_node_T prism_node;
|
|
255
325
|
hb_array_T* statements;
|
|
256
326
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
257
327
|
} AST_ERB_FOR_NODE_T;
|
|
@@ -278,6 +348,7 @@ typedef struct AST_ERB_BEGIN_NODE_STRUCT {
|
|
|
278
348
|
token_T* tag_opening;
|
|
279
349
|
token_T* content;
|
|
280
350
|
token_T* tag_closing;
|
|
351
|
+
herb_prism_node_T prism_node;
|
|
281
352
|
hb_array_T* statements;
|
|
282
353
|
struct AST_ERB_RESCUE_NODE_STRUCT* rescue_clause;
|
|
283
354
|
struct AST_ERB_ELSE_NODE_STRUCT* else_clause;
|
|
@@ -291,6 +362,7 @@ typedef struct AST_ERB_UNLESS_NODE_STRUCT {
|
|
|
291
362
|
token_T* content;
|
|
292
363
|
token_T* tag_closing;
|
|
293
364
|
location_T* then_keyword;
|
|
365
|
+
herb_prism_node_T prism_node;
|
|
294
366
|
hb_array_T* statements;
|
|
295
367
|
struct AST_ERB_ELSE_NODE_STRUCT* else_clause;
|
|
296
368
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
@@ -312,37 +384,44 @@ typedef struct AST_ERB_IN_NODE_STRUCT {
|
|
|
312
384
|
hb_array_T* statements;
|
|
313
385
|
} AST_ERB_IN_NODE_T;
|
|
314
386
|
|
|
315
|
-
AST_DOCUMENT_NODE_T* ast_document_node_init(hb_array_T* children, position_T start_position, position_T end_position, hb_array_T* errors);
|
|
316
|
-
AST_LITERAL_NODE_T* ast_literal_node_init(
|
|
317
|
-
AST_HTML_OPEN_TAG_NODE_T* ast_html_open_tag_node_init(token_T* tag_opening, token_T* tag_name, token_T* tag_closing, hb_array_T* children, bool is_void, position_T start_position, position_T end_position, hb_array_T* errors);
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
387
|
+
AST_DOCUMENT_NODE_T* ast_document_node_init(hb_array_T* children, herb_prism_context_T* prism_context, herb_prism_node_T prism_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
388
|
+
AST_LITERAL_NODE_T* ast_literal_node_init(hb_string_T content, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
389
|
+
AST_HTML_OPEN_TAG_NODE_T* ast_html_open_tag_node_init(token_T* tag_opening, token_T* tag_name, token_T* tag_closing, hb_array_T* children, bool is_void, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
390
|
+
AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T* ast_html_conditional_open_tag_node_init(AST_NODE_T* conditional, token_T* tag_name, bool is_void, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
391
|
+
AST_HTML_CLOSE_TAG_NODE_T* ast_html_close_tag_node_init(token_T* tag_opening, token_T* tag_name, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
392
|
+
AST_HTML_OMITTED_CLOSE_TAG_NODE_T* ast_html_omitted_close_tag_node_init(token_T* tag_name, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
393
|
+
AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T* ast_html_virtual_close_tag_node_init(token_T* tag_name, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
394
|
+
AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(AST_NODE_T* open_tag, token_T* tag_name, hb_array_T* body, AST_NODE_T* close_tag, bool is_void, hb_string_T element_source, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
395
|
+
AST_HTML_CONDITIONAL_ELEMENT_NODE_T* ast_html_conditional_element_node_init(hb_string_T condition, AST_NODE_T* open_conditional, struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag, hb_array_T* body, AST_NODE_T* close_tag, AST_NODE_T* close_conditional, token_T* tag_name, hb_string_T element_source, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
396
|
+
AST_HTML_ATTRIBUTE_VALUE_NODE_T* ast_html_attribute_value_node_init(token_T* open_quote, hb_array_T* children, token_T* close_quote, bool quoted, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
397
|
+
AST_HTML_ATTRIBUTE_NAME_NODE_T* ast_html_attribute_name_node_init(hb_array_T* children, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
398
|
+
AST_HTML_ATTRIBUTE_NODE_T* ast_html_attribute_node_init(struct AST_HTML_ATTRIBUTE_NAME_NODE_STRUCT* name, token_T* equals, struct AST_HTML_ATTRIBUTE_VALUE_NODE_STRUCT* value, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
399
|
+
AST_RUBY_LITERAL_NODE_T* ast_ruby_literal_node_init(hb_string_T content, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
400
|
+
AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T* ast_ruby_html_attributes_splat_node_init(hb_string_T content, hb_string_T prefix, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
401
|
+
AST_ERB_OPEN_TAG_NODE_T* ast_erb_open_tag_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, token_T* tag_name, hb_array_T* children, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
402
|
+
AST_HTML_TEXT_NODE_T* ast_html_text_node_init(hb_string_T content, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
403
|
+
AST_HTML_COMMENT_NODE_T* ast_html_comment_node_init(token_T* comment_start, hb_array_T* children, token_T* comment_end, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
404
|
+
AST_HTML_DOCTYPE_NODE_T* ast_html_doctype_node_init(token_T* tag_opening, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
405
|
+
AST_XML_DECLARATION_NODE_T* ast_xml_declaration_node_init(token_T* tag_opening, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
406
|
+
AST_CDATA_NODE_T* ast_cdata_node_init(token_T* tag_opening, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
407
|
+
AST_WHITESPACE_NODE_T* ast_whitespace_node_init(token_T* value, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
408
|
+
AST_ERB_CONTENT_NODE_T* ast_erb_content_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, analyzed_ruby_T* analyzed_ruby, bool parsed, bool valid, herb_prism_node_T prism_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
409
|
+
AST_ERB_END_NODE_T* ast_erb_end_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
410
|
+
AST_ERB_ELSE_NODE_T* ast_erb_else_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
411
|
+
AST_ERB_IF_NODE_T* ast_erb_if_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, herb_prism_node_T prism_node, hb_array_T* statements, AST_NODE_T* subsequent, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
412
|
+
AST_ERB_BLOCK_NODE_T* ast_erb_block_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, hb_array_T* body, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
413
|
+
AST_ERB_WHEN_NODE_T* ast_erb_when_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
414
|
+
AST_ERB_CASE_NODE_T* ast_erb_case_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* children, herb_prism_node_T prism_node, hb_array_T* conditions, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
415
|
+
AST_ERB_CASE_MATCH_NODE_T* ast_erb_case_match_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* children, herb_prism_node_T prism_node, hb_array_T* conditions, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
416
|
+
AST_ERB_WHILE_NODE_T* ast_erb_while_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, hb_array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
417
|
+
AST_ERB_UNTIL_NODE_T* ast_erb_until_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, hb_array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
418
|
+
AST_ERB_FOR_NODE_T* ast_erb_for_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, hb_array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
419
|
+
AST_ERB_RESCUE_NODE_T* ast_erb_rescue_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, struct AST_ERB_RESCUE_NODE_STRUCT* subsequent, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
420
|
+
AST_ERB_ENSURE_NODE_T* ast_erb_ensure_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
421
|
+
AST_ERB_BEGIN_NODE_T* ast_erb_begin_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, hb_array_T* statements, struct AST_ERB_RESCUE_NODE_STRUCT* rescue_clause, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_ENSURE_NODE_STRUCT* ensure_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
422
|
+
AST_ERB_UNLESS_NODE_T* ast_erb_unless_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, herb_prism_node_T prism_node, hb_array_T* statements, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
423
|
+
AST_ERB_YIELD_NODE_T* ast_erb_yield_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
424
|
+
AST_ERB_IN_NODE_T* ast_erb_in_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
346
425
|
|
|
347
426
|
hb_string_T ast_node_type_to_string(AST_NODE_T* node);
|
|
348
427
|
hb_string_T ast_node_human_type(AST_NODE_T* node);
|
|
@@ -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.0/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);
|
|
@@ -708,3 +890,5 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
|
708
890
|
|
|
709
891
|
}
|
|
710
892
|
}
|
|
893
|
+
|
|
894
|
+
#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.0/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
|