$darkmode
Herb C Reference
parser_helpers.c File Reference
#include "include/parser_helpers.h"
#include "include/ast_node.h"
#include "include/ast_nodes.h"
#include "include/errors.h"
#include "include/html_util.h"
#include "include/lexer.h"
#include "include/parser.h"
#include "include/token.h"
#include "include/token_matchers.h"
#include "include/util/hb_array.h"
#include "include/util/hb_buffer.h"
#include "include/util/hb_string.h"
#include <stdio.h>

Functions

void parser_push_open_tag (const parser_T *parser, token_T *tag_name)
 
bool parser_check_matching_tag (const parser_T *parser, hb_string_T tag_name)
 
token_Tparser_pop_open_tag (const parser_T *parser)
 
bool parser_in_svg_context (const parser_T *parser)
 Checks if any element in the open tags stack is an SVG element. More...
 
foreign_content_type_T parser_get_foreign_content_type (hb_string_T tag_name)
 
bool parser_is_foreign_content_tag (hb_string_T tag_name)
 
hb_string_T parser_get_foreign_content_closing_tag (foreign_content_type_T type)
 
void parser_enter_foreign_content (parser_T *parser, foreign_content_type_T type)
 
void parser_exit_foreign_content (parser_T *parser)
 
void parser_append_unexpected_error (parser_T *parser, const char *description, const char *expected, hb_array_T *errors)
 
void parser_append_unexpected_token_error (parser_T *parser, token_type_T expected_type, hb_array_T *errors)
 
void parser_append_literal_node_from_buffer (const parser_T *parser, hb_buffer_T *buffer, hb_array_T *children, position_T start)
 
token_Tparser_advance (parser_T *parser)
 
token_Tparser_consume_if_present (parser_T *parser, const token_type_T type)
 
token_Tparser_consume_expected (parser_T *parser, const token_type_T expected_type, hb_array_T *array)
 
AST_HTML_ELEMENT_NODE_Tparser_handle_missing_close_tag (AST_HTML_OPEN_TAG_NODE_T *open_tag, hb_array_T *body, hb_array_T *errors)
 
void parser_handle_mismatched_tags (const parser_T *parser, const AST_HTML_CLOSE_TAG_NODE_T *close_tag, hb_array_T *errors)
 
bool parser_is_expected_closing_tag_name (hb_string_T tag_name, foreign_content_type_T expected_type)
 

Function Documentation

◆ parser_push_open_tag()

void parser_push_open_tag ( const parser_T parser,
token_T tag_name 
)

◆ parser_check_matching_tag()

bool parser_check_matching_tag ( const parser_T parser,
hb_string_T  tag_name 
)

◆ parser_pop_open_tag()

token_T* parser_pop_open_tag ( const parser_T parser)

◆ parser_in_svg_context()

bool parser_in_svg_context ( const parser_T parser)

Checks if any element in the open tags stack is an SVG element.

Parameters
parserThe parser containing the open tags stack.
Returns
true if an SVG tag is found in the stack, false otherwise.

◆ parser_get_foreign_content_type()

foreign_content_type_T parser_get_foreign_content_type ( hb_string_T  tag_name)

◆ parser_is_foreign_content_tag()

bool parser_is_foreign_content_tag ( hb_string_T  tag_name)

◆ parser_get_foreign_content_closing_tag()

hb_string_T parser_get_foreign_content_closing_tag ( foreign_content_type_T  type)

◆ parser_enter_foreign_content()

void parser_enter_foreign_content ( parser_T parser,
foreign_content_type_T  type 
)

◆ parser_exit_foreign_content()

void parser_exit_foreign_content ( parser_T parser)

◆ parser_append_unexpected_error()

void parser_append_unexpected_error ( parser_T parser,
const char *  description,
const char *  expected,
hb_array_T *  errors 
)

◆ parser_append_unexpected_token_error()

void parser_append_unexpected_token_error ( parser_T parser,
token_type_T  expected_type,
hb_array_T *  errors 
)

◆ parser_append_literal_node_from_buffer()

void parser_append_literal_node_from_buffer ( const parser_T parser,
hb_buffer_T *  buffer,
hb_array_T *  children,
position_T  start 
)

◆ parser_advance()

token_T* parser_advance ( parser_T parser)

◆ parser_consume_if_present()

token_T* parser_consume_if_present ( parser_T parser,
const token_type_T  type 
)

◆ parser_consume_expected()

token_T* parser_consume_expected ( parser_T parser,
const token_type_T  expected_type,
hb_array_T *  array 
)

◆ parser_handle_missing_close_tag()

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 
)

◆ parser_handle_mismatched_tags()

void parser_handle_mismatched_tags ( const parser_T parser,
const AST_HTML_CLOSE_TAG_NODE_T close_tag,
hb_array_T *  errors 
)

◆ parser_is_expected_closing_tag_name()

bool parser_is_expected_closing_tag_name ( hb_string_T  tag_name,
foreign_content_type_T  expected_type 
)