@herb-tools/node 0.8.9 → 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.
Files changed (174) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/binding.gyp +26 -8
  3. package/dist/herb-node.cjs +41 -12
  4. package/dist/herb-node.cjs.map +1 -1
  5. package/dist/herb-node.esm.js +8 -1
  6. package/dist/herb-node.esm.js.map +1 -1
  7. package/dist/types/node-backend.d.ts +3 -1
  8. package/extension/error_helpers.cpp +419 -71
  9. package/extension/error_helpers.h +14 -3
  10. package/extension/extension_helpers.cpp +38 -35
  11. package/extension/extension_helpers.h +2 -2
  12. package/extension/herb.cpp +183 -64
  13. package/extension/libherb/analyze/action_view/attribute_extraction_helpers.c +290 -0
  14. package/extension/libherb/analyze/action_view/attribute_extraction_helpers.h +36 -0
  15. package/extension/libherb/analyze/action_view/content_tag.c +70 -0
  16. package/extension/libherb/analyze/action_view/link_to.c +143 -0
  17. package/extension/libherb/analyze/action_view/registry.c +60 -0
  18. package/extension/libherb/analyze/action_view/tag.c +64 -0
  19. package/extension/libherb/analyze/action_view/tag_helper_handler.h +41 -0
  20. package/extension/libherb/analyze/action_view/tag_helper_node_builders.c +305 -0
  21. package/extension/libherb/analyze/action_view/tag_helper_node_builders.h +70 -0
  22. package/extension/libherb/analyze/action_view/tag_helpers.c +748 -0
  23. package/extension/libherb/analyze/action_view/tag_helpers.h +38 -0
  24. package/extension/libherb/analyze/action_view/turbo_frame_tag.c +88 -0
  25. package/extension/libherb/analyze/analyze.c +882 -0
  26. package/extension/libherb/{include → analyze}/analyze.h +14 -4
  27. package/extension/libherb/{analyzed_ruby.c → analyze/analyzed_ruby.c} +13 -11
  28. package/extension/libherb/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
  29. package/extension/libherb/analyze/builders.c +343 -0
  30. package/extension/libherb/analyze/builders.h +27 -0
  31. package/extension/libherb/analyze/conditional_elements.c +594 -0
  32. package/extension/libherb/analyze/conditional_elements.h +9 -0
  33. package/extension/libherb/analyze/conditional_open_tags.c +640 -0
  34. package/extension/libherb/analyze/conditional_open_tags.h +9 -0
  35. package/extension/libherb/analyze/control_type.c +250 -0
  36. package/extension/libherb/analyze/control_type.h +14 -0
  37. package/extension/libherb/{analyze_helpers.c → analyze/helpers.c} +79 -31
  38. package/extension/libherb/{analyze_helpers.h → analyze/helpers.h} +22 -17
  39. package/extension/libherb/analyze/invalid_structures.c +193 -0
  40. package/extension/libherb/analyze/invalid_structures.h +11 -0
  41. package/extension/libherb/{analyze_missing_end.c → analyze/missing_end.c} +33 -22
  42. package/extension/libherb/analyze/parse_errors.c +84 -0
  43. package/extension/libherb/analyze/prism_annotate.c +397 -0
  44. package/extension/libherb/analyze/prism_annotate.h +16 -0
  45. package/extension/libherb/{analyze_transform.c → analyze/transform.c} +17 -3
  46. package/extension/libherb/ast_node.c +17 -7
  47. package/extension/libherb/ast_node.h +11 -5
  48. package/extension/libherb/ast_nodes.c +663 -388
  49. package/extension/libherb/ast_nodes.h +118 -39
  50. package/extension/libherb/ast_pretty_print.c +191 -7
  51. package/extension/libherb/ast_pretty_print.h +6 -1
  52. package/extension/libherb/element_source.h +3 -8
  53. package/extension/libherb/errors.c +1100 -507
  54. package/extension/libherb/errors.h +155 -54
  55. package/extension/libherb/extract.c +148 -49
  56. package/extension/libherb/extract.h +21 -5
  57. package/extension/libherb/herb.c +52 -34
  58. package/extension/libherb/herb.h +18 -6
  59. package/extension/libherb/herb_prism_node.h +13 -0
  60. package/extension/libherb/html_util.c +241 -12
  61. package/extension/libherb/html_util.h +7 -2
  62. package/extension/libherb/include/analyze/action_view/attribute_extraction_helpers.h +36 -0
  63. package/extension/libherb/include/analyze/action_view/tag_helper_handler.h +41 -0
  64. package/extension/libherb/include/analyze/action_view/tag_helper_node_builders.h +70 -0
  65. package/extension/libherb/include/analyze/action_view/tag_helpers.h +38 -0
  66. package/extension/libherb/{analyze.h → include/analyze/analyze.h} +14 -4
  67. package/extension/libherb/include/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
  68. package/extension/libherb/include/analyze/builders.h +27 -0
  69. package/extension/libherb/include/analyze/conditional_elements.h +9 -0
  70. package/extension/libherb/include/analyze/conditional_open_tags.h +9 -0
  71. package/extension/libherb/include/analyze/control_type.h +14 -0
  72. package/extension/libherb/include/{analyze_helpers.h → analyze/helpers.h} +22 -17
  73. package/extension/libherb/include/analyze/invalid_structures.h +11 -0
  74. package/extension/libherb/include/analyze/prism_annotate.h +16 -0
  75. package/extension/libherb/include/ast_node.h +11 -5
  76. package/extension/libherb/include/ast_nodes.h +118 -39
  77. package/extension/libherb/include/ast_pretty_print.h +6 -1
  78. package/extension/libherb/include/element_source.h +3 -8
  79. package/extension/libherb/include/errors.h +155 -54
  80. package/extension/libherb/include/extract.h +21 -5
  81. package/extension/libherb/include/herb.h +18 -6
  82. package/extension/libherb/include/herb_prism_node.h +13 -0
  83. package/extension/libherb/include/html_util.h +7 -2
  84. package/extension/libherb/include/io.h +3 -1
  85. package/extension/libherb/include/lex_helpers.h +29 -0
  86. package/extension/libherb/include/lexer.h +1 -1
  87. package/extension/libherb/include/lexer_peek_helpers.h +87 -13
  88. package/extension/libherb/include/lexer_struct.h +2 -0
  89. package/extension/libherb/include/location.h +2 -1
  90. package/extension/libherb/include/parser.h +27 -2
  91. package/extension/libherb/include/parser_helpers.h +19 -3
  92. package/extension/libherb/include/pretty_print.h +10 -5
  93. package/extension/libherb/include/prism_context.h +45 -0
  94. package/extension/libherb/include/prism_helpers.h +10 -7
  95. package/extension/libherb/include/prism_serialized.h +12 -0
  96. package/extension/libherb/include/token.h +16 -4
  97. package/extension/libherb/include/token_struct.h +10 -3
  98. package/extension/libherb/include/utf8.h +2 -1
  99. package/extension/libherb/include/util/hb_allocator.h +78 -0
  100. package/extension/libherb/include/util/hb_arena.h +6 -1
  101. package/extension/libherb/include/util/hb_arena_debug.h +12 -1
  102. package/extension/libherb/include/util/hb_array.h +7 -3
  103. package/extension/libherb/include/util/hb_buffer.h +6 -4
  104. package/extension/libherb/include/util/hb_foreach.h +79 -0
  105. package/extension/libherb/include/util/hb_narray.h +8 -4
  106. package/extension/libherb/include/util/hb_string.h +56 -9
  107. package/extension/libherb/include/util/string.h +11 -0
  108. package/extension/libherb/include/util.h +6 -3
  109. package/extension/libherb/include/version.h +1 -1
  110. package/extension/libherb/io.c +3 -2
  111. package/extension/libherb/io.h +3 -1
  112. package/extension/libherb/lex_helpers.h +29 -0
  113. package/extension/libherb/lexer.c +42 -30
  114. package/extension/libherb/lexer.h +1 -1
  115. package/extension/libherb/lexer_peek_helpers.c +12 -74
  116. package/extension/libherb/lexer_peek_helpers.h +87 -13
  117. package/extension/libherb/lexer_struct.h +2 -0
  118. package/extension/libherb/location.c +2 -2
  119. package/extension/libherb/location.h +2 -1
  120. package/extension/libherb/main.c +79 -66
  121. package/extension/libherb/parser.c +784 -247
  122. package/extension/libherb/parser.h +27 -2
  123. package/extension/libherb/parser_helpers.c +110 -23
  124. package/extension/libherb/parser_helpers.h +19 -3
  125. package/extension/libherb/parser_match_tags.c +110 -49
  126. package/extension/libherb/pretty_print.c +29 -24
  127. package/extension/libherb/pretty_print.h +10 -5
  128. package/extension/libherb/prism_context.h +45 -0
  129. package/extension/libherb/prism_helpers.c +30 -27
  130. package/extension/libherb/prism_helpers.h +10 -7
  131. package/extension/libherb/prism_serialized.h +12 -0
  132. package/extension/libherb/ruby_parser.c +2 -0
  133. package/extension/libherb/token.c +151 -66
  134. package/extension/libherb/token.h +16 -4
  135. package/extension/libherb/token_matchers.c +0 -1
  136. package/extension/libherb/token_struct.h +10 -3
  137. package/extension/libherb/utf8.c +7 -6
  138. package/extension/libherb/utf8.h +2 -1
  139. package/extension/libherb/util/hb_allocator.c +341 -0
  140. package/extension/libherb/util/hb_allocator.h +78 -0
  141. package/extension/libherb/util/hb_arena.c +81 -56
  142. package/extension/libherb/util/hb_arena.h +6 -1
  143. package/extension/libherb/util/hb_arena_debug.c +32 -17
  144. package/extension/libherb/util/hb_arena_debug.h +12 -1
  145. package/extension/libherb/util/hb_array.c +30 -15
  146. package/extension/libherb/util/hb_array.h +7 -3
  147. package/extension/libherb/util/hb_buffer.c +17 -21
  148. package/extension/libherb/util/hb_buffer.h +6 -4
  149. package/extension/libherb/util/hb_foreach.h +79 -0
  150. package/extension/libherb/util/hb_narray.c +22 -7
  151. package/extension/libherb/util/hb_narray.h +8 -4
  152. package/extension/libherb/util/hb_string.c +49 -35
  153. package/extension/libherb/util/hb_string.h +56 -9
  154. package/extension/libherb/util/string.h +11 -0
  155. package/extension/libherb/util.c +21 -11
  156. package/extension/libherb/util.h +6 -3
  157. package/extension/libherb/version.h +1 -1
  158. package/extension/libherb/visitor.c +48 -1
  159. package/extension/nodes.cpp +451 -6
  160. package/extension/nodes.h +8 -1
  161. package/extension/prism/include/prism/ast.h +4 -4
  162. package/extension/prism/include/prism/version.h +2 -2
  163. package/extension/prism/src/prism.c +1 -1
  164. package/package.json +12 -8
  165. package/src/node-backend.ts +11 -1
  166. package/dist/types/index-cjs.d.cts +0 -1
  167. package/extension/libherb/analyze.c +0 -1594
  168. package/extension/libherb/element_source.c +0 -12
  169. package/extension/libherb/include/util/hb_system.h +0 -9
  170. package/extension/libherb/util/hb_system.c +0 -30
  171. package/extension/libherb/util/hb_system.h +0 -9
  172. package/src/index-cjs.cts +0 -22
  173. /package/dist/types/{index-esm.d.mts → index.d.ts} +0 -0
  174. /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.8.9/templates/src/include/ast_nodes.h.erb
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
- const char* content;
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
- struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag;
120
+ AST_NODE_T* open_tag;
91
121
  token_T* tag_name;
