herb 0.3.1-x86_64-linux-musl → 0.4.1-x86_64-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.
@@ -7,6 +7,9 @@ module Herb
7
7
  # : (Herb::AST::DocumentNode, String, Array[Herb::Warnings::Warning], Array[Herb::Errors::Error]) -> void
8
8
  def initialize: (Herb::AST::DocumentNode, String, Array[Herb::Warnings::Warning], Array[Herb::Errors::Error]) -> void
9
9
 
10
+ # : () -> Array[Herb::Errors::Error]
11
+ def errors: () -> Array[Herb::Errors::Error]
12
+
10
13
  # : () -> bool
11
14
  def failed?: () -> bool
12
15
 
@@ -2,7 +2,7 @@
2
2
  # typed: true
3
3
 
4
4
  # NOTE: This file is generated by the templates/template.rb script and should not be
5
- # modified manually. See /Users/marcoroth/Development/herb-release/templates/sig/serialized_ast_errors.rbs.erb
5
+ # modified manually. See /Users/marcoroth/Development/herb-release-4/templates/sig/serialized_ast_errors.rbs.erb
6
6
 
7
7
  module Herb
8
8
  type serialized_unexpected_error = serialized_error & {
@@ -2,7 +2,7 @@
2
2
  # typed: true
3
3
 
4
4
  # NOTE: This file is generated by the templates/template.rb script and should not be
5
- # modified manually. See /Users/marcoroth/Development/herb-release/templates/sig/serialized_ast_nodes.rbs.erb
5
+ # modified manually. See /Users/marcoroth/Development/herb-release-4/templates/sig/serialized_ast_nodes.rbs.erb
6
6
 
7
7
  module Herb
8
8
  type serialized_document_node = serialized_node & {
data/src/analyze.c CHANGED
@@ -49,13 +49,20 @@ static bool analyze_erb_content(const AST_NODE_T* node, void* data) {
49
49
  if (node->type == AST_ERB_CONTENT_NODE) {
50
50
  AST_ERB_CONTENT_NODE_T* erb_content_node = (AST_ERB_CONTENT_NODE_T*) node;
51
51
 
52
- analyzed_ruby_T* analyzed = herb_analyze_ruby(erb_content_node->content->value);
52
+ const char* opening = erb_content_node->tag_opening->value;
53
+ if (strcmp(opening, "<%%") != 0 && strcmp(opening, "<%%=") != 0) {
54
+ analyzed_ruby_T* analyzed = herb_analyze_ruby(erb_content_node->content->value);
53
55
 
54
- if (false) { pretty_print_analyed_ruby(analyzed, erb_content_node->content->value); }
56
+ if (false) { pretty_print_analyed_ruby(analyzed, erb_content_node->content->value); }
55
57
 
56
- erb_content_node->parsed = true;
57
- erb_content_node->valid = analyzed->valid;
58
- erb_content_node->analyzed_ruby = analyzed;
58
+ erb_content_node->parsed = true;
59
+ erb_content_node->valid = analyzed->valid;
60
+ erb_content_node->analyzed_ruby = analyzed;
61
+ } else {
62
+ erb_content_node->parsed = false;
63
+ erb_content_node->valid = true;
64
+ erb_content_node->analyzed_ruby = NULL;
65
+ }
59
66
  }
60
67
 
61
68
  herb_visit_child_nodes(node, analyze_erb_content, data);
@@ -64,12 +71,20 @@ static bool analyze_erb_content(const AST_NODE_T* node, void* data) {
64
71
  }
65
72
 
66
73
  static size_t process_block_children(
67
- AST_NODE_T* node, array_T* array, size_t index, array_T* children_array, analyze_ruby_context_T* context,
74
+ AST_NODE_T* node,
75
+ array_T* array,
76
+ size_t index,
77
+ array_T* children_array,
78
+ analyze_ruby_context_T* context,
68
79
  control_type_t parent_type
69
80
  );
70
81
 
71
82
  static size_t process_subsequent_block(
72
- AST_NODE_T* node, array_T* array, size_t index, AST_NODE_T** subsequent_out, analyze_ruby_context_T* context,
83
+ AST_NODE_T* node,
84
+ array_T* array,
85
+ size_t index,
86
+ AST_NODE_T** subsequent_out,
87
+ analyze_ruby_context_T* context,
73
88
  control_type_t parent_type
74
89
  );
75
90
 
@@ -132,7 +147,10 @@ static bool is_terminator_type(control_type_t parent_type, control_type_t child_
132
147
  }
133
148
 
134
149
  static AST_NODE_T* create_control_node(
135
- AST_ERB_CONTENT_NODE_T* erb_node, array_T* children, AST_NODE_T* subsequent, AST_ERB_END_NODE_T* end_node,
150
+ AST_ERB_CONTENT_NODE_T* erb_node,
151
+ array_T* children,
152
+ AST_NODE_T* subsequent,
153
+ AST_ERB_END_NODE_T* end_node,
136
154
  control_type_t control_type
137
155
  ) {
138
156
  array_T* errors = array_init(8);
@@ -362,7 +380,11 @@ static AST_NODE_T* create_control_node(
362
380
  }
363
381
 
364
382
  static size_t process_control_structure(
365
- AST_NODE_T* node, array_T* array, size_t index, array_T* output_array, analyze_ruby_context_T* context,
383
+ AST_NODE_T* node,
384
+ array_T* array,
385
+ size_t index,
386
+ array_T* output_array,
387
+ analyze_ruby_context_T* context,
366
388
  control_type_t initial_type
367
389
  ) {
368
390
  AST_ERB_CONTENT_NODE_T* erb_node = (AST_ERB_CONTENT_NODE_T*) array_get(array, index);
@@ -858,7 +880,11 @@ static size_t process_control_structure(
858
880
  }
859
881
 
860
882
  static size_t process_subsequent_block(
861
- AST_NODE_T* node, array_T* array, size_t index, AST_NODE_T** subsequent_out, analyze_ruby_context_T* context,
883
+ AST_NODE_T* node,
884
+ array_T* array,
885
+ size_t index,
886
+ AST_NODE_T** subsequent_out,
887
+ analyze_ruby_context_T* context,
862
888
  control_type_t parent_type
863
889
  ) {
864
890
  AST_ERB_CONTENT_NODE_T* erb_node = (AST_ERB_CONTENT_NODE_T*) array_get(array, index);
@@ -922,7 +948,11 @@ static size_t process_subsequent_block(
922
948
  }
923
949
 
924
950
  static size_t process_block_children(
925
- AST_NODE_T* node, array_T* array, size_t index, array_T* children_array, analyze_ruby_context_T* context,
951
+ AST_NODE_T* node,
952
+ array_T* array,
953
+ size_t index,
954
+ array_T* children_array,
955
+ analyze_ruby_context_T* context,
926
956
  control_type_t parent_type
927
957
  ) {
928
958
  while (index < array_size(array)) {
@@ -89,12 +89,17 @@ bool search_if_nodes(const pm_node_t* node, void* data) {
89
89
  analyzed_ruby_T* analyzed = (analyzed_ruby_T*) data;
90
90
 
91
91
  if (node->type == PM_IF_NODE) {
92
- analyzed->has_if_node = true;
93
- return true;
94
- } else {
95
- pm_visit_child_nodes(node, search_if_nodes, analyzed);
92
+ const pm_if_node_t* if_node = (const pm_if_node_t*) node;
93
+
94
+ // Handle ternary
95
+ if (if_node->if_keyword_loc.start != NULL && if_node->if_keyword_loc.end != NULL) {
96
+ analyzed->has_if_node = true;
97
+ return true;
98
+ }
96
99
  }
97
100
 
101
+ pm_visit_child_nodes(node, search_if_nodes, analyzed);
102
+
98
103
  return false;
99
104
  }
100
105
 
data/src/ast_nodes.c CHANGED
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release/templates/src/ast_nodes.c.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-4/templates/src/ast_nodes.c.erb
3
3
 
4
4
  #include <stdio.h>
5
5
  #include <stdbool.h>
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release/templates/src/ast_pretty_print.c.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-4/templates/src/ast_pretty_print.c.erb
3
3
 
4
4
  #include "include/ast_node.h"
5
5
  #include "include/ast_nodes.h"
data/src/errors.c CHANGED
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release/templates/src/errors.c.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-4/templates/src/errors.c.erb
3
3
 
4
4
  #include "include/array.h"
5
5
  #include "include/errors.h"
data/src/extract.c CHANGED
@@ -20,7 +20,9 @@ void herb_extract_ruby_to_buffer_with_semicolons(const char* source, buffer_T* o
20
20
  }
21
21
 
22
22
  case TOKEN_ERB_START: {
23
- if (strcmp(token->value, "<%#") == 0) { skip_erb_content = true; }
23
+ if (strcmp(token->value, "<%#") == 0 || strcmp(token->value, "<%%") == 0 || strcmp(token->value, "<%%=") == 0) {
24
+ skip_erb_content = true;
25
+ }
24
26
 
25
27
  buffer_append_whitespace(output, range_length(token->range));
26
28
  break;
@@ -67,7 +69,9 @@ void herb_extract_ruby_to_buffer(const char* source, buffer_T* output) {
67
69
  }
68
70
 
69
71
  case TOKEN_ERB_START: {
70
- if (strcmp(token->value, "<%#") == 0) { skip_erb_content = true; }
72
+ if (strcmp(token->value, "<%#") == 0 || strcmp(token->value, "<%%") == 0 || strcmp(token->value, "<%%=") == 0) {
73
+ skip_erb_content = true;
74
+ }
71
75
 
72
76
  buffer_append_whitespace(output, range_length(token->range));
73
77
  break;
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release/templates/src/include/ast_nodes.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-4/templates/src/include/ast_nodes.h.erb
3
3
 
4
4
  #ifndef HERB_AST_NODES_H
5
5
  #define HERB_AST_NODES_H
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release/templates/src/include/ast_pretty_print.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-4/templates/src/include/ast_pretty_print.h.erb
3
3
 
4
4
  #ifndef HERB_AST_PRETTY_PRINT_H
5
5
  #define HERB_AST_PRETTY_PRINT_H
data/src/include/errors.h CHANGED
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release/templates/src/include/errors.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-4/templates/src/include/errors.h.erb
3
3
 
4
4
  #ifndef HERB_ERRORS_H
5
5
  #define HERB_ERRORS_H
@@ -16,7 +16,10 @@ void parser_append_unexpected_error(parser_T* parser, const char* description, c
16
16
  void parser_append_unexpected_token_error(parser_T* parser, token_type_T expected_type, array_T* errors);
17
17
 
18
18
  void parser_append_literal_node_from_buffer(
19
- const parser_T* parser, buffer_T* buffer, array_T* children, position_T* start
19
+ const parser_T* parser,
20
+ buffer_T* buffer,
21
+ array_T* children,
22
+ position_T* start
20
23
  );
21
24
 
22
25
  bool parser_in_svg_context(const parser_T* parser);
@@ -26,7 +29,9 @@ token_T* parser_consume_if_present(parser_T* parser, token_type_T type);
26
29
  token_T* parser_consume_expected(parser_T* parser, token_type_T type, array_T* array);
27
30
 
28
31
  AST_HTML_ELEMENT_NODE_T* parser_handle_missing_close_tag(
29
- AST_HTML_OPEN_TAG_NODE_T* open_tag, array_T* body, array_T* errors
32
+ AST_HTML_OPEN_TAG_NODE_T* open_tag,
33
+ array_T* body,
34
+ array_T* errors
30
35
  );
31
36
  void parser_handle_mismatched_tags(const parser_T* parser, const AST_HTML_CLOSE_TAG_NODE_T* close_tag, array_T* errors);
32
37
 
@@ -13,37 +13,77 @@ void pretty_print_newline(size_t indent, size_t relative_indent, buffer_T* buffe
13
13
  void pretty_print_label(const char* name, size_t indent, size_t relative_indent, bool last_property, buffer_T* buffer);
14
14
 
15
15
  void pretty_print_position_property(
16
- position_T* position, const char* name, size_t indent, size_t relative_indent, bool last_property, buffer_T* buffer
16
+ position_T* position,
17
+ const char* name,
18
+ size_t indent,
19
+ size_t relative_indent,
20
+ bool last_property,
21
+ buffer_T* buffer
17
22
  );
18
23
 
19
24
  void pretty_print_location(location_T* location, buffer_T* buffer);
20
25
 
21
26
  void pretty_print_property(
22
- const char* name, const char* value, size_t indent, size_t relative_indent, bool last_property, buffer_T* buffer
27
+ const char* name,
28
+ const char* value,
29
+ size_t indent,
30
+ size_t relative_indent,
31
+ bool last_property,
32
+ buffer_T* buffer
23
33
  );
24
34
 
25
35
  void pretty_print_size_t_property(
26
- size_t value, const char* name, size_t indent, size_t relative_indent, bool last_property, buffer_T* buffer
36
+ size_t value,
37
+ const char* name,
38
+ size_t indent,
39
+ size_t relative_indent,
40
+ bool last_property,
41
+ buffer_T* buffer
27
42
  );
28
43
 
29
44
  void pretty_print_string_property(
30
- const char* string, const char* name, size_t indent, size_t relative_indent, bool last_property, buffer_T* buffer
45
+ const char* string,
46
+ const char* name,
47
+ size_t indent,
48
+ size_t relative_indent,
49
+ bool last_property,
50
+ buffer_T* buffer
31
51
  );
32
52
 
33
53
  void pretty_print_quoted_property(
34
- const char* name, const char* value, size_t indent, size_t relative_indent, bool last_property, buffer_T* buffer
54
+ const char* name,
55
+ const char* value,
56
+ size_t indent,
57
+ size_t relative_indent,
58
+ bool last_property,
59
+ buffer_T* buffer
35
60
  );
36
61
 
37
62
  void pretty_print_boolean_property(
38
- const char* name, bool value, size_t indent, size_t relative_indent, bool last_property, buffer_T* buffer
63
+ const char* name,
64
+ bool value,
65
+ size_t indent,
66
+ size_t relative_indent,
67
+ bool last_property,
68
+ buffer_T* buffer
39
69
  );
40
70
 
41
71
  void pretty_print_token_property(
42
- token_T* token, const char* name, size_t indent, size_t relative_indent, bool last_property, buffer_T* buffer
72
+ token_T* token,
73
+ const char* name,
74
+ size_t indent,
75
+ size_t relative_indent,
76
+ bool last_property,
77
+ buffer_T* buffer
43
78
  );
44
79
 
45
80
  void pretty_print_array(
46
- const char* name, array_T* array, size_t indent, size_t relative_indent, bool last_property, buffer_T* buffer
81
+ const char* name,
82
+ array_T* array,
83
+ size_t indent,
84
+ size_t relative_indent,
85
+ bool last_property,
86
+ buffer_T* buffer
47
87
  );
48
88
 
49
89
  void pretty_print_errors(AST_NODE_T* node, size_t indent, size_t relative_indent, bool last_property, buffer_T* buffer);
@@ -10,7 +10,10 @@
10
10
  const char* pm_error_level_to_string(pm_error_level_t level);
11
11
 
12
12
  RUBY_PARSE_ERROR_T* ruby_parse_error_from_prism_error(
13
- const pm_diagnostic_t* error, const AST_NODE_T* node, const char* source, pm_parser_t* parser
13
+ const pm_diagnostic_t* error,
14
+ const AST_NODE_T* node,
15
+ const char* source,
16
+ pm_parser_t* parser
14
17
  );
15
18
 
16
19
  position_T* position_from_source_with_offset(const char* source, size_t offset);
@@ -20,7 +20,7 @@ typedef enum {
20
20
  TOKEN_HTML_COMMENT_START, // <!--
21
21
  TOKEN_HTML_COMMENT_END, // -->
22
22
 
23
- TOKEN_ERB_START, // <%, <%=, <%#, <%-, <%==, <%%
23
+ TOKEN_ERB_START, // <%, <%=, <%%=, <%#, <%-, <%==, <%%
24
24
  TOKEN_ERB_CONTENT, // Ruby Code
25
25
  TOKEN_ERB_END, // %>, -%>, %%>
26
26
 
@@ -33,6 +33,7 @@ typedef enum {
33
33
  TOKEN_EXCLAMATION, // !
34
34
  TOKEN_SEMICOLON, // ;
35
35
  TOKEN_COLON, // :
36
+ TOKEN_AT, // @
36
37
  TOKEN_PERCENT, // %
37
38
  TOKEN_AMPERSAND, // &
38
39
 
@@ -1,6 +1,6 @@
1
1
  #ifndef HERB_VERSION_H
2
2
  #define HERB_VERSION_H
3
3
 
4
- #define HERB_VERSION "0.3.1"
4
+ #define HERB_VERSION "0.4.1"
5
5
 
6
6
  #endif
data/src/lexer.c CHANGED
@@ -163,7 +163,7 @@ static token_T* lexer_parse_identifier(lexer_T* lexer) {
163
163
  // ===== ERB Parsing
164
164
 
165
165
  static token_T* lexer_parse_erb_open(lexer_T* lexer) {
166
- const char* erb_patterns[] = { "<%==", "<%=", "<%#", "<%-", "<%%", "<%" };
166
+ const char* erb_patterns[] = { "<%==", "<%%=", "<%=", "<%#", "<%-", "<%%", "<%" };
167
167
 
168
168
  lexer->state = STATE_ERB_CONTENT;
169
169
 
@@ -184,7 +184,16 @@ static token_T* lexer_parse_erb_content(lexer_T* lexer) {
184
184
  }
185
185
 
186
186
  buffer_append_char(&buffer, lexer->current_character);
187
- lexer_advance(lexer);
187
+
188
+ if (is_newline(lexer->current_character)) {
189
+ lexer->current_line++;
190
+ lexer->current_column = 0;
191
+ } else {
192
+ lexer->current_column++;
193
+ }
194
+
195
+ lexer->current_position++;
196
+ lexer->current_character = lexer->source[lexer->current_position];
188
197
  }
189
198
 
190
199
  lexer->state = STATE_ERB_CLOSE;
@@ -260,6 +269,7 @@ token_T* lexer_next_token(lexer_T* lexer) {
260
269
  case '>': return lexer_advance_current(lexer, TOKEN_HTML_TAG_END);
261
270
  case '_': return lexer_advance_current(lexer, TOKEN_UNDERSCORE);
262
271
  case ':': return lexer_advance_current(lexer, TOKEN_COLON);
272
+ case '@': return lexer_advance_current(lexer, TOKEN_AT);
263
273
  case ';': return lexer_advance_current(lexer, TOKEN_SEMICOLON);
264
274
  case '&': return lexer_advance_current(lexer, TOKEN_AMPERSAND);
265
275
  case '!': return lexer_advance_current(lexer, TOKEN_EXCLAMATION);
data/src/parser.c CHANGED
@@ -197,13 +197,19 @@ static AST_HTML_ATTRIBUTE_NAME_NODE_T* parser_parse_html_attribute_name(parser_T
197
197
  }
198
198
 
199
199
  static AST_HTML_ATTRIBUTE_VALUE_NODE_T* parser_parse_quoted_html_attribute_value(
200
- parser_T* parser, array_T* children, array_T* errors
200
+ parser_T* parser,
201
+ array_T* children,
202
+ array_T* errors
201
203
  ) {
202
204
  buffer_T buffer = buffer_new();
203
205
  token_T* opening_quote = parser_consume_expected(parser, TOKEN_QUOTE, errors);
204
206
  position_T* start = position_copy(parser->current_token->location->start);
205
207
 
206
- while (token_is_none_of(parser, TOKEN_QUOTE, TOKEN_EOF)) {
208
+ while (!token_is(parser, TOKEN_EOF)
209
+ && !(
210
+ token_is(parser, TOKEN_QUOTE) && opening_quote != NULL
211
+ && strcmp(parser->current_token->value, opening_quote->value) == 0
212
+ )) {
207
213
  if (token_is(parser, TOKEN_ERB_START)) {
208
214
  parser_append_literal_node_from_buffer(parser, &buffer, children, start);
209
215
 
@@ -472,7 +478,8 @@ static AST_HTML_CLOSE_TAG_NODE_T* parser_parse_html_close_tag(parser_T* parser)
472
478
 
473
479
  // TODO: this should probably be AST_HTML_ELEMENT_NODE_T with a AST_HTML_SELF_CLOSING_TAG_NODE_T
474
480
  static AST_HTML_ELEMENT_NODE_T* parser_parse_html_self_closing_element(
475
- const parser_T* parser, AST_HTML_OPEN_TAG_NODE_T* open_tag
481
+ const parser_T* parser,
482
+ AST_HTML_OPEN_TAG_NODE_T* open_tag
476
483
  ) {
477
484
  return ast_html_element_node_init(
478
485
  open_tag,
@@ -487,7 +494,8 @@ static AST_HTML_ELEMENT_NODE_T* parser_parse_html_self_closing_element(
487
494
  }
488
495
 
489
496
  static AST_HTML_ELEMENT_NODE_T* parser_parse_html_regular_element(
490
- parser_T* parser, AST_HTML_OPEN_TAG_NODE_T* open_tag
497
+ parser_T* parser,
498
+ AST_HTML_OPEN_TAG_NODE_T* open_tag
491
499
  ) {
492
500
  array_T* errors = array_init(8);
493
501
  array_T* body = array_init(8);
@@ -618,6 +626,7 @@ static void parser_parse_in_data_state(parser_T* parser, array_T* children, arra
618
626
  TOKEN_IDENTIFIER,
619
627
  TOKEN_NEWLINE,
620
628
  TOKEN_PERCENT,
629
+ TOKEN_QUOTE,
621
630
  TOKEN_SEMICOLON,
622
631
  TOKEN_SLASH,
623
632
  TOKEN_UNDERSCORE,
data/src/parser_helpers.c CHANGED
@@ -80,7 +80,10 @@ void parser_append_unexpected_token_error(parser_T* parser, token_type_T expecte
80
80
  }
81
81
 
82
82
  void parser_append_literal_node_from_buffer(
83
- const parser_T* parser, buffer_T* buffer, array_T* children, position_T* start
83
+ const parser_T* parser,
84
+ buffer_T* buffer,
85
+ array_T* children,
86
+ position_T* start
84
87
  ) {
85
88
  if (buffer_length(buffer) == 0) { return; }
86
89
 
@@ -115,7 +118,9 @@ token_T* parser_consume_expected(parser_T* parser, const token_type_T expected_t
115
118
  }
116
119
 
117
120
  AST_HTML_ELEMENT_NODE_T* parser_handle_missing_close_tag(
118
- AST_HTML_OPEN_TAG_NODE_T* open_tag, array_T* body, array_T* errors
121
+ AST_HTML_OPEN_TAG_NODE_T* open_tag,
122
+ array_T* body,
123
+ array_T* errors
119
124
  ) {
120
125
  append_missing_closing_tag_error(
121
126
  open_tag->tag_name,
@@ -137,7 +142,9 @@ AST_HTML_ELEMENT_NODE_T* parser_handle_missing_close_tag(
137
142
  }
138
143
 
139
144
  void parser_handle_mismatched_tags(
140
- const parser_T* parser, const AST_HTML_CLOSE_TAG_NODE_T* close_tag, array_T* errors
145
+ const parser_T* parser,
146
+ const AST_HTML_CLOSE_TAG_NODE_T* close_tag,
147
+ array_T* errors
141
148
  ) {
142
149
  if (array_size(parser->open_tags_stack) > 0) {
143
150
  token_T* expected_tag = array_last(parser->open_tags_stack);
data/src/pretty_print.c CHANGED
@@ -25,7 +25,11 @@ void pretty_print_newline(const size_t indent, const size_t relative_indent, buf
25
25
  }
26
26
 
27
27
  void pretty_print_label(
28
- const char* name, const size_t indent, const size_t relative_indent, const bool last_property, buffer_T* buffer
28
+ const char* name,
29
+ const size_t indent,
30
+ const size_t relative_indent,
31
+ const bool last_property,
32
+ buffer_T* buffer
29
33
  ) {
30
34
  pretty_print_indent(buffer, indent);
31
35
  pretty_print_indent(buffer, relative_indent);
@@ -41,7 +45,11 @@ void pretty_print_label(
41
45
  }
42
46
 
43
47
  void pretty_print_quoted_property(
44
- const char* name, const char* value, const size_t indent, const size_t relative_indent, const bool last_property,
48
+ const char* name,
49
+ const char* value,
50
+ const size_t indent,
51
+ const size_t relative_indent,
52
+ const bool last_property,
45
53
  buffer_T* buffer
46
54
  ) {
47
55
  char* quoted = quoted_string(value);
@@ -50,14 +58,22 @@ void pretty_print_quoted_property(
50
58
  }
51
59
 
52
60
  void pretty_print_boolean_property(
53
- const char* name, bool value, const size_t indent, const size_t relative_indent, const bool last_property,
61
+ const char* name,
62
+ bool value,
63
+ const size_t indent,
64
+ const size_t relative_indent,
65
+ const bool last_property,
54
66
  buffer_T* buffer
55
67
  ) {
56
68
  pretty_print_property(name, value ? "true" : "false", indent, relative_indent, last_property, buffer);
57
69
  }
58
70
 
59
71
  void pretty_print_property(
60
- const char* name, const char* value, const size_t indent, const size_t relative_indent, const bool last_property,
72
+ const char* name,
73
+ const char* value,
74
+ const size_t indent,
75
+ const size_t relative_indent,
76
+ const bool last_property,
61
77
  buffer_T* buffer
62
78
  ) {
63
79
  pretty_print_label(name, indent, relative_indent, last_property, buffer);
@@ -66,7 +82,11 @@ void pretty_print_property(
66
82
  }
67
83
 
68
84
  void pretty_print_size_t_property(
69
- size_t value, const char* name, const size_t indent, const size_t relative_indent, const bool last_property,
85
+ size_t value,
86
+ const char* name,
87
+ const size_t indent,
88
+ const size_t relative_indent,
89
+ const bool last_property,
70
90
  buffer_T* buffer
71
91
  ) {
72
92
  pretty_print_label(name, indent, relative_indent, last_property, buffer);
@@ -77,7 +97,11 @@ void pretty_print_size_t_property(
77
97
  }
78
98
 
79
99
  void pretty_print_array(
80
- const char* name, array_T* array, const size_t indent, const size_t relative_indent, const bool last_property,
100
+ const char* name,
101
+ array_T* array,
102
+ const size_t indent,
103
+ const size_t relative_indent,
104
+ const bool last_property,
81
105
  buffer_T* buffer
82
106
  ) {
83
107
  if (array == NULL) {
@@ -122,7 +146,11 @@ void pretty_print_array(
122
146
  }
123
147
 
124
148
  void pretty_print_errors(
125
- AST_NODE_T* node, const size_t indent, const size_t relative_indent, const bool last_property, buffer_T* buffer
149
+ AST_NODE_T* node,
150
+ const size_t indent,
151
+ const size_t relative_indent,
152
+ const bool last_property,
153
+ buffer_T* buffer
126
154
  ) {
127
155
  if (node->errors != NULL && array_size(node->errors) > 0) {
128
156
  error_pretty_print_array("errors", node->errors, indent, relative_indent, last_property, buffer);
@@ -146,7 +174,11 @@ void pretty_print_location(location_T* location, buffer_T* buffer) {
146
174
  }
147
175
 
148
176
  void pretty_print_position_property(
149
- position_T* position, const char* name, const size_t indent, const size_t relative_indent, const bool last_property,
177
+ position_T* position,
178
+ const char* name,
179
+ const size_t indent,
180
+ const size_t relative_indent,
181
+ const bool last_property,
150
182
  buffer_T* buffer
151
183
  ) {
152
184
  pretty_print_label(name, indent, relative_indent, last_property, buffer);
@@ -173,7 +205,11 @@ void pretty_print_position_property(
173
205
  }
174
206
 
175
207
  void pretty_print_token_property(
176
- token_T* token, const char* name, const size_t indent, const size_t relative_indent, const bool last_property,
208
+ token_T* token,
209
+ const char* name,
210
+ const size_t indent,
211
+ const size_t relative_indent,
212
+ const bool last_property,
177
213
  buffer_T* buffer
178
214
  ) {
179
215
  pretty_print_label(name, indent, relative_indent, last_property, buffer);
@@ -193,7 +229,11 @@ void pretty_print_token_property(
193
229
  }
194
230
 
195
231
  void pretty_print_string_property(
196
- const char* string, const char* name, const size_t indent, const size_t relative_indent, const bool last_property,
232
+ const char* string,
233
+ const char* name,
234
+ const size_t indent,
235
+ const size_t relative_indent,
236
+ const bool last_property,
197
237
  buffer_T* buffer
198
238
  ) {
199
239
  const char* value = "∅";
data/src/prism_helpers.c CHANGED
@@ -32,7 +32,10 @@ position_T* position_from_source_with_offset(const char* source, size_t offset)
32
32
  }
33
33
 
34
34
  RUBY_PARSE_ERROR_T* ruby_parse_error_from_prism_error(
35
- const pm_diagnostic_t* error, const AST_NODE_T* node, const char* source, pm_parser_t* parser
35
+ const pm_diagnostic_t* error,
36
+ const AST_NODE_T* node,
37
+ const char* source,
38
+ pm_parser_t* parser
36
39
  ) {
37
40
  size_t start_offset = (size_t) (error->location.start - parser->start);
38
41
  size_t end_offset = (size_t) (error->location.end - parser->start);
data/src/token.c CHANGED
@@ -61,6 +61,7 @@ const char* token_type_to_string(const token_type_T type) {
61
61
  case TOKEN_SLASH: return "TOKEN_SLASH";
62
62
  case TOKEN_SEMICOLON: return "TOKEN_SEMICOLON";
63
63
  case TOKEN_COLON: return "TOKEN_COLON";
64
+ case TOKEN_AT: return "TOKEN_AT";
64
65
  case TOKEN_LT: return "TOKEN_LT";
65
66
  case TOKEN_PERCENT: return "TOKEN_PERCENT";
66
67
  case TOKEN_AMPERSAND: return "TOKEN_AMPERSAND";
data/src/visitor.c CHANGED
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release/templates/src/visitor.c.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-4/templates/src/visitor.c.erb
3
3
 
4
4
  #include <stdio.h>
5
5
 
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.3.1
4
+ version: 0.4.1
5
5
  platform: x86_64-linux-musl
6
6
  authors:
7
7
  - Marco Roth
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-06-23 00:00:00.000000000 Z
10
+ date: 2025-07-22 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: Powerful and seamless HTML-aware ERB parsing and tooling.
13
13
  email: