herb 0.8.9-arm-linux-gnu → 0.9.0-arm-linux-gnu

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +33 -11
  3. data/README.md +64 -34
  4. data/Rakefile +48 -40
  5. data/config.yml +323 -33
  6. data/ext/herb/error_helpers.c +384 -132
  7. data/ext/herb/error_helpers.h +1 -0
  8. data/ext/herb/extconf.rb +67 -28
  9. data/ext/herb/extension.c +317 -51
  10. data/ext/herb/extension.h +1 -0
  11. data/ext/herb/extension_helpers.c +23 -14
  12. data/ext/herb/extension_helpers.h +2 -2
  13. data/ext/herb/nodes.c +537 -270
  14. data/ext/herb/nodes.h +1 -0
  15. data/herb.gemspec +3 -2
  16. data/lib/herb/3.0/herb.so +0 -0
  17. data/lib/herb/3.1/herb.so +0 -0
  18. data/lib/herb/3.2/herb.so +0 -0
  19. data/lib/herb/3.3/herb.so +0 -0
  20. data/lib/herb/3.4/herb.so +0 -0
  21. data/lib/herb/4.0/herb.so +0 -0
  22. data/lib/herb/ast/helpers.rb +3 -3
  23. data/lib/herb/ast/node.rb +15 -2
  24. data/lib/herb/ast/nodes.rb +1132 -157
  25. data/lib/herb/bootstrap.rb +87 -0
  26. data/lib/herb/cli.rb +341 -31
  27. data/lib/herb/configuration.rb +248 -0
  28. data/lib/herb/defaults.yml +32 -0
  29. data/lib/herb/engine/compiler.rb +83 -14
  30. data/lib/herb/engine/debug_visitor.rb +51 -6
  31. data/lib/herb/engine/error_formatter.rb +13 -9
  32. data/lib/herb/engine/parser_error_overlay.rb +10 -6
  33. data/lib/herb/engine/validator.rb +8 -3
  34. data/lib/herb/engine/validators/nesting_validator.rb +2 -2
  35. data/lib/herb/engine.rb +92 -33
  36. data/lib/herb/errors.rb +582 -87
  37. data/lib/herb/lex_result.rb +1 -0
  38. data/lib/herb/location.rb +7 -3
  39. data/lib/herb/parse_result.rb +12 -2
  40. data/lib/herb/parser_options.rb +57 -0
  41. data/lib/herb/position.rb +1 -0
  42. data/lib/herb/prism_inspect.rb +116 -0
  43. data/lib/herb/project.rb +923 -331
  44. data/lib/herb/range.rb +1 -0
  45. data/lib/herb/token.rb +7 -1
  46. data/lib/herb/version.rb +1 -1
  47. data/lib/herb/visitor.rb +37 -2
  48. data/lib/herb/warnings.rb +6 -1
  49. data/lib/herb.rb +35 -3
  50. data/sig/herb/ast/helpers.rbs +2 -2
  51. data/sig/herb/ast/node.rbs +12 -2
  52. data/sig/herb/ast/nodes.rbs +641 -128
  53. data/sig/herb/bootstrap.rbs +31 -0
  54. data/sig/herb/configuration.rbs +89 -0
  55. data/sig/herb/engine/compiler.rbs +9 -1
  56. data/sig/herb/engine/debug_visitor.rbs +8 -0
  57. data/sig/herb/engine/validator.rbs +5 -1
  58. data/sig/herb/engine.rbs +18 -2
  59. data/sig/herb/errors.rbs +268 -63
  60. data/sig/herb/location.rbs +4 -0
  61. data/sig/herb/parse_result.rbs +4 -2
  62. data/sig/herb/parser_options.rbs +42 -0
  63. data/sig/herb/position.rbs +1 -0
  64. data/sig/herb/prism_inspect.rbs +28 -0
  65. data/sig/herb/range.rbs +1 -0
  66. data/sig/herb/token.rbs +6 -0
  67. data/sig/herb/visitor.rbs +25 -4
  68. data/sig/herb/warnings.rbs +6 -1
  69. data/sig/herb.rbs +14 -0
  70. data/sig/herb_c_extension.rbs +5 -2
  71. data/sig/serialized_ast_errors.rbs +57 -6
  72. data/sig/serialized_ast_nodes.rbs +60 -6
  73. data/src/analyze/action_view/attribute_extraction_helpers.c +290 -0
  74. data/src/analyze/action_view/content_tag.c +70 -0
  75. data/src/analyze/action_view/link_to.c +143 -0
  76. data/src/analyze/action_view/registry.c +60 -0
  77. data/src/analyze/action_view/tag.c +64 -0
  78. data/src/analyze/action_view/tag_helper_node_builders.c +305 -0
  79. data/src/analyze/action_view/tag_helpers.c +748 -0
  80. data/src/analyze/action_view/turbo_frame_tag.c +88 -0
  81. data/src/analyze/analyze.c +882 -0
  82. data/src/{analyzed_ruby.c → analyze/analyzed_ruby.c} +13 -11
  83. data/src/analyze/builders.c +343 -0
  84. data/src/analyze/conditional_elements.c +594 -0
  85. data/src/analyze/conditional_open_tags.c +640 -0
  86. data/src/analyze/control_type.c +250 -0
  87. data/src/{analyze_helpers.c → analyze/helpers.c} +79 -31
  88. data/src/analyze/invalid_structures.c +193 -0
  89. data/src/{analyze_missing_end.c → analyze/missing_end.c} +33 -22
  90. data/src/analyze/parse_errors.c +84 -0
  91. data/src/analyze/prism_annotate.c +397 -0
  92. data/src/{analyze_transform.c → analyze/transform.c} +17 -3
  93. data/src/ast_node.c +17 -7
  94. data/src/ast_nodes.c +662 -387
  95. data/src/ast_pretty_print.c +190 -6
  96. data/src/errors.c +1099 -506
  97. data/src/extract.c +148 -49
  98. data/src/herb.c +52 -34
  99. data/src/html_util.c +241 -12
  100. data/src/include/analyze/action_view/attribute_extraction_helpers.h +36 -0
  101. data/src/include/analyze/action_view/tag_helper_handler.h +41 -0
  102. data/src/include/analyze/action_view/tag_helper_node_builders.h +70 -0
  103. data/src/include/analyze/action_view/tag_helpers.h +38 -0
  104. data/src/include/{analyze.h → analyze/analyze.h} +14 -4
  105. data/src/include/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
  106. data/src/include/analyze/builders.h +27 -0
  107. data/src/include/analyze/conditional_elements.h +9 -0
  108. data/src/include/analyze/conditional_open_tags.h +9 -0
  109. data/src/include/analyze/control_type.h +14 -0
  110. data/src/include/{analyze_helpers.h → analyze/helpers.h} +22 -17
  111. data/src/include/analyze/invalid_structures.h +11 -0
  112. data/src/include/analyze/prism_annotate.h +16 -0
  113. data/src/include/ast_node.h +11 -5
  114. data/src/include/ast_nodes.h +117 -38
  115. data/src/include/ast_pretty_print.h +5 -0
  116. data/src/include/element_source.h +3 -8
  117. data/src/include/errors.h +154 -53
  118. data/src/include/extract.h +21 -5
  119. data/src/include/herb.h +18 -6
  120. data/src/include/herb_prism_node.h +13 -0
  121. data/src/include/html_util.h +7 -2
  122. data/src/include/io.h +3 -1
  123. data/src/include/lex_helpers.h +29 -0
  124. data/src/include/lexer.h +1 -1
  125. data/src/include/lexer_peek_helpers.h +87 -13
  126. data/src/include/lexer_struct.h +2 -0
  127. data/src/include/location.h +2 -1
  128. data/src/include/parser.h +27 -2
  129. data/src/include/parser_helpers.h +19 -3
  130. data/src/include/pretty_print.h +10 -5
  131. data/src/include/prism_context.h +45 -0
  132. data/src/include/prism_helpers.h +10 -7
  133. data/src/include/prism_serialized.h +12 -0
  134. data/src/include/token.h +16 -4
  135. data/src/include/token_struct.h +10 -3
  136. data/src/include/utf8.h +2 -1
  137. data/src/include/util/hb_allocator.h +78 -0
  138. data/src/include/util/hb_arena.h +6 -1
  139. data/src/include/util/hb_arena_debug.h +12 -1
  140. data/src/include/util/hb_array.h +7 -3
  141. data/src/include/util/hb_buffer.h +6 -4
  142. data/src/include/util/hb_foreach.h +79 -0
  143. data/src/include/util/hb_narray.h +8 -4
  144. data/src/include/util/hb_string.h +56 -9
  145. data/src/include/util/string.h +11 -0
  146. data/src/include/util.h +6 -3
  147. data/src/include/version.h +1 -1
  148. data/src/io.c +3 -2
  149. data/src/lexer.c +42 -30
  150. data/src/lexer_peek_helpers.c +12 -74
  151. data/src/location.c +2 -2
  152. data/src/main.c +79 -66
  153. data/src/parser.c +784 -247
  154. data/src/parser_helpers.c +110 -23
  155. data/src/parser_match_tags.c +109 -48
  156. data/src/pretty_print.c +29 -24
  157. data/src/prism_helpers.c +30 -27
  158. data/src/ruby_parser.c +2 -0
  159. data/src/token.c +151 -66
  160. data/src/token_matchers.c +0 -1
  161. data/src/utf8.c +7 -6
  162. data/src/util/hb_allocator.c +341 -0
  163. data/src/util/hb_arena.c +81 -56
  164. data/src/util/hb_arena_debug.c +32 -17
  165. data/src/util/hb_array.c +30 -15
  166. data/src/util/hb_buffer.c +17 -21
  167. data/src/util/hb_narray.c +22 -7
  168. data/src/util/hb_string.c +49 -35
  169. data/src/util.c +21 -11
  170. data/src/visitor.c +47 -0
  171. data/templates/ext/herb/error_helpers.c.erb +24 -11
  172. data/templates/ext/herb/error_helpers.h.erb +1 -0
  173. data/templates/ext/herb/nodes.c.erb +50 -16
  174. data/templates/ext/herb/nodes.h.erb +1 -0
  175. data/templates/java/error_helpers.c.erb +1 -1
  176. data/templates/java/nodes.c.erb +30 -8
  177. data/templates/java/org/herb/ast/Errors.java.erb +24 -1
  178. data/templates/java/org/herb/ast/Nodes.java.erb +80 -21
  179. data/templates/javascript/packages/core/src/errors.ts.erb +16 -3
  180. data/templates/javascript/packages/core/src/node-type-guards.ts.erb +3 -1
  181. data/templates/javascript/packages/core/src/nodes.ts.erb +109 -32
  182. data/templates/javascript/packages/node/extension/error_helpers.cpp.erb +13 -4
  183. data/templates/javascript/packages/node/extension/nodes.cpp.erb +43 -4
  184. data/templates/lib/herb/ast/nodes.rb.erb +88 -31
  185. data/templates/lib/herb/errors.rb.erb +15 -3
  186. data/templates/lib/herb/visitor.rb.erb +2 -2
  187. data/templates/rust/src/ast/nodes.rs.erb +97 -44
  188. data/templates/rust/src/errors.rs.erb +2 -1
  189. data/templates/rust/src/nodes.rs.erb +167 -15
  190. data/templates/rust/src/union_types.rs.erb +60 -0
  191. data/templates/rust/src/visitor.rs.erb +81 -0
  192. data/templates/src/{analyze_missing_end.c.erb → analyze/missing_end.c.erb} +9 -6
  193. data/templates/src/{analyze_transform.c.erb → analyze/transform.c.erb} +2 -2
  194. data/templates/src/ast_nodes.c.erb +34 -26
  195. data/templates/src/ast_pretty_print.c.erb +24 -5
  196. data/templates/src/errors.c.erb +60 -54
  197. data/templates/src/include/ast_nodes.h.erb +6 -2
  198. data/templates/src/include/ast_pretty_print.h.erb +5 -0
  199. data/templates/src/include/errors.h.erb +15 -11
  200. data/templates/src/include/util/hb_foreach.h.erb +20 -0
  201. data/templates/src/parser_match_tags.c.erb +10 -4
  202. data/templates/src/visitor.c.erb +2 -2
  203. data/templates/template.rb +204 -29
  204. data/templates/wasm/error_helpers.cpp.erb +9 -5
  205. data/templates/wasm/nodes.cpp.erb +41 -4
  206. data/vendor/prism/config.yml +4 -4
  207. data/vendor/prism/include/prism/ast.h +4 -4
  208. data/vendor/prism/include/prism/version.h +2 -2
  209. data/vendor/prism/src/prism.c +1 -1
  210. data/vendor/prism/templates/java/org/prism/Loader.java.erb +1 -1
  211. data/vendor/prism/templates/javascript/src/deserialize.js.erb +1 -1
  212. data/vendor/prism/templates/lib/prism/node.rb.erb +23 -15
  213. data/vendor/prism/templates/lib/prism/serialize.rb.erb +1 -1
  214. data/vendor/prism/templates/rbi/prism/node.rbi.erb +3 -0
  215. data/vendor/prism/templates/sig/prism/node.rbs.erb +3 -0
  216. data/vendor/prism/templates/sig/prism.rbs.erb +9 -10
  217. metadata +58 -16
  218. data/src/analyze.c +0 -1594
  219. data/src/element_source.c +0 -12
  220. data/src/include/util/hb_system.h +0 -9
  221. data/src/util/hb_system.c +0 -30
