$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 "array.h"
5 #include "ast_nodes.h"
6 #include "buffer.h"
7 #include "errors.h"
8 #include "parser.h"
9 #include "token.h"
10 
11 void parser_push_open_tag(const parser_T* parser, token_T* tag_name);
12 bool parser_check_matching_tag(const parser_T* parser, const char* tag_name);
13 token_T* parser_pop_open_tag(const parser_T* parser);
14 
15 void parser_append_unexpected_error(parser_T* parser, const char* description, const char* expected, array_T* errors);
16 void parser_append_unexpected_token_error(parser_T* parser, token_type_T expected_type, array_T* errors);
17 
19  const parser_T* parser,
20  buffer_T* buffer,
21  array_T* children,
22  position_T* start
23 );
24 
25 bool parser_in_svg_context(const parser_T* parser);
26 
30 
32  AST_HTML_OPEN_TAG_NODE_T* open_tag,
33  array_T* body,
34  array_T* errors
35 );
36 void parser_handle_mismatched_tags(const parser_T* parser, const AST_HTML_CLOSE_TAG_NODE_T* close_tag, array_T* errors);
37 
38 #endif
token_T * parser_consume_expected(parser_T *parser, token_type_T type, array_T *array)
Definition: parser_helpers.c:108
token_T * parser_consume_if_present(parser_T *parser, token_type_T type)
Definition: parser_helpers.c:103
void parser_append_literal_node_from_buffer(const parser_T *parser, buffer_T *buffer, array_T *children, position_T *start)
Definition: parser_helpers.c:82
token_T * parser_advance(parser_T *parser)
Definition: parser_helpers.c:97
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:41
void parser_handle_mismatched_tags(const parser_T *parser, const AST_HTML_CLOSE_TAG_NODE_T *close_tag, array_T *errors)
Definition: parser_helpers.c:144
void parser_append_unexpected_error(parser_T *parser, const char *description, const char *expected, array_T *errors)
Definition: parser_helpers.c:57
void parser_push_open_tag(const parser_T *parser, token_T *tag_name)
Definition: parser_helpers.c:15
AST_HTML_ELEMENT_NODE_T * parser_handle_missing_close_tag(AST_HTML_OPEN_TAG_NODE_T *open_tag, array_T *body, array_T *errors)
Definition: parser_helpers.c:120
void parser_append_unexpected_token_error(parser_T *parser, token_type_T expected_type, array_T *errors)
Definition: parser_helpers.c:72
bool parser_check_matching_tag(const parser_T *parser, const char *tag_name)
Definition: parser_helpers.c:20
token_T * parser_pop_open_tag(const parser_T *parser)
Definition: parser_helpers.c:29
Definition: array.h:6
Definition: ast_nodes.h:77
Definition: ast_nodes.h:93
Definition: ast_nodes.h:68
Definition: buffer.h:7
Definition: parser.h:8
Definition: position.h:6
Definition: token_struct.h:45
token_type_T
Definition: token_struct.h:7