herb 0.6.1-x86-linux-musl → 0.7.0-x86-linux-musl
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/README.md +1 -0
- data/ext/herb/nodes.c +6 -4
- 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/ast/helpers.rb +26 -0
- data/lib/herb/ast/nodes.rb +7 -3
- data/lib/herb/cli.rb +158 -1
- data/lib/herb/engine/compiler.rb +399 -0
- data/lib/herb/engine/debug_visitor.rb +321 -0
- data/lib/herb/engine/error_formatter.rb +420 -0
- data/lib/herb/engine/parser_error_overlay.rb +767 -0
- data/lib/herb/engine/validation_error_overlay.rb +182 -0
- data/lib/herb/engine/validation_errors.rb +65 -0
- data/lib/herb/engine/validator.rb +75 -0
- data/lib/herb/engine/validators/accessibility_validator.rb +31 -0
- data/lib/herb/engine/validators/nesting_validator.rb +95 -0
- data/lib/herb/engine/validators/security_validator.rb +71 -0
- data/lib/herb/engine.rb +366 -0
- data/lib/herb/project.rb +3 -3
- data/lib/herb/version.rb +1 -1
- data/lib/herb/visitor.rb +2 -0
- data/lib/herb.rb +2 -0
- data/sig/herb/ast/helpers.rbs +16 -0
- data/sig/herb/ast/nodes.rbs +4 -2
- data/sig/herb/engine/compiler.rbs +109 -0
- data/sig/herb/engine/debug.rbs +38 -0
- data/sig/herb/engine/debug_visitor.rbs +70 -0
- data/sig/herb/engine/error_formatter.rbs +47 -0
- data/sig/herb/engine/parser_error_overlay.rbs +41 -0
- data/sig/herb/engine/validation_error_overlay.rbs +35 -0
- data/sig/herb/engine/validation_errors.rbs +45 -0
- data/sig/herb/engine/validator.rbs +37 -0
- data/sig/herb/engine/validators/accessibility_validator.rbs +19 -0
- data/sig/herb/engine/validators/nesting_validator.rbs +25 -0
- data/sig/herb/engine/validators/security_validator.rbs +23 -0
- data/sig/herb/engine.rbs +72 -0
- data/sig/herb/visitor.rbs +2 -0
- data/sig/herb_c_extension.rbs +7 -0
- data/sig/serialized_ast_nodes.rbs +1 -0
- data/src/ast_nodes.c +2 -1
- data/src/ast_pretty_print.c +2 -1
- data/src/element_source.c +11 -0
- data/src/include/ast_nodes.h +3 -1
- data/src/include/element_source.h +13 -0
- data/src/include/version.h +1 -1
- data/src/parser.c +3 -0
- data/src/parser_helpers.c +1 -0
- metadata +30 -2
@@ -0,0 +1,47 @@
|
|
1
|
+
# Generated from lib/herb/engine/error_formatter.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Herb
|
4
|
+
class Engine
|
5
|
+
class ErrorFormatter
|
6
|
+
CONTEXT_LINES: ::Integer
|
7
|
+
|
8
|
+
def initialize: (untyped source, untyped errors, ?untyped options) -> untyped
|
9
|
+
|
10
|
+
def format_all: () -> untyped
|
11
|
+
|
12
|
+
def format_all_with_highlighter: () -> untyped
|
13
|
+
|
14
|
+
def format_all_without_highlighter: () -> untyped
|
15
|
+
|
16
|
+
def format_error: (untyped error, untyped number) -> untyped
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def format_source_context: (untyped error) -> untyped
|
21
|
+
|
22
|
+
def format_error_details: (untyped error) -> untyped
|
23
|
+
|
24
|
+
def inline_hint?: (untyped error) -> untyped
|
25
|
+
|
26
|
+
def format_inline_hint: (untyped error) -> untyped
|
27
|
+
|
28
|
+
def find_highlighter_path: () -> untyped
|
29
|
+
|
30
|
+
def can_use_highlighter?: () -> untyped
|
31
|
+
|
32
|
+
def run_highlighter: (untyped file_path, untyped line_num, untyped context_lines) -> untyped
|
33
|
+
|
34
|
+
def run_highlighter_with_diagnostics: (untyped file_path, ?untyped context_lines) -> untyped
|
35
|
+
|
36
|
+
def herb_error_to_diagnostic: (untyped error) -> untyped
|
37
|
+
|
38
|
+
def format_error_header: (untyped error, untyped number) -> untyped
|
39
|
+
|
40
|
+
def format_suggestions: (untyped errors) -> untyped
|
41
|
+
|
42
|
+
def format_source_context_basic: (untyped error) -> untyped
|
43
|
+
|
44
|
+
def get_error_suggestion: (untyped error) -> untyped
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Generated from lib/herb/engine/parser_error_overlay.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Herb
|
4
|
+
class Engine
|
5
|
+
class ParserErrorOverlay
|
6
|
+
CONTEXT_LINES: ::Integer
|
7
|
+
|
8
|
+
ERROR_CLASS_PRIORITRY: untyped
|
9
|
+
|
10
|
+
def initialize: (untyped source, untyped errors, ?filename: untyped) -> untyped
|
11
|
+
|
12
|
+
def generate_html: () -> untyped
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def generate_error_sections: () -> untyped
|
17
|
+
|
18
|
+
def generate_code_section: (untyped error, untyped index) -> untyped
|
19
|
+
|
20
|
+
def generate_code_lines: (untyped error, untyped line_num, untyped col_num) -> untyped
|
21
|
+
|
22
|
+
def generate_suggestions_section: (untyped suggestions) -> untyped
|
23
|
+
|
24
|
+
def syntax_highlight: (untyped code) -> untyped
|
25
|
+
|
26
|
+
def highlight_with_tokens: (untyped tokens, untyped code) -> untyped
|
27
|
+
|
28
|
+
def get_character_offset: (untyped code, untyped line, untyped column) -> untyped
|
29
|
+
|
30
|
+
def update_highlighting_state: (untyped state, untyped token, untyped token_text, untyped _next_token, untyped _prev_token) -> untyped
|
31
|
+
|
32
|
+
def get_token_css_class: (untyped state, untyped token, untyped token_text) -> untyped
|
33
|
+
|
34
|
+
def get_error_suggestion: (untyped error) -> untyped
|
35
|
+
|
36
|
+
def get_inline_hint: (untyped error) -> untyped
|
37
|
+
|
38
|
+
def escape_html: (untyped text) -> untyped
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Generated from lib/herb/engine/validation_error_overlay.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Herb
|
4
|
+
class Engine
|
5
|
+
class ValidationErrorOverlay
|
6
|
+
CONTEXT_LINES: ::Integer
|
7
|
+
|
8
|
+
VALIDATOR_BADGES: untyped
|
9
|
+
|
10
|
+
SEVERITY_COLORS: untyped
|
11
|
+
|
12
|
+
def initialize: (untyped source, untyped error, ?filename: untyped) -> untyped
|
13
|
+
|
14
|
+
def generate_fragment: () -> untyped
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def generate_code_snippet: (untyped line_num, untyped col_num) -> untyped
|
19
|
+
|
20
|
+
def generate_suggestion_html: () -> untyped
|
21
|
+
|
22
|
+
def syntax_highlight: (untyped code) -> untyped
|
23
|
+
|
24
|
+
def highlight_with_tokens: (untyped tokens, untyped code) -> untyped
|
25
|
+
|
26
|
+
def get_character_offset: (untyped _content, untyped line, untyped column) -> untyped
|
27
|
+
|
28
|
+
def apply_token_style: (untyped token, untyped text) -> untyped
|
29
|
+
|
30
|
+
def escape_html: (untyped text) -> untyped
|
31
|
+
|
32
|
+
def escape_attr: (untyped text) -> untyped
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Generated from lib/herb/engine/validation_errors.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Herb
|
4
|
+
class Engine
|
5
|
+
class SecurityError < StandardError
|
6
|
+
attr_reader line: untyped
|
7
|
+
|
8
|
+
attr_reader column: untyped
|
9
|
+
|
10
|
+
attr_reader filename: untyped
|
11
|
+
|
12
|
+
attr_reader suggestion: untyped
|
13
|
+
|
14
|
+
def initialize: (untyped message, ?line: untyped, ?column: untyped, ?filename: untyped, ?suggestion: untyped) -> untyped
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def build_error_message: (untyped message) -> untyped
|
19
|
+
end
|
20
|
+
|
21
|
+
module ValidationErrors
|
22
|
+
class ValidationError
|
23
|
+
attr_reader type: untyped
|
24
|
+
|
25
|
+
attr_reader location: untyped
|
26
|
+
|
27
|
+
attr_reader message: untyped
|
28
|
+
|
29
|
+
def initialize: (untyped type, untyped location, untyped message) -> untyped
|
30
|
+
end
|
31
|
+
|
32
|
+
class SecurityValidationError
|
33
|
+
attr_reader type: untyped
|
34
|
+
|
35
|
+
attr_reader location: untyped
|
36
|
+
|
37
|
+
attr_reader message: untyped
|
38
|
+
|
39
|
+
attr_reader suggestion: untyped
|
40
|
+
|
41
|
+
def initialize: (untyped location, untyped message, untyped suggestion) -> untyped
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Generated from lib/herb/engine/validator.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Herb
|
4
|
+
class Engine
|
5
|
+
class Validator < Herb::Visitor
|
6
|
+
attr_reader diagnostics: untyped
|
7
|
+
|
8
|
+
def initialize: () -> untyped
|
9
|
+
|
10
|
+
def validate: (untyped node) -> untyped
|
11
|
+
|
12
|
+
def error: (untyped message, untyped location, ?code: untyped, ?source: untyped) -> untyped
|
13
|
+
|
14
|
+
def warning: (untyped message, untyped location, ?code: untyped, ?source: untyped) -> untyped
|
15
|
+
|
16
|
+
def info: (untyped message, untyped location, ?code: untyped, ?source: untyped) -> untyped
|
17
|
+
|
18
|
+
def hint: (untyped message, untyped location, ?code: untyped, ?source: untyped) -> untyped
|
19
|
+
|
20
|
+
def errors?: () -> untyped
|
21
|
+
|
22
|
+
def warnings?: () -> untyped
|
23
|
+
|
24
|
+
def errors: () -> untyped
|
25
|
+
|
26
|
+
def warnings: () -> untyped
|
27
|
+
|
28
|
+
def clear_diagnostics: () -> untyped
|
29
|
+
|
30
|
+
def diagnostic_count: (?untyped severity) -> untyped
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def add_diagnostic: (untyped message, untyped location, untyped severity, ?code: untyped, ?source: untyped) -> untyped
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Generated from lib/herb/engine/validators/accessibility_validator.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Herb
|
4
|
+
class Engine
|
5
|
+
module Validators
|
6
|
+
class AccessibilityValidator < Validator
|
7
|
+
def visit_html_attribute_node: (untyped node) -> untyped
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def validate_attribute: (untyped node) -> untyped
|
12
|
+
|
13
|
+
def validate_id_format: (untyped node) -> untyped
|
14
|
+
|
15
|
+
def add_validation_error: (untyped type, untyped location, untyped message) -> untyped
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Generated from lib/herb/engine/validators/nesting_validator.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Herb
|
4
|
+
class Engine
|
5
|
+
module Validators
|
6
|
+
class NestingValidator < Validator
|
7
|
+
def visit_html_element_node: (untyped node) -> untyped
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def validate_html_nesting: (untyped node) -> untyped
|
12
|
+
|
13
|
+
def validate_no_block_elements_in_paragraph: (untyped node) -> untyped
|
14
|
+
|
15
|
+
def validate_no_nested_anchors: (untyped node) -> untyped
|
16
|
+
|
17
|
+
def validate_no_interactive_in_button: (untyped node) -> untyped
|
18
|
+
|
19
|
+
def find_nested_elements: (untyped node, untyped tag_name) ?{ (?) -> untyped } -> untyped
|
20
|
+
|
21
|
+
def add_validation_error: (untyped type, untyped location, untyped message) -> untyped
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Generated from lib/herb/engine/validators/security_validator.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Herb
|
4
|
+
class Engine
|
5
|
+
module Validators
|
6
|
+
class SecurityValidator < Validator
|
7
|
+
def visit_html_open_tag_node: (untyped node) -> untyped
|
8
|
+
|
9
|
+
def visit_html_attribute_name_node: (untyped node) -> untyped
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def validate_tag_security: (untyped node) -> untyped
|
14
|
+
|
15
|
+
def validate_attribute_name_security: (untyped node) -> untyped
|
16
|
+
|
17
|
+
def add_security_error: (untyped location, untyped message, untyped suggestion) -> untyped
|
18
|
+
|
19
|
+
def add_diagnostic: (untyped message, untyped location, untyped severity, ?code: untyped, ?source: untyped, ?suggestion: untyped) -> untyped
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/sig/herb/engine.rbs
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# Generated from lib/herb/engine.rb with RBS::Inline
|
2
|
+
|
3
|
+
module Herb
|
4
|
+
class Engine
|
5
|
+
attr_reader src: untyped
|
6
|
+
|
7
|
+
attr_reader filename: untyped
|
8
|
+
|
9
|
+
attr_reader project_path: untyped
|
10
|
+
|
11
|
+
attr_reader relative_file_path: untyped
|
12
|
+
|
13
|
+
attr_reader bufvar: untyped
|
14
|
+
|
15
|
+
attr_reader debug: untyped
|
16
|
+
|
17
|
+
attr_reader content_for_head: untyped
|
18
|
+
|
19
|
+
attr_reader validation_error_template: untyped
|
20
|
+
|
21
|
+
ESCAPE_TABLE: untyped
|
22
|
+
|
23
|
+
class CompilationError < StandardError
|
24
|
+
end
|
25
|
+
|
26
|
+
def initialize: (untyped input, ?untyped properties) -> untyped
|
27
|
+
|
28
|
+
def self.h: (untyped value) -> untyped
|
29
|
+
|
30
|
+
def self.attr: (untyped value) -> untyped
|
31
|
+
|
32
|
+
def self.js: (untyped value) -> untyped
|
33
|
+
|
34
|
+
def self.css: (untyped value) -> untyped
|
35
|
+
|
36
|
+
def add_text: (untyped text) -> untyped
|
37
|
+
|
38
|
+
def add_code: (untyped code) -> untyped
|
39
|
+
|
40
|
+
def add_expression: (untyped indicator, untyped code) -> untyped
|
41
|
+
|
42
|
+
def add_expression_result: (untyped code) -> untyped
|
43
|
+
|
44
|
+
def add_expression_result_escaped: (untyped code) -> untyped
|
45
|
+
|
46
|
+
def add_expression_block: (untyped indicator, untyped code) -> untyped
|
47
|
+
|
48
|
+
def add_expression_block_result: (untyped code) -> untyped
|
49
|
+
|
50
|
+
def add_expression_block_result_escaped: (untyped code) -> untyped
|
51
|
+
|
52
|
+
def add_postamble: (untyped postamble) -> untyped
|
53
|
+
|
54
|
+
def with_buffer: () ?{ (?) -> untyped } -> untyped
|
55
|
+
|
56
|
+
def terminate_expression: () -> untyped
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def run_validation: (untyped ast) -> untyped
|
61
|
+
|
62
|
+
def handle_parser_errors: (untyped parser_errors, untyped input, untyped _ast) -> untyped
|
63
|
+
|
64
|
+
def handle_validation_errors: (untyped errors, untyped input) -> untyped
|
65
|
+
|
66
|
+
def add_validation_overlay: (untyped errors, ?untyped input) -> untyped
|
67
|
+
|
68
|
+
def escape_attr: (untyped text) -> untyped
|
69
|
+
|
70
|
+
def add_parser_error_overlay: (untyped parser_errors, untyped input) -> untyped
|
71
|
+
end
|
72
|
+
end
|
data/sig/herb/visitor.rbs
CHANGED
data/src/ast_nodes.c
CHANGED
@@ -62,7 +62,7 @@ AST_HTML_CLOSE_TAG_NODE_T* ast_html_close_tag_node_init(token_T* tag_opening, to
|
|
62
62
|
return html_close_tag_node;
|
63
63
|
}
|
64
64
|
|
65
|
-
AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag, token_T* tag_name, array_T* body, struct AST_HTML_CLOSE_TAG_NODE_STRUCT* close_tag, bool is_void, position_T* start_position, position_T* end_position, array_T* errors) {
|
65
|
+
AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag, token_T* tag_name, array_T* body, struct AST_HTML_CLOSE_TAG_NODE_STRUCT* close_tag, bool is_void, element_source_t source, position_T* start_position, position_T* end_position, array_T* errors) {
|
66
66
|
AST_HTML_ELEMENT_NODE_T* html_element_node = malloc(sizeof(AST_HTML_ELEMENT_NODE_T));
|
67
67
|
|
68
68
|
ast_node_init(&html_element_node->base, AST_HTML_ELEMENT_NODE, start_position, end_position, errors);
|
@@ -72,6 +72,7 @@ AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(struct AST_HTML_OPEN_TAG_NOD
|
|
72
72
|
html_element_node->body = body;
|
73
73
|
html_element_node->close_tag = close_tag;
|
74
74
|
html_element_node->is_void = is_void;
|
75
|
+
html_element_node->source = source;
|
75
76
|
|
76
77
|
return html_element_node;
|
77
78
|
}
|
data/src/ast_pretty_print.c
CHANGED
@@ -98,7 +98,8 @@ void ast_pretty_print_node(AST_NODE_T* node, const size_t indent, const size_t r
|
|
98
98
|
}
|
99
99
|
buffer_append(buffer, "\n");
|
100
100
|
|
101
|
-
pretty_print_boolean_property("is_void", html_element_node->is_void, indent, relative_indent,
|
101
|
+
pretty_print_boolean_property("is_void", html_element_node->is_void, indent, relative_indent, false, buffer);
|
102
|
+
pretty_print_string_property(element_source_to_string(html_element_node->source), "source", indent, relative_indent, true, buffer);
|
102
103
|
} break;
|
103
104
|
|
104
105
|
case AST_HTML_ATTRIBUTE_VALUE_NODE: {
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#include "include/element_source.h"
|
2
|
+
|
3
|
+
const char* element_source_to_string(element_source_t source) {
|
4
|
+
switch (source) {
|
5
|
+
case ELEMENT_SOURCE_HTML: return "HTML";
|
6
|
+
case ELEMENT_SOURCE_ACTIONVIEW: return "ActionView";
|
7
|
+
case ELEMENT_SOURCE_HAML: return "Haml";
|
8
|
+
case ELEMENT_SOURCE_SLIM: return "Slim";
|
9
|
+
default: return "Unknown";
|
10
|
+
}
|
11
|
+
}
|
data/src/include/ast_nodes.h
CHANGED
@@ -13,6 +13,7 @@
|
|
13
13
|
#include "location.h"
|
14
14
|
#include "token_struct.h"
|
15
15
|
#include "analyzed_ruby.h"
|
16
|
+
#include "element_source.h"
|
16
17
|
|
17
18
|
typedef enum {
|
18
19
|
AST_DOCUMENT_NODE,
|
@@ -90,6 +91,7 @@ typedef struct AST_HTML_ELEMENT_NODE_STRUCT {
|
|
90
91
|
array_T* body;
|
91
92
|
struct AST_HTML_CLOSE_TAG_NODE_STRUCT* close_tag;
|
92
93
|
bool is_void;
|
94
|
+
element_source_t source;
|
93
95
|
} AST_HTML_ELEMENT_NODE_T;
|
94
96
|
|
95
97
|
typedef struct AST_HTML_ATTRIBUTE_VALUE_NODE_STRUCT {
|
@@ -309,7 +311,7 @@ AST_DOCUMENT_NODE_T* ast_document_node_init(array_T* children, position_T* start
|
|
309
311
|
AST_LITERAL_NODE_T* ast_literal_node_init(const char* content, position_T* start_position, position_T* end_position, array_T* errors);
|
310
312
|
AST_HTML_OPEN_TAG_NODE_T* ast_html_open_tag_node_init(token_T* tag_opening, token_T* tag_name, token_T* tag_closing, array_T* children, bool is_void, position_T* start_position, position_T* end_position, array_T* errors);
|
311
313
|
AST_HTML_CLOSE_TAG_NODE_T* ast_html_close_tag_node_init(token_T* tag_opening, token_T* tag_name, array_T* children, token_T* tag_closing, position_T* start_position, position_T* end_position, array_T* errors);
|
312
|
-
AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag, token_T* tag_name, array_T* body, struct AST_HTML_CLOSE_TAG_NODE_STRUCT* close_tag, bool is_void, position_T* start_position, position_T* end_position, array_T* errors);
|
314
|
+
AST_HTML_ELEMENT_NODE_T* ast_html_element_node_init(struct AST_HTML_OPEN_TAG_NODE_STRUCT* open_tag, token_T* tag_name, array_T* body, struct AST_HTML_CLOSE_TAG_NODE_STRUCT* close_tag, bool is_void, element_source_t source, position_T* start_position, position_T* end_position, array_T* errors);
|
313
315
|
AST_HTML_ATTRIBUTE_VALUE_NODE_T* ast_html_attribute_value_node_init(token_T* open_quote, array_T* children, token_T* close_quote, bool quoted, position_T* start_position, position_T* end_position, array_T* errors);
|
314
316
|
AST_HTML_ATTRIBUTE_NAME_NODE_T* ast_html_attribute_name_node_init(array_T* children, position_T* start_position, position_T* end_position, array_T* errors);
|
315
317
|
AST_HTML_ATTRIBUTE_NODE_T* ast_html_attribute_node_init(struct AST_HTML_ATTRIBUTE_NAME_NODE_STRUCT* name, token_T* equals, struct AST_HTML_ATTRIBUTE_VALUE_NODE_STRUCT* value, position_T* start_position, position_T* end_position, array_T* errors);
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#ifndef HERB_ELEMENT_SOURCE_H
|
2
|
+
#define HERB_ELEMENT_SOURCE_H
|
3
|
+
|
4
|
+
typedef enum {
|
5
|
+
ELEMENT_SOURCE_HTML,
|
6
|
+
ELEMENT_SOURCE_ACTIONVIEW,
|
7
|
+
ELEMENT_SOURCE_HAML,
|
8
|
+
ELEMENT_SOURCE_SLIM
|
9
|
+
} element_source_t;
|
10
|
+
|
11
|
+
const char* element_source_to_string(element_source_t source);
|
12
|
+
|
13
|
+
#endif
|
data/src/include/version.h
CHANGED
data/src/parser.c
CHANGED
@@ -910,6 +910,7 @@ static AST_HTML_ELEMENT_NODE_T* parser_parse_html_self_closing_element(
|
|
910
910
|
NULL,
|
911
911
|
NULL,
|
912
912
|
true,
|
913
|
+
ELEMENT_SOURCE_HTML,
|
913
914
|
open_tag->base.location->start,
|
914
915
|
open_tag->base.location->end,
|
915
916
|
NULL
|
@@ -958,6 +959,7 @@ static AST_HTML_ELEMENT_NODE_T* parser_parse_html_regular_element(
|
|
958
959
|
body,
|
959
960
|
close_tag,
|
960
961
|
false,
|
962
|
+
ELEMENT_SOURCE_HTML,
|
961
963
|
open_tag->base.location->start,
|
962
964
|
close_tag->base.location->end,
|
963
965
|
errors
|
@@ -988,6 +990,7 @@ static AST_HTML_ELEMENT_NODE_T* parser_parse_html_element(parser_T* parser) {
|
|
988
990
|
NULL,
|
989
991
|
NULL,
|
990
992
|
false,
|
993
|
+
ELEMENT_SOURCE_HTML,
|
991
994
|
open_tag->base.location->start,
|
992
995
|
open_tag->base.location->end,
|
993
996
|
errors
|
data/src/parser_helpers.c
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: herb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: x86-linux-musl
|
6
6
|
authors:
|
7
7
|
- Marco Roth
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-09-05 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: Powerful and seamless HTML-aware ERB parsing and tooling.
|
13
13
|
email:
|
@@ -39,9 +39,21 @@ files:
|
|
39
39
|
- lib/herb/3.3/herb.so
|
40
40
|
- lib/herb/3.4/herb.so
|
41
41
|
- lib/herb/ast.rb
|
42
|
+
- lib/herb/ast/helpers.rb
|
42
43
|
- lib/herb/ast/node.rb
|
43
44
|
- lib/herb/ast/nodes.rb
|
44
45
|
- lib/herb/cli.rb
|
46
|
+
- lib/herb/engine.rb
|
47
|
+
- lib/herb/engine/compiler.rb
|
48
|
+
- lib/herb/engine/debug_visitor.rb
|
49
|
+
- lib/herb/engine/error_formatter.rb
|
50
|
+
- lib/herb/engine/parser_error_overlay.rb
|
51
|
+
- lib/herb/engine/validation_error_overlay.rb
|
52
|
+
- lib/herb/engine/validation_errors.rb
|
53
|
+
- lib/herb/engine/validator.rb
|
54
|
+
- lib/herb/engine/validators/accessibility_validator.rb
|
55
|
+
- lib/herb/engine/validators/nesting_validator.rb
|
56
|
+
- lib/herb/engine/validators/security_validator.rb
|
45
57
|
- lib/herb/errors.rb
|
46
58
|
- lib/herb/lex_result.rb
|
47
59
|
- lib/herb/libherb.rb
|
@@ -66,8 +78,21 @@ files:
|
|
66
78
|
- lib/herb/warnings.rb
|
67
79
|
- sig/herb.rbs
|
68
80
|
- sig/herb/ast.rbs
|
81
|
+
- sig/herb/ast/helpers.rbs
|
69
82
|
- sig/herb/ast/node.rbs
|
70
83
|
- sig/herb/ast/nodes.rbs
|
84
|
+
- sig/herb/engine.rbs
|
85
|
+
- sig/herb/engine/compiler.rbs
|
86
|
+
- sig/herb/engine/debug.rbs
|
87
|
+
- sig/herb/engine/debug_visitor.rbs
|
88
|
+
- sig/herb/engine/error_formatter.rbs
|
89
|
+
- sig/herb/engine/parser_error_overlay.rbs
|
90
|
+
- sig/herb/engine/validation_error_overlay.rbs
|
91
|
+
- sig/herb/engine/validation_errors.rbs
|
92
|
+
- sig/herb/engine/validator.rbs
|
93
|
+
- sig/herb/engine/validators/accessibility_validator.rbs
|
94
|
+
- sig/herb/engine/validators/nesting_validator.rbs
|
95
|
+
- sig/herb/engine/validators/security_validator.rbs
|
71
96
|
- sig/herb/errors.rbs
|
72
97
|
- sig/herb/lex_result.rbs
|
73
98
|
- sig/herb/location.rbs
|
@@ -80,6 +105,7 @@ files:
|
|
80
105
|
- sig/herb/version.rbs
|
81
106
|
- sig/herb/visitor.rbs
|
82
107
|
- sig/herb/warnings.rbs
|
108
|
+
- sig/herb_c_extension.rbs
|
83
109
|
- sig/serialized.rbs
|
84
110
|
- sig/serialized_ast_errors.rbs
|
85
111
|
- sig/serialized_ast_nodes.rbs
|
@@ -91,6 +117,7 @@ files:
|
|
91
117
|
- src/ast_nodes.c
|
92
118
|
- src/ast_pretty_print.c
|
93
119
|
- src/buffer.c
|
120
|
+
- src/element_source.c
|
94
121
|
- src/errors.c
|
95
122
|
- src/extract.c
|
96
123
|
- src/herb.c
|
@@ -103,6 +130,7 @@ files:
|
|
103
130
|
- src/include/ast_nodes.h
|
104
131
|
- src/include/ast_pretty_print.h
|
105
132
|
- src/include/buffer.h
|
133
|
+
- src/include/element_source.h
|
106
134
|
- src/include/errors.h
|
107
135
|
- src/include/extract.h
|
108
136
|
- src/include/herb.h
|