Hubbub $Id$
parser.h
Go to the documentation of this file.
1/*
2 * This file is part of Hubbub.
3 * Licensed under the MIT License,
4 * http://www.opensource.org/licenses/mit-license.php
5 * Copyright 2007-8 John-Mark Bell <jmb@netsurf-browser.org>
6 */
7
8#ifndef hubbub_parser_h_
9#define hubbub_parser_h_
10
11#ifdef __cplusplus
12extern "C"
13{
14#endif
15
16#include <stdbool.h>
17#include <inttypes.h>
18
19#include <hubbub/errors.h>
20#include <hubbub/functypes.h>
21#include <hubbub/tree.h>
22#include <hubbub/types.h>
23
25
38
43 struct {
45 void *pw;
48 struct {
50 void *pw;
53 struct {
65
66/* Create a hubbub parser */
67hubbub_error hubbub_parser_create(const char *enc, bool fix_enc,
68 hubbub_parser **parser);
69/* Destroy a hubbub parser */
71
72/* Configure a hubbub parser */
76
77/* Pass a chunk of data to a hubbub parser for parsing */
78/* This data is encoded in the input charset */
80 const uint8_t *data, size_t len);
81
97 const uint8_t *data, size_t len);
98/* Inform the parser that the last chunk of data has been parsed */
100
101/* Read the document charset */
102const char *hubbub_parser_read_charset(hubbub_parser *parser,
103 hubbub_charset_source *source);
104
105#ifdef __cplusplus
106}
107#endif
108
109#endif
110
hubbub_error
Definition: errors.h:18
hubbub_error(* hubbub_token_handler)(const hubbub_token *token, void *pw)
Type of token handling function.
Definition: functypes.h:29
void(* hubbub_error_handler)(uint32_t line, uint32_t col, const char *message, void *pw)
Type of parse error handling function.
Definition: functypes.h:40
size_t len
Definition: initial.c:23
hubbub_error hubbub_parser_insert_chunk(hubbub_parser *parser, const uint8_t *data, size_t len)
Insert a chunk of data into a hubbub parser input stream.
Definition: parser.c:218
const char * hubbub_parser_read_charset(hubbub_parser *parser, hubbub_charset_source *source)
Read the document charset.
Definition: parser.c:305
hubbub_error hubbub_parser_destroy(hubbub_parser *parser)
Destroy a hubbub parser.
Definition: parser.c:102
hubbub_error hubbub_parser_parse_chunk(hubbub_parser *parser, const uint8_t *data, size_t len)
Pass a chunk of data to a hubbub parser for parsing.
Definition: parser.c:235
union hubbub_parser_optparams hubbub_parser_optparams
Hubbub parser option parameters.
hubbub_error hubbub_parser_create(const char *enc, bool fix_enc, hubbub_parser **parser)
Create a hubbub parser.
Definition: parser.c:41
hubbub_parser_opttype
Hubbub parser option types.
Definition: parser.h:29
@ HUBBUB_PARSER_PAUSE
Definition: parser.h:36
@ HUBBUB_PARSER_ENABLE_SCRIPTING
Definition: parser.h:35
@ HUBBUB_PARSER_DOCUMENT_NODE
Definition: parser.h:34
@ HUBBUB_PARSER_TREE_HANDLER
Definition: parser.h:33
@ HUBBUB_PARSER_TOKEN_HANDLER
Definition: parser.h:30
@ HUBBUB_PARSER_ERROR_HANDLER
Definition: parser.h:31
@ HUBBUB_PARSER_CONTENT_MODEL
Definition: parser.h:32
hubbub_error hubbub_parser_setopt(hubbub_parser *parser, hubbub_parser_opttype type, hubbub_parser_optparams *params)
Configure a hubbub parser.
Definition: parser.c:126
hubbub_error hubbub_parser_completed(hubbub_parser *parser)
Inform the parser that the last chunk of data has been parsed.
Definition: parser.c:279
Hubbub parser object.
Definition: parser.c:24
Hubbub tree handler.
Definition: tree.h:273
hubbub_charset_source
Source of charset information, in order of importance A client-dictated charset will override all oth...
Definition: types.h:22
hubbub_content_model
Content model flag.
Definition: types.h:32
Hubbub parser option parameters.
Definition: parser.h:42
hubbub_error_handler handler
Definition: parser.h:49
struct hubbub_parser_optparams::@12 error_handler
Error handling callback.
struct hubbub_parser_optparams::@11 token_handler
Token handling callback.
bool enable_scripting
Whether to enable scripting.
Definition: parser.h:61
void * document_node
Document node.
Definition: parser.h:59
struct hubbub_parser_optparams::@13 content_model
Current content model.
hubbub_token_handler handler
Definition: parser.h:44
bool pause_parse
Pause parsing.
Definition: parser.h:63
void * pw
Definition: parser.h:45
hubbub_content_model model
Definition: parser.h:54
hubbub_tree_handler * tree_handler
Tree handling callbacks.
Definition: parser.h:57