@herb-tools/node 0.7.4 → 0.7.5

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.
Files changed (56) hide show
  1. package/binding.gyp +0 -1
  2. package/dist/herb-node.esm.js +1 -1
  3. package/extension/error_helpers.cpp +1 -1
  4. package/extension/error_helpers.h +1 -1
  5. package/extension/extension_helpers.cpp +9 -27
  6. package/extension/extension_helpers.h +3 -3
  7. package/extension/libherb/analyze.c +43 -80
  8. package/extension/libherb/ast_node.c +10 -13
  9. package/extension/libherb/ast_node.h +3 -3
  10. package/extension/libherb/ast_nodes.c +32 -34
  11. package/extension/libherb/ast_nodes.h +33 -33
  12. package/extension/libherb/ast_pretty_print.c +1 -1
  13. package/extension/libherb/ast_pretty_print.h +1 -1
  14. package/extension/libherb/buffer.c +10 -1
  15. package/extension/libherb/errors.c +36 -36
  16. package/extension/libherb/errors.h +22 -22
  17. package/extension/libherb/include/ast_node.h +3 -3
  18. package/extension/libherb/include/ast_nodes.h +33 -33
  19. package/extension/libherb/include/ast_pretty_print.h +1 -1
  20. package/extension/libherb/include/errors.h +22 -22
  21. package/extension/libherb/include/lexer_peek_helpers.h +8 -6
  22. package/extension/libherb/include/lexer_struct.h +10 -9
  23. package/extension/libherb/include/location.h +10 -13
  24. package/extension/libherb/include/parser_helpers.h +1 -1
  25. package/extension/libherb/include/position.h +3 -14
  26. package/extension/libherb/include/pretty_print.h +1 -1
  27. package/extension/libherb/include/prism_helpers.h +1 -1
  28. package/extension/libherb/include/range.h +4 -13
  29. package/extension/libherb/include/token.h +0 -3
  30. package/extension/libherb/include/token_struct.h +2 -2
  31. package/extension/libherb/include/version.h +1 -1
  32. package/extension/libherb/lexer.c +3 -2
  33. package/extension/libherb/lexer_peek_helpers.c +10 -4
  34. package/extension/libherb/lexer_peek_helpers.h +8 -6
  35. package/extension/libherb/lexer_struct.h +10 -9
  36. package/extension/libherb/location.c +9 -37
  37. package/extension/libherb/location.h +10 -13
  38. package/extension/libherb/parser.c +98 -119
  39. package/extension/libherb/parser_helpers.c +15 -15
  40. package/extension/libherb/parser_helpers.h +1 -1
  41. package/extension/libherb/position.h +3 -14
  42. package/extension/libherb/pretty_print.c +7 -12
  43. package/extension/libherb/pretty_print.h +1 -1
  44. package/extension/libherb/prism_helpers.c +7 -7
  45. package/extension/libherb/prism_helpers.h +1 -1
  46. package/extension/libherb/range.c +2 -35
  47. package/extension/libherb/range.h +4 -13
  48. package/extension/libherb/token.c +25 -29
  49. package/extension/libherb/token.h +0 -3
  50. package/extension/libherb/token_struct.h +2 -2
  51. package/extension/libherb/version.h +1 -1
  52. package/extension/libherb/visitor.c +1 -1
  53. package/extension/nodes.cpp +1 -1
  54. package/extension/nodes.h +1 -1
  55. package/package.json +2 -2
  56. package/extension/libherb/position.c +0 -33
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.4/templates/src/errors.c.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.5/templates/src/errors.c.erb
3
3
 
4
4
  #include "include/array.h"
5
5
  #include "include/errors.h"
@@ -20,14 +20,15 @@ size_t error_sizeof(void) {
20
20
  return sizeof(struct ERROR_STRUCT);
21
21
  }
22
22
 
