Herb C Reference
Loading...
Searching...
No Matches
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 "parser.h"
6#include "util/hb_array.h"
7#include "util/hb_buffer.h"
8#include "util/hb_string.h"
9
10void parser_push_open_tag(const parser_T* parser, token_T* tag_name);
11bool parser_check_matching_tag(const parser_T* parser, hb_string_T tag_name);
13
15 parser_T* parser,
16 const char* description,
17 const char* expected,
18 hb_array_T* errors
19);
20void parser_append_unexpected_token_error(parser_T* parser, token_type_T expected_type, hb_array_T* errors);
21
23 const parser_T* parser,
24 hb_buffer_T* buffer,
25 hb_array_T* children,
26 position_T start
27);
28
29bool parser_in_svg_context(const parser_T* parser);
30
32bool parser_is_foreign_content_tag(hb_string_T tag_name);
34
37
38bool parser_is_expected_closing_tag_name(hb_string_T tag_name, foreign_content_type_T expected_type);
39
42token_T* parser_consume_expected(parser_T* parser, token_type_T type, hb_array_T* array);
43
45 const parser_T* parser,
47 hb_array_T* body,
48 hb_array_T* errors
49);
51 const parser_T* parser,
52 const AST_HTML_CLOSE_TAG_NODE_T* close_tag,
53 hb_array_T* errors
54);
55
56void parser_synchronize(parser_T* parser, hb_array_T* errors);
57
58bool parser_can_close_ancestor(const parser_T* parser, hb_string_T tag_name);
59size_t parser_find_ancestor_depth(const parser_T* parser, hb_string_T tag_name);
60
61#endif
foreign_content_type_T
Definition parser.h:9
token_T * parser_advance(parser_T *parser)
Definition parser_helpers.c:140
void parser_append_unexpected_error(parser_T *parser, const char *description, const char *expected, hb_array_T *errors)
Definition parser_helpers.c:93
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:125
token_T * parser_pop_open_tag(const parser_T *parser)
Definition parser_helpers.c:27
void parser_enter_foreign_content(parser_T *parser, foreign_content_type_T type)
Definition parser_helpers.c:79
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:39
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:198
void parser_append_unexpected_token_error(parser_T *parser, token_type_T expected_type, hb_array_T *errors)
Definition parser_helpers.c:114
bool parser_check_matching_tag(const parser_T *parser, hb_string_T tag_name)
Definition parser_helpers.c:18
bool parser_is_foreign_content_tag(hb_string_T tag_name)
Definition parser_helpers.c:67
foreign_content_type_T parser_get_foreign_content_type(hb_string_T tag_name)
Definition parser_helpers.c:58
bool parser_is_expected_closing_tag_name(hb_string_T tag_name, foreign_content_type_T expected_type)
Definition parser_helpers.c:226
size_t parser_find_ancestor_depth(const parser_T *parser, hb_string_T tag_name)
Definition parser_helpers.c:262
bool parser_can_close_ancestor(const parser_T *parser, hb_string_T tag_name)
Definition parser_helpers.c:250
void parser_push_open_tag(const parser_T *parser, token_T *tag_name)
Definition parser_helpers.c:13
void parser_exit_foreign_content(parser_T *parser)
Definition parser_helpers.c:86
void parser_synchronize(parser_T *parser, hb_array_T *errors)
Definition parser_helpers.c:234
AST_HTML_ELEMENT_NODE_T * parser_handle_missing_close_tag(const parser_T *parser, AST_HTML_OPEN_TAG_NODE_T *open_tag, hb_array_T *body, hb_array_T *errors)
Definition parser_helpers.c:170
token_T * parser_consume_if_present(parser_T *parser, token_type_T type)
Definition parser_helpers.c:146
token_T * parser_consume_expected(parser_T *parser, token_type_T type, hb_array_T *array)
Definition parser_helpers.c:151
hb_string_T parser_get_foreign_content_closing_tag(foreign_content_type_T type)
Definition parser_helpers.c:71
Definition ast_nodes.h:93
Definition ast_nodes.h:106
Definition ast_nodes.h:77
Definition parser.h:33
Definition position.h:8
Definition token_struct.h:54
token_type_T
Definition token_struct.h:9