herb 0.8.10-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.
- checksums.yaml +4 -4
- data/Makefile +11 -3
- data/README.md +64 -34
- data/Rakefile +48 -40
- data/config.yml +317 -34
- data/ext/herb/error_helpers.c +367 -140
- data/ext/herb/error_helpers.h +1 -0
- data/ext/herb/extconf.rb +67 -28
- data/ext/herb/extension.c +317 -51
- data/ext/herb/extension.h +1 -0
- data/ext/herb/extension_helpers.c +23 -14
- data/ext/herb/extension_helpers.h +2 -2
- data/ext/herb/nodes.c +537 -270
- data/ext/herb/nodes.h +1 -0
- data/herb.gemspec +3 -2
- data/lib/herb/3.0/herb.so +0 -0
- data/lib/herb/3.1/herb.so +0 -0
- data/lib/herb/3.2/herb.so +0 -0
- data/lib/herb/3.3/herb.so +0 -0
- data/lib/herb/3.4/herb.so +0 -0
- data/lib/herb/4.0/herb.so +0 -0
- data/lib/herb/ast/helpers.rb +3 -3
- data/lib/herb/ast/node.rb +15 -2
- data/lib/herb/ast/nodes.rb +1132 -157
- data/lib/herb/bootstrap.rb +87 -0
- data/lib/herb/cli.rb +341 -31
- data/lib/herb/configuration.rb +248 -0
- data/lib/herb/defaults.yml +32 -0
- data/lib/herb/engine/compiler.rb +78 -11
- data/lib/herb/engine/debug_visitor.rb +13 -3
- data/lib/herb/engine/error_formatter.rb +13 -9
- data/lib/herb/engine/parser_error_overlay.rb +10 -6
- data/lib/herb/engine/validator.rb +8 -3
- data/lib/herb/engine/validators/nesting_validator.rb +2 -2
- data/lib/herb/engine.rb +82 -35
- data/lib/herb/errors.rb +563 -88
- data/lib/herb/lex_result.rb +1 -0
- data/lib/herb/location.rb +7 -3
- data/lib/herb/parse_result.rb +12 -2
- data/lib/herb/parser_options.rb +57 -0
- data/lib/herb/position.rb +1 -0
- data/lib/herb/prism_inspect.rb +116 -0
- data/lib/herb/project.rb +923 -331
- data/lib/herb/range.rb +1 -0
- data/lib/herb/token.rb +7 -1
- data/lib/herb/version.rb +1 -1
- data/lib/herb/visitor.rb +37 -2
- data/lib/herb/warnings.rb +6 -1
- data/lib/herb.rb +35 -3
- data/sig/herb/ast/helpers.rbs +2 -2
- data/sig/herb/ast/node.rbs +12 -2
- data/sig/herb/ast/nodes.rbs +641 -128
- data/sig/herb/bootstrap.rbs +31 -0
- data/sig/herb/configuration.rbs +89 -0
- data/sig/herb/engine/compiler.rbs +9 -1
- data/sig/herb/engine/debug_visitor.rbs +2 -0
- data/sig/herb/engine/validator.rbs +5 -1
- data/sig/herb/engine.rbs +17 -3
- data/sig/herb/errors.rbs +258 -63
- data/sig/herb/location.rbs +4 -0
- data/sig/herb/parse_result.rbs +4 -2
- data/sig/herb/parser_options.rbs +42 -0
- data/sig/herb/position.rbs +1 -0
- data/sig/herb/prism_inspect.rbs +28 -0
- data/sig/herb/range.rbs +1 -0
- data/sig/herb/token.rbs +6 -0
- data/sig/herb/visitor.rbs +25 -4
- data/sig/herb/warnings.rbs +6 -1
- data/sig/herb.rbs +14 -0
- data/sig/herb_c_extension.rbs +5 -2
- data/sig/serialized_ast_errors.rbs +54 -6
- data/sig/serialized_ast_nodes.rbs +60 -6
- data/src/analyze/action_view/attribute_extraction_helpers.c +290 -0
- data/src/analyze/action_view/content_tag.c +70 -0
- data/src/analyze/action_view/link_to.c +143 -0
- data/src/analyze/action_view/registry.c +60 -0
- data/src/analyze/action_view/tag.c +64 -0
- data/src/analyze/action_view/tag_helper_node_builders.c +305 -0
- data/src/analyze/action_view/tag_helpers.c +748 -0
- data/src/analyze/action_view/turbo_frame_tag.c +88 -0
- data/src/analyze/analyze.c +882 -0
- data/src/{analyzed_ruby.c → analyze/analyzed_ruby.c} +13 -11
- data/src/analyze/builders.c +343 -0
- data/src/analyze/conditional_elements.c +594 -0
- data/src/analyze/conditional_open_tags.c +640 -0
- data/src/analyze/control_type.c +250 -0
- data/src/{analyze_helpers.c → analyze/helpers.c} +48 -23
- data/src/analyze/invalid_structures.c +193 -0
- data/src/{analyze_missing_end.c → analyze/missing_end.c} +33 -22
- data/src/analyze/parse_errors.c +84 -0
- data/src/analyze/prism_annotate.c +397 -0
- data/src/{analyze_transform.c → analyze/transform.c} +17 -3
- data/src/ast_node.c +17 -7
- data/src/ast_nodes.c +662 -387
- data/src/ast_pretty_print.c +190 -6
- data/src/errors.c +1076 -520
- data/src/extract.c +145 -49
- data/src/herb.c +52 -34
- data/src/html_util.c +241 -12
- data/src/include/analyze/action_view/attribute_extraction_helpers.h +36 -0
- data/src/include/analyze/action_view/tag_helper_handler.h +41 -0
- data/src/include/analyze/action_view/tag_helper_node_builders.h +70 -0
- data/src/include/analyze/action_view/tag_helpers.h +38 -0
- data/src/include/{analyze.h → analyze/analyze.h} +14 -4
- data/src/include/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
- data/src/include/analyze/builders.h +27 -0
- data/src/include/analyze/conditional_elements.h +9 -0
- data/src/include/analyze/conditional_open_tags.h +9 -0
- data/src/include/analyze/control_type.h +14 -0
- data/src/include/{analyze_helpers.h → analyze/helpers.h} +4 -2
- data/src/include/analyze/invalid_structures.h +11 -0
- data/src/include/analyze/prism_annotate.h +16 -0
- data/src/include/ast_node.h +11 -5
- data/src/include/ast_nodes.h +117 -38
- data/src/include/ast_pretty_print.h +5 -0
- data/src/include/element_source.h +3 -8
- data/src/include/errors.h +148 -55
- data/src/include/extract.h +21 -5
- data/src/include/herb.h +18 -6
- data/src/include/herb_prism_node.h +13 -0
- data/src/include/html_util.h +7 -2
- data/src/include/io.h +3 -1
- data/src/include/lex_helpers.h +29 -0
- data/src/include/lexer.h +1 -1
- data/src/include/lexer_peek_helpers.h +87 -13
- data/src/include/lexer_struct.h +2 -0
- data/src/include/location.h +2 -1
- data/src/include/parser.h +27 -2
- data/src/include/parser_helpers.h +19 -3
- data/src/include/pretty_print.h +10 -5
- data/src/include/prism_context.h +45 -0
- data/src/include/prism_helpers.h +10 -7
- data/src/include/prism_serialized.h +12 -0
- data/src/include/token.h +16 -4
- data/src/include/token_struct.h +10 -3
- data/src/include/utf8.h +2 -1
- data/src/include/util/hb_allocator.h +78 -0
- data/src/include/util/hb_arena.h +6 -1
- data/src/include/util/hb_arena_debug.h +12 -1
- data/src/include/util/hb_array.h +7 -3
- data/src/include/util/hb_buffer.h +6 -4
- data/src/include/util/hb_foreach.h +79 -0
- data/src/include/util/hb_narray.h +8 -4
- data/src/include/util/hb_string.h +56 -9
- data/src/include/util.h +6 -3
- data/src/include/version.h +1 -1
- data/src/io.c +3 -2
- data/src/lexer.c +42 -30
- data/src/lexer_peek_helpers.c +12 -74
- data/src/location.c +2 -2
- data/src/main.c +53 -28
- data/src/parser.c +783 -247
- data/src/parser_helpers.c +110 -23
- data/src/parser_match_tags.c +109 -48
- data/src/pretty_print.c +29 -24
- data/src/prism_helpers.c +30 -27
- data/src/ruby_parser.c +2 -0
- data/src/token.c +151 -66
- data/src/token_matchers.c +0 -1
- data/src/utf8.c +7 -6
- data/src/util/hb_allocator.c +341 -0
- data/src/util/hb_arena.c +81 -56
- data/src/util/hb_arena_debug.c +32 -17
- data/src/util/hb_array.c +30 -15
- data/src/util/hb_buffer.c +17 -21
- data/src/util/hb_narray.c +22 -7
- data/src/util/hb_string.c +49 -35
- data/src/util.c +21 -11
- data/src/visitor.c +47 -0
- data/templates/ext/herb/error_helpers.c.erb +24 -11
- data/templates/ext/herb/error_helpers.h.erb +1 -0
- data/templates/ext/herb/nodes.c.erb +50 -16
- data/templates/ext/herb/nodes.h.erb +1 -0
- data/templates/java/error_helpers.c.erb +1 -1
- data/templates/java/nodes.c.erb +30 -8
- data/templates/java/org/herb/ast/Errors.java.erb +24 -1
- data/templates/java/org/herb/ast/Nodes.java.erb +80 -21
- data/templates/javascript/packages/core/src/errors.ts.erb +16 -3
- data/templates/javascript/packages/core/src/node-type-guards.ts.erb +3 -1
- data/templates/javascript/packages/core/src/nodes.ts.erb +109 -32
- data/templates/javascript/packages/node/extension/error_helpers.cpp.erb +13 -4
- data/templates/javascript/packages/node/extension/nodes.cpp.erb +43 -4
- data/templates/lib/herb/ast/nodes.rb.erb +88 -31
- data/templates/lib/herb/errors.rb.erb +15 -3
- data/templates/lib/herb/visitor.rb.erb +2 -2
- data/templates/rust/src/ast/nodes.rs.erb +97 -44
- data/templates/rust/src/errors.rs.erb +2 -1
- data/templates/rust/src/nodes.rs.erb +167 -15
- data/templates/rust/src/union_types.rs.erb +60 -0
- data/templates/rust/src/visitor.rs.erb +81 -0
- data/templates/src/{analyze_missing_end.c.erb → analyze/missing_end.c.erb} +9 -6
- data/templates/src/{analyze_transform.c.erb → analyze/transform.c.erb} +2 -2
- data/templates/src/ast_nodes.c.erb +34 -26
- data/templates/src/ast_pretty_print.c.erb +24 -5
- data/templates/src/errors.c.erb +60 -54
- data/templates/src/include/ast_nodes.h.erb +6 -2
- data/templates/src/include/ast_pretty_print.h.erb +5 -0
- data/templates/src/include/errors.h.erb +15 -11
- data/templates/src/include/util/hb_foreach.h.erb +20 -0
- data/templates/src/parser_match_tags.c.erb +10 -4
- data/templates/src/visitor.c.erb +2 -2
- data/templates/template.rb +204 -29
- data/templates/wasm/error_helpers.cpp.erb +9 -5
- data/templates/wasm/nodes.cpp.erb +41 -4
- metadata +57 -16
- data/src/analyze.c +0 -1608
- data/src/element_source.c +0 -12
- data/src/include/util/hb_system.h +0 -9
- data/src/util/hb_system.c +0 -30
data/src/include/ast_nodes.h
CHANGED
|
@@ -7,11 +7,15 @@
|
|
|
7
7
|
#include <stdbool.h>
|
|
8
8
|
#include <prism.h>
|
|
9
9
|
|
|
10
|
-
#include "analyzed_ruby.h"
|
|
10
|
+
#include "analyze/analyzed_ruby.h"
|
|
11
11
|
#include "element_source.h"
|
|
12
|
+
#include "herb_prism_node.h"
|
|
13
|
+
#include "prism_context.h"
|
|
14
|
+
#include "prism_serialized.h"
|
|
12
15
|
#include "location.h"
|
|
13
16
|
#include "position.h"
|
|
14
17
|
#include "token_struct.h"
|
|
18
|
+
#include "util/hb_allocator.h"
|
|
15
19
|
#include "util/hb_array.h"
|
|
16
20
|
#include "util/hb_buffer.h"
|
|
17
21
|
#include "util/hb_string.h"
|
|
@@ -20,11 +24,18 @@ typedef enum {
|
|
|
20
24
|
AST_DOCUMENT_NODE,
|
|
21
25
|
AST_LITERAL_NODE,
|
|
22
26
|
AST_HTML_OPEN_TAG_NODE,
|
|
27
|
+
AST_HTML_CONDITIONAL_OPEN_TAG_NODE,
|
|
23
28
|
AST_HTML_CLOSE_TAG_NODE,
|
|
29
|
+
AST_HTML_OMITTED_CLOSE_TAG_NODE,
|
|
30
|
+
AST_HTML_VIRTUAL_CLOSE_TAG_NODE,
|
|
24
31
|
AST_HTML_ELEMENT_NODE,
|
|
32
|
+
AST_HTML_CONDITIONAL_ELEMENT_NODE,
|
|
25
33
|
AST_HTML_ATTRIBUTE_VALUE_NODE,
|
|
26
34
|
AST_HTML_ATTRIBUTE_NAME_NODE,
|
|
27
35
|
AST_HTML_ATTRIBUTE_NODE,
|
|
36
|
+
AST_RUBY_LITERAL_NODE,
|
|
37
|
+
AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE,
|
|
38
|
+
AST_ERB_OPEN_TAG_NODE,
|
|
28
39
|
AST_HTML_TEXT_NODE,
|
|
29
40
|
AST_HTML_COMMENT_NODE,
|
|
30
41
|
AST_HTML_DOCTYPE_NODE,
|
|
@@ -61,11 +72,13 @@ typedef struct AST_NODE_STRUCT {
|
|
|
61
72
|
typedef struct AST_DOCUMENT_NODE_STRUCT {
|
|
62
73
|
AST_NODE_T base;
|
|
63
74
|
hb_array_T* children;
|
|
75
|
+
herb_prism_context_T* prism_context;
|
|
76
|
+
herb_prism_node_T prism_node;
|
|
64
77
|
} AST_DOCUMENT_NODE_T;
|
|
65
78
|
|
|
66
79
|
typedef struct AST_LITERAL_NODE_STRUCT {
|
|
67
80
|
AST_NODE_T base;
|
|
68
|
-
|
|
81
|
+
hb_string_T content;
|
|
69
82
|
} AST_LITERAL_NODE_T;
|
|
70
83
|
|
|
71
84
|
typedef struct AST_HTML_OPEN_TAG_NODE_STRUCT {
|
|
@@ -77,6 +90,13 @@ typedef struct AST_HTML_OPEN_TAG_NODE_STRUCT {
|
|
|
77
90
|
bool is_void;
|
|
78
91
|
} AST_HTML_OPEN_TAG_NODE_T;
|
|
79
92
|
|
|
93
|
+
typedef struct AST_HTML_CONDITIONAL_OPEN_TAG_NODE_STRUCT {
|
|
94
|
+
AST_NODE_T base;
|
|
95
|
+
AST_NODE_T* conditional;
|
|
96
|
+
token_T* tag_name;
|
|
97
|
+
bool is_void;
|
|
98
|
+
} AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T;
|
|
99
|
+
|
|
80
100
|
typedef struct AST_HTML_CLOSE_TAG_NODE_STRUCT {
|
|
81
101
|
AST_NODE_T base;
|
|
82
102
|
token_T* tag_opening;
|
|
@@ -85,16 +105,38 @@ typedef struct AST_HTML_CLOSE_TAG_NODE_STRUCT {
|
|
|
85
105
|
token_T* tag_closing;
|
|
86
106
|
} AST_HTML_CLOSE_TAG_NODE_T;
|
|
87
107
|
|
|
108
|
+
typedef struct AST_HTML_OMITTED_CLOSE_TAG_NODE_STRUCT {
|
|
109
|
+
AST_NODE_T base;
|
|
110
|
+
token_T* tag_name;
|
|
111
|
+
} AST_HTML_OMITTED_CLOSE_TAG_NODE_T;
|
|
112
|
+
|
|
113
|
+
typedef struct AST_HTML_VIRTUAL_CLOSE_TAG_NODE_STRUCT {
|
|
114
|
+
AST_NODE_T base;
|
|
115
|
+
token_T* tag_name;
|
|
116
|
+
} AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T;
|
|
117
|
+
|
|
88
118
|
typedef struct AST_HTML_ELEMENT_NODE_STRUCT {
|
|
89
119
|
AST_NODE_T base;
|
|
90
|
-
|
|
120
|
+
AST_NODE_T* open_tag;
|
|
91
121
|
token_T* tag_name;
|
|
92
122
|
hb_array_T* body;
|
|
93
|
-
|
|
123
|
+
AST_NODE_T* close_tag;
|
|
94
124
|
bool is_void;
|
|
95
|
-
|
|
125
|
+
hb_string_T element_source;
|
|
96
126
|
} AST_HTML_ELEMENT_NODE_T;
|
|
97
127
|
|
|
128
|
+
typedef struct AST_HTML_CONDITIONAL_ELEMENT_NODE_STRUCT {
|
|
129
|
+
AST_NODE_T base;
|
|
130
|
+
hb_string_T condition;
|
|
131
|
+
AST_NODE_T* open_conditional;
|
|
132
|
+
struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag;
|
|
133
|
+
hb_array_T* body;
|
|
134
|
+
AST_NODE_T* close_tag;
|
|
135
|
+
AST_NODE_T* close_conditional;
|
|
136
|
+
token_T* tag_name;
|
|
137
|
+
hb_string_T element_source;
|
|
138
|
+
} AST_HTML_CONDITIONAL_ELEMENT_NODE_T;
|
|
139
|
+
|
|
98
140
|
typedef struct AST_HTML_ATTRIBUTE_VALUE_NODE_STRUCT {
|
|
99
141
|
AST_NODE_T base;
|
|
100
142
|
token_T* open_quote;
|
|
@@ -115,9 +157,29 @@ typedef struct AST_HTML_ATTRIBUTE_NODE_STRUCT {
|
|
|
115
157
|
struct AST_HTML_ATTRIBUTE_VALUE_NODE_STRUCT* value;
|
|
116
158
|
} AST_HTML_ATTRIBUTE_NODE_T;
|
|
117
159
|
|
|
160
|
+
typedef struct AST_RUBY_LITERAL_NODE_STRUCT {
|
|
161
|
+
AST_NODE_T base;
|
|
162
|
+
hb_string_T content;
|
|
163
|
+
} AST_RUBY_LITERAL_NODE_T;
|
|
164
|
+
|
|
165
|
+
typedef struct AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_STRUCT {
|
|
166
|
+
AST_NODE_T base;
|
|
167
|
+
hb_string_T content;
|
|
168
|
+
hb_string_T prefix;
|
|
169
|
+
} AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T;
|
|
170
|
+
|
|
171
|
+
typedef struct AST_ERB_OPEN_TAG_NODE_STRUCT {
|
|
172
|
+
AST_NODE_T base;
|
|
173
|
+
token_T* tag_opening;
|
|
174
|
+
token_T* content;
|
|
175
|
+
token_T* tag_closing;
|
|
176
|
+
token_T* tag_name;
|
|
177
|
+
hb_array_T* children;
|
|
178
|
+
} AST_ERB_OPEN_TAG_NODE_T;
|
|
179
|
+
|
|
118
180
|
typedef struct AST_HTML_TEXT_NODE_STRUCT {
|
|
119
181
|
AST_NODE_T base;
|
|
120
|
-
|
|
182
|
+
hb_string_T content;
|
|
121
183
|
} AST_HTML_TEXT_NODE_T;
|
|
122
184
|
|
|
123
185
|
typedef struct AST_HTML_COMMENT_NODE_STRUCT {
|
|
@@ -161,6 +223,7 @@ typedef struct AST_ERB_CONTENT_NODE_STRUCT {
|
|
|
161
223
|
analyzed_ruby_T* analyzed_ruby;
|
|
162
224
|
bool parsed;
|
|
163
225
|
bool valid;
|
|
226
|
+
herb_prism_node_T prism_node;
|
|
164
227
|
} AST_ERB_CONTENT_NODE_T;
|
|
165
228
|
|
|
166
229
|
typedef struct AST_ERB_END_NODE_STRUCT {
|
|
@@ -184,8 +247,9 @@ typedef struct AST_ERB_IF_NODE_STRUCT {
|
|
|
184
247
|
token_T* content;
|
|
185
248
|
token_T* tag_closing;
|
|
186
249
|
location_T* then_keyword;
|
|
250
|
+
herb_prism_node_T prism_node;
|
|
187
251
|
hb_array_T* statements;
|
|
188
|
-
|
|
252
|
+
AST_NODE_T* subsequent;
|
|
189
253
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
190
254
|
} AST_ERB_IF_NODE_T;
|
|
191
255
|
|
|
@@ -194,6 +258,7 @@ typedef struct AST_ERB_BLOCK_NODE_STRUCT {
|
|
|
194
258
|
token_T* tag_opening;
|
|
195
259
|
token_T* content;
|
|
196
260
|
token_T* tag_closing;
|
|
261
|
+
herb_prism_node_T prism_node;
|
|
197
262
|
hb_array_T* body;
|
|
198
263
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
199
264
|
} AST_ERB_BLOCK_NODE_T;
|
|
@@ -213,6 +278,7 @@ typedef struct AST_ERB_CASE_NODE_STRUCT {
|
|
|
213
278
|
token_T* content;
|
|
214
279
|
token_T* tag_closing;
|
|
215
280
|
hb_array_T* children;
|
|
281
|
+
herb_prism_node_T prism_node;
|
|
216
282
|
hb_array_T* conditions;
|
|
217
283
|
struct AST_ERB_ELSE_NODE_STRUCT* else_clause;
|
|
218
284
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
@@ -224,6 +290,7 @@ typedef struct AST_ERB_CASE_MATCH_NODE_STRUCT {
|
|
|
224
290
|
token_T* content;
|
|
225
291
|
token_T* tag_closing;
|
|
226
292
|
hb_array_T* children;
|
|
293
|
+
herb_prism_node_T prism_node;
|
|
227
294
|
hb_array_T* conditions;
|
|
228
295
|
struct AST_ERB_ELSE_NODE_STRUCT* else_clause;
|
|
229
296
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
@@ -234,6 +301,7 @@ typedef struct AST_ERB_WHILE_NODE_STRUCT {
|
|
|
234
301
|
token_T* tag_opening;
|
|
235
302
|
token_T* content;
|
|
236
303
|
token_T* tag_closing;
|
|
304
|
+
herb_prism_node_T prism_node;
|
|
237
305
|
hb_array_T* statements;
|
|
238
306
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
239
307
|
} AST_ERB_WHILE_NODE_T;
|
|
@@ -243,6 +311,7 @@ typedef struct AST_ERB_UNTIL_NODE_STRUCT {
|
|
|
243
311
|
token_T* tag_opening;
|
|
244
312
|
token_T* content;
|
|
245
313
|
token_T* tag_closing;
|
|
314
|
+
herb_prism_node_T prism_node;
|
|
246
315
|
hb_array_T* statements;
|
|
247
316
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
248
317
|
} AST_ERB_UNTIL_NODE_T;
|
|
@@ -252,6 +321,7 @@ typedef struct AST_ERB_FOR_NODE_STRUCT {
|
|
|
252
321
|
token_T* tag_opening;
|
|
253
322
|
token_T* content;
|
|
254
323
|
token_T* tag_closing;
|
|
324
|
+
herb_prism_node_T prism_node;
|
|
255
325
|
hb_array_T* statements;
|
|
256
326
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
257
327
|
} AST_ERB_FOR_NODE_T;
|
|
@@ -278,6 +348,7 @@ typedef struct AST_ERB_BEGIN_NODE_STRUCT {
|
|
|
278
348
|
token_T* tag_opening;
|
|
279
349
|
token_T* content;
|
|
280
350
|
token_T* tag_closing;
|
|
351
|
+
herb_prism_node_T prism_node;
|
|
281
352
|
hb_array_T* statements;
|
|
282
353
|
struct AST_ERB_RESCUE_NODE_STRUCT* rescue_clause;
|
|
283
354
|
struct AST_ERB_ELSE_NODE_STRUCT* else_clause;
|
|
@@ -291,6 +362,7 @@ typedef struct AST_ERB_UNLESS_NODE_STRUCT {
|
|
|
291
362
|
token_T* content;
|
|
292
363
|
token_T* tag_closing;
|
|
293
364
|
location_T* then_keyword;
|
|
365
|
+
herb_prism_node_T prism_node;
|
|
294
366
|
hb_array_T* statements;
|
|
295
367
|
struct AST_ERB_ELSE_NODE_STRUCT* else_clause;
|
|
296
368
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
@@ -312,37 +384,44 @@ typedef struct AST_ERB_IN_NODE_STRUCT {
|
|
|
312
384
|
hb_array_T* statements;
|
|
313
385
|
} AST_ERB_IN_NODE_T;
|
|
314
386
|
|
|
315
|
-
AST_DOCUMENT_NODE_T* ast_document_node_init(hb_array_T* children, position_T start_position, position_T end_position, hb_array_T* errors);
|
|
316
|
-
AST_LITERAL_NODE_T* ast_literal_node_init(
|
|
317
|
-
AST_HTML_OPEN_TAG_NODE_T* ast_html_open_tag_node_init(token_T* tag_opening, token_T* tag_name, token_T* tag_closing, hb_array_T* children, bool is_void, position_T start_position, position_T end_position, hb_array_T* errors);
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
387
|
+
AST_DOCUMENT_NODE_T* ast_document_node_init(hb_array_T* children, herb_prism_context_T* prism_context, herb_prism_node_T prism_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
388
|
+
AST_LITERAL_NODE_T* ast_literal_node_init(hb_string_T content, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
389
|
+
AST_HTML_OPEN_TAG_NODE_T* ast_html_open_tag_node_init(token_T* tag_opening, token_T* tag_name, token_T* tag_closing, hb_array_T* children, bool is_void, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
390
|
+
AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T* ast_html_conditional_open_tag_node_init(AST_NODE_T* conditional, token_T* tag_name, bool is_void, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
391
|
+
AST_HTML_CLOSE_TAG_NODE_T* ast_html_close_tag_node_init(token_T* tag_opening, token_T* tag_name, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
392
|
+
AST_HTML_OMITTED_CLOSE_TAG_NODE_T* ast_html_omitted_close_tag_node_init(token_T* tag_name, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
393
|
+
AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T* ast_html_virtual_close_tag_node_init(token_T* tag_name, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
394
|
+
AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(AST_NODE_T* open_tag, token_T* tag_name, hb_array_T* body, AST_NODE_T* close_tag, bool is_void, hb_string_T element_source, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
395
|
+
AST_HTML_CONDITIONAL_ELEMENT_NODE_T* ast_html_conditional_element_node_init(hb_string_T condition, AST_NODE_T* open_conditional, struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag, hb_array_T* body, AST_NODE_T* close_tag, AST_NODE_T* close_conditional, token_T* tag_name, hb_string_T element_source, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
396
|
+
AST_HTML_ATTRIBUTE_VALUE_NODE_T* ast_html_attribute_value_node_init(token_T* open_quote, hb_array_T* children, token_T* close_quote, bool quoted, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
397
|
+
AST_HTML_ATTRIBUTE_NAME_NODE_T* ast_html_attribute_name_node_init(hb_array_T* children, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
398
|
+
AST_HTML_ATTRIBUTE_NODE_T* ast_html_attribute_node_init(struct AST_HTML_ATTRIBUTE_NAME_NODE_STRUCT* name, token_T* equals, struct AST_HTML_ATTRIBUTE_VALUE_NODE_STRUCT* value, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
399
|
+
AST_RUBY_LITERAL_NODE_T* ast_ruby_literal_node_init(hb_string_T content, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
400
|
+
AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T* ast_ruby_html_attributes_splat_node_init(hb_string_T content, hb_string_T prefix, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
401
|
+
AST_ERB_OPEN_TAG_NODE_T* ast_erb_open_tag_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, token_T* tag_name, hb_array_T* children, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
402
|
+
AST_HTML_TEXT_NODE_T* ast_html_text_node_init(hb_string_T content, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
403
|
+
AST_HTML_COMMENT_NODE_T* ast_html_comment_node_init(token_T* comment_start, hb_array_T* children, token_T* comment_end, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
404
|
+
AST_HTML_DOCTYPE_NODE_T* ast_html_doctype_node_init(token_T* tag_opening, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
405
|
+
AST_XML_DECLARATION_NODE_T* ast_xml_declaration_node_init(token_T* tag_opening, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
406
|
+
AST_CDATA_NODE_T* ast_cdata_node_init(token_T* tag_opening, hb_array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
407
|
+
AST_WHITESPACE_NODE_T* ast_whitespace_node_init(token_T* value, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
408
|
+
AST_ERB_CONTENT_NODE_T* ast_erb_content_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, analyzed_ruby_T* analyzed_ruby, bool parsed, bool valid, herb_prism_node_T prism_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
409
|
+
AST_ERB_END_NODE_T* ast_erb_end_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
410
|
+
AST_ERB_ELSE_NODE_T* ast_erb_else_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
411
|
+
AST_ERB_IF_NODE_T* ast_erb_if_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, herb_prism_node_T prism_node, hb_array_T* statements, AST_NODE_T* subsequent, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
412
|
+
AST_ERB_BLOCK_NODE_T* ast_erb_block_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, hb_array_T* body, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
413
|
+
AST_ERB_WHEN_NODE_T* ast_erb_when_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
414
|
+
AST_ERB_CASE_NODE_T* ast_erb_case_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* children, herb_prism_node_T prism_node, hb_array_T* conditions, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
415
|
+
AST_ERB_CASE_MATCH_NODE_T* ast_erb_case_match_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* children, herb_prism_node_T prism_node, hb_array_T* conditions, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
416
|
+
AST_ERB_WHILE_NODE_T* ast_erb_while_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, hb_array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
417
|
+
AST_ERB_UNTIL_NODE_T* ast_erb_until_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, hb_array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
418
|
+
AST_ERB_FOR_NODE_T* ast_erb_for_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, hb_array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
419
|
+
AST_ERB_RESCUE_NODE_T* ast_erb_rescue_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, struct AST_ERB_RESCUE_NODE_STRUCT* subsequent, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
420
|
+
AST_ERB_ENSURE_NODE_T* ast_erb_ensure_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
421
|
+
AST_ERB_BEGIN_NODE_T* ast_erb_begin_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, herb_prism_node_T prism_node, hb_array_T* statements, struct AST_ERB_RESCUE_NODE_STRUCT* rescue_clause, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_ENSURE_NODE_STRUCT* ensure_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
422
|
+
AST_ERB_UNLESS_NODE_T* ast_erb_unless_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, herb_prism_node_T prism_node, hb_array_T* statements, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
423
|
+
AST_ERB_YIELD_NODE_T* ast_erb_yield_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
424
|
+
AST_ERB_IN_NODE_T* ast_erb_in_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, location_T* then_keyword, hb_array_T* statements, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
346
425
|
|
|
347
426
|
hb_string_T ast_node_type_to_string(AST_NODE_T* node);
|
|
348
427
|
hb_string_T ast_node_human_type(AST_NODE_T* node);
|
|
@@ -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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
ELEMENT_SOURCE_HAML,
|
|
10
|
-
ELEMENT_SOURCE_SLIM
|
|
11
|
-
} element_source_t;
|
|
12
|
-
|
|
13
|
-
hb_string_T element_source_to_string(element_source_t source);
|
|
6
|
+
#define ELEMENT_SOURCE_HTML hb_string("HTML")
|
|
7
|
+
#define ELEMENT_SOURCE_HAML hb_string("Haml")
|
|
8
|
+
#define ELEMENT_SOURCE_SLIM hb_string("Slim")
|
|
14
9
|
|
|
15
10
|
#endif
|
data/src/include/errors.h
CHANGED
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
#include "location.h"
|
|
9
9
|
#include "position.h"
|
|
10
10
|
#include "token.h"
|
|
11
|
+
#include "util/hb_allocator.h"
|
|
11
12
|
#include "util/hb_array.h"
|
|
12
13
|
#include "util/hb_buffer.h"
|
|
14
|
+
#include "util/hb_string.h"
|
|
13
15
|
|
|
14
16
|
typedef enum {
|
|
15
17
|
UNEXPECTED_ERROR,
|
|
@@ -17,28 +19,38 @@ typedef enum {
|
|
|
17
19
|
MISSING_OPENING_TAG_ERROR,
|
|
18
20
|
MISSING_CLOSING_TAG_ERROR,
|
|
19
21
|
TAG_NAMES_MISMATCH_ERROR,
|
|
20
|
-
QUOTES_MISMATCH_ERROR,
|
|
21
22
|
VOID_ELEMENT_CLOSING_TAG_ERROR,
|
|
22
23
|
UNCLOSED_ELEMENT_ERROR,
|
|
23
24
|
RUBY_PARSE_ERROR,
|
|
24
25
|
ERB_CONTROL_FLOW_SCOPE_ERROR,
|
|
25
|
-
|
|
26
|
+
MISSING_ERB_END_TAG_ERROR,
|
|
26
27
|
ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR,
|
|
27
28
|
ERB_CASE_WITH_CONDITIONS_ERROR,
|
|
29
|
+
CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR,
|
|
30
|
+
CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR,
|
|
31
|
+
INVALID_COMMENT_CLOSING_TAG_ERROR,
|
|
32
|
+
OMITTED_CLOSING_TAG_ERROR,
|
|
33
|
+
UNCLOSED_OPEN_TAG_ERROR,
|
|
34
|
+
UNCLOSED_CLOSE_TAG_ERROR,
|
|
35
|
+
UNCLOSED_QUOTE_ERROR,
|
|
36
|
+
MISSING_ATTRIBUTE_VALUE_ERROR,
|
|
37
|
+
UNCLOSED_ERB_TAG_ERROR,
|
|
38
|
+
STRAY_ERB_CLOSING_TAG_ERROR,
|
|
39
|
+
NESTED_ERB_TAG_ERROR,
|
|
28
40
|
} error_type_T;
|
|
29
41
|
|
|
30
42
|
typedef struct ERROR_STRUCT {
|
|
31
43
|
error_type_T type;
|
|
32
44
|
location_T location;
|
|
33
|
-
|
|
45
|
+
hb_string_T message;
|
|
34
46
|
} ERROR_T;
|
|
35
47
|
|
|
36
48
|
|
|
37
49
|
typedef struct {
|
|
38
50
|
ERROR_T base;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
hb_string_T description;
|
|
52
|
+
hb_string_T expected;
|
|
53
|
+
hb_string_T found;
|
|
42
54
|
} UNEXPECTED_ERROR_T;
|
|
43
55
|
|
|
44
56
|
typedef struct {
|
|
@@ -63,17 +75,11 @@ typedef struct {
|
|
|
63
75
|
token_T* closing_tag;
|
|
64
76
|
} TAG_NAMES_MISMATCH_ERROR_T;
|
|
65
77
|
|
|
66
|
-
typedef struct {
|
|
67
|
-
ERROR_T base;
|
|
68
|
-
token_T* opening_quote;
|
|
69
|
-
token_T* closing_quote;
|
|
70
|
-
} QUOTES_MISMATCH_ERROR_T;
|
|
71
|
-
|
|
72
78
|
typedef struct {
|
|
73
79
|
ERROR_T base;
|
|
74
80
|
token_T* tag_name;
|
|
75
|
-
|
|
76
|
-
|
|
81
|
+
hb_string_T expected;
|
|
82
|
+
hb_string_T found;
|
|
77
83
|
} VOID_ELEMENT_CLOSING_TAG_ERROR_T;
|
|
78
84
|
|
|
79
85
|
typedef struct {
|
|
@@ -83,20 +89,20 @@ typedef struct {
|
|
|
83
89
|
|
|
84
90
|
typedef struct {
|
|
85
91
|
ERROR_T base;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
hb_string_T error_message;
|
|
93
|
+
hb_string_T diagnostic_id;
|
|
94
|
+
hb_string_T level;
|
|
89
95
|
} RUBY_PARSE_ERROR_T;
|
|
90
96
|
|
|
91
97
|
typedef struct {
|
|
92
98
|
ERROR_T base;
|
|
93
|
-
|
|
99
|
+
hb_string_T keyword;
|
|
94
100
|
} ERB_CONTROL_FLOW_SCOPE_ERROR_T;
|
|
95
101
|
|
|
96
102
|
typedef struct {
|
|
97
103
|
ERROR_T base;
|
|
98
|
-
|
|
99
|
-
}
|
|
104
|
+
hb_string_T keyword;
|
|
105
|
+
} MISSING_ERB_END_TAG_ERROR_T;
|
|
100
106
|
|
|
101
107
|
typedef struct {
|
|
102
108
|
ERROR_T base;
|
|
@@ -108,50 +114,137 @@ typedef struct {
|
|
|
108
114
|
/* no additional fields */
|
|
109
115
|
} ERB_CASE_WITH_CONDITIONS_ERROR_T;
|
|
110
116
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
117
|
+
typedef struct {
|
|
118
|
+
ERROR_T base;
|
|
119
|
+
size_t line;
|
|
120
|
+
size_t column;
|
|
121
|
+
} CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR_T;
|
|
122
|
+
|
|
123
|
+
typedef struct {
|
|
124
|
+
ERROR_T base;
|
|
125
|
+
hb_string_T tag_name;
|
|
126
|
+
hb_string_T open_condition;
|
|
127
|
+
size_t open_line;
|
|
128
|
+
size_t open_column;
|
|
129
|
+
hb_string_T close_condition;
|
|
130
|
+
size_t close_line;
|
|
131
|
+
size_t close_column;
|
|
132
|
+
} CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR_T;
|
|
133
|
+
|
|
134
|
+
typedef struct {
|
|
135
|
+
ERROR_T base;
|
|
136
|
+
token_T* closing_tag;
|
|
137
|
+
} INVALID_COMMENT_CLOSING_TAG_ERROR_T;
|
|
138
|
+
|
|
139
|
+
typedef struct {
|
|
140
|
+
ERROR_T base;
|
|
141
|
+
token_T* opening_tag;
|
|
142
|
+
position_T insertion_point;
|
|
143
|
+
} OMITTED_CLOSING_TAG_ERROR_T;
|
|
144
|
+
|
|
145
|
+
typedef struct {
|
|
146
|
+
ERROR_T base;
|
|
147
|
+
token_T* tag_name;
|
|
148
|
+
} UNCLOSED_OPEN_TAG_ERROR_T;
|
|
149
|
+
|
|
150
|
+
typedef struct {
|
|
151
|
+
ERROR_T base;
|
|
152
|
+
token_T* tag_name;
|
|
153
|
+
} UNCLOSED_CLOSE_TAG_ERROR_T;
|
|
154
|
+
|
|
155
|
+
typedef struct {
|
|
156
|
+
ERROR_T base;
|
|
157
|
+
token_T* opening_quote;
|
|
158
|
+
} UNCLOSED_QUOTE_ERROR_T;
|
|
159
|
+
|
|
160
|
+
typedef struct {
|
|
161
|
+
ERROR_T base;
|
|
162
|
+
hb_string_T attribute_name;
|
|
163
|
+
} MISSING_ATTRIBUTE_VALUE_ERROR_T;
|
|
164
|
+
|
|
165
|
+
typedef struct {
|
|
166
|
+
ERROR_T base;
|
|
167
|
+
token_T* opening_tag;
|
|
168
|
+
} UNCLOSED_ERB_TAG_ERROR_T;
|
|
169
|
+
|
|
170
|
+
typedef struct {
|
|
171
|
+
ERROR_T base;
|
|
172
|
+
/* no additional fields */
|
|
173
|
+
} STRAY_ERB_CLOSING_TAG_ERROR_T;
|
|
174
|
+
|
|
175
|
+
typedef struct {
|
|
176
|
+
ERROR_T base;
|
|
177
|
+
token_T* opening_tag;
|
|
178
|
+
size_t nested_tag_line;
|
|
179
|
+
size_t nested_tag_column;
|
|
180
|
+
} NESTED_ERB_TAG_ERROR_T;
|
|
181
|
+
|
|
182
|
+
UNEXPECTED_ERROR_T* unexpected_error_init(hb_string_T description, hb_string_T expected, hb_string_T found, position_T start, position_T end, hb_allocator_T* allocator);
|
|
183
|
+
void append_unexpected_error(hb_string_T description, hb_string_T expected, hb_string_T found, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
184
|
+
UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error_init(token_type_T expected_type, token_T* found, position_T start, position_T end, hb_allocator_T* allocator);
|
|
185
|
+
void append_unexpected_token_error(token_type_T expected_type, token_T* found, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
186
|
+
MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error_init(token_T* closing_tag, position_T start, position_T end, hb_allocator_T* allocator);
|
|
187
|
+
void append_missing_opening_tag_error(token_T* closing_tag, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
188
|
+
MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error_init(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator);
|
|
189
|
+
void append_missing_closing_tag_error(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
190
|
+
TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error_init(token_T* opening_tag, token_T* closing_tag, position_T start, position_T end, hb_allocator_T* allocator);
|
|
191
|
+
void append_tag_names_mismatch_error(token_T* opening_tag, token_T* closing_tag, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
192
|
+
VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error_init(token_T* tag_name, hb_string_T expected, hb_string_T found, position_T start, position_T end, hb_allocator_T* allocator);
|
|
193
|
+
void append_void_element_closing_tag_error(token_T* tag_name, hb_string_T expected, hb_string_T found, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
194
|
+
UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error_init(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator);
|
|
195
|
+
void append_unclosed_element_error(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
196
|
+
RUBY_PARSE_ERROR_T* ruby_parse_error_init(hb_string_T error_message, hb_string_T diagnostic_id, hb_string_T level, position_T start, position_T end, hb_allocator_T* allocator);
|
|
197
|
+
void append_ruby_parse_error(hb_string_T error_message, hb_string_T diagnostic_id, hb_string_T level, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
198
|
+
ERB_CONTROL_FLOW_SCOPE_ERROR_T* erb_control_flow_scope_error_init(hb_string_T keyword, position_T start, position_T end, hb_allocator_T* allocator);
|
|
199
|
+
void append_erb_control_flow_scope_error(hb_string_T keyword, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
200
|
+
MISSING_ERB_END_TAG_ERROR_T* missing_erb_end_tag_error_init(hb_string_T keyword, position_T start, position_T end, hb_allocator_T* allocator);
|
|
201
|
+
void append_missing_erb_end_tag_error(hb_string_T keyword, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
202
|
+
ERB_MULTIPLE_BLOCKS_IN_TAG_ERROR_T* erb_multiple_blocks_in_tag_error_init(position_T start, position_T end, hb_allocator_T* allocator);
|
|
203
|
+
void append_erb_multiple_blocks_in_tag_error(position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
204
|
+
ERB_CASE_WITH_CONDITIONS_ERROR_T* erb_case_with_conditions_error_init(position_T start, position_T end, hb_allocator_T* allocator);
|
|
205
|
+
void append_erb_case_with_conditions_error(position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
206
|
+
CONDITIONAL_ELEMENT_MULTIPLE_TAGS_ERROR_T* conditional_element_multiple_tags_error_init(size_t line, size_t column, position_T start, position_T end, hb_allocator_T* allocator);
|
|
207
|
+
void append_conditional_element_multiple_tags_error(size_t line, size_t column, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
208
|
+
CONDITIONAL_ELEMENT_CONDITION_MISMATCH_ERROR_T* conditional_element_condition_mismatch_error_init(hb_string_T tag_name, hb_string_T open_condition, size_t open_line, size_t open_column, hb_string_T close_condition, size_t close_line, size_t close_column, position_T start, position_T end, hb_allocator_T* allocator);
|
|
209
|
+
void append_conditional_element_condition_mismatch_error(hb_string_T tag_name, hb_string_T open_condition, size_t open_line, size_t open_column, hb_string_T close_condition, size_t close_line, size_t close_column, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
210
|
+
INVALID_COMMENT_CLOSING_TAG_ERROR_T* invalid_comment_closing_tag_error_init(token_T* closing_tag, position_T start, position_T end, hb_allocator_T* allocator);
|
|
211
|
+
void append_invalid_comment_closing_tag_error(token_T* closing_tag, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
212
|
+
OMITTED_CLOSING_TAG_ERROR_T* omitted_closing_tag_error_init(token_T* opening_tag, position_T insertion_point, position_T start, position_T end, hb_allocator_T* allocator);
|
|
213
|
+
void append_omitted_closing_tag_error(token_T* opening_tag, position_T insertion_point, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
214
|
+
UNCLOSED_OPEN_TAG_ERROR_T* unclosed_open_tag_error_init(token_T* tag_name, position_T start, position_T end, hb_allocator_T* allocator);
|
|
215
|
+
void append_unclosed_open_tag_error(token_T* tag_name, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
216
|
+
UNCLOSED_CLOSE_TAG_ERROR_T* unclosed_close_tag_error_init(token_T* tag_name, position_T start, position_T end, hb_allocator_T* allocator);
|
|
217
|
+
void append_unclosed_close_tag_error(token_T* tag_name, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
218
|
+
UNCLOSED_QUOTE_ERROR_T* unclosed_quote_error_init(token_T* opening_quote, position_T start, position_T end, hb_allocator_T* allocator);
|
|
219
|
+
void append_unclosed_quote_error(token_T* opening_quote, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
220
|
+
MISSING_ATTRIBUTE_VALUE_ERROR_T* missing_attribute_value_error_init(hb_string_T attribute_name, position_T start, position_T end, hb_allocator_T* allocator);
|
|
221
|
+
void append_missing_attribute_value_error(hb_string_T attribute_name, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
222
|
+
UNCLOSED_ERB_TAG_ERROR_T* unclosed_erb_tag_error_init(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator);
|
|
223
|
+
void append_unclosed_erb_tag_error(token_T* opening_tag, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
224
|
+
STRAY_ERB_CLOSING_TAG_ERROR_T* stray_erb_closing_tag_error_init(position_T start, position_T end, hb_allocator_T* allocator);
|
|
225
|
+
void append_stray_erb_closing_tag_error(position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
226
|
+
NESTED_ERB_TAG_ERROR_T* nested_erb_tag_error_init(token_T* opening_tag, size_t nested_tag_line, size_t nested_tag_column, position_T start, position_T end, hb_allocator_T* allocator);
|
|
227
|
+
void append_nested_erb_tag_error(token_T* opening_tag, size_t nested_tag_line, size_t nested_tag_column, position_T start, position_T end, hb_allocator_T* allocator, hb_array_T* errors);
|
|
137
228
|
|
|
138
229
|
void error_init(ERROR_T* error, error_type_T type, position_T start, position_T end);
|
|
139
230
|
|
|
140
231
|
size_t error_sizeof(void);
|
|
141
232
|
error_type_T error_type(ERROR_T* error);
|
|
142
233
|
|
|
143
|
-
|
|
234
|
+
hb_string_T error_message(ERROR_T* error);
|
|
144
235
|
|
|
145
|
-
|
|
146
|
-
|
|
236
|
+
hb_string_T error_type_to_string(ERROR_T* error);
|
|
237
|
+
hb_string_T error_human_type(ERROR_T* error);
|
|
147
238
|
|
|
148
|
-
void error_free(ERROR_T* error);
|
|
239
|
+
void error_free(ERROR_T* error, hb_allocator_T* allocator);
|
|
149
240
|
|
|
150
|
-
|
|
241
|
+
#ifndef HERB_EXCLUDE_PRETTYPRINT
|
|
242
|
+
void error_pretty_print(ERROR_T* error, size_t indent, size_t relative_indent, hb_buffer_T* buffer);
|
|
151
243
|
|
|
152
|
-
void error_pretty_print_array(
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
);
|
|
244
|
+
void error_pretty_print_array(
|
|
245
|
+
const char* name, hb_array_T* array, size_t indent, size_t relative_indent, bool last_property,
|
|
246
|
+
hb_buffer_T* buffer
|
|
247
|
+
);
|
|
248
|
+
#endif
|
|
156
249
|
|
|
157
250
|
#endif
|