23
- void error_init(ERROR_T* error, const error_type_T type, position_T* start, position_T* end) {
23
+ void error_init(ERROR_T* error, const error_type_T type, position_T start, position_T end) {
24
24
  if (!error) { return; }
25
25
 
26
26
  error->type = type;
27
- error->location = location_init(position_copy(start), position_copy(end));
27
+ error->location.start = start;
28
+ error->location.end = end;
28
29
  }
29
30
 
30
- UNEXPECTED_ERROR_T* unexpected_error_init(const char* description, const char* expected, const char* found, position_T* start, position_T* end) {
31
+ UNEXPECTED_ERROR_T* unexpected_error_init(const char* description, const char* expected, const char* found, position_T start, position_T end) {
31
32
  UNEXPECTED_ERROR_T* unexpected_error = malloc(sizeof(UNEXPECTED_ERROR_T));
32
33
 
33
34
  error_init(&unexpected_error->base, UNEXPECTED_ERROR, start, end);
@@ -71,11 +72,11 @@ UNEXPECTED_ERROR_T* unexpected_error_init(const char* description, const char* e
71
72
  return unexpected_error;
72
73
  }
73
74
 
74
- void append_unexpected_error(const char* description, const char* expected, const char* found, position_T* start, position_T* end, array_T* errors) {
75
+ void append_unexpected_error(const char* description, const char* expected, const char* found, position_T start, position_T end, array_T* errors) {
75
76
  array_append(errors, unexpected_error_init(description, expected, found, start, end));
76
77
  }
77
78
 
78
- UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error_init(token_type_T expected_type, token_T* found, position_T* start, position_T* end) {
79
+ UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error_init(token_type_T expected_type, token_T* found, position_T start, position_T end) {
79
80
  UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error = malloc(sizeof(UNEXPECTED_TOKEN_ERROR_T));
80
81
 
81
82
  error_init(&unexpected_token_error->base, UNEXPECTED_TOKEN_ERROR, start, end);
@@ -100,8 +101,8 @@ UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error_init(token_type_T expected_type
100
101
  message_template,
101
102
  truncated_argument_0,
102
103
  truncated_argument_1,
103
- found->location->start->line,
104
- found->location->start->column
104
+ found->location.start.line,
105
+ found->location.start.column
105
106
  );
106
107
 
107
108
  unexpected_token_error->base.message = herb_strdup(message);
@@ -115,11 +116,11 @@ UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error_init(token_type_T expected_type
115
116
  return unexpected_token_error;
116
117
  }
117
118
 
118
- void append_unexpected_token_error(token_type_T expected_type, token_T* found, position_T* start, position_T* end, array_T* errors) {
119
+ void append_unexpected_token_error(token_type_T expected_type, token_T* found, position_T start, position_T end, array_T* errors) {
119
120
  array_append(errors, unexpected_token_error_init(expected_type, found, start, end));
120
121
  }
121
122
 
122
- MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error_init(token_T* closing_tag, position_T* start, position_T* end) {
123
+ MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error_init(token_T* closing_tag, position_T start, position_T end) {
123
124
  MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error = malloc(sizeof(MISSING_OPENING_TAG_ERROR_T));
124
125
 
125
126
  error_init(&missing_opening_tag_error->base, MISSING_OPENING_TAG_ERROR, start, end);
@@ -139,8 +140,8 @@ MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error_init(token_T* closing_tag
139
140
  message_size,
140
141
  message_template,
141
142
  truncated_argument_0,
142
- closing_tag->location->start->line,
143
- closing_tag->location->start->column
143
+ closing_tag->location.start.line,
144
+ closing_tag->location.start.column
144
145
  );
145
146
 
146
147
  missing_opening_tag_error->base.message = herb_strdup(message);
@@ -153,11 +154,11 @@ MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error_init(token_T* closing_tag
153
154
  return missing_opening_tag_error;
154
155
  }
155
156
 
156
- void append_missing_opening_tag_error(token_T* closing_tag, position_T* start, position_T* end, array_T* errors) {
157
+ void append_missing_opening_tag_error(token_T* closing_tag, position_T start, position_T end, array_T* errors) {
157
158
  array_append(errors, missing_opening_tag_error_init(closing_tag, start, end));
158
159
  }
159
160
 
160
- MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error_init(token_T* opening_tag, position_T* start, position_T* end) {
161
+ MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error_init(token_T* opening_tag, position_T start, position_T end) {
161
162
  MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error = malloc(sizeof(MISSING_CLOSING_TAG_ERROR_T));
162
163
 
163
164
  error_init(&missing_closing_tag_error->base, MISSING_CLOSING_TAG_ERROR, start, end);
@@ -181,8 +182,8 @@ MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error_init(token_T* opening_tag
181
182
  message_size,
182
183
  message_template,
183
184
  truncated_argument_0,
184
- opening_tag->location->start->line,
185
- opening_tag->location->start->column,
185
+ opening_tag->location.start.line,
186
+ opening_tag->location.start.column,
186
187
  truncated_argument_3
187
188
  );
188
189
 
@@ -196,11 +197,11 @@ MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error_init(token_T* opening_tag
196
197
  return missing_closing_tag_error;
197
198
  }
198
199
 
199
- void append_missing_closing_tag_error(token_T* opening_tag, position_T* start, position_T* end, array_T* errors) {
200
+ void append_missing_closing_tag_error(token_T* opening_tag, position_T start, position_T end, array_T* errors) {
200
201
  array_append(errors, missing_closing_tag_error_init(opening_tag, start, end));
201
202
  }
202
203
 
203
- TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error_init(token_T* opening_tag, token_T* closing_tag, position_T* start, position_T* end) {
204
+ TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error_init(token_T* opening_tag, token_T* closing_tag, position_T start, position_T end) {
204
205
  TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error = malloc(sizeof(TAG_NAMES_MISMATCH_ERROR_T));
205
206
 
206
207
  error_init(&tag_names_mismatch_error->base, TAG_NAMES_MISMATCH_ERROR, start, end);
@@ -224,11 +225,11 @@ TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error_init(token_T* opening_tag,
224
225
  message_size,
225
226
  message_template,
226
227
  truncated_argument_0,
227
- opening_tag->location->start->line,
228
- opening_tag->location->start->column,
228
+ opening_tag->location.start.line,
229
+ opening_tag->location.start.column,
229
230
  truncated_argument_3,
230
- closing_tag->location->start->line,
231
- closing_tag->location->start->column
231
+ closing_tag->location.start.line,
232
+ closing_tag->location.start.column
232
233
  );
233
234
 
234
235
  tag_names_mismatch_error->base.message = herb_strdup(message);
@@ -242,11 +243,11 @@ TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error_init(token_T* opening_tag,
242
243
  return tag_names_mismatch_error;
243
244
  }
244
245
 
245
- void append_tag_names_mismatch_error(token_T* opening_tag, token_T* closing_tag, position_T* start, position_T* end, array_T* errors) {
246
+ void append_tag_names_mismatch_error(token_T* opening_tag, token_T* closing_tag, position_T start, position_T end, array_T* errors) {
246
247
  array_append(errors, tag_names_mismatch_error_init(opening_tag, closing_tag, start, end));
247
248
  }
248
249
 
249
- QUOTES_MISMATCH_ERROR_T* quotes_mismatch_error_init(token_T* opening_quote, token_T* closing_quote, position_T* start, position_T* end) {
250
+ QUOTES_MISMATCH_ERROR_T* quotes_mismatch_error_init(token_T* opening_quote, token_T* closing_quote, position_T start, position_T end) {
250
251
  QUOTES_MISMATCH_ERROR_T* quotes_mismatch_error = malloc(sizeof(QUOTES_MISMATCH_ERROR_T));
251
252
 
252
253
  error_init(&quotes_mismatch_error->base, QUOTES_MISMATCH_ERROR, start, end);
@@ -271,8 +272,8 @@ QUOTES_MISMATCH_ERROR_T* quotes_mismatch_error_init(token_T* opening_quote, toke
271
272
  message_template,
272
273
  truncated_argument_0,
273
274
  truncated_argument_1,
274
- closing_quote->location->start->line,
275
- closing_quote->location->start->column
275
+ closing_quote->location.start.line,
276
+ closing_quote->location.start.column
276
277
  );
277
278
 
278
279
  quotes_mismatch_error->base.message = herb_strdup(message);
@@ -286,11 +287,11 @@ QUOTES_MISMATCH_ERROR_T* quotes_mismatch_error_init(token_T* opening_quote, toke
286
287
  return quotes_mismatch_error;
287
288
  }
288
289
 
289
- void append_quotes_mismatch_error(token_T* opening_quote, token_T* closing_quote, position_T* start, position_T* end, array_T* errors) {
290
+ void append_quotes_mismatch_error(token_T* opening_quote, token_T* closing_quote, position_T start, position_T end, array_T* errors) {
290
291
  array_append(errors, quotes_mismatch_error_init(opening_quote, closing_quote, start, end));
291
292
  }
292
293
 
293
- VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error_init(token_T* tag_name, const char* expected, const char* found, position_T* start, position_T* end) {
294
+ VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error_init(token_T* tag_name, const char* expected, const char* found, position_T start, position_T end) {
294
295
  VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error = malloc(sizeof(VOID_ELEMENT_CLOSING_TAG_ERROR_T));
295
296
 
296
297
  error_init(&void_element_closing_tag_error->base, VOID_ELEMENT_CLOSING_TAG_ERROR, start, end);
@@ -339,11 +340,11 @@ VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error_init(token_T* t
339
340
  return void_element_closing_tag_error;
340
341
  }
341
342
 
342
- void append_void_element_closing_tag_error(token_T* tag_name, const char* expected, const char* found, position_T* start, position_T* end, array_T* errors) {
343
+ void append_void_element_closing_tag_error(token_T* tag_name, const char* expected, const char* found, position_T start, position_T end, array_T* errors) {
343
344
  array_append(errors, void_element_closing_tag_error_init(tag_name, expected, found, start, end));
344
345
  }
345
346
 
346
- UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error_init(token_T* opening_tag, position_T* start, position_T* end) {
347
+ UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error_init(token_T* opening_tag, position_T start, position_T end) {
347
348
  UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error = malloc(sizeof(UNCLOSED_ELEMENT_ERROR_T));
348
349
 
349
350
  error_init(&unclosed_element_error->base, UNCLOSED_ELEMENT_ERROR, start, end);
@@ -363,8 +364,8 @@ UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error_init(token_T* opening_tag, posi
363
364
  message_size,
364
365
  message_template,
365
366
  truncated_argument_0,
366
- opening_tag->location->start->line,
367
- opening_tag->location->start->column
367
+ opening_tag->location.start.line,
368
+ opening_tag->location.start.column
368
369
  );
369
370
 
370
371
  unclosed_element_error->base.message = herb_strdup(message);
@@ -377,11 +378,11 @@ UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error_init(token_T* opening_tag, posi
377
378
  return unclosed_element_error;
378
379
  }
379
380
 
380
- void append_unclosed_element_error(token_T* opening_tag, position_T* start, position_T* end, array_T* errors) {
381
+ void append_unclosed_element_error(token_T* opening_tag, position_T start, position_T end, array_T* errors) {
381
382
  array_append(errors, unclosed_element_error_init(opening_tag, start, end));
382
383
  }
383
384
 
384
- RUBY_PARSE_ERROR_T* ruby_parse_error_init(const char* error_message, const char* diagnostic_id, const char* level, position_T* start, position_T* end) {
385
+ RUBY_PARSE_ERROR_T* ruby_parse_error_init(const char* error_message, const char* diagnostic_id, const char* level, position_T start, position_T end) {
385
386
  RUBY_PARSE_ERROR_T* ruby_parse_error = malloc(sizeof(RUBY_PARSE_ERROR_T));
386
387
 
387
388
  error_init(&ruby_parse_error->base, RUBY_PARSE_ERROR, start, end);
@@ -420,7 +421,7 @@ RUBY_PARSE_ERROR_T* ruby_parse_error_init(const char* error_message, const char*
420
421
  return ruby_parse_error;
421
422
  }
422
423
 
423
- void append_ruby_parse_error(const char* error_message, const char* diagnostic_id, const char* level, position_T* start, position_T* end, array_T* errors) {
424
+ void append_ruby_parse_error(const char* error_message, const char* diagnostic_id, const char* level, position_T start, position_T end, array_T* errors) {
424
425
  array_append(errors, ruby_parse_error_init(error_message, diagnostic_id, level, start, end));
425
426
  }
426
427
 
@@ -459,7 +460,6 @@ const char* error_human_type(ERROR_T* error) {
459
460
  void error_free_base_error(ERROR_T* error) {
460
461
  if (error == NULL) { return; }
461
462
 
462
- if (error->location != NULL) { location_free(error->location); }
463
463
  if (error->message != NULL) { free(error->message); }
464
464
 
465
465
  free(error);
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.4/templates/src/include/errors.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.5/templates/src/include/errors.h.erb
3
3
 
4
4
  #ifndef HERB_ERRORS_H
5
5
  #define HERB_ERRORS_H
@@ -25,7 +25,7 @@ typedef enum {
25
25
 
26
26
  typedef struct ERROR_STRUCT {
27
27
  error_type_T type;
28
- location_T* location;
28
+ location_T location;
29
29
  char* message;
30
30
  } ERROR_T;
31
31
 
@@ -84,26 +84,26 @@ typedef struct {
84
84
  const char* level;
85
85
  } RUBY_PARSE_ERROR_T;
86
86
 
87
- UNEXPECTED_ERROR_T* unexpected_error_init(const char* description, const char* expected, const char* found, position_T* start, position_T* end);
88
- void append_unexpected_error(const char* description, const char* expected, const char* found, position_T* start, position_T* end, array_T* errors);
89
- UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error_init(token_type_T expected_type, token_T* found, position_T* start, position_T* end);
90
- void append_unexpected_token_error(token_type_T expected_type, token_T* found, position_T* start, position_T* end, array_T* errors);
91
- MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error_init(token_T* closing_tag, position_T* start, position_T* end);
92
- void append_missing_opening_tag_error(token_T* closing_tag, position_T* start, position_T* end, array_T* errors);
93
- MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error_init(token_T* opening_tag, position_T* start, position_T* end);
94
- void append_missing_closing_tag_error(token_T* opening_tag, position_T* start, position_T* end, array_T* errors);
95
- TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error_init(token_T* opening_tag, token_T* closing_tag, position_T* start, position_T* end);
96
- void append_tag_names_mismatch_error(token_T* opening_tag, token_T* closing_tag, position_T* start, position_T* end, array_T* errors);
97
- QUOTES_MISMATCH_ERROR_T* quotes_mismatch_error_init(token_T* opening_quote, token_T* closing_quote, position_T* start, position_T* end);
98
- void append_quotes_mismatch_error(token_T* opening_quote, token_T* closing_quote, position_T* start, position_T* end, array_T* errors);
99
- VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error_init(token_T* tag_name, const char* expected, const char* found, position_T* start, position_T* end);
100
- void append_void_element_closing_tag_error(token_T* tag_name, const char* expected, const char* found, position_T* start, position_T* end, array_T* errors);
101
- UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error_init(token_T* opening_tag, position_T* start, position_T* end);
102
- void append_unclosed_element_error(token_T* opening_tag, position_T* start, position_T* end, array_T* errors);
103
- RUBY_PARSE_ERROR_T* ruby_parse_error_init(const char* error_message, const char* diagnostic_id, const char* level, position_T* start, position_T* end);
104
- void append_ruby_parse_error(const char* error_message, const char* diagnostic_id, const char* level, position_T* start, position_T* end, array_T* errors);
105
-
106
- void error_init(ERROR_T* error, error_type_T type, position_T* start, position_T* end);
87
+ UNEXPECTED_ERROR_T* unexpected_error_init(const char* description, const char* expected, const char* found, position_T start, position_T end);
88
+ void append_unexpected_error(const char* description, const char* expected, const char* found, position_T start, position_T end, array_T* errors);
89
+ UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error_init(token_type_T expected_type, token_T* found, position_T start, position_T end);
90
+ void append_unexpected_token_error(token_type_T expected_type, token_T* found, position_T start, position_T end, array_T* errors);
91
+ MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error_init(token_T* closing_tag, position_T start, position_T end);
92
+ void append_missing_opening_tag_error(token_T* closing_tag, position_T start, position_T end, array_T* errors);
93
+ MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error_init(token_T* opening_tag, position_T start, position_T end);
94
+ void append_missing_closing_tag_error(token_T* opening_tag, position_T start, position_T end, array_T* errors);
95
+ TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error_init(token_T* opening_tag, token_T* closing_tag, position_T start, position_T end);
96
+ void append_tag_names_mismatch_error(token_T* opening_tag, token_T* closing_tag, position_T start, position_T end, array_T* errors);
97
+ QUOTES_MISMATCH_ERROR_T* quotes_mismatch_error_init(token_T* opening_quote, token_T* closing_quote, position_T start, position_T end);
98
+ void append_quotes_mismatch_error(token_T* opening_quote, token_T* closing_quote, position_T start, position_T end, array_T* errors);
99
+ VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error_init(token_T* tag_name, const char* expected, const char* found, position_T start, position_T end);
100
+ void append_void_element_closing_tag_error(token_T* tag_name, const char* expected, const char* found, position_T start, position_T end, array_T* errors);
101
+ UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error_init(token_T* opening_tag, position_T start, position_T end);
102
+ void append_unclosed_element_error(token_T* opening_tag, position_T start, position_T end, array_T* errors);
103
+ RUBY_PARSE_ERROR_T* ruby_parse_error_init(const char* error_message, const char* diagnostic_id, const char* level, position_T start, position_T end);
104
+ void append_ruby_parse_error(const char* error_message, const char* diagnostic_id, const char* level, position_T start, position_T end, array_T* errors);
105
+
106
+ void error_init(ERROR_T* error, error_type_T type, position_T start, position_T end);
107
107
 
108
108
  size_t error_sizeof(void);
109
109
  error_type_T error_type(ERROR_T* error);
@@ -6,7 +6,7 @@
6
6
  #include "position.h"
7
7
  #include "token_struct.h"
8
8
 
9
- void ast_node_init(AST_NODE_T* node, ast_node_type_T type, position_T* start, position_T* end, array_T* errors);
9
+ void ast_node_init(AST_NODE_T* node, ast_node_type_T type, position_T start, position_T end, array_T* errors);
10
10
  void ast_node_free(AST_NODE_T* node);
11
11
 
12
12
  AST_LITERAL_NODE_T* ast_literal_node_init_from_token(const token_T* token);
@@ -18,8 +18,8 @@ ast_node_type_T ast_node_type(const AST_NODE_T* node);
18
18
 
19
19
  char* ast_node_name(AST_NODE_T* node);
20
20
 
21
- void ast_node_set_start(AST_NODE_T* node, position_T* position);
22
- void ast_node_set_end(AST_NODE_T* node, position_T* position);
21
+ void ast_node_set_start(AST_NODE_T* node, position_T position);
22
+ void ast_node_set_end(AST_NODE_T* node, position_T position);
23
23
 
24
24
  size_t ast_node_errors_count(const AST_NODE_T* node);
25
25
  array_T* ast_node_errors(const AST_NODE_T* node);
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.4/templates/src/include/ast_nodes.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.5/templates/src/include/ast_nodes.h.erb
3
3
 
4
4
  #ifndef HERB_AST_NODES_H
5
5
  #define HERB_AST_NODES_H
@@ -51,7 +51,7 @@ typedef enum {
51
51
 
52
52
  typedef struct AST_NODE_STRUCT {
53
53
  ast_node_type_T type;
54
- location_T* location;
54
+ location_T location;
55
55
  // maybe a range too?
56
56
  array_T* errors;
57
57
  } AST_NODE_T;
@@ -307,37 +307,37 @@ typedef struct AST_ERB_IN_NODE_STRUCT {
307
307
  array_T* statements;
308
308
  } AST_ERB_IN_NODE_T;
309
309
 
310
- AST_DOCUMENT_NODE_T* ast_document_node_init(array_T* children, position_T* start_position, position_T* end_position, array_T* errors);
311
- AST_LITERAL_NODE_T* ast_literal_node_init(const char* content, position_T* start_position, position_T* end_position, array_T* errors);
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);
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);
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);
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);
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);
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);
318
- AST_HTML_TEXT_NODE_T* ast_html_text_node_init(const char* content, position_T* start_position, position_T* end_position, array_T* errors);
319
- AST_HTML_COMMENT_NODE_T* ast_html_comment_node_init(token_T* comment_start, array_T* children, token_T* comment_end, position_T* start_position, position_T* end_position, array_T* errors);
320
- AST_HTML_DOCTYPE_NODE_T* ast_html_doctype_node_init(token_T* tag_opening, array_T* children, token_T* tag_closing, position_T* start_position, position_T* end_position, array_T* errors);
321
- AST_XML_DECLARATION_NODE_T* ast_xml_declaration_node_init(token_T* tag_opening, array_T* children, token_T* tag_closing, position_T* start_position, position_T* end_position, array_T* errors);
322
- AST_CDATA_NODE_T* ast_cdata_node_init(token_T* tag_opening, array_T* children, token_T* tag_closing, position_T* start_position, position_T* end_position, array_T* errors);
323
- AST_WHITESPACE_NODE_T* ast_whitespace_node_init(token_T* value, position_T* start_position, position_T* end_position, array_T* errors);
324
- AST_ERB_CONTENT_NODE_T* ast_erb_content_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, analyzed_ruby_T* analyzed_ruby, bool parsed, bool valid, position_T* start_position, position_T* end_position, array_T* errors);
325
- AST_ERB_END_NODE_T* ast_erb_end_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, position_T* start_position, position_T* end_position, array_T* errors);
326
- AST_ERB_ELSE_NODE_T* ast_erb_else_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, position_T* start_position, position_T* end_position, array_T* errors);
327
- AST_ERB_IF_NODE_T* ast_erb_if_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_NODE_STRUCT* subsequent, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
328
- AST_ERB_BLOCK_NODE_T* ast_erb_block_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* body, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
329
- AST_ERB_WHEN_NODE_T* ast_erb_when_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, position_T* start_position, position_T* end_position, array_T* errors);
330
- AST_ERB_CASE_NODE_T* ast_erb_case_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* children, array_T* conditions, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
331
- AST_ERB_CASE_MATCH_NODE_T* ast_erb_case_match_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* children, array_T* conditions, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
332
- AST_ERB_WHILE_NODE_T* ast_erb_while_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
333
- AST_ERB_UNTIL_NODE_T* ast_erb_until_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
334
- AST_ERB_FOR_NODE_T* ast_erb_for_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
335
- AST_ERB_RESCUE_NODE_T* ast_erb_rescue_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_ERB_RESCUE_NODE_STRUCT* subsequent, position_T* start_position, position_T* end_position, array_T* errors);
336
- AST_ERB_ENSURE_NODE_T* ast_erb_ensure_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, position_T* start_position, position_T* end_position, array_T* errors);
337
- AST_ERB_BEGIN_NODE_T* ast_erb_begin_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_ERB_RESCUE_NODE_STRUCT* rescue_clause, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_ENSURE_NODE_STRUCT* ensure_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
338
- AST_ERB_UNLESS_NODE_T* ast_erb_unless_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T* start_position, position_T* end_position, array_T* errors);
339
- AST_ERB_YIELD_NODE_T* ast_erb_yield_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, position_T* start_position, position_T* end_position, array_T* errors);
340
- AST_ERB_IN_NODE_T* ast_erb_in_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, position_T* start_position, position_T* end_position, array_T* errors);
310
+ AST_DOCUMENT_NODE_T* ast_document_node_init(array_T* children, position_T start_position, position_T end_position, array_T* errors);
311
+ AST_LITERAL_NODE_T* ast_literal_node_init(const char* content, position_T start_position, position_T end_position, array_T* errors);
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);
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);
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);
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);
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);
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);
318
+ AST_HTML_TEXT_NODE_T* ast_html_text_node_init(const char* content, position_T start_position, position_T end_position, array_T* errors);
319
+ AST_HTML_COMMENT_NODE_T* ast_html_comment_node_init(token_T* comment_start, array_T* children, token_T* comment_end, position_T start_position, position_T end_position, array_T* errors);
320
+ AST_HTML_DOCTYPE_NODE_T* ast_html_doctype_node_init(token_T* tag_opening, array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, array_T* errors);
321
+ AST_XML_DECLARATION_NODE_T* ast_xml_declaration_node_init(token_T* tag_opening, array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, array_T* errors);
322
+ AST_CDATA_NODE_T* ast_cdata_node_init(token_T* tag_opening, array_T* children, token_T* tag_closing, position_T start_position, position_T end_position, array_T* errors);
323
+ AST_WHITESPACE_NODE_T* ast_whitespace_node_init(token_T* value, position_T start_position, position_T end_position, array_T* errors);
324
+ AST_ERB_CONTENT_NODE_T* ast_erb_content_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, analyzed_ruby_T* analyzed_ruby, bool parsed, bool valid, position_T start_position, position_T end_position, array_T* errors);
325
+ AST_ERB_END_NODE_T* ast_erb_end_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, position_T start_position, position_T end_position, array_T* errors);
326
+ AST_ERB_ELSE_NODE_T* ast_erb_else_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, position_T start_position, position_T end_position, array_T* errors);
327
+ AST_ERB_IF_NODE_T* ast_erb_if_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_NODE_STRUCT* subsequent, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, array_T* errors);
328
+ AST_ERB_BLOCK_NODE_T* ast_erb_block_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* body, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, array_T* errors);
329
+ AST_ERB_WHEN_NODE_T* ast_erb_when_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, position_T start_position, position_T end_position, array_T* errors);
330
+ AST_ERB_CASE_NODE_T* ast_erb_case_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* children, array_T* conditions, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, array_T* errors);
331
+ AST_ERB_CASE_MATCH_NODE_T* ast_erb_case_match_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* children, array_T* conditions, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, array_T* errors);
332
+ AST_ERB_WHILE_NODE_T* ast_erb_while_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, array_T* errors);
333
+ AST_ERB_UNTIL_NODE_T* ast_erb_until_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, array_T* errors);
334
+ AST_ERB_FOR_NODE_T* ast_erb_for_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, array_T* errors);
335
+ AST_ERB_RESCUE_NODE_T* ast_erb_rescue_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_ERB_RESCUE_NODE_STRUCT* subsequent, position_T start_position, position_T end_position, array_T* errors);
336
+ AST_ERB_ENSURE_NODE_T* ast_erb_ensure_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, position_T start_position, position_T end_position, array_T* errors);
337
+ AST_ERB_BEGIN_NODE_T* ast_erb_begin_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_ERB_RESCUE_NODE_STRUCT* rescue_clause, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_ENSURE_NODE_STRUCT* ensure_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, array_T* errors);
338
+ AST_ERB_UNLESS_NODE_T* ast_erb_unless_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, struct AST_ERB_ELSE_NODE_STRUCT* else_clause, struct AST_ERB_END_NODE_STRUCT* end_node, position_T start_position, position_T end_position, array_T* errors);
339
+ AST_ERB_YIELD_NODE_T* ast_erb_yield_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, position_T start_position, position_T end_position, array_T* errors);
340
+ AST_ERB_IN_NODE_T* ast_erb_in_node_init(token_T* tag_opening, token_T* content, token_T* tag_closing, array_T* statements, position_T start_position, position_T end_position, array_T* errors);
341
341
 
