herb 0.8.10-arm-linux-gnu → 0.9.1-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 +473 -34
- data/ext/herb/error_helpers.c +535 -140
- data/ext/herb/error_helpers.h +1 -0
- data/ext/herb/extconf.rb +67 -28
- data/ext/herb/extension.c +321 -51
- data/ext/herb/extension.h +1 -0
- data/ext/herb/extension_helpers.c +24 -14
- data/ext/herb/extension_helpers.h +2 -2
- data/ext/herb/nodes.c +647 -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 +1530 -179
- 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 +119 -43
- data/lib/herb/errors.rb +808 -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 +62 -0
- data/lib/herb/position.rb +1 -0
- data/lib/herb/prism_inspect.rb +120 -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 +47 -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 +773 -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 +21 -3
- data/sig/herb/errors.rbs +372 -63
- data/sig/herb/location.rbs +4 -0
- data/sig/herb/parse_result.rbs +4 -2
- data/sig/herb/parser_options.rbs +46 -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 +31 -4
- data/sig/herb/warnings.rbs +6 -1
- data/sig/herb.rbs +14 -0
- data/sig/herb_c_extension.rbs +5 -2
- data/sig/rubyvm.rbs +5 -0
- data/sig/serialized_ast_errors.rbs +82 -6
- data/sig/serialized_ast_nodes.rbs +91 -6
- data/src/analyze/action_view/attribute_extraction_helpers.c +303 -0
- data/src/analyze/action_view/content_tag.c +78 -0
- data/src/analyze/action_view/link_to.c +167 -0
- data/src/analyze/action_view/registry.c +83 -0
- data/src/analyze/action_view/tag.c +70 -0
- data/src/analyze/action_view/tag_helper_node_builders.c +305 -0
- data/src/analyze/action_view/tag_helpers.c +815 -0
- data/src/analyze/action_view/turbo_frame_tag.c +88 -0
- data/src/analyze/analyze.c +885 -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 +399 -0
- data/src/analyze/render_nodes.c +761 -0
- data/src/{analyze_transform.c → analyze/transform.c} +24 -3
- data/src/ast_node.c +17 -7
- data/src/ast_nodes.c +759 -387
- data/src/ast_pretty_print.c +264 -6
- data/src/errors.c +1454 -519
- 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 +43 -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/analyze/render_nodes.h +11 -0
- data/src/include/ast_node.h +11 -5
- data/src/include/ast_nodes.h +154 -38
- data/src/include/ast_pretty_print.h +5 -0
- data/src/include/element_source.h +3 -8
- data/src/include/errors.h +206 -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 +28 -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 +784 -247
- data/src/parser_helpers.c +110 -23
- data/src/parser_match_tags.c +129 -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 +67 -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 +95 -32
- 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 +168 -16
- 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 +60 -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/ext/herb/nodes.c
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// be modified manually. See /home/runner/work/herb/herb/templates/ext/herb/nodes.c.erb
|
|
3
3
|
|
|
4
4
|
#include <ruby.h>
|
|
5
|
+
#include <ruby/encoding.h>
|
|
5
6
|
|
|
6
7
|
#include "error_helpers.h"
|
|
7
8
|
#include "extension_helpers.h"
|
|
@@ -14,31 +15,133 @@
|
|
|
14
15
|
VALUE rb_node_from_c_struct(AST_NODE_T* node);
|
|
15
16
|
static VALUE rb_nodes_array_from_c_array(hb_array_T* array);
|
|
16
17
|
|
|
18
|
+
static VALUE mAST;
|
|
19
|
+
static VALUE cNode;
|
|
20
|
+
static VALUE cDocumentNode;
|
|
21
|
+
static VALUE cLiteralNode;
|
|
22
|
+
static VALUE cHTMLOpenTagNode;
|
|
23
|
+
static VALUE cHTMLConditionalOpenTagNode;
|
|
24
|
+
static VALUE cHTMLCloseTagNode;
|
|
25
|
+
static VALUE cHTMLOmittedCloseTagNode;
|
|
26
|
+
static VALUE cHTMLVirtualCloseTagNode;
|
|
27
|
+
static VALUE cHTMLElementNode;
|
|
28
|
+
static VALUE cHTMLConditionalElementNode;
|
|
29
|
+
static VALUE cHTMLAttributeValueNode;
|
|
30
|
+
static VALUE cHTMLAttributeNameNode;
|
|
31
|
+
static VALUE cHTMLAttributeNode;
|
|
32
|
+
static VALUE cRubyLiteralNode;
|
|
33
|
+
static VALUE cRubyHTMLAttributesSplatNode;
|
|
34
|
+
static VALUE cERBOpenTagNode;
|
|
35
|
+
static VALUE cHTMLTextNode;
|
|
36
|
+
static VALUE cHTMLCommentNode;
|
|
37
|
+
static VALUE cHTMLDoctypeNode;
|
|
38
|
+
static VALUE cXMLDeclarationNode;
|
|
39
|
+
static VALUE cCDATANode;
|
|
40
|
+
static VALUE cWhitespaceNode;
|
|
41
|
+
static VALUE cERBContentNode;
|
|
42
|
+
static VALUE cERBEndNode;
|
|
43
|
+
static VALUE cERBElseNode;
|
|
44
|
+
static VALUE cERBIfNode;
|
|
45
|
+
static VALUE cERBBlockNode;
|
|
46
|
+
static VALUE cERBWhenNode;
|
|
47
|
+
static VALUE cERBCaseNode;
|
|
48
|
+
static VALUE cERBCaseMatchNode;
|
|
49
|
+
static VALUE cERBWhileNode;
|
|
50
|
+
static VALUE cERBUntilNode;
|
|
51
|
+
static VALUE cERBForNode;
|
|
52
|
+
static VALUE cERBRescueNode;
|
|
53
|
+
static VALUE cERBEnsureNode;
|
|
54
|
+
static VALUE cERBBeginNode;
|
|
55
|
+
static VALUE cERBUnlessNode;
|
|
56
|
+
static VALUE cRubyRenderLocalNode;
|
|
57
|
+
static VALUE cERBRenderNode;
|
|
58
|
+
static VALUE cERBYieldNode;
|
|
59
|
+
static VALUE cERBInNode;
|
|
60
|
+
|
|
61
|
+
void rb_init_node_classes(void) {
|
|
62
|
+
mAST = rb_define_module_under(mHerb, "AST");
|
|
63
|
+
cNode = rb_define_class_under(mAST, "Node", rb_cObject);
|
|
64
|
+
cDocumentNode = rb_define_class_under(mAST, "DocumentNode", cNode);
|
|
65
|
+
cLiteralNode = rb_define_class_under(mAST, "LiteralNode", cNode);
|
|
66
|
+
cHTMLOpenTagNode = rb_define_class_under(mAST, "HTMLOpenTagNode", cNode);
|
|
67
|
+
cHTMLConditionalOpenTagNode = rb_define_class_under(mAST, "HTMLConditionalOpenTagNode", cNode);
|
|
68
|
+
cHTMLCloseTagNode = rb_define_class_under(mAST, "HTMLCloseTagNode", cNode);
|
|
69
|
+
cHTMLOmittedCloseTagNode = rb_define_class_under(mAST, "HTMLOmittedCloseTagNode", cNode);
|
|
70
|
+
cHTMLVirtualCloseTagNode = rb_define_class_under(mAST, "HTMLVirtualCloseTagNode", cNode);
|
|
71
|
+
cHTMLElementNode = rb_define_class_under(mAST, "HTMLElementNode", cNode);
|
|
72
|
+
cHTMLConditionalElementNode = rb_define_class_under(mAST, "HTMLConditionalElementNode", cNode);
|
|
73
|
+
cHTMLAttributeValueNode = rb_define_class_under(mAST, "HTMLAttributeValueNode", cNode);
|
|
74
|
+
cHTMLAttributeNameNode = rb_define_class_under(mAST, "HTMLAttributeNameNode", cNode);
|
|
75
|
+
cHTMLAttributeNode = rb_define_class_under(mAST, "HTMLAttributeNode", cNode);
|
|
76
|
+
cRubyLiteralNode = rb_define_class_under(mAST, "RubyLiteralNode", cNode);
|
|
77
|
+
cRubyHTMLAttributesSplatNode = rb_define_class_under(mAST, "RubyHTMLAttributesSplatNode", cNode);
|
|
78
|
+
cERBOpenTagNode = rb_define_class_under(mAST, "ERBOpenTagNode", cNode);
|
|
79
|
+
cHTMLTextNode = rb_define_class_under(mAST, "HTMLTextNode", cNode);
|
|
80
|
+
cHTMLCommentNode = rb_define_class_under(mAST, "HTMLCommentNode", cNode);
|
|
81
|
+
cHTMLDoctypeNode = rb_define_class_under(mAST, "HTMLDoctypeNode", cNode);
|
|
82
|
+
cXMLDeclarationNode = rb_define_class_under(mAST, "XMLDeclarationNode", cNode);
|
|
83
|
+
cCDATANode = rb_define_class_under(mAST, "CDATANode", cNode);
|
|
84
|
+
cWhitespaceNode = rb_define_class_under(mAST, "WhitespaceNode", cNode);
|
|
85
|
+
cERBContentNode = rb_define_class_under(mAST, "ERBContentNode", cNode);
|
|
86
|
+
cERBEndNode = rb_define_class_under(mAST, "ERBEndNode", cNode);
|
|
87
|
+
cERBElseNode = rb_define_class_under(mAST, "ERBElseNode", cNode);
|
|
88
|
+
cERBIfNode = rb_define_class_under(mAST, "ERBIfNode", cNode);
|
|
89
|
+
cERBBlockNode = rb_define_class_under(mAST, "ERBBlockNode", cNode);
|
|
90
|
+
cERBWhenNode = rb_define_class_under(mAST, "ERBWhenNode", cNode);
|
|
91
|
+
cERBCaseNode = rb_define_class_under(mAST, "ERBCaseNode", cNode);
|
|
92
|
+
cERBCaseMatchNode = rb_define_class_under(mAST, "ERBCaseMatchNode", cNode);
|
|
93
|
+
cERBWhileNode = rb_define_class_under(mAST, "ERBWhileNode", cNode);
|
|
94
|
+
cERBUntilNode = rb_define_class_under(mAST, "ERBUntilNode", cNode);
|
|
95
|
+
cERBForNode = rb_define_class_under(mAST, "ERBForNode", cNode);
|
|
96
|
+
cERBRescueNode = rb_define_class_under(mAST, "ERBRescueNode", cNode);
|
|
97
|
+
cERBEnsureNode = rb_define_class_under(mAST, "ERBEnsureNode", cNode);
|
|
98
|
+
cERBBeginNode = rb_define_class_under(mAST, "ERBBeginNode", cNode);
|
|
99
|
+
cERBUnlessNode = rb_define_class_under(mAST, "ERBUnlessNode", cNode);
|
|
100
|
+
cRubyRenderLocalNode = rb_define_class_under(mAST, "RubyRenderLocalNode", cNode);
|
|
101
|
+
cERBRenderNode = rb_define_class_under(mAST, "ERBRenderNode", cNode);
|
|
102
|
+
cERBYieldNode = rb_define_class_under(mAST, "ERBYieldNode", cNode);
|
|
103
|
+
cERBInNode = rb_define_class_under(mAST, "ERBInNode", cNode);
|
|
104
|
+
}
|
|
105
|
+
|
|
17
106
|
static VALUE rb_document_node_from_c_struct(AST_DOCUMENT_NODE_T* document_node) {
|
|
18
107
|
if (document_node == NULL) { return Qnil; }
|
|
19
108
|
|
|
20
109
|
AST_NODE_T* node = &document_node->base;
|
|
21
110
|
|
|
22
|
-
VALUE
|
|
23
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
24
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
25
|
-
VALUE DocumentNode = rb_define_class_under(AST, "DocumentNode", Node);
|
|
26
|
-
|
|
27
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
28
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
111
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
29
112
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
30
113
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
31
114
|
|
|
32
115
|
VALUE document_node_children = rb_nodes_array_from_c_array(document_node->children);
|
|
116
|
+
/* prism_context is internal parser state, not exposed to Ruby */
|
|
117
|
+
VALUE document_node_prism_context = Qnil;
|
|
118
|
+
VALUE document_node_prism_node;
|
|
119
|
+
if (document_node->prism_node.node != NULL && document_node->prism_node.parser != NULL) {
|
|
120
|
+
pm_buffer_t pm_buffer = { 0 };
|
|
121
|
+
pm_serialize(document_node->prism_node.parser, document_node->prism_node.node, &pm_buffer);
|
|
122
|
+
|
|
123
|
+
if (pm_buffer.length > 0) {
|
|
124
|
+
document_node_prism_node = rb_str_new(pm_buffer.value, pm_buffer.length);
|
|
125
|
+
rb_enc_associate(document_node_prism_node, rb_ascii8bit_encoding());
|
|
126
|
+
OBJ_FREEZE(document_node_prism_node);
|
|
127
|
+
} else {
|
|
128
|
+
document_node_prism_node = Qnil;
|
|
129
|
+
}
|
|
130
|
+
pm_buffer_free(&pm_buffer);
|
|
131
|
+
} else {
|
|
132
|
+
document_node_prism_node = Qnil;
|
|
133
|
+
}
|
|
33
134
|
|
|
34
|
-
VALUE args[
|
|
135
|
+
VALUE args[6] = {
|
|
35
136
|
type,
|
|
36
137
|
location,
|
|
37
138
|
errors,
|
|
38
|
-
document_node_children
|
|
139
|
+
document_node_children,
|
|
140
|
+
document_node_prism_context,
|
|
141
|
+
document_node_prism_node
|
|
39
142
|
};
|
|
40
143
|
|
|
41
|
-
return rb_class_new_instance(
|
|
144
|
+
return rb_class_new_instance(6, args, cDocumentNode);
|
|
42
145
|
};
|
|
43
146
|
|
|
44
147
|
static VALUE rb_literal_node_from_c_struct(AST_LITERAL_NODE_T* literal_node) {
|
|
@@ -46,17 +149,11 @@ static VALUE rb_literal_node_from_c_struct(AST_LITERAL_NODE_T* literal_node) {
|
|
|
46
149
|
|
|
47
150
|
AST_NODE_T* node = &literal_node->base;
|
|
48
151
|
|
|
49
|
-
VALUE
|
|
50
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
51
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
52
|
-
VALUE LiteralNode = rb_define_class_under(AST, "LiteralNode", Node);
|
|
53
|
-
|
|
54
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
55
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
152
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
56
153
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
57
154
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
58
155
|
|
|
59
|
-
VALUE literal_node_content =
|
|
156
|
+
VALUE literal_node_content = rb_string_from_hb_string(literal_node->content);
|
|
60
157
|
|
|
61
158
|
VALUE args[4] = {
|
|
62
159
|
type,
|
|
@@ -65,7 +162,7 @@ static VALUE rb_literal_node_from_c_struct(AST_LITERAL_NODE_T* literal_node) {
|
|
|
65
162
|
literal_node_content
|
|
66
163
|
};
|
|
67
164
|
|
|
68
|
-
return rb_class_new_instance(4, args,
|
|
165
|
+
return rb_class_new_instance(4, args, cLiteralNode);
|
|
69
166
|
};
|
|
70
167
|
|
|
71
168
|
static VALUE rb_html_open_tag_node_from_c_struct(AST_HTML_OPEN_TAG_NODE_T* html_open_tag_node) {
|
|
@@ -73,13 +170,7 @@ static VALUE rb_html_open_tag_node_from_c_struct(AST_HTML_OPEN_TAG_NODE_T* html_
|
|
|
73
170
|
|
|
74
171
|
AST_NODE_T* node = &html_open_tag_node->base;
|
|
75
172
|
|
|
76
|
-
VALUE
|
|
77
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
78
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
79
|
-
VALUE HTMLOpenTagNode = rb_define_class_under(AST, "HTMLOpenTagNode", Node);
|
|
80
|
-
|
|
81
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
82
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
173
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
83
174
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
84
175
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
85
176
|
|
|
@@ -100,7 +191,32 @@ static VALUE rb_html_open_tag_node_from_c_struct(AST_HTML_OPEN_TAG_NODE_T* html_
|
|
|
100
191
|
html_open_tag_node_is_void
|
|
101
192
|
};
|
|
102
193
|
|
|
103
|
-
return rb_class_new_instance(8, args,
|
|
194
|
+
return rb_class_new_instance(8, args, cHTMLOpenTagNode);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
static VALUE rb_html_conditional_open_tag_node_from_c_struct(AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T* html_conditional_open_tag_node) {
|
|
198
|
+
if (html_conditional_open_tag_node == NULL) { return Qnil; }
|
|
199
|
+
|
|
200
|
+
AST_NODE_T* node = &html_conditional_open_tag_node->base;
|
|
201
|
+
|
|
202
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
203
|
+
VALUE location = rb_location_from_c_struct(node->location);
|
|
204
|
+
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
205
|
+
|
|
206
|
+
VALUE html_conditional_open_tag_node_conditional = rb_node_from_c_struct((AST_NODE_T*) html_conditional_open_tag_node->conditional);
|
|
207
|
+
VALUE html_conditional_open_tag_node_tag_name = rb_token_from_c_struct(html_conditional_open_tag_node->tag_name);
|
|
208
|
+
VALUE html_conditional_open_tag_node_is_void = (html_conditional_open_tag_node->is_void) ? Qtrue : Qfalse;
|
|
209
|
+
|
|
210
|
+
VALUE args[6] = {
|
|
211
|
+
type,
|
|
212
|
+
location,
|
|
213
|
+
errors,
|
|
214
|
+
html_conditional_open_tag_node_conditional,
|
|
215
|
+
html_conditional_open_tag_node_tag_name,
|
|
216
|
+
html_conditional_open_tag_node_is_void
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
return rb_class_new_instance(6, args, cHTMLConditionalOpenTagNode);
|
|
104
220
|
};
|
|
105
221
|
|
|
106
222
|
static VALUE rb_html_close_tag_node_from_c_struct(AST_HTML_CLOSE_TAG_NODE_T* html_close_tag_node) {
|
|
@@ -108,13 +224,7 @@ static VALUE rb_html_close_tag_node_from_c_struct(AST_HTML_CLOSE_TAG_NODE_T* htm
|
|
|
108
224
|
|
|
109
225
|
AST_NODE_T* node = &html_close_tag_node->base;
|
|
110
226
|
|
|
111
|
-
VALUE
|
|
112
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
113
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
114
|
-
VALUE HTMLCloseTagNode = rb_define_class_under(AST, "HTMLCloseTagNode", Node);
|
|
115
|
-
|
|
116
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
117
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
227
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
118
228
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
119
229
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
120
230
|
|
|
@@ -133,7 +243,49 @@ static VALUE rb_html_close_tag_node_from_c_struct(AST_HTML_CLOSE_TAG_NODE_T* htm
|
|
|
133
243
|
html_close_tag_node_tag_closing
|
|
134
244
|
};
|
|
135
245
|
|
|
136
|
-
return rb_class_new_instance(7, args,
|
|
246
|
+
return rb_class_new_instance(7, args, cHTMLCloseTagNode);
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
static VALUE rb_html_omitted_close_tag_node_from_c_struct(AST_HTML_OMITTED_CLOSE_TAG_NODE_T* html_omitted_close_tag_node) {
|
|
250
|
+
if (html_omitted_close_tag_node == NULL) { return Qnil; }
|
|
251
|
+
|
|
252
|
+
AST_NODE_T* node = &html_omitted_close_tag_node->base;
|
|
253
|
+
|
|
254
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
255
|
+
VALUE location = rb_location_from_c_struct(node->location);
|
|
256
|
+
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
257
|
+
|
|
258
|
+
VALUE html_omitted_close_tag_node_tag_name = rb_token_from_c_struct(html_omitted_close_tag_node->tag_name);
|
|
259
|
+
|
|
260
|
+
VALUE args[4] = {
|
|
261
|
+
type,
|
|
262
|
+
location,
|
|
263
|
+
errors,
|
|
264
|
+
html_omitted_close_tag_node_tag_name
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
return rb_class_new_instance(4, args, cHTMLOmittedCloseTagNode);
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
static VALUE rb_html_virtual_close_tag_node_from_c_struct(AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T* html_virtual_close_tag_node) {
|
|
271
|
+
if (html_virtual_close_tag_node == NULL) { return Qnil; }
|
|
272
|
+
|
|
273
|
+
AST_NODE_T* node = &html_virtual_close_tag_node->base;
|
|
274
|
+
|
|
275
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
276
|
+
VALUE location = rb_location_from_c_struct(node->location);
|
|
277
|
+
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
278
|
+
|
|
279
|
+
VALUE html_virtual_close_tag_node_tag_name = rb_token_from_c_struct(html_virtual_close_tag_node->tag_name);
|
|
280
|
+
|
|
281
|
+
VALUE args[4] = {
|
|
282
|
+
type,
|
|
283
|
+
location,
|
|
284
|
+
errors,
|
|
285
|
+
html_virtual_close_tag_node_tag_name
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
return rb_class_new_instance(4, args, cHTMLVirtualCloseTagNode);
|
|
137
289
|
};
|
|
138
290
|
|
|
139
291
|
static VALUE rb_html_element_node_from_c_struct(AST_HTML_ELEMENT_NODE_T* html_element_node) {
|
|
@@ -141,13 +293,7 @@ static VALUE rb_html_element_node_from_c_struct(AST_HTML_ELEMENT_NODE_T* html_el
|
|
|
141
293
|
|
|
142
294
|
AST_NODE_T* node = &html_element_node->base;
|
|
143
295
|
|
|
144
|
-
VALUE
|
|
145
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
146
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
147
|
-
VALUE HTMLElementNode = rb_define_class_under(AST, "HTMLElementNode", Node);
|
|
148
|
-
|
|
149
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
150
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
296
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
151
297
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
152
298
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
153
299
|
|
|
@@ -156,11 +302,7 @@ static VALUE rb_html_element_node_from_c_struct(AST_HTML_ELEMENT_NODE_T* html_el
|
|
|
156
302
|
VALUE html_element_node_body = rb_nodes_array_from_c_array(html_element_node->body);
|
|
157
303
|
VALUE html_element_node_close_tag = rb_node_from_c_struct((AST_NODE_T*) html_element_node->close_tag);
|
|
158
304
|
VALUE html_element_node_is_void = (html_element_node->is_void) ? Qtrue : Qfalse;
|
|
159
|
-
VALUE
|
|
160
|
-
{
|
|
161
|
-
hb_string_T element_source_string = element_source_to_string(html_element_node->source);
|
|
162
|
-
html_element_node_source = rb_utf8_str_new(element_source_string.data, element_source_string.length);
|
|
163
|
-
}
|
|
305
|
+
VALUE html_element_node_element_source = rb_string_from_hb_string(html_element_node->element_source);
|
|
164
306
|
|
|
165
307
|
VALUE args[9] = {
|
|
166
308
|
type,
|
|
@@ -171,10 +313,45 @@ static VALUE rb_html_element_node_from_c_struct(AST_HTML_ELEMENT_NODE_T* html_el
|
|
|
171
313
|
html_element_node_body,
|
|
172
314
|
html_element_node_close_tag,
|
|
173
315
|
html_element_node_is_void,
|
|
174
|
-
|
|
316
|
+
html_element_node_element_source
|
|
175
317
|
};
|
|
176
318
|
|
|
177
|
-
return rb_class_new_instance(9, args,
|
|
319
|
+
return rb_class_new_instance(9, args, cHTMLElementNode);
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
static VALUE rb_html_conditional_element_node_from_c_struct(AST_HTML_CONDITIONAL_ELEMENT_NODE_T* html_conditional_element_node) {
|
|
323
|
+
if (html_conditional_element_node == NULL) { return Qnil; }
|
|
324
|
+
|
|
325
|
+
AST_NODE_T* node = &html_conditional_element_node->base;
|
|
326
|
+
|
|
327
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
328
|
+
VALUE location = rb_location_from_c_struct(node->location);
|
|
329
|
+
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
330
|
+
|
|
331
|
+
VALUE html_conditional_element_node_condition = rb_string_from_hb_string(html_conditional_element_node->condition);
|
|
332
|
+
VALUE html_conditional_element_node_open_conditional = rb_node_from_c_struct((AST_NODE_T*) html_conditional_element_node->open_conditional);
|
|
333
|
+
VALUE html_conditional_element_node_open_tag = rb_node_from_c_struct((AST_NODE_T*) html_conditional_element_node->open_tag);
|
|
334
|
+
VALUE html_conditional_element_node_body = rb_nodes_array_from_c_array(html_conditional_element_node->body);
|
|
335
|
+
VALUE html_conditional_element_node_close_tag = rb_node_from_c_struct((AST_NODE_T*) html_conditional_element_node->close_tag);
|
|
336
|
+
VALUE html_conditional_element_node_close_conditional = rb_node_from_c_struct((AST_NODE_T*) html_conditional_element_node->close_conditional);
|
|
337
|
+
VALUE html_conditional_element_node_tag_name = rb_token_from_c_struct(html_conditional_element_node->tag_name);
|
|
338
|
+
VALUE html_conditional_element_node_element_source = rb_string_from_hb_string(html_conditional_element_node->element_source);
|
|
339
|
+
|
|
340
|
+
VALUE args[11] = {
|
|
341
|
+
type,
|
|
342
|
+
location,
|
|
343
|
+
errors,
|
|
344
|
+
html_conditional_element_node_condition,
|
|
345
|
+
html_conditional_element_node_open_conditional,
|
|
346
|
+
html_conditional_element_node_open_tag,
|
|
347
|
+
html_conditional_element_node_body,
|
|
348
|
+
html_conditional_element_node_close_tag,
|
|
349
|
+
html_conditional_element_node_close_conditional,
|
|
350
|
+
html_conditional_element_node_tag_name,
|
|
351
|
+
html_conditional_element_node_element_source
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
return rb_class_new_instance(11, args, cHTMLConditionalElementNode);
|
|
178
355
|
};
|
|
179
356
|
|
|
180
357
|
static VALUE rb_html_attribute_value_node_from_c_struct(AST_HTML_ATTRIBUTE_VALUE_NODE_T* html_attribute_value_node) {
|
|
@@ -182,13 +359,7 @@ static VALUE rb_html_attribute_value_node_from_c_struct(AST_HTML_ATTRIBUTE_VALUE
|
|
|
182
359
|
|
|
183
360
|
AST_NODE_T* node = &html_attribute_value_node->base;
|
|
184
361
|
|
|
185
|
-
VALUE
|
|
186
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
187
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
188
|
-
VALUE HTMLAttributeValueNode = rb_define_class_under(AST, "HTMLAttributeValueNode", Node);
|
|
189
|
-
|
|
190
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
191
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
362
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
192
363
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
193
364
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
194
365
|
|
|
@@ -207,7 +378,7 @@ static VALUE rb_html_attribute_value_node_from_c_struct(AST_HTML_ATTRIBUTE_VALUE
|
|
|
207
378
|
html_attribute_value_node_quoted
|
|
208
379
|
};
|
|
209
380
|
|
|
210
|
-
return rb_class_new_instance(7, args,
|
|
381
|
+
return rb_class_new_instance(7, args, cHTMLAttributeValueNode);
|
|
211
382
|
};
|
|
212
383
|
|
|
213
384
|
static VALUE rb_html_attribute_name_node_from_c_struct(AST_HTML_ATTRIBUTE_NAME_NODE_T* html_attribute_name_node) {
|
|
@@ -215,13 +386,7 @@ static VALUE rb_html_attribute_name_node_from_c_struct(AST_HTML_ATTRIBUTE_NAME_N
|
|
|
215
386
|
|
|
216
387
|
AST_NODE_T* node = &html_attribute_name_node->base;
|
|
217
388
|
|
|
218
|
-
VALUE
|
|
219
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
220
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
221
|
-
VALUE HTMLAttributeNameNode = rb_define_class_under(AST, "HTMLAttributeNameNode", Node);
|
|
222
|
-
|
|
223
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
224
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
389
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
225
390
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
226
391
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
227
392
|
|
|
@@ -234,7 +399,7 @@ static VALUE rb_html_attribute_name_node_from_c_struct(AST_HTML_ATTRIBUTE_NAME_N
|
|
|
234
399
|
html_attribute_name_node_children
|
|
235
400
|
};
|
|
236
401
|
|
|
237
|
-
return rb_class_new_instance(4, args,
|
|
402
|
+
return rb_class_new_instance(4, args, cHTMLAttributeNameNode);
|
|
238
403
|
};
|
|
239
404
|
|
|
240
405
|
static VALUE rb_html_attribute_node_from_c_struct(AST_HTML_ATTRIBUTE_NODE_T* html_attribute_node) {
|
|
@@ -242,13 +407,7 @@ static VALUE rb_html_attribute_node_from_c_struct(AST_HTML_ATTRIBUTE_NODE_T* htm
|
|
|
242
407
|
|
|
243
408
|
AST_NODE_T* node = &html_attribute_node->base;
|
|
244
409
|
|
|
245
|
-
VALUE
|
|
246
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
247
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
248
|
-
VALUE HTMLAttributeNode = rb_define_class_under(AST, "HTMLAttributeNode", Node);
|
|
249
|
-
|
|
250
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
251
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
410
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
252
411
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
253
412
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
254
413
|
|
|
@@ -265,7 +424,80 @@ static VALUE rb_html_attribute_node_from_c_struct(AST_HTML_ATTRIBUTE_NODE_T* htm
|
|
|
265
424
|
html_attribute_node_value
|
|
266
425
|
};
|
|
267
426
|
|
|
268
|
-
return rb_class_new_instance(6, args,
|
|
427
|
+
return rb_class_new_instance(6, args, cHTMLAttributeNode);
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
static VALUE rb_ruby_literal_node_from_c_struct(AST_RUBY_LITERAL_NODE_T* ruby_literal_node) {
|
|
431
|
+
if (ruby_literal_node == NULL) { return Qnil; }
|
|
432
|
+
|
|
433
|
+
AST_NODE_T* node = &ruby_literal_node->base;
|
|
434
|
+
|
|
435
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
436
|
+
VALUE location = rb_location_from_c_struct(node->location);
|
|
437
|
+
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
438
|
+
|
|
439
|
+
VALUE ruby_literal_node_content = rb_string_from_hb_string(ruby_literal_node->content);
|
|
440
|
+
|
|
441
|
+
VALUE args[4] = {
|
|
442
|
+
type,
|
|
443
|
+
location,
|
|
444
|
+
errors,
|
|
445
|
+
ruby_literal_node_content
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
return rb_class_new_instance(4, args, cRubyLiteralNode);
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
static VALUE rb_ruby_html_attributes_splat_node_from_c_struct(AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T* ruby_html_attributes_splat_node) {
|
|
452
|
+
if (ruby_html_attributes_splat_node == NULL) { return Qnil; }
|
|
453
|
+
|
|
454
|
+
AST_NODE_T* node = &ruby_html_attributes_splat_node->base;
|
|
455
|
+
|
|
456
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
457
|
+
VALUE location = rb_location_from_c_struct(node->location);
|
|
458
|
+
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
459
|
+
|
|
460
|
+
VALUE ruby_html_attributes_splat_node_content = rb_string_from_hb_string(ruby_html_attributes_splat_node->content);
|
|
461
|
+
VALUE ruby_html_attributes_splat_node_prefix = rb_string_from_hb_string(ruby_html_attributes_splat_node->prefix);
|
|
462
|
+
|
|
463
|
+
VALUE args[5] = {
|
|
464
|
+
type,
|
|
465
|
+
location,
|
|
466
|
+
errors,
|
|
467
|
+
ruby_html_attributes_splat_node_content,
|
|
468
|
+
ruby_html_attributes_splat_node_prefix
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
return rb_class_new_instance(5, args, cRubyHTMLAttributesSplatNode);
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
static VALUE rb_erb_open_tag_node_from_c_struct(AST_ERB_OPEN_TAG_NODE_T* erb_open_tag_node) {
|
|
475
|
+
if (erb_open_tag_node == NULL) { return Qnil; }
|
|
476
|
+
|
|
477
|
+
AST_NODE_T* node = &erb_open_tag_node->base;
|
|
478
|
+
|
|
479
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
480
|
+
VALUE location = rb_location_from_c_struct(node->location);
|
|
481
|
+
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
482
|
+
|
|
483
|
+
VALUE erb_open_tag_node_tag_opening = rb_token_from_c_struct(erb_open_tag_node->tag_opening);
|
|
484
|
+
VALUE erb_open_tag_node_content = rb_token_from_c_struct(erb_open_tag_node->content);
|
|
485
|
+
VALUE erb_open_tag_node_tag_closing = rb_token_from_c_struct(erb_open_tag_node->tag_closing);
|
|
486
|
+
VALUE erb_open_tag_node_tag_name = rb_token_from_c_struct(erb_open_tag_node->tag_name);
|
|
487
|
+
VALUE erb_open_tag_node_children = rb_nodes_array_from_c_array(erb_open_tag_node->children);
|
|
488
|
+
|
|
489
|
+
VALUE args[8] = {
|
|
490
|
+
type,
|
|
491
|
+
location,
|
|
492
|
+
errors,
|
|
493
|
+
erb_open_tag_node_tag_opening,
|
|
494
|
+
erb_open_tag_node_content,
|
|
495
|
+
erb_open_tag_node_tag_closing,
|
|
496
|
+
erb_open_tag_node_tag_name,
|
|
497
|
+
erb_open_tag_node_children
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
return rb_class_new_instance(8, args, cERBOpenTagNode);
|
|
269
501
|
};
|
|
270
502
|
|
|
271
503
|
static VALUE rb_html_text_node_from_c_struct(AST_HTML_TEXT_NODE_T* html_text_node) {
|
|
@@ -273,17 +505,11 @@ static VALUE rb_html_text_node_from_c_struct(AST_HTML_TEXT_NODE_T* html_text_nod
|
|
|
273
505
|
|
|
274
506
|
AST_NODE_T* node = &html_text_node->base;
|
|
275
507
|
|
|
276
|
-
VALUE
|
|
277
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
278
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
279
|
-
VALUE HTMLTextNode = rb_define_class_under(AST, "HTMLTextNode", Node);
|
|
280
|
-
|
|
281
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
282
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
508
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
283
509
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
284
510
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
285
511
|
|
|
286
|
-
VALUE html_text_node_content =
|
|
512
|
+
VALUE html_text_node_content = rb_string_from_hb_string(html_text_node->content);
|
|
287
513
|
|
|
288
514
|
VALUE args[4] = {
|
|
289
515
|
type,
|
|
@@ -292,7 +518,7 @@ static VALUE rb_html_text_node_from_c_struct(AST_HTML_TEXT_NODE_T* html_text_nod
|
|
|
292
518
|
html_text_node_content
|
|
293
519
|
};
|
|
294
520
|
|
|
295
|
-
return rb_class_new_instance(4, args,
|
|
521
|
+
return rb_class_new_instance(4, args, cHTMLTextNode);
|
|
296
522
|
};
|
|
297
523
|
|
|
298
524
|
static VALUE rb_html_comment_node_from_c_struct(AST_HTML_COMMENT_NODE_T* html_comment_node) {
|
|
@@ -300,13 +526,7 @@ static VALUE rb_html_comment_node_from_c_struct(AST_HTML_COMMENT_NODE_T* html_co
|
|
|
300
526
|
|
|
301
527
|
AST_NODE_T* node = &html_comment_node->base;
|
|
302
528
|
|
|
303
|
-
VALUE
|
|
304
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
305
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
306
|
-
VALUE HTMLCommentNode = rb_define_class_under(AST, "HTMLCommentNode", Node);
|
|
307
|
-
|
|
308
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
309
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
529
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
310
530
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
311
531
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
312
532
|
|
|
@@ -323,7 +543,7 @@ static VALUE rb_html_comment_node_from_c_struct(AST_HTML_COMMENT_NODE_T* html_co
|
|
|
323
543
|
html_comment_node_comment_end
|
|
324
544
|
};
|
|
325
545
|
|
|
326
|
-
return rb_class_new_instance(6, args,
|
|
546
|
+
return rb_class_new_instance(6, args, cHTMLCommentNode);
|
|
327
547
|
};
|
|
328
548
|
|
|
329
549
|
static VALUE rb_html_doctype_node_from_c_struct(AST_HTML_DOCTYPE_NODE_T* html_doctype_node) {
|
|
@@ -331,13 +551,7 @@ static VALUE rb_html_doctype_node_from_c_struct(AST_HTML_DOCTYPE_NODE_T* html_do
|
|
|
331
551
|
|
|
332
552
|
AST_NODE_T* node = &html_doctype_node->base;
|
|
333
553
|
|
|
334
|
-
VALUE
|
|
335
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
336
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
337
|
-
VALUE HTMLDoctypeNode = rb_define_class_under(AST, "HTMLDoctypeNode", Node);
|
|
338
|
-
|
|
339
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
340
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
554
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
341
555
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
342
556
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
343
557
|
|
|
@@ -354,7 +568,7 @@ static VALUE rb_html_doctype_node_from_c_struct(AST_HTML_DOCTYPE_NODE_T* html_do
|
|
|
354
568
|
html_doctype_node_tag_closing
|
|
355
569
|
};
|
|
356
570
|
|
|
357
|
-
return rb_class_new_instance(6, args,
|
|
571
|
+
return rb_class_new_instance(6, args, cHTMLDoctypeNode);
|
|
358
572
|
};
|
|
359
573
|
|
|
360
574
|
static VALUE rb_xml_declaration_node_from_c_struct(AST_XML_DECLARATION_NODE_T* xml_declaration_node) {
|
|
@@ -362,13 +576,7 @@ static VALUE rb_xml_declaration_node_from_c_struct(AST_XML_DECLARATION_NODE_T* x
|
|
|
362
576
|
|
|
363
577
|
AST_NODE_T* node = &xml_declaration_node->base;
|
|
364
578
|
|
|
365
|
-
VALUE
|
|
366
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
367
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
368
|
-
VALUE XMLDeclarationNode = rb_define_class_under(AST, "XMLDeclarationNode", Node);
|
|
369
|
-
|
|
370
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
371
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
579
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
372
580
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
373
581
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
374
582
|
|
|
@@ -385,7 +593,7 @@ static VALUE rb_xml_declaration_node_from_c_struct(AST_XML_DECLARATION_NODE_T* x
|
|
|
385
593
|
xml_declaration_node_tag_closing
|
|
386
594
|
};
|
|
387
595
|
|
|
388
|
-
return rb_class_new_instance(6, args,
|
|
596
|
+
return rb_class_new_instance(6, args, cXMLDeclarationNode);
|
|
389
597
|
};
|
|
390
598
|
|
|
391
599
|
static VALUE rb_cdata_node_from_c_struct(AST_CDATA_NODE_T* cdata_node) {
|
|
@@ -393,13 +601,7 @@ static VALUE rb_cdata_node_from_c_struct(AST_CDATA_NODE_T* cdata_node) {
|
|
|
393
601
|
|
|
394
602
|
AST_NODE_T* node = &cdata_node->base;
|
|
395
603
|
|
|
396
|
-
VALUE
|
|
397
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
398
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
399
|
-
VALUE CDATANode = rb_define_class_under(AST, "CDATANode", Node);
|
|
400
|
-
|
|
401
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
402
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
604
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
403
605
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
404
606
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
405
607
|
|
|
@@ -416,7 +618,7 @@ static VALUE rb_cdata_node_from_c_struct(AST_CDATA_NODE_T* cdata_node) {
|
|
|
416
618
|
cdata_node_tag_closing
|
|
417
619
|
};
|
|
418
620
|
|
|
419
|
-
return rb_class_new_instance(6, args,
|
|
621
|
+
return rb_class_new_instance(6, args, cCDATANode);
|
|
420
622
|
};
|
|
421
623
|
|
|
422
624
|
static VALUE rb_whitespace_node_from_c_struct(AST_WHITESPACE_NODE_T* whitespace_node) {
|
|
@@ -424,13 +626,7 @@ static VALUE rb_whitespace_node_from_c_struct(AST_WHITESPACE_NODE_T* whitespace_
|
|
|
424
626
|
|
|
425
627
|
AST_NODE_T* node = &whitespace_node->base;
|
|
426
628
|
|
|
427
|
-
VALUE
|
|
428
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
429
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
430
|
-
VALUE WhitespaceNode = rb_define_class_under(AST, "WhitespaceNode", Node);
|
|
431
|
-
|
|
432
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
433
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
629
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
434
630
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
435
631
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
436
632
|
|
|
@@ -443,7 +639,7 @@ static VALUE rb_whitespace_node_from_c_struct(AST_WHITESPACE_NODE_T* whitespace_
|
|
|
443
639
|
whitespace_node_value
|
|
444
640
|
};
|
|
445
641
|
|
|
446
|
-
return rb_class_new_instance(4, args,
|
|
642
|
+
return rb_class_new_instance(4, args, cWhitespaceNode);
|
|
447
643
|
};
|
|
448
644
|
|
|
449
645
|
static VALUE rb_erb_content_node_from_c_struct(AST_ERB_CONTENT_NODE_T* erb_content_node) {
|
|
@@ -451,25 +647,35 @@ static VALUE rb_erb_content_node_from_c_struct(AST_ERB_CONTENT_NODE_T* erb_conte
|
|
|
451
647
|
|
|
452
648
|
AST_NODE_T* node = &erb_content_node->base;
|
|
453
649
|
|
|
454
|
-
VALUE
|
|
455
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
456
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
457
|
-
VALUE ERBContentNode = rb_define_class_under(AST, "ERBContentNode", Node);
|
|
458
|
-
|
|
459
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
460
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
650
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
461
651
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
462
652
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
463
653
|
|
|
464
654
|
VALUE erb_content_node_tag_opening = rb_token_from_c_struct(erb_content_node->tag_opening);
|
|
465
655
|
VALUE erb_content_node_content = rb_token_from_c_struct(erb_content_node->content);
|
|
466
656
|
VALUE erb_content_node_tag_closing = rb_token_from_c_struct(erb_content_node->tag_closing);
|
|
467
|
-
/*
|
|
657
|
+
/* analyzed_ruby is internal parser state, not exposed to Ruby */
|
|
468
658
|
VALUE erb_content_node_analyzed_ruby = Qnil;
|
|
469
659
|
VALUE erb_content_node_parsed = (erb_content_node->parsed) ? Qtrue : Qfalse;
|
|
470
660
|
VALUE erb_content_node_valid = (erb_content_node->valid) ? Qtrue : Qfalse;
|
|
661
|
+
VALUE erb_content_node_prism_node;
|
|
662
|
+
if (erb_content_node->prism_node.node != NULL && erb_content_node->prism_node.parser != NULL) {
|
|
663
|
+
pm_buffer_t pm_buffer = { 0 };
|
|
664
|
+
pm_serialize(erb_content_node->prism_node.parser, erb_content_node->prism_node.node, &pm_buffer);
|
|
665
|
+
|
|
666
|
+
if (pm_buffer.length > 0) {
|
|
667
|
+
erb_content_node_prism_node = rb_str_new(pm_buffer.value, pm_buffer.length);
|
|
668
|
+
rb_enc_associate(erb_content_node_prism_node, rb_ascii8bit_encoding());
|
|
669
|
+
OBJ_FREEZE(erb_content_node_prism_node);
|
|
670
|
+
} else {
|
|
671
|
+
erb_content_node_prism_node = Qnil;
|
|
672
|
+
}
|
|
673
|
+
pm_buffer_free(&pm_buffer);
|
|
674
|
+
} else {
|
|
675
|
+
erb_content_node_prism_node = Qnil;
|
|
676
|
+
}
|
|
471
677
|
|
|
472
|
-
VALUE args[
|
|
678
|
+
VALUE args[10] = {
|
|
473
679
|
type,
|
|
474
680
|
location,
|
|
475
681
|
errors,
|
|
@@ -478,10 +684,11 @@ static VALUE rb_erb_content_node_from_c_struct(AST_ERB_CONTENT_NODE_T* erb_conte
|
|
|
478
684
|
erb_content_node_tag_closing,
|
|
479
685
|
erb_content_node_analyzed_ruby,
|
|
480
686
|
erb_content_node_parsed,
|
|
481
|
-
erb_content_node_valid
|
|
687
|
+
erb_content_node_valid,
|
|
688
|
+
erb_content_node_prism_node
|
|
482
689
|
};
|
|
483
690
|
|
|
484
|
-
return rb_class_new_instance(
|
|
691
|
+
return rb_class_new_instance(10, args, cERBContentNode);
|
|
485
692
|
};
|
|
486
693
|
|
|
487
694
|
static VALUE rb_erb_end_node_from_c_struct(AST_ERB_END_NODE_T* erb_end_node) {
|
|
@@ -489,13 +696,7 @@ static VALUE rb_erb_end_node_from_c_struct(AST_ERB_END_NODE_T* erb_end_node) {
|
|
|
489
696
|
|
|
490
697
|
AST_NODE_T* node = &erb_end_node->base;
|
|
491
698
|
|
|
492
|
-
VALUE
|
|
493
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
494
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
495
|
-
VALUE ERBEndNode = rb_define_class_under(AST, "ERBEndNode", Node);
|
|
496
|
-
|
|
497
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
498
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
699
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
499
700
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
500
701
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
501
702
|
|
|
@@ -512,7 +713,7 @@ static VALUE rb_erb_end_node_from_c_struct(AST_ERB_END_NODE_T* erb_end_node) {
|
|
|
512
713
|
erb_end_node_tag_closing
|
|
513
714
|
};
|
|
514
715
|
|
|
515
|
-
return rb_class_new_instance(6, args,
|
|
716
|
+
return rb_class_new_instance(6, args, cERBEndNode);
|
|
516
717
|
};
|
|
517
718
|
|
|
518
719
|
static VALUE rb_erb_else_node_from_c_struct(AST_ERB_ELSE_NODE_T* erb_else_node) {
|
|
@@ -520,13 +721,7 @@ static VALUE rb_erb_else_node_from_c_struct(AST_ERB_ELSE_NODE_T* erb_else_node)
|
|
|
520
721
|
|
|
521
722
|
AST_NODE_T* node = &erb_else_node->base;
|
|
522
723
|
|
|
523
|
-
VALUE
|
|
524
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
525
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
526
|
-
VALUE ERBElseNode = rb_define_class_under(AST, "ERBElseNode", Node);
|
|
527
|
-
|
|
528
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
529
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
724
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
530
725
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
531
726
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
532
727
|
|
|
@@ -545,7 +740,7 @@ static VALUE rb_erb_else_node_from_c_struct(AST_ERB_ELSE_NODE_T* erb_else_node)
|
|
|
545
740
|
erb_else_node_statements
|
|
546
741
|
};
|
|
547
742
|
|
|
548
|
-
return rb_class_new_instance(7, args,
|
|
743
|
+
return rb_class_new_instance(7, args, cERBElseNode);
|
|
549
744
|
};
|
|
550
745
|
|
|
551
746
|
static VALUE rb_erb_if_node_from_c_struct(AST_ERB_IF_NODE_T* erb_if_node) {
|
|
@@ -553,13 +748,7 @@ static VALUE rb_erb_if_node_from_c_struct(AST_ERB_IF_NODE_T* erb_if_node) {
|
|
|
553
748
|
|
|
554
749
|
AST_NODE_T* node = &erb_if_node->base;
|
|
555
750
|
|
|
556
|
-
VALUE
|
|
557
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
558
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
559
|
-
VALUE ERBIfNode = rb_define_class_under(AST, "ERBIfNode", Node);
|
|
560
|
-
|
|
561
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
562
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
751
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
563
752
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
564
753
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
565
754
|
|
|
@@ -567,11 +756,27 @@ static VALUE rb_erb_if_node_from_c_struct(AST_ERB_IF_NODE_T* erb_if_node) {
|
|
|
567
756
|
VALUE erb_if_node_content = rb_token_from_c_struct(erb_if_node->content);
|
|
568
757
|
VALUE erb_if_node_tag_closing = rb_token_from_c_struct(erb_if_node->tag_closing);
|
|
569
758
|
VALUE erb_if_node_then_keyword = (erb_if_node->then_keyword != NULL) ? rb_location_from_c_struct(*erb_if_node->then_keyword) : Qnil;
|
|
759
|
+
VALUE erb_if_node_prism_node;
|
|
760
|
+
if (erb_if_node->prism_node.node != NULL && erb_if_node->prism_node.parser != NULL) {
|
|
761
|
+
pm_buffer_t pm_buffer = { 0 };
|
|
762
|
+
pm_serialize(erb_if_node->prism_node.parser, erb_if_node->prism_node.node, &pm_buffer);
|
|
763
|
+
|
|
764
|
+
if (pm_buffer.length > 0) {
|
|
765
|
+
erb_if_node_prism_node = rb_str_new(pm_buffer.value, pm_buffer.length);
|
|
766
|
+
rb_enc_associate(erb_if_node_prism_node, rb_ascii8bit_encoding());
|
|
767
|
+
OBJ_FREEZE(erb_if_node_prism_node);
|
|
768
|
+
} else {
|
|
769
|
+
erb_if_node_prism_node = Qnil;
|
|
770
|
+
}
|
|
771
|
+
pm_buffer_free(&pm_buffer);
|
|
772
|
+
} else {
|
|
773
|
+
erb_if_node_prism_node = Qnil;
|
|
774
|
+
}
|
|
570
775
|
VALUE erb_if_node_statements = rb_nodes_array_from_c_array(erb_if_node->statements);
|
|
571
776
|
VALUE erb_if_node_subsequent = rb_node_from_c_struct((AST_NODE_T*) erb_if_node->subsequent);
|
|
572
777
|
VALUE erb_if_node_end_node = rb_node_from_c_struct((AST_NODE_T*) erb_if_node->end_node);
|
|
573
778
|
|
|
574
|
-
VALUE args[
|
|
779
|
+
VALUE args[11] = {
|
|
575
780
|
type,
|
|
576
781
|
location,
|
|
577
782
|
errors,
|
|
@@ -579,12 +784,13 @@ static VALUE rb_erb_if_node_from_c_struct(AST_ERB_IF_NODE_T* erb_if_node) {
|
|
|
579
784
|
erb_if_node_content,
|
|
580
785
|
erb_if_node_tag_closing,
|
|
581
786
|
erb_if_node_then_keyword,
|
|
787
|
+
erb_if_node_prism_node,
|
|
582
788
|
erb_if_node_statements,
|
|
583
789
|
erb_if_node_subsequent,
|
|
584
790
|
erb_if_node_end_node
|
|
585
791
|
};
|
|
586
792
|
|
|
587
|
-
return rb_class_new_instance(
|
|
793
|
+
return rb_class_new_instance(11, args, cERBIfNode);
|
|
588
794
|
};
|
|
589
795
|
|
|
590
796
|
static VALUE rb_erb_block_node_from_c_struct(AST_ERB_BLOCK_NODE_T* erb_block_node) {
|
|
@@ -592,34 +798,45 @@ static VALUE rb_erb_block_node_from_c_struct(AST_ERB_BLOCK_NODE_T* erb_block_nod
|
|
|
592
798
|
|
|
593
799
|
AST_NODE_T* node = &erb_block_node->base;
|
|
594
800
|
|
|
595
|
-
VALUE
|
|
596
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
597
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
598
|
-
VALUE ERBBlockNode = rb_define_class_under(AST, "ERBBlockNode", Node);
|
|
599
|
-
|
|
600
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
601
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
801
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
602
802
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
603
803
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
604
804
|
|
|
605
805
|
VALUE erb_block_node_tag_opening = rb_token_from_c_struct(erb_block_node->tag_opening);
|
|
606
806
|
VALUE erb_block_node_content = rb_token_from_c_struct(erb_block_node->content);
|
|
607
807
|
VALUE erb_block_node_tag_closing = rb_token_from_c_struct(erb_block_node->tag_closing);
|
|
808
|
+
VALUE erb_block_node_prism_node;
|
|
809
|
+
if (erb_block_node->prism_node.node != NULL && erb_block_node->prism_node.parser != NULL) {
|
|
810
|
+
pm_buffer_t pm_buffer = { 0 };
|
|
811
|
+
pm_serialize(erb_block_node->prism_node.parser, erb_block_node->prism_node.node, &pm_buffer);
|
|
812
|
+
|
|
813
|
+
if (pm_buffer.length > 0) {
|
|
814
|
+
erb_block_node_prism_node = rb_str_new(pm_buffer.value, pm_buffer.length);
|
|
815
|
+
rb_enc_associate(erb_block_node_prism_node, rb_ascii8bit_encoding());
|
|
816
|
+
OBJ_FREEZE(erb_block_node_prism_node);
|
|
817
|
+
} else {
|
|
818
|
+
erb_block_node_prism_node = Qnil;
|
|
819
|
+
}
|
|
820
|
+
pm_buffer_free(&pm_buffer);
|
|
821
|
+
} else {
|
|
822
|
+
erb_block_node_prism_node = Qnil;
|
|
823
|
+
}
|
|
608
824
|
VALUE erb_block_node_body = rb_nodes_array_from_c_array(erb_block_node->body);
|
|
609
825
|
VALUE erb_block_node_end_node = rb_node_from_c_struct((AST_NODE_T*) erb_block_node->end_node);
|
|
610
826
|
|
|
611
|
-
VALUE args[
|
|
827
|
+
VALUE args[9] = {
|
|
612
828
|
type,
|
|
613
829
|
location,
|
|
614
830
|
errors,
|
|
615
831
|
erb_block_node_tag_opening,
|
|
616
832
|
erb_block_node_content,
|
|
617
833
|
erb_block_node_tag_closing,
|
|
834
|
+
erb_block_node_prism_node,
|
|
618
835
|
erb_block_node_body,
|
|
619
836
|
erb_block_node_end_node
|
|
620
837
|
};
|
|
621
838
|
|
|
622
|
-
return rb_class_new_instance(
|
|
839
|
+
return rb_class_new_instance(9, args, cERBBlockNode);
|
|
623
840
|
};
|
|
624
841
|
|
|
625
842
|
static VALUE rb_erb_when_node_from_c_struct(AST_ERB_WHEN_NODE_T* erb_when_node) {
|
|
@@ -627,13 +844,7 @@ static VALUE rb_erb_when_node_from_c_struct(AST_ERB_WHEN_NODE_T* erb_when_node)
|
|
|
627
844
|
|
|
628
845
|
AST_NODE_T* node = &erb_when_node->base;
|
|
629
846
|
|
|
630
|
-
VALUE
|
|
631
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
632
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
633
|
-
VALUE ERBWhenNode = rb_define_class_under(AST, "ERBWhenNode", Node);
|
|
634
|
-
|
|
635
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
636
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
847
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
637
848
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
638
849
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
639
850
|
|
|
@@ -654,7 +865,7 @@ static VALUE rb_erb_when_node_from_c_struct(AST_ERB_WHEN_NODE_T* erb_when_node)
|
|
|
654
865
|
erb_when_node_statements
|
|
655
866
|
};
|
|
656
867
|
|
|
657
|
-
return rb_class_new_instance(8, args,
|
|
868
|
+
return rb_class_new_instance(8, args, cERBWhenNode);
|
|
658
869
|
};
|
|
659
870
|
|
|
660
871
|
static VALUE rb_erb_case_node_from_c_struct(AST_ERB_CASE_NODE_T* erb_case_node) {
|
|
@@ -662,13 +873,7 @@ static VALUE rb_erb_case_node_from_c_struct(AST_ERB_CASE_NODE_T* erb_case_node)
|
|
|
662
873
|
|
|
663
874
|
AST_NODE_T* node = &erb_case_node->base;
|
|
664
875
|
|
|
665
|
-
VALUE
|
|
666
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
667
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
668
|
-
VALUE ERBCaseNode = rb_define_class_under(AST, "ERBCaseNode", Node);
|
|
669
|
-
|
|
670
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
671
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
876
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
672
877
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
673
878
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
674
879
|
|
|
@@ -676,11 +881,27 @@ static VALUE rb_erb_case_node_from_c_struct(AST_ERB_CASE_NODE_T* erb_case_node)
|
|
|
676
881
|
VALUE erb_case_node_content = rb_token_from_c_struct(erb_case_node->content);
|
|
677
882
|
VALUE erb_case_node_tag_closing = rb_token_from_c_struct(erb_case_node->tag_closing);
|
|
678
883
|
VALUE erb_case_node_children = rb_nodes_array_from_c_array(erb_case_node->children);
|
|
884
|
+
VALUE erb_case_node_prism_node;
|
|
885
|
+
if (erb_case_node->prism_node.node != NULL && erb_case_node->prism_node.parser != NULL) {
|
|
886
|
+
pm_buffer_t pm_buffer = { 0 };
|
|
887
|
+
pm_serialize(erb_case_node->prism_node.parser, erb_case_node->prism_node.node, &pm_buffer);
|
|
888
|
+
|
|
889
|
+
if (pm_buffer.length > 0) {
|
|
890
|
+
erb_case_node_prism_node = rb_str_new(pm_buffer.value, pm_buffer.length);
|
|
891
|
+
rb_enc_associate(erb_case_node_prism_node, rb_ascii8bit_encoding());
|
|
892
|
+
OBJ_FREEZE(erb_case_node_prism_node);
|
|
893
|
+
} else {
|
|
894
|
+
erb_case_node_prism_node = Qnil;
|
|
895
|
+
}
|
|
896
|
+
pm_buffer_free(&pm_buffer);
|
|
897
|
+
} else {
|
|
898
|
+
erb_case_node_prism_node = Qnil;
|
|
899
|
+
}
|
|
679
900
|
VALUE erb_case_node_conditions = rb_nodes_array_from_c_array(erb_case_node->conditions);
|
|
680
901
|
VALUE erb_case_node_else_clause = rb_node_from_c_struct((AST_NODE_T*) erb_case_node->else_clause);
|
|
681
902
|
VALUE erb_case_node_end_node = rb_node_from_c_struct((AST_NODE_T*) erb_case_node->end_node);
|
|
682
903
|
|
|
683
|
-
VALUE args[
|
|
904
|
+
VALUE args[11] = {
|
|
684
905
|
type,
|
|
685
906
|
location,
|
|
686
907
|
errors,
|
|
@@ -688,12 +909,13 @@ static VALUE rb_erb_case_node_from_c_struct(AST_ERB_CASE_NODE_T* erb_case_node)
|
|
|
688
909
|
erb_case_node_content,
|
|
689
910
|
erb_case_node_tag_closing,
|
|
690
911
|
erb_case_node_children,
|
|
912
|
+
erb_case_node_prism_node,
|
|
691
913
|
erb_case_node_conditions,
|
|
692
914
|
erb_case_node_else_clause,
|
|
693
915
|
erb_case_node_end_node
|
|
694
916
|
};
|
|
695
917
|
|
|
696
|
-
return rb_class_new_instance(
|
|
918
|
+
return rb_class_new_instance(11, args, cERBCaseNode);
|
|
697
919
|
};
|
|
698
920
|
|
|
699
921
|
static VALUE rb_erb_case_match_node_from_c_struct(AST_ERB_CASE_MATCH_NODE_T* erb_case_match_node) {
|
|
@@ -701,13 +923,7 @@ static VALUE rb_erb_case_match_node_from_c_struct(AST_ERB_CASE_MATCH_NODE_T* erb
|
|
|
701
923
|
|
|
702
924
|
AST_NODE_T* node = &erb_case_match_node->base;
|
|
703
925
|
|
|
704
|
-
VALUE
|
|
705
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
706
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
707
|
-
VALUE ERBCaseMatchNode = rb_define_class_under(AST, "ERBCaseMatchNode", Node);
|
|
708
|
-
|
|
709
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
710
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
926
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
711
927
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
712
928
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
713
929
|
|
|
@@ -715,11 +931,27 @@ static VALUE rb_erb_case_match_node_from_c_struct(AST_ERB_CASE_MATCH_NODE_T* erb
|
|
|
715
931
|
VALUE erb_case_match_node_content = rb_token_from_c_struct(erb_case_match_node->content);
|
|
716
932
|
VALUE erb_case_match_node_tag_closing = rb_token_from_c_struct(erb_case_match_node->tag_closing);
|
|
717
933
|
VALUE erb_case_match_node_children = rb_nodes_array_from_c_array(erb_case_match_node->children);
|
|
934
|
+
VALUE erb_case_match_node_prism_node;
|
|
935
|
+
if (erb_case_match_node->prism_node.node != NULL && erb_case_match_node->prism_node.parser != NULL) {
|
|
936
|
+
pm_buffer_t pm_buffer = { 0 };
|
|
937
|
+
pm_serialize(erb_case_match_node->prism_node.parser, erb_case_match_node->prism_node.node, &pm_buffer);
|
|
938
|
+
|
|
939
|
+
if (pm_buffer.length > 0) {
|
|
940
|
+
erb_case_match_node_prism_node = rb_str_new(pm_buffer.value, pm_buffer.length);
|
|
941
|
+
rb_enc_associate(erb_case_match_node_prism_node, rb_ascii8bit_encoding());
|
|
942
|
+
OBJ_FREEZE(erb_case_match_node_prism_node);
|
|
943
|
+
} else {
|
|
944
|
+
erb_case_match_node_prism_node = Qnil;
|
|
945
|
+
}
|
|
946
|
+
pm_buffer_free(&pm_buffer);
|
|
947
|
+
} else {
|
|
948
|
+
erb_case_match_node_prism_node = Qnil;
|
|
949
|
+
}
|
|
718
950
|
VALUE erb_case_match_node_conditions = rb_nodes_array_from_c_array(erb_case_match_node->conditions);
|
|
719
951
|
VALUE erb_case_match_node_else_clause = rb_node_from_c_struct((AST_NODE_T*) erb_case_match_node->else_clause);
|
|
720
952
|
VALUE erb_case_match_node_end_node = rb_node_from_c_struct((AST_NODE_T*) erb_case_match_node->end_node);
|
|
721
953
|
|
|
722
|
-
VALUE args[
|
|
954
|
+
VALUE args[11] = {
|
|
723
955
|
type,
|
|
724
956
|
location,
|
|
725
957
|
errors,
|
|
@@ -727,12 +959,13 @@ static VALUE rb_erb_case_match_node_from_c_struct(AST_ERB_CASE_MATCH_NODE_T* erb
|
|
|
727
959
|
erb_case_match_node_content,
|
|
728
960
|
erb_case_match_node_tag_closing,
|
|
729
961
|
erb_case_match_node_children,
|
|
962
|
+
erb_case_match_node_prism_node,
|
|
730
963
|
erb_case_match_node_conditions,
|
|
731
964
|
erb_case_match_node_else_clause,
|
|
732
965
|
erb_case_match_node_end_node
|
|
733
966
|
};
|
|
734
967
|
|
|
735
|
-
return rb_class_new_instance(
|
|
968
|
+
return rb_class_new_instance(11, args, cERBCaseMatchNode);
|
|
736
969
|
};
|
|
737
970
|
|
|
738
971
|
static VALUE rb_erb_while_node_from_c_struct(AST_ERB_WHILE_NODE_T* erb_while_node) {
|
|
@@ -740,34 +973,45 @@ static VALUE rb_erb_while_node_from_c_struct(AST_ERB_WHILE_NODE_T* erb_while_nod
|
|
|
740
973
|
|
|
741
974
|
AST_NODE_T* node = &erb_while_node->base;
|
|
742
975
|
|
|
743
|
-
VALUE
|
|
744
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
745
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
746
|
-
VALUE ERBWhileNode = rb_define_class_under(AST, "ERBWhileNode", Node);
|
|
747
|
-
|
|
748
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
749
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
976
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
750
977
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
751
978
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
752
979
|
|
|
753
980
|
VALUE erb_while_node_tag_opening = rb_token_from_c_struct(erb_while_node->tag_opening);
|
|
754
981
|
VALUE erb_while_node_content = rb_token_from_c_struct(erb_while_node->content);
|
|
755
982
|
VALUE erb_while_node_tag_closing = rb_token_from_c_struct(erb_while_node->tag_closing);
|
|
983
|
+
VALUE erb_while_node_prism_node;
|
|
984
|
+
if (erb_while_node->prism_node.node != NULL && erb_while_node->prism_node.parser != NULL) {
|
|
985
|
+
pm_buffer_t pm_buffer = { 0 };
|
|
986
|
+
pm_serialize(erb_while_node->prism_node.parser, erb_while_node->prism_node.node, &pm_buffer);
|
|
987
|
+
|
|
988
|
+
if (pm_buffer.length > 0) {
|
|
989
|
+
erb_while_node_prism_node = rb_str_new(pm_buffer.value, pm_buffer.length);
|
|
990
|
+
rb_enc_associate(erb_while_node_prism_node, rb_ascii8bit_encoding());
|
|
991
|
+
OBJ_FREEZE(erb_while_node_prism_node);
|
|
992
|
+
} else {
|
|
993
|
+
erb_while_node_prism_node = Qnil;
|
|
994
|
+
}
|
|
995
|
+
pm_buffer_free(&pm_buffer);
|
|
996
|
+
} else {
|
|
997
|
+
erb_while_node_prism_node = Qnil;
|
|
998
|
+
}
|
|
756
999
|
VALUE erb_while_node_statements = rb_nodes_array_from_c_array(erb_while_node->statements);
|
|
757
1000
|
VALUE erb_while_node_end_node = rb_node_from_c_struct((AST_NODE_T*) erb_while_node->end_node);
|
|
758
1001
|
|
|
759
|
-
VALUE args[
|
|
1002
|
+
VALUE args[9] = {
|
|
760
1003
|
type,
|
|
761
1004
|
location,
|
|
762
1005
|
errors,
|
|
763
1006
|
erb_while_node_tag_opening,
|
|
764
1007
|
erb_while_node_content,
|
|
765
1008
|
erb_while_node_tag_closing,
|
|
1009
|
+
erb_while_node_prism_node,
|
|
766
1010
|
erb_while_node_statements,
|
|
767
1011
|
erb_while_node_end_node
|
|
768
1012
|
};
|
|
769
1013
|
|
|
770
|
-
return rb_class_new_instance(
|
|
1014
|
+
return rb_class_new_instance(9, args, cERBWhileNode);
|
|
771
1015
|
};
|
|
772
1016
|
|
|
773
1017
|
static VALUE rb_erb_until_node_from_c_struct(AST_ERB_UNTIL_NODE_T* erb_until_node) {
|
|
@@ -775,34 +1019,45 @@ static VALUE rb_erb_until_node_from_c_struct(AST_ERB_UNTIL_NODE_T* erb_until_nod
|
|
|
775
1019
|
|
|
776
1020
|
AST_NODE_T* node = &erb_until_node->base;
|
|
777
1021
|
|
|
778
|
-
VALUE
|
|
779
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
780
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
781
|
-
VALUE ERBUntilNode = rb_define_class_under(AST, "ERBUntilNode", Node);
|
|
782
|
-
|
|
783
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
784
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
1022
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
785
1023
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
786
1024
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
787
1025
|
|
|
788
1026
|
VALUE erb_until_node_tag_opening = rb_token_from_c_struct(erb_until_node->tag_opening);
|
|
789
1027
|
VALUE erb_until_node_content = rb_token_from_c_struct(erb_until_node->content);
|
|
790
1028
|
VALUE erb_until_node_tag_closing = rb_token_from_c_struct(erb_until_node->tag_closing);
|
|
1029
|
+
VALUE erb_until_node_prism_node;
|
|
1030
|
+
if (erb_until_node->prism_node.node != NULL && erb_until_node->prism_node.parser != NULL) {
|
|
1031
|
+
pm_buffer_t pm_buffer = { 0 };
|
|
1032
|
+
pm_serialize(erb_until_node->prism_node.parser, erb_until_node->prism_node.node, &pm_buffer);
|
|
1033
|
+
|
|
1034
|
+
if (pm_buffer.length > 0) {
|
|
1035
|
+
erb_until_node_prism_node = rb_str_new(pm_buffer.value, pm_buffer.length);
|
|
1036
|
+
rb_enc_associate(erb_until_node_prism_node, rb_ascii8bit_encoding());
|
|
1037
|
+
OBJ_FREEZE(erb_until_node_prism_node);
|
|
1038
|
+
} else {
|
|
1039
|
+
erb_until_node_prism_node = Qnil;
|
|
1040
|
+
}
|
|
1041
|
+
pm_buffer_free(&pm_buffer);
|
|
1042
|
+
} else {
|
|
1043
|
+
erb_until_node_prism_node = Qnil;
|
|
1044
|
+
}
|
|
791
1045
|
VALUE erb_until_node_statements = rb_nodes_array_from_c_array(erb_until_node->statements);
|
|
792
1046
|
VALUE erb_until_node_end_node = rb_node_from_c_struct((AST_NODE_T*) erb_until_node->end_node);
|
|
793
1047
|
|
|
794
|
-
VALUE args[
|
|
1048
|
+
VALUE args[9] = {
|
|
795
1049
|
type,
|
|
796
1050
|
location,
|
|
797
1051
|
errors,
|
|
798
1052
|
erb_until_node_tag_opening,
|
|
799
1053
|
erb_until_node_content,
|
|
800
1054
|
erb_until_node_tag_closing,
|
|
1055
|
+
erb_until_node_prism_node,
|
|
801
1056
|
erb_until_node_statements,
|
|
802
1057
|
erb_until_node_end_node
|
|
803
1058
|
};
|
|
804
1059
|
|
|
805
|
-
return rb_class_new_instance(
|
|
1060
|
+
return rb_class_new_instance(9, args, cERBUntilNode);
|
|
806
1061
|
};
|
|
807
1062
|
|
|
808
1063
|
static VALUE rb_erb_for_node_from_c_struct(AST_ERB_FOR_NODE_T* erb_for_node) {
|
|
@@ -810,34 +1065,45 @@ static VALUE rb_erb_for_node_from_c_struct(AST_ERB_FOR_NODE_T* erb_for_node) {
|
|
|
810
1065
|
|
|
811
1066
|
AST_NODE_T* node = &erb_for_node->base;
|
|
812
1067
|
|
|
813
|
-
VALUE
|
|
814
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
815
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
816
|
-
VALUE ERBForNode = rb_define_class_under(AST, "ERBForNode", Node);
|
|
817
|
-
|
|
818
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
819
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
1068
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
820
1069
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
821
1070
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
822
1071
|
|
|
823
1072
|
VALUE erb_for_node_tag_opening = rb_token_from_c_struct(erb_for_node->tag_opening);
|
|
824
1073
|
VALUE erb_for_node_content = rb_token_from_c_struct(erb_for_node->content);
|
|
825
1074
|
VALUE erb_for_node_tag_closing = rb_token_from_c_struct(erb_for_node->tag_closing);
|
|
1075
|
+
VALUE erb_for_node_prism_node;
|
|
1076
|
+
if (erb_for_node->prism_node.node != NULL && erb_for_node->prism_node.parser != NULL) {
|
|
1077
|
+
pm_buffer_t pm_buffer = { 0 };
|
|
1078
|
+
pm_serialize(erb_for_node->prism_node.parser, erb_for_node->prism_node.node, &pm_buffer);
|
|
1079
|
+
|
|
1080
|
+
if (pm_buffer.length > 0) {
|
|
1081
|
+
erb_for_node_prism_node = rb_str_new(pm_buffer.value, pm_buffer.length);
|
|
1082
|
+
rb_enc_associate(erb_for_node_prism_node, rb_ascii8bit_encoding());
|
|
1083
|
+
OBJ_FREEZE(erb_for_node_prism_node);
|
|
1084
|
+
} else {
|
|
1085
|
+
erb_for_node_prism_node = Qnil;
|
|
1086
|
+
}
|
|
1087
|
+
pm_buffer_free(&pm_buffer);
|
|
1088
|
+
} else {
|
|
1089
|
+
erb_for_node_prism_node = Qnil;
|
|
1090
|
+
}
|
|
826
1091
|
VALUE erb_for_node_statements = rb_nodes_array_from_c_array(erb_for_node->statements);
|
|
827
1092
|
VALUE erb_for_node_end_node = rb_node_from_c_struct((AST_NODE_T*) erb_for_node->end_node);
|
|
828
1093
|
|
|
829
|
-
VALUE args[
|
|
1094
|
+
VALUE args[9] = {
|
|
830
1095
|
type,
|
|
831
1096
|
location,
|
|
832
1097
|
errors,
|
|
833
1098
|
erb_for_node_tag_opening,
|
|
834
1099
|
erb_for_node_content,
|
|
835
1100
|
erb_for_node_tag_closing,
|
|
1101
|
+
erb_for_node_prism_node,
|
|
836
1102
|
erb_for_node_statements,
|
|
837
1103
|
erb_for_node_end_node
|
|
838
1104
|
};
|
|
839
1105
|
|
|
840
|
-
return rb_class_new_instance(
|
|
1106
|
+
return rb_class_new_instance(9, args, cERBForNode);
|
|
841
1107
|
};
|
|
842
1108
|
|
|
843
1109
|
static VALUE rb_erb_rescue_node_from_c_struct(AST_ERB_RESCUE_NODE_T* erb_rescue_node) {
|
|
@@ -845,13 +1111,7 @@ static VALUE rb_erb_rescue_node_from_c_struct(AST_ERB_RESCUE_NODE_T* erb_rescue_
|
|
|
845
1111
|
|
|
846
1112
|
AST_NODE_T* node = &erb_rescue_node->base;
|
|
847
1113
|
|
|
848
|
-
VALUE
|
|
849
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
850
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
851
|
-
VALUE ERBRescueNode = rb_define_class_under(AST, "ERBRescueNode", Node);
|
|
852
|
-
|
|
853
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
854
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
1114
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
855
1115
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
856
1116
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
857
1117
|
|
|
@@ -872,7 +1132,7 @@ static VALUE rb_erb_rescue_node_from_c_struct(AST_ERB_RESCUE_NODE_T* erb_rescue_
|
|
|
872
1132
|
erb_rescue_node_subsequent
|
|
873
1133
|
};
|
|
874
1134
|
|
|
875
|
-
return rb_class_new_instance(8, args,
|
|
1135
|
+
return rb_class_new_instance(8, args, cERBRescueNode);
|
|
876
1136
|
};
|
|
877
1137
|
|
|
878
1138
|
static VALUE rb_erb_ensure_node_from_c_struct(AST_ERB_ENSURE_NODE_T* erb_ensure_node) {
|
|
@@ -880,13 +1140,7 @@ static VALUE rb_erb_ensure_node_from_c_struct(AST_ERB_ENSURE_NODE_T* erb_ensure_
|
|
|
880
1140
|
|
|
881
1141
|
AST_NODE_T* node = &erb_ensure_node->base;
|
|
882
1142
|
|
|
883
|
-
VALUE
|
|
884
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
885
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
886
|
-
VALUE ERBEnsureNode = rb_define_class_under(AST, "ERBEnsureNode", Node);
|
|
887
|
-
|
|
888
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
889
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
1143
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
890
1144
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
891
1145
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
892
1146
|
|
|
@@ -905,7 +1159,7 @@ static VALUE rb_erb_ensure_node_from_c_struct(AST_ERB_ENSURE_NODE_T* erb_ensure_
|
|
|
905
1159
|
erb_ensure_node_statements
|
|
906
1160
|
};
|
|
907
1161
|
|
|
908
|
-
return rb_class_new_instance(7, args,
|
|
1162
|
+
return rb_class_new_instance(7, args, cERBEnsureNode);
|
|
909
1163
|
};
|
|
910
1164
|
|
|
911
1165
|
static VALUE rb_erb_begin_node_from_c_struct(AST_ERB_BEGIN_NODE_T* erb_begin_node) {
|
|
@@ -913,32 +1167,43 @@ static VALUE rb_erb_begin_node_from_c_struct(AST_ERB_BEGIN_NODE_T* erb_begin_nod
|
|
|
913
1167
|
|
|
914
1168
|
AST_NODE_T* node = &erb_begin_node->base;
|
|
915
1169
|
|
|
916
|
-
VALUE
|
|
917
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
918
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
919
|
-
VALUE ERBBeginNode = rb_define_class_under(AST, "ERBBeginNode", Node);
|
|
920
|
-
|
|
921
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
922
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
1170
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
923
1171
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
924
1172
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
925
1173
|
|
|
926
1174
|
VALUE erb_begin_node_tag_opening = rb_token_from_c_struct(erb_begin_node->tag_opening);
|
|
927
1175
|
VALUE erb_begin_node_content = rb_token_from_c_struct(erb_begin_node->content);
|
|
928
1176
|
VALUE erb_begin_node_tag_closing = rb_token_from_c_struct(erb_begin_node->tag_closing);
|
|
1177
|
+
VALUE erb_begin_node_prism_node;
|
|
1178
|
+
if (erb_begin_node->prism_node.node != NULL && erb_begin_node->prism_node.parser != NULL) {
|
|
1179
|
+
pm_buffer_t pm_buffer = { 0 };
|
|
1180
|
+
pm_serialize(erb_begin_node->prism_node.parser, erb_begin_node->prism_node.node, &pm_buffer);
|
|
1181
|
+
|
|
1182
|
+
if (pm_buffer.length > 0) {
|
|
1183
|
+
erb_begin_node_prism_node = rb_str_new(pm_buffer.value, pm_buffer.length);
|
|
1184
|
+
rb_enc_associate(erb_begin_node_prism_node, rb_ascii8bit_encoding());
|
|
1185
|
+
OBJ_FREEZE(erb_begin_node_prism_node);
|
|
1186
|
+
} else {
|
|
1187
|
+
erb_begin_node_prism_node = Qnil;
|
|
1188
|
+
}
|
|
1189
|
+
pm_buffer_free(&pm_buffer);
|
|
1190
|
+
} else {
|
|
1191
|
+
erb_begin_node_prism_node = Qnil;
|
|
1192
|
+
}
|
|
929
1193
|
VALUE erb_begin_node_statements = rb_nodes_array_from_c_array(erb_begin_node->statements);
|
|
930
1194
|
VALUE erb_begin_node_rescue_clause = rb_node_from_c_struct((AST_NODE_T*) erb_begin_node->rescue_clause);
|
|
931
1195
|
VALUE erb_begin_node_else_clause = rb_node_from_c_struct((AST_NODE_T*) erb_begin_node->else_clause);
|
|
932
1196
|
VALUE erb_begin_node_ensure_clause = rb_node_from_c_struct((AST_NODE_T*) erb_begin_node->ensure_clause);
|
|
933
1197
|
VALUE erb_begin_node_end_node = rb_node_from_c_struct((AST_NODE_T*) erb_begin_node->end_node);
|
|
934
1198
|
|
|
935
|
-
VALUE args[
|
|
1199
|
+
VALUE args[12] = {
|
|
936
1200
|
type,
|
|
937
1201
|
location,
|
|
938
1202
|
errors,
|
|
939
1203
|
erb_begin_node_tag_opening,
|
|
940
1204
|
erb_begin_node_content,
|
|
941
1205
|
erb_begin_node_tag_closing,
|
|
1206
|
+
erb_begin_node_prism_node,
|
|
942
1207
|
erb_begin_node_statements,
|
|
943
1208
|
erb_begin_node_rescue_clause,
|
|
944
1209
|
erb_begin_node_else_clause,
|
|
@@ -946,7 +1211,7 @@ static VALUE rb_erb_begin_node_from_c_struct(AST_ERB_BEGIN_NODE_T* erb_begin_nod
|
|
|
946
1211
|
erb_begin_node_end_node
|
|
947
1212
|
};
|
|
948
1213
|
|
|
949
|
-
return rb_class_new_instance(
|
|
1214
|
+
return rb_class_new_instance(12, args, cERBBeginNode);
|
|
950
1215
|
};
|
|
951
1216
|
|
|
952
1217
|
static VALUE rb_erb_unless_node_from_c_struct(AST_ERB_UNLESS_NODE_T* erb_unless_node) {
|
|
@@ -954,13 +1219,7 @@ static VALUE rb_erb_unless_node_from_c_struct(AST_ERB_UNLESS_NODE_T* erb_unless_
|
|
|
954
1219
|
|
|
955
1220
|
AST_NODE_T* node = &erb_unless_node->base;
|
|
956
1221
|
|
|
957
|
-
VALUE
|
|
958
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
959
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
960
|
-
VALUE ERBUnlessNode = rb_define_class_under(AST, "ERBUnlessNode", Node);
|
|
961
|
-
|
|
962
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
963
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
1222
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
964
1223
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
965
1224
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
966
1225
|
|
|
@@ -968,11 +1227,27 @@ static VALUE rb_erb_unless_node_from_c_struct(AST_ERB_UNLESS_NODE_T* erb_unless_
|
|
|
968
1227
|
VALUE erb_unless_node_content = rb_token_from_c_struct(erb_unless_node->content);
|
|
969
1228
|
VALUE erb_unless_node_tag_closing = rb_token_from_c_struct(erb_unless_node->tag_closing);
|
|
970
1229
|
VALUE erb_unless_node_then_keyword = (erb_unless_node->then_keyword != NULL) ? rb_location_from_c_struct(*erb_unless_node->then_keyword) : Qnil;
|
|
1230
|
+
VALUE erb_unless_node_prism_node;
|
|
1231
|
+
if (erb_unless_node->prism_node.node != NULL && erb_unless_node->prism_node.parser != NULL) {
|
|
1232
|
+
pm_buffer_t pm_buffer = { 0 };
|
|
1233
|
+
pm_serialize(erb_unless_node->prism_node.parser, erb_unless_node->prism_node.node, &pm_buffer);
|
|
1234
|
+
|
|
1235
|
+
if (pm_buffer.length > 0) {
|
|
1236
|
+
erb_unless_node_prism_node = rb_str_new(pm_buffer.value, pm_buffer.length);
|
|
1237
|
+
rb_enc_associate(erb_unless_node_prism_node, rb_ascii8bit_encoding());
|
|
1238
|
+
OBJ_FREEZE(erb_unless_node_prism_node);
|
|
1239
|
+
} else {
|
|
1240
|
+
erb_unless_node_prism_node = Qnil;
|
|
1241
|
+
}
|
|
1242
|
+
pm_buffer_free(&pm_buffer);
|
|
1243
|
+
} else {
|
|
1244
|
+
erb_unless_node_prism_node = Qnil;
|
|
1245
|
+
}
|
|
971
1246
|
VALUE erb_unless_node_statements = rb_nodes_array_from_c_array(erb_unless_node->statements);
|
|
972
1247
|
VALUE erb_unless_node_else_clause = rb_node_from_c_struct((AST_NODE_T*) erb_unless_node->else_clause);
|
|
973
1248
|
VALUE erb_unless_node_end_node = rb_node_from_c_struct((AST_NODE_T*) erb_unless_node->end_node);
|
|
974
1249
|
|
|
975
|
-
VALUE args[
|
|
1250
|
+
VALUE args[11] = {
|
|
976
1251
|
type,
|
|
977
1252
|
location,
|
|
978
1253
|
errors,
|
|
@@ -980,12 +1255,117 @@ static VALUE rb_erb_unless_node_from_c_struct(AST_ERB_UNLESS_NODE_T* erb_unless_
|
|
|
980
1255
|
erb_unless_node_content,
|
|
981
1256
|
erb_unless_node_tag_closing,
|
|
982
1257
|
erb_unless_node_then_keyword,
|
|
1258
|
+
erb_unless_node_prism_node,
|
|
983
1259
|
erb_unless_node_statements,
|
|
984
1260
|
erb_unless_node_else_clause,
|
|
985
1261
|
erb_unless_node_end_node
|
|
986
1262
|
};
|
|
987
1263
|
|
|
988
|
-
return rb_class_new_instance(
|
|
1264
|
+
return rb_class_new_instance(11, args, cERBUnlessNode);
|
|
1265
|
+
};
|
|
1266
|
+
|
|
1267
|
+
static VALUE rb_ruby_render_local_node_from_c_struct(AST_RUBY_RENDER_LOCAL_NODE_T* ruby_render_local_node) {
|
|
1268
|
+
if (ruby_render_local_node == NULL) { return Qnil; }
|
|
1269
|
+
|
|
1270
|
+
AST_NODE_T* node = &ruby_render_local_node->base;
|
|
1271
|
+
|
|
1272
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
1273
|
+
VALUE location = rb_location_from_c_struct(node->location);
|
|
1274
|
+
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
1275
|
+
|
|
1276
|
+
VALUE ruby_render_local_node_name = rb_token_from_c_struct(ruby_render_local_node->name);
|
|
1277
|
+
VALUE ruby_render_local_node_value = rb_node_from_c_struct((AST_NODE_T*) ruby_render_local_node->value);
|
|
1278
|
+
|
|
1279
|
+
VALUE args[5] = {
|
|
1280
|
+
type,
|
|
1281
|
+
location,
|
|
1282
|
+
errors,
|
|
1283
|
+
ruby_render_local_node_name,
|
|
1284
|
+
ruby_render_local_node_value
|
|
1285
|
+
};
|
|
1286
|
+
|
|
1287
|
+
return rb_class_new_instance(5, args, cRubyRenderLocalNode);
|
|
1288
|
+
};
|
|
1289
|
+
|
|
1290
|
+
static VALUE rb_erb_render_node_from_c_struct(AST_ERB_RENDER_NODE_T* erb_render_node) {
|
|
1291
|
+
if (erb_render_node == NULL) { return Qnil; }
|
|
1292
|
+
|
|
1293
|
+
AST_NODE_T* node = &erb_render_node->base;
|
|
1294
|
+
|
|
1295
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
1296
|
+
VALUE location = rb_location_from_c_struct(node->location);
|
|
1297
|
+
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
1298
|
+
|
|
1299
|
+
VALUE erb_render_node_tag_opening = rb_token_from_c_struct(erb_render_node->tag_opening);
|
|
1300
|
+
VALUE erb_render_node_content = rb_token_from_c_struct(erb_render_node->content);
|
|
1301
|
+
VALUE erb_render_node_tag_closing = rb_token_from_c_struct(erb_render_node->tag_closing);
|
|
1302
|
+
/* analyzed_ruby is internal parser state, not exposed to Ruby */
|
|
1303
|
+
VALUE erb_render_node_analyzed_ruby = Qnil;
|
|
1304
|
+
VALUE erb_render_node_prism_node;
|
|
1305
|
+
if (erb_render_node->prism_node.node != NULL && erb_render_node->prism_node.parser != NULL) {
|
|
1306
|
+
pm_buffer_t pm_buffer = { 0 };
|
|
1307
|
+
pm_serialize(erb_render_node->prism_node.parser, erb_render_node->prism_node.node, &pm_buffer);
|
|
1308
|
+
|
|
1309
|
+
if (pm_buffer.length > 0) {
|
|
1310
|
+
erb_render_node_prism_node = rb_str_new(pm_buffer.value, pm_buffer.length);
|
|
1311
|
+
rb_enc_associate(erb_render_node_prism_node, rb_ascii8bit_encoding());
|
|
1312
|
+
OBJ_FREEZE(erb_render_node_prism_node);
|
|
1313
|
+
} else {
|
|
1314
|
+
erb_render_node_prism_node = Qnil;
|
|
1315
|
+
}
|
|
1316
|
+
pm_buffer_free(&pm_buffer);
|
|
1317
|
+
} else {
|
|
1318
|
+
erb_render_node_prism_node = Qnil;
|
|
1319
|
+
}
|
|
1320
|
+
VALUE erb_render_node_partial = rb_token_from_c_struct(erb_render_node->partial);
|
|
1321
|
+
VALUE erb_render_node_template_path = rb_token_from_c_struct(erb_render_node->template_path);
|
|
1322
|
+
VALUE erb_render_node_layout = rb_token_from_c_struct(erb_render_node->layout);
|
|
1323
|
+
VALUE erb_render_node_file = rb_token_from_c_struct(erb_render_node->file);
|
|
1324
|
+
VALUE erb_render_node_inline_template = rb_token_from_c_struct(erb_render_node->inline_template);
|
|
1325
|
+
VALUE erb_render_node_body = rb_token_from_c_struct(erb_render_node->body);
|
|
1326
|
+
VALUE erb_render_node_plain = rb_token_from_c_struct(erb_render_node->plain);
|
|
1327
|
+
VALUE erb_render_node_html = rb_token_from_c_struct(erb_render_node->html);
|
|
1328
|
+
VALUE erb_render_node_renderable = rb_token_from_c_struct(erb_render_node->renderable);
|
|
1329
|
+
VALUE erb_render_node_collection = rb_token_from_c_struct(erb_render_node->collection);
|
|
1330
|
+
VALUE erb_render_node_object = rb_token_from_c_struct(erb_render_node->object);
|
|
1331
|
+
VALUE erb_render_node_as_name = rb_token_from_c_struct(erb_render_node->as_name);
|
|
1332
|
+
VALUE erb_render_node_spacer_template = rb_token_from_c_struct(erb_render_node->spacer_template);
|
|
1333
|
+
VALUE erb_render_node_formats = rb_token_from_c_struct(erb_render_node->formats);
|
|
1334
|
+
VALUE erb_render_node_variants = rb_token_from_c_struct(erb_render_node->variants);
|
|
1335
|
+
VALUE erb_render_node_handlers = rb_token_from_c_struct(erb_render_node->handlers);
|
|
1336
|
+
VALUE erb_render_node_content_type = rb_token_from_c_struct(erb_render_node->content_type);
|
|
1337
|
+
VALUE erb_render_node_locals = rb_nodes_array_from_c_array(erb_render_node->locals);
|
|
1338
|
+
|
|
1339
|
+
VALUE args[26] = {
|
|
1340
|
+
type,
|
|
1341
|
+
location,
|
|
1342
|
+
errors,
|
|
1343
|
+
erb_render_node_tag_opening,
|
|
1344
|
+
erb_render_node_content,
|
|
1345
|
+
erb_render_node_tag_closing,
|
|
1346
|
+
erb_render_node_analyzed_ruby,
|
|
1347
|
+
erb_render_node_prism_node,
|
|
1348
|
+
erb_render_node_partial,
|
|
1349
|
+
erb_render_node_template_path,
|
|
1350
|
+
erb_render_node_layout,
|
|
1351
|
+
erb_render_node_file,
|
|
1352
|
+
erb_render_node_inline_template,
|
|
1353
|
+
erb_render_node_body,
|
|
1354
|
+
erb_render_node_plain,
|
|
1355
|
+
erb_render_node_html,
|
|
1356
|
+
erb_render_node_renderable,
|
|
1357
|
+
erb_render_node_collection,
|
|
1358
|
+
erb_render_node_object,
|
|
1359
|
+
erb_render_node_as_name,
|
|
1360
|
+
erb_render_node_spacer_template,
|
|
1361
|
+
erb_render_node_formats,
|
|
1362
|
+
erb_render_node_variants,
|
|
1363
|
+
erb_render_node_handlers,
|
|
1364
|
+
erb_render_node_content_type,
|
|
1365
|
+
erb_render_node_locals
|
|
1366
|
+
};
|
|
1367
|
+
|
|
1368
|
+
return rb_class_new_instance(26, args, cERBRenderNode);
|
|
989
1369
|
};
|
|
990
1370
|
|
|
991
1371
|
static VALUE rb_erb_yield_node_from_c_struct(AST_ERB_YIELD_NODE_T* erb_yield_node) {
|
|
@@ -993,13 +1373,7 @@ static VALUE rb_erb_yield_node_from_c_struct(AST_ERB_YIELD_NODE_T* erb_yield_nod
|
|
|
993
1373
|
|
|
994
1374
|
AST_NODE_T* node = &erb_yield_node->base;
|
|
995
1375
|
|
|
996
|
-
VALUE
|
|
997
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
998
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
999
|
-
VALUE ERBYieldNode = rb_define_class_under(AST, "ERBYieldNode", Node);
|
|
1000
|
-
|
|
1001
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
1002
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
1376
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
1003
1377
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
1004
1378
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
1005
1379
|
|
|
@@ -1016,7 +1390,7 @@ static VALUE rb_erb_yield_node_from_c_struct(AST_ERB_YIELD_NODE_T* erb_yield_nod
|
|
|
1016
1390
|
erb_yield_node_tag_closing
|
|
1017
1391
|
};
|
|
1018
1392
|
|
|
1019
|
-
return rb_class_new_instance(6, args,
|
|
1393
|
+
return rb_class_new_instance(6, args, cERBYieldNode);
|
|
1020
1394
|
};
|
|
1021
1395
|
|
|
1022
1396
|
static VALUE rb_erb_in_node_from_c_struct(AST_ERB_IN_NODE_T* erb_in_node) {
|
|
@@ -1024,13 +1398,7 @@ static VALUE rb_erb_in_node_from_c_struct(AST_ERB_IN_NODE_T* erb_in_node) {
|
|
|
1024
1398
|
|
|
1025
1399
|
AST_NODE_T* node = &erb_in_node->base;
|
|
1026
1400
|
|
|
1027
|
-
VALUE
|
|
1028
|
-
VALUE AST = rb_define_module_under(Herb, "AST");
|
|
1029
|
-
VALUE Node = rb_define_class_under(AST, "Node", rb_cObject);
|
|
1030
|
-
VALUE ERBInNode = rb_define_class_under(AST, "ERBInNode", Node);
|
|
1031
|
-
|
|
1032
|
-
hb_string_T node_type = ast_node_type_to_string(node);
|
|
1033
|
-
VALUE type = rb_utf8_str_new(node_type.data, node_type.length);
|
|
1401
|
+
VALUE type = rb_string_from_hb_string(ast_node_type_to_string(node));
|
|
1034
1402
|
VALUE location = rb_location_from_c_struct(node->location);
|
|
1035
1403
|
VALUE errors = rb_errors_array_from_c_array(node->errors);
|
|
1036
1404
|
|
|
@@ -1051,7 +1419,7 @@ static VALUE rb_erb_in_node_from_c_struct(AST_ERB_IN_NODE_T* erb_in_node) {
|
|
|
1051
1419
|
erb_in_node_statements
|
|
1052
1420
|
};
|
|
1053
1421
|
|
|
1054
|
-
return rb_class_new_instance(8, args,
|
|
1422
|
+
return rb_class_new_instance(8, args, cERBInNode);
|
|
1055
1423
|
};
|
|
1056
1424
|
|
|
1057
1425
|
|
|
@@ -1062,11 +1430,18 @@ VALUE rb_node_from_c_struct(AST_NODE_T* node) {
|
|
|
1062
1430
|
case AST_DOCUMENT_NODE: return rb_document_node_from_c_struct((AST_DOCUMENT_NODE_T*) node); break;
|
|
1063
1431
|
case AST_LITERAL_NODE: return rb_literal_node_from_c_struct((AST_LITERAL_NODE_T*) node); break;
|
|
1064
1432
|
case AST_HTML_OPEN_TAG_NODE: return rb_html_open_tag_node_from_c_struct((AST_HTML_OPEN_TAG_NODE_T*) node); break;
|
|
1433
|
+
case AST_HTML_CONDITIONAL_OPEN_TAG_NODE: return rb_html_conditional_open_tag_node_from_c_struct((AST_HTML_CONDITIONAL_OPEN_TAG_NODE_T*) node); break;
|
|
1065
1434
|
case AST_HTML_CLOSE_TAG_NODE: return rb_html_close_tag_node_from_c_struct((AST_HTML_CLOSE_TAG_NODE_T*) node); break;
|
|
1435
|
+
case AST_HTML_OMITTED_CLOSE_TAG_NODE: return rb_html_omitted_close_tag_node_from_c_struct((AST_HTML_OMITTED_CLOSE_TAG_NODE_T*) node); break;
|
|
1436
|
+
case AST_HTML_VIRTUAL_CLOSE_TAG_NODE: return rb_html_virtual_close_tag_node_from_c_struct((AST_HTML_VIRTUAL_CLOSE_TAG_NODE_T*) node); break;
|
|
1066
1437
|
case AST_HTML_ELEMENT_NODE: return rb_html_element_node_from_c_struct((AST_HTML_ELEMENT_NODE_T*) node); break;
|
|
1438
|
+
case AST_HTML_CONDITIONAL_ELEMENT_NODE: return rb_html_conditional_element_node_from_c_struct((AST_HTML_CONDITIONAL_ELEMENT_NODE_T*) node); break;
|
|
1067
1439
|
case AST_HTML_ATTRIBUTE_VALUE_NODE: return rb_html_attribute_value_node_from_c_struct((AST_HTML_ATTRIBUTE_VALUE_NODE_T*) node); break;
|
|
1068
1440
|
case AST_HTML_ATTRIBUTE_NAME_NODE: return rb_html_attribute_name_node_from_c_struct((AST_HTML_ATTRIBUTE_NAME_NODE_T*) node); break;
|
|
1069
1441
|
case AST_HTML_ATTRIBUTE_NODE: return rb_html_attribute_node_from_c_struct((AST_HTML_ATTRIBUTE_NODE_T*) node); break;
|
|
1442
|
+
case AST_RUBY_LITERAL_NODE: return rb_ruby_literal_node_from_c_struct((AST_RUBY_LITERAL_NODE_T*) node); break;
|
|
1443
|
+
case AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE: return rb_ruby_html_attributes_splat_node_from_c_struct((AST_RUBY_HTML_ATTRIBUTES_SPLAT_NODE_T*) node); break;
|
|
1444
|
+
case AST_ERB_OPEN_TAG_NODE: return rb_erb_open_tag_node_from_c_struct((AST_ERB_OPEN_TAG_NODE_T*) node); break;
|
|
1070
1445
|
case AST_HTML_TEXT_NODE: return rb_html_text_node_from_c_struct((AST_HTML_TEXT_NODE_T*) node); break;
|
|
1071
1446
|
case AST_HTML_COMMENT_NODE: return rb_html_comment_node_from_c_struct((AST_HTML_COMMENT_NODE_T*) node); break;
|
|
1072
1447
|
case AST_HTML_DOCTYPE_NODE: return rb_html_doctype_node_from_c_struct((AST_HTML_DOCTYPE_NODE_T*) node); break;
|
|
@@ -1088,6 +1463,8 @@ VALUE rb_node_from_c_struct(AST_NODE_T* node) {
|
|
|
1088
1463
|
case AST_ERB_ENSURE_NODE: return rb_erb_ensure_node_from_c_struct((AST_ERB_ENSURE_NODE_T*) node); break;
|
|
1089
1464
|
case AST_ERB_BEGIN_NODE: return rb_erb_begin_node_from_c_struct((AST_ERB_BEGIN_NODE_T*) node); break;
|
|
1090
1465
|
case AST_ERB_UNLESS_NODE: return rb_erb_unless_node_from_c_struct((AST_ERB_UNLESS_NODE_T*) node); break;
|
|
1466
|
+
case AST_RUBY_RENDER_LOCAL_NODE: return rb_ruby_render_local_node_from_c_struct((AST_RUBY_RENDER_LOCAL_NODE_T*) node); break;
|
|
1467
|
+
case AST_ERB_RENDER_NODE: return rb_erb_render_node_from_c_struct((AST_ERB_RENDER_NODE_T*) node); break;
|
|
1091
1468
|
case AST_ERB_YIELD_NODE: return rb_erb_yield_node_from_c_struct((AST_ERB_YIELD_NODE_T*) node); break;
|
|
1092
1469
|
case AST_ERB_IN_NODE: return rb_erb_in_node_from_c_struct((AST_ERB_IN_NODE_T*) node); break;
|
|
1093
1470
|
}
|