$darkmode
Herb C Reference
parser_helpers.h
Go to the documentation of this file.
1 #ifndef HERB_PARSER_HELPERS_H
2 #define HERB_PARSER_HELPERS_H
3 
4 #include "ast_nodes.h"
5 #include "errors.h"
6 #include "parser.h"
7 #include "token.h"
8 #include "util/hb_array.h"
9 #include "util/hb_buffer.h"
10 #include "util/hb_string.h"
11 
12 void parser_push_open_tag(const parser_T* parser, token_T* tag_name);
13 bool parser_check_matching_tag(const parser_T* parser, hb_string_T tag_name);
14 token_T* parser_pop_open_tag(const parser_T* parser);
15 
17  parser_T* parser,
18  const char* description,
19  const char* expected,
20  hb_array_T* errors
21 );
22 void parser_append_unexpected_token_error(parser_T* parser, token_type_T expected_type, hb_array_T* errors);
23 
25  const parser_T* parser,
26  hb_buffer_T* buffer,
27  hb_array_T* children,
28  position_T start
29 );
30 
31 bool parser_in_svg_context(const parser_T* parser);
32 
34 bool parser_is_foreign_content_tag(hb_string_T tag_name);
36 
39 
40 bool parser_is_expected_closing_tag_name(hb_string_T tag_name, foreign_content_type_T expected_type);
41 
44 token_T* parser_consume_expected(parser_T* parser, token_type_T type, hb_array_T* array);
45 
47  AST_HTML_OPEN_TAG_NODE_T* open_tag,
48  hb_array_T* body,
49  hb_array_T* errors
50 );
52  const parser_T* parser,
53  const AST_HTML_CLOSE_TAG_NODE_T* close_tag,
54  hb_array_T* errors
55 );
56 
57 #endif
foreign_content_type_T
Definition: parser.h:8
token_T * parser_consume_if_present(parser_T *parser, token_type_T type)
Definition: parser_helpers.c:147
token_T * parser_consume_expected(parser_T *parser, token_type_T type, hb_array_T *array)
Definition: parser_helpers.c:152
void parser_append_unexpected_error(parser_T *parser, const char *description, const char *expected, hb_array_T *errors)
Definition: parser_helpers.c:96
void parser_append_literal_node_from_buffer(const parser_T *parser, hb_buffer_T *buffer, hb_array_T *children, position_T start)
Definition: parser_helpers.c:126
token_T * parser_advance(parser_T *parser)
Definition: parser_helpers.c:141
void parser_enter_foreign_content(parser_T *parser, foreign_content_type_T type)
Definition: parser_helpers.c:82
bool parser_in_svg_context(const parser_T *parser)
Checks if any element in the open tags stack is an SVG element.
Definition: parser_helpers.c:42
AST_HTML_ELEMENT_NODE_T * parser_handle_missing_close_tag(AST_HTML_OPEN_TAG_NODE_T *open_tag, hb_array_T *body, hb_array_T *errors)
Definition: parser_helpers.c:164
void parser_handle_mismatched_tags(const parser_T *parser, const AST_HTML_CLOSE_TAG_NODE_T *close_tag, hb_array_T *errors)
Definition: parser_helpers.c:189
void parser_append_unexpected_token_error(parser_T *parser, token_type_T expected_type, hb_array_T *errors)
Definition: parser_helpers.c:116
bool parser_check_matching_tag(const parser_T *parser, hb_string_T tag_name)
Definition: parser_helpers.c:21
bool parser_is_foreign_content_tag(hb_string_T tag_name)
Definition: parser_helpers.c:70
foreign_content_type_T parser_get_foreign_content_type(hb_string_T tag_name)
Definition: parser_helpers.c:61
bool parser_is_expected_closing_tag_name(hb_string_T tag_name, foreign_content_type_T expected_type)
Definition: parser_helpers.c:215
void parser_push_open_tag(const parser_T *parser, token_T *tag_name)
Definition: parser_helpers.c:16
void parser_exit_foreign_content(parser_T *parser)
Definition: parser_helpers.c:89
token_T * parser_pop_open_tag(const parser_T *parser)
Definition: parser_helpers.c:30
hb_string_T parser_get_foreign_content_closing_tag(foreign_content_type_T type)
Definition: parser_helpers.c:74
Definition: ast_nodes.h:80
Definition: ast_nodes.h:88
Definition: ast_nodes.h:71
Definition: parser.h:24
Definition: position.h:6
Definition: token_struct.h:51
token_type_T
Definition: token_struct.h:7