Hubbub  $Id$
tokeniser.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 John-Mark Bell <jmb@netsurf-browser.org>
6  */
7 
8 #ifndef hubbub_tokeniser_tokeniser_h_
9 #define hubbub_tokeniser_tokeniser_h_
10 
11 #include <stdbool.h>
12 #include <inttypes.h>
13 
14 #include <hubbub/errors.h>
15 #include <hubbub/functypes.h>
16 #include <hubbub/types.h>
17 
18 #include <parserutils/input/inputstream.h>
19 
20 typedef struct hubbub_tokeniser hubbub_tokeniser;
21 
32 
37  struct {
39  void *pw;
42  struct {
44  void *pw;
47  struct {
53  bool pause_parse;
55 
56 /* Create a hubbub tokeniser */
57 hubbub_error hubbub_tokeniser_create(parserutils_inputstream *input,
58  hubbub_tokeniser **tokeniser);
59 /* Destroy a hubbub tokeniser */
61 
62 /* Configure a hubbub tokeniser */
66 
67 /* Insert a chunk of data into the input stream */
69  const uint8_t *data, size_t len);
70 
71 /* Process remaining data in the input stream */
73 
74 #endif
75 
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
Tokeniser data structure.
Definition: tokeniser.c:165
hubbub_error hubbub_tokeniser_create(parserutils_inputstream *input, hubbub_tokeniser **tokeniser)
Create a hubbub tokeniser.
Definition: tokeniser.c:285
hubbub_tokeniser_opttype
Hubbub tokeniser option types.
Definition: tokeniser.h:25
@ HUBBUB_TOKENISER_PAUSE
Definition: tokeniser.h:30
@ HUBBUB_TOKENISER_TOKEN_HANDLER
Definition: tokeniser.h:26
@ HUBBUB_TOKENISER_PROCESS_CDATA
Definition: tokeniser.h:29
@ HUBBUB_TOKENISER_CONTENT_MODEL
Definition: tokeniser.h:28
@ HUBBUB_TOKENISER_ERROR_HANDLER
Definition: tokeniser.h:27
hubbub_error hubbub_tokeniser_setopt(hubbub_tokeniser *tokeniser, hubbub_tokeniser_opttype type, hubbub_tokeniser_optparams *params)
Configure a hubbub tokeniser.
Definition: tokeniser.c:366
hubbub_error hubbub_tokeniser_run(hubbub_tokeniser *tokeniser)
Process remaining data in the input stream.
Definition: tokeniser.c:454
hubbub_error hubbub_tokeniser_insert_chunk(hubbub_tokeniser *tokeniser, const uint8_t *data, size_t len)
Insert a chunk of data into the input stream.
Definition: tokeniser.c:433
union hubbub_tokeniser_optparams hubbub_tokeniser_optparams
Hubbub tokeniser option parameters.
hubbub_error hubbub_tokeniser_destroy(hubbub_tokeniser *tokeniser)
Destroy a hubbub tokeniser.
Definition: tokeniser.c:340
element_type type
Definition: treebuilder.c:26
hubbub_content_model
Content model flag.
Definition: types.h:32
Hubbub tokeniser option parameters.
Definition: tokeniser.h:36
bool pause_parse
Pause parsing.
Definition: tokeniser.h:53
hubbub_error_handler handler
Definition: tokeniser.h:43
struct hubbub_tokeniser_optparams::@5 token_handler
Token handling callback.
bool process_cdata
Whether to process CDATA sections.
Definition: tokeniser.h:51
hubbub_content_model model
Definition: tokeniser.h:48
hubbub_token_handler handler
Definition: tokeniser.h:38
void * pw
Definition: tokeniser.h:39
struct hubbub_tokeniser_optparams::@6 error_handler
Error handling callback.
struct hubbub_tokeniser_optparams::@7 content_model
Current content model.