@@ -0,0 +1,16 @@
1
+ #ifndef HERB_PRISM_ANNOTATE_H
2
+ #define HERB_PRISM_ANNOTATE_H
3
+
4
+ #include "../ast_nodes.h"
5
+ #include "../util/hb_allocator.h"
6
+
7
+ void herb_annotate_prism_nodes(
8
+ AST_DOCUMENT_NODE_T* document,
9
+ const char* source,
10
+ bool prism_nodes,
11
+ bool prism_nodes_deep,
12
+ bool prism_program,
13
+ hb_allocator_T* allocator
14
+ );
15
+
16
+ #endif
@@ -5,19 +5,25 @@
5
5
  #include "errors.h"
6
6
  #include "position.h"
7
7
  #include "token_struct.h"
8
+ #include "util/hb_allocator.h"
8
9
 
9
- void ast_node_init(AST_NODE_T* node, ast_node_type_T type, position_T start, position_T end, hb_array_T* errors);
10
- void ast_node_free(AST_NODE_T* node);
10
+ void ast_node_init(
11
+ AST_NODE_T* node,
12
+ ast_node_type_T type,
13
+ position_T start,
14
+ position_T end,
15
+ hb_array_T* errors,
16
+ hb_allocator_T* allocator
17
+ );
18
+ void ast_node_free(AST_NODE_T* node, hb_allocator_T* allocator);
11
19
 