342
342
  const char* ast_node_type_to_string(AST_NODE_T* node);
343
343
  const char* ast_node_human_type(AST_NODE_T* node);
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.4/templates/src/include/ast_pretty_print.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.5/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
@@ -1,5 +1,5 @@
1
1
  // NOTE: This file is generated by the templates/template.rb script and should not
2
- // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.4/templates/src/include/errors.h.erb
2
+ // be modified manually. See /Users/marcoroth/Development/herb-release-0.7.5/templates/src/include/errors.h.erb
3
3
 
4
4
  #ifndef HERB_ERRORS_H
5
5
  #define HERB_ERRORS_H
@@ -25,7 +25,7 @@ typedef enum {
25
25
 
26
26
  typedef struct ERROR_STRUCT {
27
27
  error_type_T type;
28
- location_T* location;
28
+ location_T location;
29
29
  char* message;
30
30
  } ERROR_T;
31
31
 
@@ -84,26 +84,26 @@ typedef struct {
84
84
  const char* level;
85
85
  } RUBY_PARSE_ERROR_T;
86
86
 
87
- UNEXPECTED_ERROR_T* unexpected_error_init(const char* description, const char* expected, const char* found, position_T* start, position_T* end);
88
- void append_unexpected_error(const char* description, const char* expected, const char* found, position_T* start, position_T* end, array_T* errors);
89
- UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error_init(token_type_T expected_type, token_T* found, position_T* start, position_T* end);
90
- void append_unexpected_token_error(token_type_T expected_type, token_T* found, position_T* start, position_T* end, array_T* errors);
91
- MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error_init(token_T* closing_tag, position_T* start, position_T* end);
92
- void append_missing_opening_tag_error(token_T* closing_tag, position_T* start, position_T* end, array_T* errors);
93
- MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error_init(token_T* opening_tag, position_T* start, position_T* end);
94
- void append_missing_closing_tag_error(token_T* opening_tag, position_T* start, position_T* end, array_T* errors);
95
- TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error_init(token_T* opening_tag, token_T* closing_tag, position_T* start, position_T* end);
96
- void append_tag_names_mismatch_error(token_T* opening_tag, token_T* closing_tag, position_T* start, position_T* end, array_T* errors);
97
- QUOTES_MISMATCH_ERROR_T* quotes_mismatch_error_init(token_T* opening_quote, token_T* closing_quote, position_T* start, position_T* end);
98
- void append_quotes_mismatch_error(token_T* opening_quote, token_T* closing_quote, position_T* start, position_T* end, array_T* errors);
99
- VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error_init(token_T* tag_name, const char* expected, const char* found, position_T* start, position_T* end);
100
- void append_void_element_closing_tag_error(token_T* tag_name, const char* expected, const char* found, position_T* start, position_T* end, array_T* errors);
101
- UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error_init(token_T* opening_tag, position_T* start, position_T* end);
102
- void append_unclosed_element_error(token_T* opening_tag, position_T* start, position_T* end, array_T* errors);
103
- RUBY_PARSE_ERROR_T* ruby_parse_error_init(const char* error_message, const char* diagnostic_id, const char* level, position_T* start, position_T* end);
104
- void append_ruby_parse_error(const char* error_message, const char* diagnostic_id, const char* level, position_T* start, position_T* end, array_T* errors);
105
-
106
- void error_init(ERROR_T* error, error_type_T type, position_T* start, position_T* end);
87
+ UNEXPECTED_ERROR_T* unexpected_error_init(const char* description, const char* expected, const char* found, position_T start, position_T end);
88
+ void append_unexpected_error(const char* description, const char* expected, const char* found, position_T start, position_T end, array_T* errors);
89
+ UNEXPECTED_TOKEN_ERROR_T* unexpected_token_error_init(token_type_T expected_type, token_T* found, position_T start, position_T end);
90
+ void append_unexpected_token_error(token_type_T expected_type, token_T* found, position_T start, position_T end, array_T* errors);
91
+ MISSING_OPENING_TAG_ERROR_T* missing_opening_tag_error_init(token_T* closing_tag, position_T start, position_T end);
92
+ void append_missing_opening_tag_error(token_T* closing_tag, position_T start, position_T end, array_T* errors);
93
+ MISSING_CLOSING_TAG_ERROR_T* missing_closing_tag_error_init(token_T* opening_tag, position_T start, position_T end);
94
+ void append_missing_closing_tag_error(token_T* opening_tag, position_T start, position_T end, array_T* errors);
95
+ TAG_NAMES_MISMATCH_ERROR_T* tag_names_mismatch_error_init(token_T* opening_tag, token_T* closing_tag, position_T start, position_T end);
96
+ void append_tag_names_mismatch_error(token_T* opening_tag, token_T* closing_tag, position_T start, position_T end, array_T* errors);
97
+ QUOTES_MISMATCH_ERROR_T* quotes_mismatch_error_init(token_T* opening_quote, token_T* closing_quote, position_T start, position_T end);
98
+ void append_quotes_mismatch_error(token_T* opening_quote, token_T* closing_quote, position_T start, position_T end, array_T* errors);
99
+ VOID_ELEMENT_CLOSING_TAG_ERROR_T* void_element_closing_tag_error_init(token_T* tag_name, const char* expected, const char* found, position_T start, position_T end);
100
+ void append_void_element_closing_tag_error(token_T* tag_name, const char* expected, const char* found, position_T start, position_T end, array_T* errors);
101
+ UNCLOSED_ELEMENT_ERROR_T* unclosed_element_error_init(token_T* opening_tag, position_T start, position_T end);
102
+ void append_unclosed_element_error(token_T* opening_tag, position_T start, position_T end, array_T* errors);
103
+ RUBY_PARSE_ERROR_T* ruby_parse_error_init(const char* error_message, const char* diagnostic_id, const char* level, position_T start, position_T end);
104
+ void append_ruby_parse_error(const char* error_message, const char* diagnostic_id, const char* level, position_T start, position_T end, array_T* errors);
105
+
106
+ void error_init(ERROR_T* error, error_type_T type, position_T start, position_T end);
107
107
 
108
108
  size_t error_sizeof(void);
109
109
  error_type_T error_type(ERROR_T* error);
@@ -5,16 +5,17 @@
5
5
  #include "token_struct.h"
6
6
 
7
7
  #include <stdbool.h>
8
+ #include <stdint.h>
8
9
  #include <stdio.h>
9
10
  #include <stdlib.h>
10
11
 
11
12
  typedef struct {
12
- size_t position;
13
- size_t line;
14
- size_t column;
15
- size_t previous_position;
16
- size_t previous_line;
17
- size_t previous_column;
13
+ uint32_t position;
14
+ uint32_t line;
15
+ uint32_t column;
16
+ uint32_t previous_position;
17
+ uint32_t previous_line;
18
+ uint32_t previous_column;
18
19
  char current_character;
19
20
  lexer_state_T state;
20
21
  } lexer_state_snapshot_T;
@@ -31,6 +32,7 @@ bool lexer_peek_for_html_comment_end(const lexer_T* lexer, int offset);
31
32
  bool lexer_peek_erb_close_tag(const lexer_T* lexer, int offset);
32
33
  bool lexer_peek_erb_dash_close_tag(const lexer_T* lexer, int offset);
33
34
  bool lexer_peek_erb_percent_close_tag(const lexer_T* lexer, int offset);
35
+ bool lexer_peek_erb_equals_close_tag(const lexer_T* lexer, int offset);
34
36
  bool lexer_peek_erb_end(const lexer_T* lexer, int offset);
35
37
 
36
38
  char lexer_backtrack(const lexer_T* lexer, int offset);
@@ -2,6 +2,7 @@
2
2
  #define HERB_LEXER_STRUCT_H
3
3
 
4
4
  #include <stdbool.h>
5
+ #include <stdint.h>
5
6
  #include <stdlib.h>
6
7
 
7
8
  typedef enum {
@@ -12,20 +13,20 @@ typedef enum {
12
13
 
13
14
  typedef struct LEXER_STRUCT {
14
15
  const char* source;
15
- size_t source_length;
16
+ uint32_t source_length;
16
17
 
17
- size_t current_line;
18
- size_t current_column;
19
- size_t current_position;
18
+ uint32_t current_line;
19
+ uint32_t current_column;
20
+ uint32_t current_position;
20
21
 
21
- size_t previous_line;
22
- size_t previous_column;
23
- size_t previous_position;
22
+ uint32_t previous_line;
23
+ uint32_t previous_column;
24
+ uint32_t previous_position;
24
25
 
25
26
  char current_character;
26
27
  lexer_state_T state;
27
- size_t stall_counter;
28
- size_t last_position;
28
+ uint32_t stall_counter;
29
+ uint32_t last_position;
29
30
  bool stalled;
30
31
  } lexer_T;
31
32
 
@@ -1,25 +1,22 @@
1
1
  #ifndef HERB_LOCATION_H
2
2
  #define HERB_LOCATION_H
3
3
 
4
+ #include <stdint.h>
4
5
  #include <stdlib.h>
5
6
 
6
7
  #include "position.h"
7
8
 
8
9
  typedef struct LOCATION_STRUCT {
9
- position_T* start;
10
- position_T* end;
10
+ position_T start;
11
+ position_T end;
11
12
  } location_T;
12
13
 
13
- location_T* location_init(position_T* start, position_T* end);
14
- location_T* location_from(size_t start_line, size_t start_column, size_t end_line, size_t end_column);
15
-
16
- position_T* location_start(location_T* location);
17
- position_T* location_end_(location_T* location);
18
-
19
- size_t location_sizeof(void);
20
-
21
- location_T* location_copy(location_T* location);
22
-
23
- void location_free(location_T* location);
14
+ void location_from(
15
+ location_T* location,
16
+ uint32_t start_line,
17
+ uint32_t start_column,
18
+ uint32_t end_line,
19
+ uint32_t end_column
20
+ );
24
21
 
25
22
  #endif
@@ -19,7 +19,7 @@ void parser_append_literal_node_from_buffer(
19
19
  const parser_T* parser,
20
20
  buffer_T* buffer,
21
21
  array_T* children,
22
- position_T* start
22
+ position_T start
23
23
  );
24
24
 
25
25
  bool parser_in_svg_context(const parser_T* parser);
@@ -1,22 +1,11 @@
1
1
  #ifndef HERB_POSITION_H
2
2
  #define HERB_POSITION_H
3
3
 
4
- #include <stdlib.h>
4
+ #include <stdint.h>
5
5
 
6
6
  typedef struct POSITION_STRUCT {
7
- size_t line;
8
- size_t column;
7
+ uint32_t line;
8
+ uint32_t column;
9
9
  } position_T;
10
10
 
11
- position_T* position_init(size_t line, size_t column);
12
-
13
- size_t position_line(const position_T* position);
14
- size_t position_column(const position_T* position);
15
-
16
- size_t position_sizeof(void);
17
-
18
- position_T* position_copy(position_T* position);
19
-
20
- void position_free(position_T* position);
21
-
22
11
  #endif
@@ -21,7 +21,7 @@ void pretty_print_position_property(
21
21
  buffer_T* buffer
22
22
  );
23
23
 
24
- void pretty_print_location(location_T* location, buffer_T* buffer);
24
+ void pretty_print_location(location_T location, buffer_T* buffer);
25
25
 
26
26
  void pretty_print_property(
27
27
  const char* name,