php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
after_body.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018-2020 Alexander Borisov
3 *
4 * Author: Alexander Borisov <borisov@lexbor.com>
5 */
6
9
10
11bool
13 lxb_html_token_t *token)
14{
15 switch (token->tag_id) {
17 lxb_dom_comment_t *comment;
18 lxb_dom_node_t *html_node;
19
20 html_node = lxb_html_tree_open_elements_first(tree);
21
22 comment = lxb_html_tree_insert_comment(tree, token, html_node);
23 if (comment == NULL) {
24 return lxb_html_tree_process_abort(tree);
25 }
26
27 break;
28 }
29
31 lxb_html_tree_parse_error(tree, token,
33 break;
34
35 case LXB_TAG_HTML:
37 {
38 if (tree->fragment != NULL) {
39 lxb_html_tree_parse_error(tree, token,
41 return true;
42 }
43
45
46 return true;
47 }
48
49 return lxb_html_tree_insertion_mode_in_body(tree, token);
50
53 if (tree->status != LXB_STATUS_OK) {
54 return lxb_html_tree_process_abort(tree);
55 }
56
57 break;
58
59 case LXB_TAG__TEXT: {
60 lxb_html_token_t ws_token = *token;
61
63 if (tree->status != LXB_STATUS_OK) {
64 return lxb_html_tree_process_abort(tree);
65 }
66
67 if (ws_token.text_start == ws_token.text_end) {
68 return lxb_html_tree_insertion_mode_in_body(tree, token);
69 }
70 }
71 /* fall through */
72
73 default:
75
77
78 return false;
79 }
80
81 return true;
82}
bool lxb_html_tree_insertion_mode_after_body(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition after_body.c:12
@ LXB_STATUS_OK
Definition base.h:49
struct lxb_dom_comment lxb_dom_comment_t
Definition interface.h:49
struct lxb_dom_node lxb_dom_node_t
Definition interface.h:38
#define NULL
Definition gdcache.h:45
struct lxb_html_tree lxb_html_tree_t
Definition base.h:28
lxb_status_t lxb_html_token_data_skip_ws_begin(lxb_html_token_t *token)
Definition token.c:179
@ LXB_HTML_TOKEN_TYPE_CLOSE
Definition token.h:27
@ LXB_HTML_RULES_ERROR_UNCLTO
Definition error.h:24
@ LXB_HTML_RULES_ERROR_UNTO
Definition error.h:22
@ LXB_HTML_RULES_ERROR_DOTOAFBOMO
Definition error.h:86
LXB_API bool lxb_html_tree_insertion_mode_after_after_body(lxb_html_tree_t *tree, lxb_html_token_t *token)
LXB_API bool lxb_html_tree_insertion_mode_in_body(lxb_html_tree_t *tree, lxb_html_token_t *token)
Definition in_body.c:1685
bool lxb_html_tree_process_abort(lxb_html_tree_t *tree)
Definition tree.c:224
lxb_dom_comment_t * lxb_html_tree_insert_comment(lxb_html_tree_t *tree, lxb_html_token_t *token, lxb_dom_node_t *pos)
Definition tree.c:790
lxb_status_t lxb_html_tree_stop_parsing(lxb_html_tree_t *tree)
Definition tree.c:216
void lxb_html_tree_parse_error(lxb_html_tree_t *tree, lxb_html_token_t *token, lxb_html_tree_error_id_t id)
Definition tree.c:237
lxb_inline lxb_dom_node_t * lxb_html_tree_open_elements_first(lxb_html_tree_t *tree)
lxb_html_token_type_t type
Definition token.h:49
const lxb_char_t * text_end
Definition token.h:40
lxb_tag_id_t tag_id
Definition token.h:48
const lxb_char_t * text_start
Definition token.h:39
lxb_status_t status
Definition tree.h:66
lxb_html_tree_insertion_mode_f mode
Definition tree.h:62
lxb_dom_node_t * fragment
Definition tree.h:43
@ LXB_TAG__EM_DOCTYPE
Definition const.h:29
@ LXB_TAG__END_OF_FILE
Definition const.h:25
@ LXB_TAG_HTML
Definition const.h:125
@ LXB_TAG__EM_COMMENT
Definition const.h:28
@ LXB_TAG__TEXT
Definition const.h:26