92
122
  hb_array_T* body;
93
- struct AST_HTML_CLOSE_TAG_NODE_STRUCT* close_tag;
123
+ AST_NODE_T* close_tag;
94
124
  bool is_void;
95
- element_source_t source;
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
- const char* content;
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
- struct AST_NODE_STRUCT* subsequent;
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(const char* content, position_T start_position, position_T end_position, hb_array_T* errors);
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
- 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);
319
- AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag, token_T* tag_name, hb_array_T* body, struct AST_HTML_CLOSE_TAG_NODE_STRUCT* close_tag, bool is_void, element_source_t source, position_T start_position, position_T end_position, hb_array_T* errors);
320
- 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);
321
- 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);
322
- 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);
323
- AST_HTML_TEXT_NODE_T* ast_html_text_node_init(const char* content, position_T start_position, position_T end_position, hb_array_T* errors);
324
- 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);
325
- 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);
326
- 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);
327
- 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);
328
- AST_WHITESPACE_NODE_T* ast_whitespace_node_init(token_T* value, position_T start_position, position_T end_position, hb_array_T* errors);
329
- AST_ERB_CONTENT_NODE_T* ast_erb_content_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, analyzed_ruby_T* analyzed_ruby, bool parsed, bool valid, position_T start_position, position_T end_position, hb_array_T* errors);
330
- 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);
331
- 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);
332
- AST_ERB_IF_NODE_T* ast_erb_if_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, hb_array_T* statements, struct AST_NODE_STRUCT* subsequent, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors);
333
- AST_ERB_BLOCK_NODE_T* ast_erb_block_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* body, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors);
334
- 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);
335
- AST_ERB_CASE_NODE_T* ast_erb_case_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* children, hb_array_T* conditions, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors);
336
- AST_ERB_CASE_MATCH_NODE_T* ast_erb_case_match_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* children, hb_array_T* conditions, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors);
337
- AST_ERB_WHILE_NODE_T* ast_erb_while_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors);
338
- AST_ERB_UNTIL_NODE_T* ast_erb_until_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors);
339
- AST_ERB_FOR_NODE_T* ast_erb_for_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors);
340
- 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);
341
- 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);
342
- AST_ERB_BEGIN_NODE_T* ast_erb_begin_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, struct AST_ERB_RESCUE_NODE_STRUCT* rescue_clause, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_ENSURE_NODE_STRUCT* ensure_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors);
343
- AST_ERB_UNLESS_NODE_T* ast_erb_unless_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, hb_array_T* statements, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors);
344
- 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);
345
- 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);
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.8.9/templates/src/ast_pretty_print.c.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.9.0/templates/src/ast_pretty_print.c.erb
3
3
 
4
- #include "include/analyze_helpers.h"
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, true, buffer);
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(hb_string(literal_node->content), hb_string("content"), indent, relative_indent, true, buffer);
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(element_source_to_string(html_element_node->source), hb_string("source"), indent, relative_indent, true, buffer);
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(hb_string(html_text_node->content), hb_string("content"), indent, relative_indent, true, buffer);
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, true, buffer);
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.8.9/templates/src/include/ast_pretty_print.h.erb
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