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 
21 
32 
37  struct {
39  void *pw;
40  } token_handler;
42  struct {
44  void *pw;
45  } error_handler;
47  struct {
49  } content_model;
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_tokeniser_optparams::handler
hubbub_token_handler handler
Definition: tokeniser.h:38
hubbub_tokeniser_optparams::pw
void * pw
Definition: tokeniser.h:39
types.h
HUBBUB_TOKENISER_PAUSE
@ HUBBUB_TOKENISER_PAUSE
Definition: tokeniser.h:30
hubbub_tokeniser_insert_chunk
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
hubbub_tokeniser_optparams::token_handler
struct hubbub_tokeniser_optparams::@5 token_handler
Token handling callback.
HUBBUB_TOKENISER_TOKEN_HANDLER
@ HUBBUB_TOKENISER_TOKEN_HANDLER
Definition: tokeniser.h:26
errors.h
HUBBUB_TOKENISER_CONTENT_MODEL
@ HUBBUB_TOKENISER_CONTENT_MODEL
Definition: tokeniser.h:28
hubbub_tokeniser_optparams::process_cdata
bool process_cdata
Whether to process CDATA sections.
Definition: tokeniser.h:51
hubbub_tokeniser
Tokeniser data structure.
Definition: tokeniser.c:165
HUBBUB_TOKENISER_ERROR_HANDLER
@ HUBBUB_TOKENISER_ERROR_HANDLER
Definition: tokeniser.h:27
hubbub_tokeniser_optparams::content_model
struct hubbub_tokeniser_optparams::@7 content_model
Current content model.
hubbub_tokeniser_optparams::error_handler
struct hubbub_tokeniser_optparams::@6 error_handler
Error handling callback.
hubbub_tokeniser_optparams::handler
hubbub_error_handler handler
Definition: tokeniser.h:43
hubbub_error_handler
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
HUBBUB_TOKENISER_PROCESS_CDATA
@ HUBBUB_TOKENISER_PROCESS_CDATA
Definition: tokeniser.h:29
hubbub_error
hubbub_error
Definition: errors.h:18
hubbub_tokeniser_optparams::pause_parse
bool pause_parse
Pause parsing.
Definition: tokeniser.h:53
type
element_type type
Definition: treebuilder.c:26
hubbub_tokeniser_run
hubbub_error hubbub_tokeniser_run(hubbub_tokeniser *tokeniser)
Process remaining data in the input stream.
Definition: tokeniser.c:454
hubbub_token_handler
hubbub_error(* hubbub_token_handler)(const hubbub_token *token, void *pw)
Type of token handling function.
Definition: functypes.h:29
functypes.h
hubbub_tokeniser_setopt
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_content_model
hubbub_content_model
Content model flag.
Definition: types.h:32
hubbub_tokeniser_optparams
Hubbub tokeniser option parameters.
Definition: tokeniser.h:36
len
size_t len
Definition: initial.c:23
hubbub_tokeniser_create
hubbub_error hubbub_tokeniser_create(parserutils_inputstream *input, hubbub_tokeniser **tokeniser)
Create a hubbub tokeniser.
Definition: tokeniser.c:285
hubbub_tokeniser_opttype
hubbub_tokeniser_opttype
Hubbub tokeniser option types.
Definition: tokeniser.h:25
hubbub_tokeniser_optparams::model
hubbub_content_model model
Definition: tokeniser.h:48
hubbub_tokeniser_optparams
union hubbub_tokeniser_optparams hubbub_tokeniser_optparams
Hubbub tokeniser option parameters.
hubbub_tokeniser_destroy
hubbub_error hubbub_tokeniser_destroy(hubbub_tokeniser *tokeniser)
Destroy a hubbub tokeniser.
Definition: tokeniser.c:340