@herb-tools/node 0.8.10 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +27 -8
- package/dist/herb-node.cjs +41 -12
- package/dist/herb-node.cjs.map +1 -1
- package/dist/herb-node.esm.js +8 -1
- package/dist/herb-node.esm.js.map +1 -1
- package/dist/types/node-backend.d.ts +3 -1
- package/extension/error_helpers.cpp +598 -73
- package/extension/error_helpers.h +20 -3
- package/extension/extension_helpers.cpp +40 -35
- package/extension/extension_helpers.h +2 -2
- package/extension/herb.cpp +194 -64
- package/extension/libherb/analyze/action_view/attribute_extraction_helpers.c +303 -0
- package/extension/libherb/analyze/action_view/attribute_extraction_helpers.h +36 -0
- package/extension/libherb/analyze/action_view/content_tag.c +78 -0
- package/extension/libherb/analyze/action_view/link_to.c +167 -0
- package/extension/libherb/analyze/action_view/registry.c +83 -0
- package/extension/libherb/analyze/action_view/tag.c +70 -0
- package/extension/libherb/analyze/action_view/tag_helper_handler.h +43 -0
- package/extension/libherb/analyze/action_view/tag_helper_node_builders.c +305 -0
- package/extension/libherb/analyze/action_view/tag_helper_node_builders.h +70 -0
- package/extension/libherb/analyze/action_view/tag_helpers.c +815 -0
- package/extension/libherb/analyze/action_view/tag_helpers.h +38 -0
- package/extension/libherb/analyze/action_view/turbo_frame_tag.c +88 -0
- package/extension/libherb/analyze/analyze.c +885 -0
- package/extension/libherb/{include → analyze}/analyze.h +14 -4
- package/extension/libherb/{analyzed_ruby.c → analyze/analyzed_ruby.c} +13 -11
- package/extension/libherb/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
- package/extension/libherb/analyze/builders.c +343 -0
- package/extension/libherb/analyze/builders.h +27 -0
- package/extension/libherb/analyze/conditional_elements.c +594 -0
- package/extension/libherb/analyze/conditional_elements.h +9 -0
- package/extension/libherb/analyze/conditional_open_tags.c +640 -0
- package/extension/libherb/analyze/conditional_open_tags.h +9 -0
- package/extension/libherb/analyze/control_type.c +250 -0
- package/extension/libherb/analyze/control_type.h +14 -0
- package/extension/libherb/{analyze_helpers.c → analyze/helpers.c} +48 -23
- package/extension/libherb/{analyze_helpers.h → analyze/helpers.h} +4 -2
- package/extension/libherb/analyze/invalid_structures.c +193 -0
- package/extension/libherb/analyze/invalid_structures.h +11 -0
- package/extension/libherb/{analyze_missing_end.c → analyze/missing_end.c} +33 -22
- package/extension/libherb/analyze/parse_errors.c +84 -0
- package/extension/libherb/analyze/prism_annotate.c +399 -0
- package/extension/libherb/analyze/prism_annotate.h +16 -0
- package/extension/libherb/analyze/render_nodes.c +761 -0
- package/extension/libherb/analyze/render_nodes.h +11 -0
- package/extension/libherb/{analyze_transform.c → analyze/transform.c} +24 -3
- package/extension/libherb/ast_node.c +17 -7
- package/extension/libherb/ast_node.h +11 -5
- package/extension/libherb/ast_nodes.c +760 -388
- package/extension/libherb/ast_nodes.h +155 -39
- package/extension/libherb/ast_pretty_print.c +265 -7
- package/extension/libherb/ast_pretty_print.h +6 -1
- package/extension/libherb/element_source.h +3 -8
- package/extension/libherb/errors.c +1455 -520
- package/extension/libherb/errors.h +207 -56
- package/extension/libherb/extract.c +145 -49
- package/extension/libherb/extract.h +21 -5
- package/extension/libherb/herb.c +52 -34
- package/extension/libherb/herb.h +18 -6
- package/extension/libherb/herb_prism_node.h +13 -0
- package/extension/libherb/html_util.c +241 -12
- package/extension/libherb/html_util.h +7 -2
- package/extension/libherb/include/analyze/action_view/attribute_extraction_helpers.h +36 -0
- package/extension/libherb/include/analyze/action_view/tag_helper_handler.h +43 -0
- package/extension/libherb/include/analyze/action_view/tag_helper_node_builders.h +70 -0
- package/extension/libherb/include/analyze/action_view/tag_helpers.h +38 -0
- package/extension/libherb/{analyze.h → include/analyze/analyze.h} +14 -4
- package/extension/libherb/include/{analyzed_ruby.h → analyze/analyzed_ruby.h} +3 -3
- package/extension/libherb/include/analyze/builders.h +27 -0
- package/extension/libherb/include/analyze/conditional_elements.h +9 -0
- package/extension/libherb/include/analyze/conditional_open_tags.h +9 -0
- package/extension/libherb/include/analyze/control_type.h +14 -0
- package/extension/libherb/include/{analyze_helpers.h → analyze/helpers.h} +4 -2
- package/extension/libherb/include/analyze/invalid_structures.h +11 -0
- package/extension/libherb/include/analyze/prism_annotate.h +16 -0
- package/extension/libherb/include/analyze/render_nodes.h +11 -0
- package/extension/libherb/include/ast_node.h +11 -5
- package/extension/libherb/include/ast_nodes.h +155 -39
- package/extension/libherb/include/ast_pretty_print.h +6 -1
- package/extension/libherb/include/element_source.h +3 -8
- package/extension/libherb/include/errors.h +207 -56
- package/extension/libherb/include/extract.h +21 -5
- package/extension/libherb/include/herb.h +18 -6
- package/extension/libherb/include/herb_prism_node.h +13 -0
- package/extension/libherb/include/html_util.h +7 -2
- package/extension/libherb/include/io.h +3 -1
- package/extension/libherb/include/lex_helpers.h +29 -0
- package/extension/libherb/include/lexer.h +1 -1
- package/extension/libherb/include/lexer_peek_helpers.h +87 -13
- package/extension/libherb/include/lexer_struct.h +2 -0
- package/extension/libherb/include/location.h +2 -1
- package/extension/libherb/include/parser.h +28 -2
- package/extension/libherb/include/parser_helpers.h +19 -3
- package/extension/libherb/include/pretty_print.h +10 -5
- package/extension/libherb/include/prism_context.h +45 -0
- package/extension/libherb/include/prism_helpers.h +10 -7
- package/extension/libherb/include/prism_serialized.h +12 -0
- package/extension/libherb/include/token.h +16 -4
- package/extension/libherb/include/token_struct.h +10 -3
- package/extension/libherb/include/utf8.h +2 -1
- package/extension/libherb/include/util/hb_allocator.h +78 -0
- package/extension/libherb/include/util/hb_arena.h +6 -1
- package/extension/libherb/include/util/hb_arena_debug.h +12 -1
- package/extension/libherb/include/util/hb_array.h +7 -3
- package/extension/libherb/include/util/hb_buffer.h +6 -4
- package/extension/libherb/include/util/hb_foreach.h +79 -0
- package/extension/libherb/include/util/hb_narray.h +8 -4
- package/extension/libherb/include/util/hb_string.h +56 -9
- package/extension/libherb/include/util.h +6 -3
- package/extension/libherb/include/version.h +1 -1
- package/extension/libherb/io.c +3 -2
- package/extension/libherb/io.h +3 -1
- package/extension/libherb/lex_helpers.h +29 -0
- package/extension/libherb/lexer.c +42 -30
- package/extension/libherb/lexer.h +1 -1
- package/extension/libherb/lexer_peek_helpers.c +12 -74
- package/extension/libherb/lexer_peek_helpers.h +87 -13
- package/extension/libherb/lexer_struct.h +2 -0
- package/extension/libherb/location.c +2 -2
- package/extension/libherb/location.h +2 -1
- package/extension/libherb/main.c +53 -28
- package/extension/libherb/parser.c +784 -247
- package/extension/libherb/parser.h +28 -2
- package/extension/libherb/parser_helpers.c +110 -23
- package/extension/libherb/parser_helpers.h +19 -3
- package/extension/libherb/parser_match_tags.c +130 -49
- package/extension/libherb/pretty_print.c +29 -24
- package/extension/libherb/pretty_print.h +10 -5
- package/extension/libherb/prism_context.h +45 -0
- package/extension/libherb/prism_helpers.c +30 -27
- package/extension/libherb/prism_helpers.h +10 -7
- package/extension/libherb/prism_serialized.h +12 -0
- package/extension/libherb/ruby_parser.c +2 -0
- package/extension/libherb/token.c +151 -66
- package/extension/libherb/token.h +16 -4
- package/extension/libherb/token_matchers.c +0 -1
- package/extension/libherb/token_struct.h +10 -3
- package/extension/libherb/utf8.c +7 -6
- package/extension/libherb/utf8.h +2 -1
- package/extension/libherb/util/hb_allocator.c +341 -0
- package/extension/libherb/util/hb_allocator.h +78 -0
- package/extension/libherb/util/hb_arena.c +81 -56
- package/extension/libherb/util/hb_arena.h +6 -1
- package/extension/libherb/util/hb_arena_debug.c +32 -17
- package/extension/libherb/util/hb_arena_debug.h +12 -1
- package/extension/libherb/util/hb_array.c +30 -15
- package/extension/libherb/util/hb_array.h +7 -3
- package/extension/libherb/util/hb_buffer.c +17 -21
- package/extension/libherb/util/hb_buffer.h +6 -4
- package/extension/libherb/util/hb_foreach.h +79 -0
- package/extension/libherb/util/hb_narray.c +22 -7
- package/extension/libherb/util/hb_narray.h +8 -4
- package/extension/libherb/util/hb_string.c +49 -35
- package/extension/libherb/util/hb_string.h +56 -9
- package/extension/libherb/util.c +21 -11
- package/extension/libherb/util.h +6 -3
- package/extension/libherb/version.h +1 -1
- package/extension/libherb/visitor.c +68 -1
- package/extension/nodes.cpp +593 -6
- package/extension/nodes.h +10 -1
- package/package.json +12 -8
- package/src/node-backend.ts +11 -1
- package/dist/types/index-cjs.d.cts +0 -1
- package/extension/libherb/analyze.c +0 -1608
- package/extension/libherb/element_source.c +0 -12
- package/extension/libherb/include/util/hb_system.h +0 -9
- package/extension/libherb/util/hb_system.c +0 -30
- package/extension/libherb/util/hb_system.h +0 -9
- package/src/index-cjs.cts +0 -22
- /package/dist/types/{index-esm.d.mts → index.d.ts} +0 -0
- /package/src/{index-esm.mts → index.ts} +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#ifndef HERB_ANALYZE_TAG_HELPERS_H
|
|
2
|
+
#define HERB_ANALYZE_TAG_HELPERS_H
|
|
3
|
+
|
|
4
|
+
#include "../../ast_nodes.h"
|
|
5
|
+
#include "../../position.h"
|
|
6
|
+
#include "../../util/hb_array.h"
|
|
7
|
+
#include "../analyze.h"
|
|
8
|
+
#include "tag_helper_handler.h"
|
|
9
|
+
|
|
10
|
+
#include <prism.h>
|
|
11
|
+
#include <stdbool.h>
|
|
12
|
+
|
|
13
|
+
typedef struct {
|
|
14
|
+
const pm_node_t* tag_helper_node;
|
|
15
|
+
const uint8_t* source;
|
|
16
|
+
pm_parser_t* parser;
|
|
17
|
+
tag_helper_info_T* info;
|
|
18
|
+
const tag_helper_handler_T* matched_handler;
|
|
19
|
+
bool found;
|
|
20
|
+
} tag_helper_search_data_T;
|
|
21
|
+
|
|
22
|
+
bool search_tag_helper_node(const pm_node_t* node, void* data);
|
|
23
|
+
|
|
24
|
+
position_T prism_location_to_position_with_offset(
|
|
25
|
+
const pm_location_t* pm_location,
|
|
26
|
+
const char* original_source,
|
|
27
|
+
size_t erb_content_offset,
|
|
28
|
+
const uint8_t* erb_content_source
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
position_T byte_offset_to_position(const char* source, size_t offset);
|
|
32
|
+
|
|
33
|
+
size_t calculate_byte_offset_from_position(const char* source, position_T position);
|
|
34
|
+
|
|
35
|
+
void transform_tag_helper_blocks(const AST_NODE_T* node, analyze_ruby_context_T* context);
|
|
36
|
+
bool transform_tag_helper_nodes(const AST_NODE_T* node, void* data);
|
|
37
|
+
|
|
38
|
+
#endif
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
#ifndef HERB_ANALYZE_H
|
|
2
2
|
#define HERB_ANALYZE_H
|
|
3
3
|
|
|
4
|
+
#include "../ast_nodes.h"
|
|
5
|
+
#include "../parser.h"
|
|
6
|
+
#include "../util/hb_allocator.h"
|
|
7
|
+
#include "../util/hb_array.h"
|
|
4
8
|
#include "analyzed_ruby.h"
|
|
5
|
-
#include "ast_nodes.h"
|
|
6
|
-
#include "util/hb_array.h"
|
|
7
9
|
|
|
8
10
|
typedef struct ANALYZE_RUBY_CONTEXT_STRUCT {
|
|
9
11
|
AST_DOCUMENT_NODE_T* document;
|
|
10
12
|
AST_NODE_T* parent;
|
|
11
13
|
hb_array_T* ruby_context_stack;
|
|
14
|
+
hb_allocator_T* allocator;
|
|
15
|
+
const char* source;
|
|
12
16
|
} analyze_ruby_context_T;
|
|
13
17
|
|
|
14
18
|
typedef enum {
|
|
@@ -36,10 +40,16 @@ typedef enum {
|
|
|
36
40
|
typedef struct {
|
|
37
41
|
int loop_depth;
|
|
38
42
|
int rescue_depth;
|
|
43
|
+
hb_allocator_T* allocator;
|
|
39
44
|
} invalid_erb_context_T;
|
|
40
45
|
|
|
41
|
-
void herb_analyze_parse_errors(AST_DOCUMENT_NODE_T* document, const char* source);
|
|
42
|
-
void herb_analyze_parse_tree(
|
|
46
|
+
void herb_analyze_parse_errors(AST_DOCUMENT_NODE_T* document, const char* source, hb_allocator_T* allocator);
|
|
47
|
+
void herb_analyze_parse_tree(
|
|
48
|
+
AST_DOCUMENT_NODE_T* document,
|
|
49
|
+
const char* source,
|
|
50
|
+
const parser_options_T* options,
|
|
51
|
+
hb_allocator_T* allocator
|
|
52
|
+
);
|
|
43
53
|
|
|
44
54
|
hb_array_T* rewrite_node_array(AST_NODE_T* node, hb_array_T* array, analyze_ruby_context_T* context);
|
|
45
55
|
bool transform_erb_nodes(const AST_NODE_T* node, void* data);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#ifndef HERB_ANALYZED_RUBY_H
|
|
2
2
|
#define HERB_ANALYZED_RUBY_H
|
|
3
3
|
|
|
4
|
-
#include "util/hb_array.h"
|
|
5
|
-
#include "util/hb_string.h"
|
|
4
|
+
#include "../util/hb_array.h"
|
|
5
|
+
#include "../util/hb_string.h"
|
|
6
6
|
|
|
7
7
|
#include <prism.h>
|
|
8
8
|
|
|
@@ -35,6 +35,6 @@ typedef struct ANALYZED_RUBY_STRUCT {
|
|
|
35
35
|
|
|
36
36
|
analyzed_ruby_T* init_analyzed_ruby(hb_string_T source);
|
|
37
37
|
void free_analyzed_ruby(analyzed_ruby_T* analyzed);
|
|
38
|
-
|
|
38
|
+
hb_string_T erb_keyword_from_analyzed_ruby(const analyzed_ruby_T* analyzed);
|
|
39
39
|
|
|
40
40
|
#endif
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#ifndef HERB_ANALYZE_BUILDERS_H
|
|
2
|
+
#define HERB_ANALYZE_BUILDERS_H
|
|
3
|
+
|
|
4
|
+
#include "../ast_nodes.h"
|
|
5
|
+
#include "../location.h"
|
|
6
|
+
#include "../position.h"
|
|
7
|
+
#include "../util/hb_allocator.h"
|
|
8
|
+
#include "analyze.h"
|
|
9
|
+
|
|
10
|
+
position_T erb_content_end_position(const AST_ERB_CONTENT_NODE_T* erb_node);
|
|
11
|
+
|
|
12
|
+
location_T* compute_then_keyword(
|
|
13
|
+
AST_ERB_CONTENT_NODE_T* erb_node,
|
|
14
|
+
control_type_t control_type,
|
|
15
|
+
hb_allocator_T* allocator
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
AST_NODE_T* create_control_node(
|
|
19
|
+
AST_ERB_CONTENT_NODE_T* erb_node,
|
|
20
|
+
hb_array_T* children,
|
|
21
|
+
AST_NODE_T* subsequent,
|
|
22
|
+
AST_ERB_END_NODE_T* end_node,
|
|
23
|
+
control_type_t control_type,
|
|
24
|
+
hb_allocator_T* allocator
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
#endif
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#ifndef HERB_ANALYZE_CONDITIONAL_ELEMENTS_H
|
|
2
|
+
#define HERB_ANALYZE_CONDITIONAL_ELEMENTS_H
|
|
3
|
+
|
|
4
|
+
#include "../ast_nodes.h"
|
|
5
|
+
#include "../util/hb_allocator.h"
|
|
6
|
+
|
|
7
|
+
void herb_transform_conditional_elements(AST_DOCUMENT_NODE_T* document, hb_allocator_T* allocator);
|
|
8
|
+
|
|
9
|
+
#endif
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#ifndef HERB_ANALYZE_CONDITIONAL_OPEN_TAGS_H
|
|
2
|
+
#define HERB_ANALYZE_CONDITIONAL_OPEN_TAGS_H
|
|
3
|
+
|
|
4
|
+
#include "../ast_nodes.h"
|
|
5
|
+
#include "../util/hb_allocator.h"
|
|
6
|
+
|
|
7
|
+
void herb_transform_conditional_open_tags(AST_DOCUMENT_NODE_T* document, hb_allocator_T* allocator);
|
|
8
|
+
|
|
9
|
+
#endif
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#ifndef HERB_ANALYZE_CONTROL_TYPE_H
|
|
2
|
+
#define HERB_ANALYZE_CONTROL_TYPE_H
|
|
3
|
+
|
|
4
|
+
#include "../ast_nodes.h"
|
|
5
|
+
#include "analyze.h"
|
|
6
|
+
|
|
7
|
+
#include <stdbool.h>
|
|
8
|
+
|
|
9
|
+
control_type_t detect_control_type(AST_ERB_CONTENT_NODE_T* erb_node);
|
|
10
|
+
bool is_subsequent_type(control_type_t parent_type, control_type_t child_type);
|
|
11
|
+
bool is_terminator_type(control_type_t parent_type, control_type_t child_type);
|
|
12
|
+
bool is_compound_control_type(control_type_t type);
|
|
13
|
+
|
|
14
|
+
#endif
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
#include <prism.h>
|
|
5
5
|
#include <stdbool.h>
|
|
6
6
|
|
|
7
|
+
#include "../ast_node.h"
|
|
8
|
+
#include "../util/hb_allocator.h"
|
|
7
9
|
#include "analyzed_ruby.h"
|
|
8
|
-
#include "ast_node.h"
|
|
9
10
|
|
|
10
11
|
bool has_if_node(analyzed_ruby_T* analyzed);
|
|
11
12
|
bool has_elsif_node(analyzed_ruby_T* analyzed);
|
|
@@ -26,6 +27,7 @@ bool has_ensure_node(analyzed_ruby_T* analyzed);
|
|
|
26
27
|
bool has_unless_node(analyzed_ruby_T* analyzed);
|
|
27
28
|
bool has_yield_node(analyzed_ruby_T* analyzed);
|
|
28
29
|
bool has_then_keyword(analyzed_ruby_T* analyzed);
|
|
30
|
+
bool has_inline_case_condition(analyzed_ruby_T* analyzed);
|
|
29
31
|
|
|
30
32
|
bool has_error_message(analyzed_ruby_T* anlayzed, const char* message);
|
|
31
33
|
|
|
@@ -58,6 +60,6 @@ bool search_unexpected_in_nodes(analyzed_ruby_T* analyzed);
|
|
|
58
60
|
bool search_unexpected_rescue_nodes(analyzed_ruby_T* analyzed);
|
|
59
61
|
bool search_unexpected_when_nodes(analyzed_ruby_T* analyzed);
|
|
60
62
|
|
|
61
|
-
void check_erb_node_for_missing_end(const AST_NODE_T* node);
|
|
63
|
+
void check_erb_node_for_missing_end(const AST_NODE_T* node, hb_allocator_T* allocator);
|
|
62
64
|
|
|
63
65
|
#endif
|
|
@@ -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(
|
|
10
|
-
|
|
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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.9.1/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,
|
|
@@ -46,6 +57,8 @@ typedef enum {
|
|
|
46
57
|
AST_ERB_ENSURE_NODE,
|
|
47
58
|
AST_ERB_BEGIN_NODE,
|
|
48
59
|
AST_ERB_UNLESS_NODE,
|
|
60
|
+
AST_RUBY_RENDER_LOCAL_NODE,
|
|
61
|
+
AST_ERB_RENDER_NODE,
|
|
49
62
|
AST_ERB_YIELD_NODE,
|
|
50
63
|
AST_ERB_IN_NODE,
|
|
51
64
|
} ast_node_type_T;
|
|
@@ -61,11 +74,13 @@ typedef struct AST_NODE_STRUCT {
|
|
|
61
74
|
typedef struct AST_DOCUMENT_NODE_STRUCT {
|
|
62
75
|
AST_NODE_T base;
|
|
63
76
|
hb_array_T* children;
|
|
77
|
+
herb_prism_context_T* prism_context;
|
|
78
|
+
herb_prism_node_T prism_node;
|
|
64
79
|
} AST_DOCUMENT_NODE_T;
|
|
65
80
|
|
|
66
81
|
typedef struct AST_LITERAL_NODE_STRUCT {
|
|
67
82
|
AST_NODE_T base;
|
|
68
|
-
|
|
83
|
+
hb_string_T content;
|
|
69
84
|
} AST_LITERAL_NODE_T;
|
|
70
85
|
|
|
71
86
|
typedef struct AST_HTML_OPEN_TAG_NODE_STRUCT {
|
|
@@ -77,6 +92,13 @@ typedef struct AST_HTML_OPEN_TAG_NODE_STRUCT {
|
|
|
77
92
|
bool is_void;
|
|
78
93
|
} AST_HTML_OPEN_TAG_NODE_T;
|
|
79
94
|
|
|
95
|
+
typedef struct AST_HTML_CONDITIONAL_OPEN_TAG_NODE_STRUCT {
|
|
96
|
+
AST_NODE_T base;
|
|
97
|
+
AST_NODE_T* conditional;
|
|
98
|
+
token_T* tag_name;
|
|
99
|
+
bool is_void;
|
|
100
|
+
} AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T;
|
|
101
|
+
|
|
80
102
|
typedef struct AST_HTML_CLOSE_TAG_NODE_STRUCT {
|
|
81
103
|
AST_NODE_T base;
|
|
82
104
|
token_T* tag_opening;
|
|
@@ -85,16 +107,38 @@ typedef struct AST_HTML_CLOSE_TAG_NODE_STRUCT {
|
|
|
85
107
|
token_T* tag_closing;
|
|
86
108
|
} AST_HTML_CLOSE_TAG_NODE_T;
|
|
87
109
|
|
|
110
|
+
typedef struct AST_HTML_OMITTED_CLOSE_TAG_NODE_STRUCT {
|
|
111
|
+
AST_NODE_T base;
|
|
112
|
+
token_T* tag_name;
|
|
113
|
+
} AST_HTML_OMITTED_CLOSE_TAG_NODE_T;
|
|
114
|
+
|
|
115
|
+
typedef struct AST_HTML_VIRTUAL_CLOSE_TAG_NODE_STRUCT {
|
|
116
|
+
AST_NODE_T base;
|
|
117
|
+
token_T* tag_name;
|
|
118
|
+
} AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T;
|
|
119
|
+
|
|
88
120
|
typedef struct AST_HTML_ELEMENT_NODE_STRUCT {
|
|
89
121
|
AST_NODE_T base;
|
|
90
|
-
|
|
122
|
+
AST_NODE_T* open_tag;
|
|
91
123
|
token_T* tag_name;
|
|
92
124
|
hb_array_T* body;
|
|
93
|
-
|
|
125
|
+
AST_NODE_T* close_tag;
|
|
94
126
|
bool is_void;
|
|
95
|
-
|
|
127
|
+
hb_string_T element_source;
|
|
96
128
|
} AST_HTML_ELEMENT_NODE_T;
|
|
97
129
|
|
|
130
|
+
typedef struct AST_HTML_CONDITIONAL_ELEMENT_NODE_STRUCT {
|
|
131
|
+
AST_NODE_T base;
|
|
132
|
+
hb_string_T condition;
|
|
133
|
+
AST_NODE_T* open_conditional;
|
|
134
|
+
struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag;
|
|
135
|
+
hb_array_T* body;
|
|
136
|
+
AST_NODE_T* close_tag;
|
|
137
|
+
AST_NODE_T* close_conditional;
|
|
138
|
+
token_T* tag_name;
|
|
139
|
+
hb_string_T element_source;
|
|
140
|
+
} AST_HTML_CONDITIONAL_ELEMENT_NODE_T;
|
|
141
|
+
|
|
98
142
|
typedef struct AST_HTML_ATTRIBUTE_VALUE_NODE_STRUCT {
|
|
99
143
|
AST_NODE_T base;
|
|
100
144
|
token_T* open_quote;
|
|
@@ -115,9 +159,29 @@ typedef struct AST_HTML_ATTRIBUTE_NODE_STRUCT {
|
|
|
115
159
|
struct AST_HTML_ATTRIBUTE_VALUE_NODE_STRUCT* value;
|
|
116
160
|
} AST_HTML_ATTRIBUTE_NODE_T;
|
|
117
161
|
|
|
162
|
+
typedef struct AST_RUBY_LITERAL_NODE_STRUCT {
|
|
163
|
+
AST_NODE_T base;
|
|
164
|
+
hb_string_T content;
|
|
165
|
+
} AST_RUBY_LITERAL_NODE_T;
|
|
166
|
+
|
|
167
|
+
typedef struct AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_STRUCT {
|
|
168
|
+
AST_NODE_T base;
|
|
169
|
+
hb_string_T content;
|
|
170
|
+
hb_string_T prefix;
|
|
171
|
+
} AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T;
|
|
172
|
+
|
|
173
|
+
typedef struct AST_ERB_OPEN_TAG_NODE_STRUCT {
|
|
174
|
+
AST_NODE_T base;
|
|
175
|
+
token_T* tag_opening;
|
|
176
|
+
token_T* content;
|
|
177
|
+
token_T* tag_closing;
|
|
178
|
+
token_T* tag_name;
|
|
179
|
+
hb_array_T* children;
|
|
180
|
+
} AST_ERB_OPEN_TAG_NODE_T;
|
|
181
|
+
|
|
118
182
|
typedef struct AST_HTML_TEXT_NODE_STRUCT {
|
|
119
183
|
AST_NODE_T base;
|
|
120
|
-
|
|
184
|
+
hb_string_T content;
|
|
121
185
|
} AST_HTML_TEXT_NODE_T;
|
|
122
186
|
|
|
123
187
|
typedef struct AST_HTML_COMMENT_NODE_STRUCT {
|
|
@@ -161,6 +225,7 @@ typedef struct AST_ERB_CONTENT_NODE_STRUCT {
|
|
|
161
225
|
analyzed_ruby_T* analyzed_ruby;
|
|
162
226
|
bool parsed;
|
|
163
227
|
bool valid;
|
|
228
|
+
herb_prism_node_T prism_node;
|
|
164
229
|
} AST_ERB_CONTENT_NODE_T;
|
|
165
230
|
|
|
166
231
|
typedef struct AST_ERB_END_NODE_STRUCT {
|
|
@@ -184,8 +249,9 @@ typedef struct AST_ERB_IF_NODE_STRUCT {
|
|
|
184
249
|
token_T* content;
|
|
185
250
|
token_T* tag_closing;
|
|
186
251
|
location_T* then_keyword;
|
|
252
|
+
herb_prism_node_T prism_node;
|
|
187
253
|
hb_array_T* statements;
|
|
188
|
-
|
|
254
|
+
AST_NODE_T* subsequent;
|
|
189
255
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
190
256
|
} AST_ERB_IF_NODE_T;
|
|
191
257
|
|
|
@@ -194,6 +260,7 @@ typedef struct AST_ERB_BLOCK_NODE_STRUCT {
|
|
|
194
260
|
token_T* tag_opening;
|
|
195
261
|
token_T* content;
|
|
196
262
|
token_T* tag_closing;
|
|
263
|
+
herb_prism_node_T prism_node;
|
|
197
264
|
hb_array_T* body;
|
|
198
265
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
199
266
|
} AST_ERB_BLOCK_NODE_T;
|
|
@@ -213,6 +280,7 @@ typedef struct AST_ERB_CASE_NODE_STRUCT {
|
|
|
213
280
|
token_T* content;
|
|
214
281
|
token_T* tag_closing;
|
|
215
282
|
hb_array_T* children;
|
|
283
|
+
herb_prism_node_T prism_node;
|
|
216
284
|
hb_array_T* conditions;
|
|
217
285
|
struct AST_ERB_ELSE_NODE_STRUCT* else_clause;
|
|
218
286
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
@@ -224,6 +292,7 @@ typedef struct AST_ERB_CASE_MATCH_NODE_STRUCT {
|
|
|
224
292
|
token_T* content;
|
|
225
293
|
token_T* tag_closing;
|
|
226
294
|
hb_array_T* children;
|
|
295
|
+
herb_prism_node_T prism_node;
|
|
227
296
|
hb_array_T* conditions;
|
|
228
297
|
struct AST_ERB_ELSE_NODE_STRUCT* else_clause;
|
|
229
298
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
@@ -234,6 +303,7 @@ typedef struct AST_ERB_WHILE_NODE_STRUCT {
|
|
|
234
303
|
token_T* tag_opening;
|
|
235
304
|
token_T* content;
|
|
236
305
|
token_T* tag_closing;
|
|
306
|
+
herb_prism_node_T prism_node;
|
|
237
307
|
hb_array_T* statements;
|
|
238
308
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
239
309
|
} AST_ERB_WHILE_NODE_T;
|
|
@@ -243,6 +313,7 @@ typedef struct AST_ERB_UNTIL_NODE_STRUCT {
|
|
|
243
313
|
token_T* tag_opening;
|
|
244
314
|
token_T* content;
|
|
245
315
|
token_T* tag_closing;
|
|
316
|
+
herb_prism_node_T prism_node;
|
|
246
317
|
hb_array_T* statements;
|
|
247
318
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
248
319
|
} AST_ERB_UNTIL_NODE_T;
|
|
@@ -252,6 +323,7 @@ typedef struct AST_ERB_FOR_NODE_STRUCT {
|
|
|
252
323
|
token_T* tag_opening;
|
|
253
324
|
token_T* content;
|
|
254
325
|
token_T* tag_closing;
|
|
326
|
+
herb_prism_node_T prism_node;
|
|
255
327
|
hb_array_T* statements;
|
|
256
328
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
257
329
|
} AST_ERB_FOR_NODE_T;
|
|
@@ -278,6 +350,7 @@ typedef struct AST_ERB_BEGIN_NODE_STRUCT {
|
|
|
278
350
|
token_T* tag_opening;
|
|
279
351
|
token_T* content;
|
|
280
352
|
token_T* tag_closing;
|
|
353
|
+
herb_prism_node_T prism_node;
|
|
281
354
|
hb_array_T* statements;
|
|
282
355
|
struct AST_ERB_RESCUE_NODE_STRUCT* rescue_clause;
|
|
283
356
|
struct AST_ERB_ELSE_NODE_STRUCT* else_clause;
|
|
@@ -291,11 +364,45 @@ typedef struct AST_ERB_UNLESS_NODE_STRUCT {
|
|
|
291
364
|
token_T* content;
|
|
292
365
|
token_T* tag_closing;
|
|
293
366
|
location_T* then_keyword;
|
|
367
|
+
herb_prism_node_T prism_node;
|
|
294
368
|
hb_array_T* statements;
|
|
295
369
|
struct AST_ERB_ELSE_NODE_STRUCT* else_clause;
|
|
296
370
|
struct AST_ERB_END_NODE_STRUCT* end_node;
|
|
297
371
|
} AST_ERB_UNLESS_NODE_T;
|
|
298
372
|
|
|
373
|
+
typedef struct AST_RUBY_RENDER_LOCAL_NODE_STRUCT {
|
|
374
|
+
AST_NODE_T base;
|
|
375
|
+
token_T* name;
|
|
376
|
+
struct AST_RUBY_LITERAL_NODE_STRUCT* value;
|
|
377
|
+
} AST_RUBY_RENDER_LOCAL_NODE_T;
|
|
378
|
+
|
|
379
|
+
typedef struct AST_ERB_RENDER_NODE_STRUCT {
|
|
380
|
+
AST_NODE_T base;
|
|
381
|
+
token_T* tag_opening;
|
|
382
|
+
token_T* content;
|
|
383
|
+
token_T* tag_closing;
|
|
384
|
+
analyzed_ruby_T* analyzed_ruby;
|
|
385
|
+
herb_prism_node_T prism_node;
|
|
386
|
+
token_T* partial;
|
|
387
|
+
token_T* template_path;
|
|
388
|
+
token_T* layout;
|
|
389
|
+
token_T* file;
|
|
390
|
+
token_T* inline_template;
|
|
391
|
+
token_T* body;
|
|
392
|
+
token_T* plain;
|
|
393
|
+
token_T* html;
|
|
394
|
+
token_T* renderable;
|
|
395
|
+
token_T* collection;
|
|
396
|
+
token_T* object;
|
|
397
|
+
token_T* as_name;
|
|
398
|
+
token_T* spacer_template;
|
|
399
|
+
token_T* formats;
|
|
400
|
+
token_T* variants;
|
|
401
|
+
token_T* handlers;
|
|
402
|
+
token_T* content_type;
|
|
403
|
+
hb_array_T* locals;
|
|
404
|
+
} AST_ERB_RENDER_NODE_T;
|
|
405
|
+
|
|
299
406
|
typedef struct AST_ERB_YIELD_NODE_STRUCT {
|
|
300
407
|
AST_NODE_T base;
|
|
301
408
|
token_T* tag_opening;
|
|
@@ -312,37 +419,46 @@ typedef struct AST_ERB_IN_NODE_STRUCT {
|
|
|
312
419
|
hb_array_T* statements;
|
|
313
420
|
} AST_ERB_IN_NODE_T;
|
|
314
421
|
|
|
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
|
-
|
|
422
|
+
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);
|
|
423
|
+
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);
|
|
424
|
+
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);
|
|
425
|
+
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);
|
|
426
|
+
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);
|
|
427
|
+
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);
|
|
428
|
+
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);
|
|
429
|
+
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);
|
|
430
|
+
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);
|
|
431
|
+
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);
|
|
432
|
+
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);
|
|
433
|
+
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);
|
|
434
|
+
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);
|
|
435
|
+
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);
|
|
436
|
+
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);
|
|
437
|
+
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);
|
|
438
|
+
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);
|
|
439
|
+
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);
|
|
440
|
+
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);
|
|
441
|
+
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);
|
|
442
|
+
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);
|
|
443
|
+
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);
|
|
444
|
+
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);
|
|
445
|
+
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);
|
|
446
|
+
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);
|
|
447
|
+
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);
|
|
448
|
+
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);
|
|
449
|
+
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);
|
|
450
|
+
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);
|
|
451
|
+
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);
|
|
452
|
+
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);
|
|
453
|
+
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);
|
|
454
|
+
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);
|
|
455
|
+
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);
|
|
456
|
+
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);
|
|
457
|
+
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);
|
|
458
|
+
AST_RUBY_RENDER_LOCAL_NODE_T* ast_ruby_render_local_node_init(token_T* name, struct AST_RUBY_LITERAL_NODE_STRUCT* value, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
459
|
+
AST_ERB_RENDER_NODE_T* ast_erb_render_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, analyzed_ruby_T* analyzed_ruby, herb_prism_node_T prism_node, token_T* partial, token_T* template_path, token_T* layout, token_T* file, token_T* inline_template, token_T* body, token_T* plain, token_T* html, token_T* renderable, token_T* collection, token_T* object, token_T* as_name, token_T* spacer_template, token_T* formats, token_T* variants, token_T* handlers, token_T* content_type, hb_array_T* locals, position_T start_position, position_T end_position, hb_array_T* errors, hb_allocator_T* allocator);
|
|
460
|
+
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);
|
|
461
|
+
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
462
|
|
|
347
463
|
hb_string_T ast_node_type_to_string(AST_NODE_T* node);
|
|
348
464
|
hb_string_T ast_node_human_type(AST_NODE_T* node);
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
// NOTE: This file is generated by the templates/template.rb script and should not
|
|
2
|
-
// be modified manually. See /Users/marcoroth/Development/herb-release-0.
|
|
2
|
+
// be modified manually. See /Users/marcoroth/Development/herb-release-0.9.1/templates/src/include/ast_pretty_print.h.erb
|
|
3
3
|
|
|
4
4
|
#ifndef HERB_AST_PRETTY_PRINT_H
|
|
5
5
|
#define HERB_AST_PRETTY_PRINT_H
|
|
6
6
|
|
|
7
|
+
#ifdef HERB_EXCLUDE_PRETTYPRINT
|
|
8
|
+
// Pretty print support excluded
|
|
9
|
+
#else
|
|
10
|
+
|
|
7
11
|
#include "ast_nodes.h"
|
|
8
12
|
#include "util/hb_buffer.h"
|
|
9
13
|
|
|
@@ -15,3 +19,4 @@ void ast_pretty_print_node(
|
|
|
15
19
|
);
|
|
16
20
|
|
|
17
21
|
#endif
|
|
22
|
+
#endif
|