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 "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
12void parser_push_open_tag(const parser_T* parser, token_T* tag_name);
13bool parser_check_matching_tag(const parser_T* parser, hb_string_T tag_name);
15
17 parser_T* parser,
18 hb_array_T* errors,
19 const char* description,
20 token_type_T first_token,
21 ...
22);
23#define parser_append_unexpected_error(parser, errors, description, ...) \
24 parser_append_unexpected_error_impl(parser, errors, description, __VA_ARGS__, TOKEN_SENTINEL)
25
27 parser_T* parser,
28 hb_array_T* errors,
29 const char* description,
30 const char* expected
31);
32void parser_append_unexpected_token_error(parser_T* parser, token_type_T expected_type, hb_array_T* errors);
33
35 const parser_T* parser,
36 hb_buffer_T* buffer,
37 hb_array_T* children,
38 position_T start
39);
40
41bool parser_in_svg_context(const parser_T* parser);
42
44bool parser_is_foreign_content_tag(hb_string_T tag_name);
46
49
50bool parser_is_expected_closing_tag_name(hb_string_T tag_name, foreign_content_type_T expected_type);
51
54token_T* parser_consume_expected(parser_T* parser, token_type_T type, hb_array_T* array);
55
57 parser_T* parser,
59 hb_array_T* body,
60 hb_array_T* errors
61);
63 const parser_T* parser,
64 const AST_HTML_CLOSE_TAG_NODE_T* close_tag,
65 hb_array_T* errors
66);
67
68void parser_synchronize(parser_T* parser, hb_array_T* errors);
69
70bool parser_can_close_ancestor(const parser_T* parser, hb_string_T tag_name);
71size_t parser_find_ancestor_depth(const parser_T* parser, hb_string_T tag_name);
72
73#endif
foreign_content_type_T
Definition parser.h:9
token_T * parser_advance(parser_T *parser)
Definition parser_helpers.c:174
void parser_append_unexpected_error_string(parser_T *parser, hb_array_T *errors, const char *description, const char *expected)
Definition parser_helpers.c:122
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:154
token_T * parser_pop_open_tag(const parser_T *parser)
Definition parser_helpers.c:28
void parser_enter_foreign_content(parser_T *parser, foreign_content_type_T type)
Definition parser_helpers.c:80
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:40
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:232
void parser_append_unexpected_token_error(parser_T *parser, token_type_T expected_type, hb_array_T *errors)
Definition parser_helpers.c:143
bool parser_check_matching_tag(const parser_T *parser, hb_string_T tag_name)
Definition parser_helpers.c:19
bool parser_is_foreign_content_tag(hb_string_T tag_name)
Definition parser_helpers.c:68
foreign_content_type_T parser_get_foreign_content_type(hb_string_T tag_name)
Definition parser_helpers.c:59
bool parser_is_expected_closing_tag_name(hb_string_T tag_name, foreign_content_type_T expected_type)
Definition parser_helpers.c:260
size_t parser_find_ancestor_depth(const parser_T *parser, hb_string_T tag_name)
Definition parser_helpers.c:296
bool parser_can_close_ancestor(const parser_T *parser, hb_string_T tag_name)
Definition parser_helpers.c:284
void parser_push_open_tag(const parser_T *parser, token_T *tag_name)
Definition parser_helpers.c:14
void parser_exit_foreign_content(parser_T *parser)
Definition parser_helpers.c:87
void parser_append_unexpected_error_impl(parser_T *parser, hb_array_T *errors, const char *description, token_type_T first_token,...)
Definition parser_helpers.c:94
AST_HTML_ELEMENT_NODE_T * parser_handle_missing_close_tag(parser_T *parser, AST_HTML_OPEN_TAG_NODE_T *open_tag, hb_array_T *body, hb_array_T *errors)
Definition parser_helpers.c:204
void parser_synchronize(parser_T *parser, hb_array_T *errors)
Definition parser_helpers.c:268
token_T * parser_consume_if_present(parser_T *parser, token_type_T type)
Definition parser_helpers.c:180
token_T * parser_consume_expected(parser_T *parser, token_type_T type, hb_array_T *array)
Definition parser_helpers.c:185
hb_string_T parser_get_foreign_content_closing_tag(foreign_content_type_T type)
Definition parser_helpers.c:72
Definition ast_nodes.h:91
Definition ast_nodes.h:104
Definition ast_nodes.h:75
Definition parser.h:33
Definition position.h:8
Definition token_struct.h:57
token_type_T
Definition token_struct.h:9