Hubbub
Macros | Functions | Variables
initial.c File Reference
#include <assert.h>
#include <string.h>
#include "treebuilder/modes.h"
#include "treebuilder/internal.h"
#include "treebuilder/treebuilder.h"
#include "utils/utils.h"

Go to the source code of this file.

Macros

#define S(s)   { s, sizeof s - 1 }
 
#define S(s)   (uint8_t *) s, sizeof s - 1
 
#define S(s)   (uint8_t *) s, sizeof s - 1
 

Functions

static bool starts_with (const uint8_t *a, size_t a_len, const uint8_t *b, size_t b_len)
 Check if one string starts with another. More...
 
static bool lookup_full_quirks (hubbub_treebuilder *treebuilder, const hubbub_doctype *cdoc)
 Determine whether this doctype triggers full quirks mode. More...
 
static bool lookup_limited_quirks (hubbub_treebuilder *treebuilder, const hubbub_doctype *cdoc)
 Determine whether this doctype triggers limited quirks mode. More...
 
hubbub_error handle_initial (hubbub_treebuilder *treebuilder, const hubbub_token *token)
 Handle token in initial insertion mode. More...
 

Variables

struct {
   const char *   name
 
   size_t   len
 
public_doctypes []
 

Macro Definition Documentation

◆ S [1/3]

#define S (   s)    { s, sizeof s - 1 }

Definition at line 19 of file initial.c.

Referenced by lookup_full_quirks(), and lookup_limited_quirks().

◆ S [2/3]

#define S (   s)    (uint8_t *) s, sizeof s - 1

Definition at line 19 of file initial.c.

◆ S [3/3]

#define S (   s)    (uint8_t *) s, sizeof s - 1

Definition at line 19 of file initial.c.

Function Documentation

◆ handle_initial()

hubbub_error handle_initial ( hubbub_treebuilder treebuilder,
const hubbub_token token 
)

◆ lookup_full_quirks()

static bool lookup_full_quirks ( hubbub_treebuilder treebuilder,
const hubbub_doctype cdoc 
)
static

Determine whether this doctype triggers full quirks mode.

Parameters
treebuilderTreebuilder instance
cdocThe doctype to examine
Returns
True to trigger quirks, false otherwise

Definition at line 109 of file initial.c.

References hubbub_string_match_ci(), len, hubbub_string::len, name, hubbub_doctype::name, hubbub_string::ptr, public_doctypes, hubbub_doctype::public_id, hubbub_doctype::public_missing, S, starts_with(), hubbub_doctype::system_id, hubbub_doctype::system_missing, and UNUSED.

Referenced by handle_initial().

◆ lookup_limited_quirks()

static bool lookup_limited_quirks ( hubbub_treebuilder treebuilder,
const hubbub_doctype cdoc 
)
static

Determine whether this doctype triggers limited quirks mode.

Parameters
treebuilderTreebuilder instance
cdocThe doctype to examine
Returns
True to trigger quirks, false otherwise

Definition at line 176 of file initial.c.

References hubbub_string::len, hubbub_string::ptr, hubbub_doctype::public_id, S, starts_with(), hubbub_doctype::system_missing, and UNUSED.

Referenced by handle_initial().

◆ starts_with()

static bool starts_with ( const uint8_t *  a,
size_t  a_len,
const uint8_t *  b,
size_t  b_len 
)
static

Check if one string starts with another.

Parameters
aString to compare
a_lenLength of first string
bString to compare
b_lenLength of second string

Definition at line 91 of file initial.c.

References hubbub_string_match_ci().

Referenced by lookup_full_quirks(), and lookup_limited_quirks().

Variable Documentation

◆ len

size_t len

Definition at line 23 of file initial.c.

Referenced by adjust_foreign_attributes(), adjust_mathml_attributes(), adjust_svg_attributes(), adjust_svg_tagname(), emit_current_chars(), handle_after_body(), handle_in_foreign_content(), hubbub_charset_extract(), hubbub_charset_read_bom(), hubbub_charset_scan_meta(), hubbub_parser_insert_chunk(), hubbub_parser_parse_chunk(), hubbub_tokeniser_consume_character_reference(), hubbub_tokeniser_handle_after_attribute_name(), hubbub_tokeniser_handle_after_attribute_value_q(), hubbub_tokeniser_handle_after_doctype_name(), hubbub_tokeniser_handle_after_doctype_public(), hubbub_tokeniser_handle_after_doctype_system(), hubbub_tokeniser_handle_attribute_name(), hubbub_tokeniser_handle_attribute_value_dq(), hubbub_tokeniser_handle_attribute_value_sq(), hubbub_tokeniser_handle_attribute_value_uq(), hubbub_tokeniser_handle_before_attribute_name(), hubbub_tokeniser_handle_before_attribute_value(), hubbub_tokeniser_handle_before_doctype_name(), hubbub_tokeniser_handle_before_doctype_public(), hubbub_tokeniser_handle_before_doctype_system(), hubbub_tokeniser_handle_bogus_comment(), hubbub_tokeniser_handle_bogus_doctype(), hubbub_tokeniser_handle_cdata_block(), hubbub_tokeniser_handle_character_reference_data(), hubbub_tokeniser_handle_character_reference_in_attribute_value(), hubbub_tokeniser_handle_close_tag_open(), hubbub_tokeniser_handle_comment(), hubbub_tokeniser_handle_data(), hubbub_tokeniser_handle_doctype(), hubbub_tokeniser_handle_doctype_name(), hubbub_tokeniser_handle_doctype_public_dq(), hubbub_tokeniser_handle_doctype_public_sq(), hubbub_tokeniser_handle_doctype_system_dq(), hubbub_tokeniser_handle_doctype_system_sq(), hubbub_tokeniser_handle_markup_declaration_open(), hubbub_tokeniser_handle_match_cdata(), hubbub_tokeniser_handle_match_comment(), hubbub_tokeniser_handle_match_doctype(), hubbub_tokeniser_handle_match_public(), hubbub_tokeniser_handle_match_system(), hubbub_tokeniser_handle_named_entity(), hubbub_tokeniser_handle_numbered_entity(), hubbub_tokeniser_handle_self_closing_start_tag(), hubbub_tokeniser_handle_tag_name(), hubbub_tokeniser_handle_tag_open(), hubbub_tokeniser_insert_chunk(), and lookup_full_quirks().

◆ name

const char* name

◆ public_doctypes

struct { ... } public_doctypes[]

Referenced by lookup_full_quirks().