12
- AST_LITERAL_NODE_T* ast_literal_node_init_from_token(const token_T* token);
20
+ AST_LITERAL_NODE_T* ast_literal_node_init_from_token(const token_T* token, hb_allocator_T* allocator);
13
21
 
14
22
  size_t ast_node_sizeof(void);
15
23
  size_t ast_node_child_count(AST_NODE_T* node);
16
24
 
17
25
  ast_node_type_T ast_node_type(const AST_NODE_T* node);
18
26
 
19
- char* ast_node_name(AST_NODE_T* node);
20
-
21
27
  void ast_node_set_start(AST_NODE_T* node, position_T position);
22
28
  void ast_node_set_end(AST_NODE_T* node, position_T position);
23
29
 
@@ -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);
@@ -4,6 +4,10 @@
4
4
  #ifndef HERB_AST_PRETTY_PRINT_H
5
5
  #define HERB_AST_PRETTY_PRINT_H
6
6
 
7
+ #ifdef HERB_EXCLUDE_PRETTYPRINT
8
+ // Pretty print support excluded
9
+ #else
10
+
7
11
  #include "ast_nodes.h"
8
12
  #include "util/hb_buffer.h"
9
13
 
@@ -15,3 +19,4 @@ void ast_pretty_print_node(
15
19
  );
16
20
 
17
21
  #endif
22
+ #endif
@@ -3,13 +3,8 @@
3
3
 
4
4
  #include "util/hb_string.h"
5
5
 
6
- typedef enum {
7
- ELEMENT_SOURCE_HTML,
8
- ELEMENT_SOURCE_ACTIONVIEW,
9
- ELEMENT_SOURCE_HAML,
10
- ELEMENT_SOURCE_SLIM
11
- } element_source_t;
12
-
13
- hb_string_T element_source_to_string(element_source_t source);
6
+ #define ELEMENT_SOURCE_HTML hb_string("HTML")
7
+ #define ELEMENT_SOURCE_HAML hb_string("Haml")
8
+ #define ELEMENT_SOURCE_SLIM hb_string("Slim")
14
9
 
15
10
  #endif